]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html
LP2045292 Color contrast for AngularJS patron bills
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / cat / volcopy / copy-attrs.component.html
1 <eg-string #loanDurationShort i18n-text text="Short"></eg-string>
2 <eg-string #loanDurationNormal i18n-text text="Normal"></eg-string>
3 <eg-string #loanDurationLong i18n-text text="Long"></eg-string>
4
5 <eg-string #fineLevelLow i18n-text text="Low"></eg-string>
6 <eg-string #fineLevelNormal i18n-text text="Normal"></eg-string>
7 <eg-string #fineLevelHigh i18n-text text="High"></eg-string>
8
9 <eg-string #olLabel text="Owning Library" i18n-text></eg-string>
10
11 <eg-string #mintConditionYes i18n-text text="Good"></eg-string>
12 <eg-string #mintConditionNo i18n-text text="Damaged"></eg-string>
13
14 <eg-string #savedHoldingsTemplates i18n-text text="Saved holdings template(s)"></eg-string>
15 <eg-string #deletedHoldingsTemplate i18n-text text="Deleted holdings template"></eg-string>
16
17 <!-- We ask this question a lot.  Here's a handy template -->
18 <ng-template #yesNoSelect let-field="field">
19   <eg-combobox domId="{{field}}-input" 
20     [required]="true" [ngModel]="values['field']" 
21     (ngModelChange)="values[field] = $event ? $event.id : null">
22     <eg-combobox-entry entryId="t" entryLabel="Yes" i18n-entryLabel>
23     </eg-combobox-entry>
24     <eg-combobox-entry entryId="f" entryLabel="No" i18n-entryLabel>
25     </eg-combobox-entry>
26   </eg-combobox>
27 </ng-template>
28
29 <!-- this one is also repeated a lot -->
30 <ng-template #batchAttr let-field="field" let-required="required"
31   let-label="label" let-template="template" let-displayAs="displayAs">
32   <eg-batch-item-attr 
33     [name]="field" 
34     [label]="label || copyFieldLabel(field)"
35     [valueRequired]="required"
36     [displayAs]="displayAs"
37     [editInputDomId]="field + '-input'"
38     [editTemplate]="template"
39     [labelCounts]="itemAttrCounts(field)"
40     (valueCleared)="applyCopyValue(field, null)"
41     (changesSaved)="applyCopyValue(field, undefined, $event)">
42   </eg-batch-item-attr>
43 </ng-template>
44
45 <!-- Copy Templates -->
46 <div class="row border rounded border-dark pt-2 pb-2 bg-faint">
47   <div class="col-lg-1 fw-bold" i18n>Templates:</div>
48   <div class="col-lg-4">
49     <eg-combobox #copyTemplateCbox domId="template-select" 
50       [allowFreeText]="true" [entries]="volcopy.templateNames">
51     </eg-combobox>
52   </div>
53   <div class="col-lg-7 d-flex">
54     <button type="button" class="btn btn-outline-dark me-2" (click)="applyTemplate()" i18n>Apply Template</button>
55     <button type="button" class="btn btn-outline-dark me-2" (click)="saveTemplate()" i18n>Save Template</button>
56
57     <!-- 
58       The typical approach of wrapping a file input in a <label> results
59       in button-ish things that have slightly different dimensions.
60       Instead have a button activate a hidden file input.
61     -->
62     <button type="button" class="btn btn-outline-dark me-2" (click)="templateFile.click()">
63       <input type="file" class="d-none" #templateFile
64         (change)="importTemplate($event)" id="template-file-upload"/>
65       <span i18n>Import Templates</span>
66     </button>
67     <input type="file" class="d-none" #templateFile
68         (change)="importTemplate($event)" id="template-file-upload"/>
69
70     <a (click)="exportTemplate($event)"
71       download="export_copy_template.json" [href]="exportTemplateUrl()">
72       <button type="button" class="btn btn-outline-dark me-2" i18n>Export All Templates</button>
73     </a>
74     
75     <div class="flex-1"> </div>
76     <button type="button" class="btn btn-outline-danger me-2" 
77       (click)="deleteTemplate()" i18n>Delete Template</button>
78   </div>
79 </div>
80
81
82 <div class="row d-flex">
83
84   <!-- COLUMN 1 -->
85   <div class="flex-1 p-1">
86     <div class="p-1"><h4 class="fw-bold" i18n>Identification</h4></div>
87
88
89     <div class="mb-1" *ngIf="displayAttr('status')">
90
91       <ng-container *ngIf="statusEditable(); else noEditStat">
92         <ng-template #statusTemplate>
93           <eg-combobox domId="status-input"
94             (ngModelChange)="values['status'] = $event ? $event.id : null"
95             [ngModel]="values['status']" [disableEntries]="volcopy.magicCopyStats">
96             <eg-combobox-entry 
97               *ngFor="let stat of volcopy.commonData.acp_status"
98               [entryId]="stat.id()" [entryLabel]="stat.name()">
99             </eg-combobox-entry>
100           </eg-combobox>
101         </ng-template>
102         <ng-container *ngTemplateOutlet="batchAttr;
103           context:{field:'status', template:statusTemplate}">
104         </ng-container>
105       </ng-container>
106
107       <ng-template #noEditStat>
108         <eg-batch-item-attr label="Item Status" i18n-label [readOnly]="true"
109           [labelCounts]="itemAttrCounts('status')">
110         </eg-batch-item-attr>
111       </ng-template>
112     </div>
113
114     <div class="mb-1" *ngIf="displayAttr('barcode')">
115       <eg-batch-item-attr label="Barcode" i18n-label
116         [readOnly]="true" [labelCounts]="itemAttrCounts('barcode')">
117       </eg-batch-item-attr>
118     </div>
119
120     <div class="mb-1" *ngIf="displayAttr('create_date')">
121       <eg-batch-item-attr label="Creation Date" i18n-label [readOnly]="true"
122         [labelCounts]="itemAttrCounts('create_date')">
123       </eg-batch-item-attr>
124     </div>
125
126     <div class="mb-1" *ngIf="displayAttr('active_date')">
127       <eg-batch-item-attr label="Active Date" i18n-label [readOnly]="true"
128         [labelCounts]="itemAttrCounts('active_date')">
129       </eg-batch-item-attr>
130     </div>
131
132     <div class="mb-1" *ngIf="displayAttr('creator')">
133       <eg-batch-item-attr label="Creator" i18n-label [readOnly]="true"
134         [labelCounts]="itemAttrCounts('creator')">
135       </eg-batch-item-attr>
136     </div>
137
138     <div class="mb-1" *ngIf="displayAttr('edit_date')">
139       <eg-batch-item-attr label="Last Edit Date" i18n-label [readOnly]="true"
140         [labelCounts]="itemAttrCounts('edit_date')">
141       </eg-batch-item-attr>
142     </div>
143
144     <div class="mb-1" *ngIf="displayAttr('editor')">
145       <eg-batch-item-attr label="Last Editor" i18n-label [readOnly]="true"
146         [labelCounts]="itemAttrCounts('editor')">
147       </eg-batch-item-attr>
148     </div>
149
150   </div>
151
152   <!-- COLUMN 2 -->
153   <div class="flex-1 p-1">
154     <div class="p-1"><h4 class="fw-bold" i18n>Location</h4></div>
155
156     <div *ngIf="displayAttr('location')">
157       <ng-template #locationTemplate>
158         <eg-item-location-select (valueChange)="values['location'] = $event"
159           [contextOrgIds]="copyLocationOrgs()"
160           domId='location-input' [required]="true" permFilter="UPDATE_COPY">
161         </eg-item-location-select>
162       </ng-template>
163       <ng-container *ngTemplateOutlet="batchAttr;
164         context:{field:'location',required:true,template:locationTemplate}">
165       </ng-container>
166     </div>
167
168     <div *ngIf="displayAttr('circ_lib')">
169       <ng-template #circLibTemplate>
170         <eg-org-select 
171           domId="circ_lib-input" [ariaLabel]="copyFieldLabel('circ_lib')"
172           (onChange)="values['circ_lib'] = $event ? $event.id() : null"
173           [hideOrgs]="volcopy.hideVolOrgs"
174           [limitPerms]="['UPDATE_COPY']">
175         </eg-org-select>
176       </ng-template>
177       <ng-container *ngTemplateOutlet="batchAttr;
178         context:{field:'circ_lib',required:true,template:circLibTemplate}">
179       </ng-container>
180     </div>
181
182     <div *ngIf="displayAttr('owning_lib')">
183       <ng-template #owningLibTemplate>
184         <eg-org-select 
185           domId="owning_lib-input" [ariaLabel]="olLabel.text"
186           (onChange)="values['owning_lib'] = $event ? $event.id() : null"
187           [hideOrgs]="volcopy.hideVolOrgs"
188           [limitPerms]="['UPDATE_COPY']">
189         </eg-org-select>
190       </ng-template>
191       <ng-container *ngTemplateOutlet="batchAttr;
192         context:{field:'owning_lib',required:true,template:owningLibTemplate,label:olLabel.text}">
193       </ng-container>
194     </div>
195
196     <div *ngIf="displayAttr('copy_number')">
197       <ng-template #copyNumberTemplate>
198         <input type="number" class="form-control"
199           id="copy_number-input" [(ngModel)]="values['copy_number']"/>
200       </ng-template>
201       <ng-container *ngTemplateOutlet="batchAttr;
202         context:{field:'copy_number',template:copyNumberTemplate}">
203       </ng-container>
204     </div>
205   </div>
206
207   <!-- COLUMN 3 -->
208
209   <div class="flex-1 p-1">
210     <div class="p-1"><h4 class="fw-bold" i18n>Circulation</h4></div>
211
212     <div *ngIf="displayAttr('circulate')">
213       <ng-template #circulateTemplate>
214         <ng-container *ngTemplateOutlet="yesNoSelect;context:{field:'circulate'}">
215         </ng-container>
216       </ng-template>
217       <ng-container *ngTemplateOutlet="batchAttr;
218         context:{field:'circulate',required:true,template:circulateTemplate,displayAs:'bool'}">
219       </ng-container>
220     </div>
221
222     <div *ngIf="displayAttr('holdable')">
223       <ng-template #holdableTemplate>
224         <ng-container *ngTemplateOutlet="yesNoSelect;context:{field:'holdable'}">
225         </ng-container>
226       </ng-template>
227       <ng-container *ngTemplateOutlet="batchAttr;
228         context:{field:'holdable',required:true,template:holdableTemplate,displayAs:'bool'}">
229       </ng-container>
230     </div>
231
232     <div *ngIf="displayAttr('age_protect')">
233       <ng-template #ageProtectTemplate>
234         <eg-combobox domId="age_protect-input"
235           (ngModelChange)="values['age_protect'] = $event ? $event.id : null"
236           [ngModel]="values['age_protect']">
237           <eg-combobox-entry 
238             *ngFor="let rule of volcopy.commonData.acp_age_protect"
239             [entryId]="rule.id()" [entryLabel]="rule.name()">
240           </eg-combobox-entry>
241         </eg-combobox>
242       </ng-template>
243       <ng-container *ngTemplateOutlet="batchAttr;
244         context:{field:'age_protect',template:ageProtectTemplate}">
245       </ng-container>
246     </div>
247
248     <div *ngIf="displayAttr('floating')">
249       <ng-template #floatingTemplate>
250         <eg-combobox domId="floating-input"
251           (ngModelChange)="values['floating'] = $event ? $event.id : null"
252           [ngModel]="values['floating']">
253           <eg-combobox-entry 
254             *ngFor="let grp of volcopy.commonData.acp_floating_group"
255             [entryId]="grp.id()" [entryLabel]="grp.name()">
256           </eg-combobox-entry>
257         </eg-combobox>
258       </ng-template>
259       <ng-container *ngTemplateOutlet="batchAttr;
260         context:{field:'floating',template:floatingTemplate}">
261       </ng-container>
262     </div>
263
264     <div *ngIf="displayAttr('loan_duration')">
265       <ng-template #loanDurationTemplate>
266         <select class="form-select" 
267           id="loan_duration-input" [(ngModel)]="values['loan_duration']">
268           <option value="1" i18n>{{loanDurationShort.text}}</option>
269           <option value="2" i18n>{{loanDurationNormal.text}}</option>
270           <option value="3" i18n>{{loanDurationLong.text}}</option>
271         </select>
272       </ng-template>
273       <ng-container *ngTemplateOutlet="batchAttr;
274         context:{field:'loan_duration',required:true,template:loanDurationTemplate}">
275       </ng-container>
276     </div>
277
278     <div *ngIf="displayAttr('fine_level')">
279       <ng-template #fineLevelTemplate>
280         <select class="form-select" 
281           id="fine_level-input" [(ngModel)]="values['fine_level']">
282           <option value="1" i18n>{{fineLevelLow.text}}</option>
283           <option value="2" i18n>{{fineLevelNormal.text}}</option>
284           <option value="3" i18n>{{fineLevelHigh.text}}</option>
285         </select>
286       </ng-template>
287       <ng-container *ngTemplateOutlet="batchAttr;
288         context:{field:'fine_level',required:true,template:fineLevelTemplate}">
289       </ng-container>
290     </div>
291
292     <div *ngIf="displayAttr('circ_as_type')">
293       <ng-template #circAsTypeTemplate>
294         <eg-combobox domId="circ_as_type-input"
295           (ngModelChange)="values['circ_as_type'] = $event ? $event.id : null"
296           [ngModel]="values['circ_as_type']">
297           <eg-combobox-entry *ngFor="let map of volcopy.commonData.acp_item_type_map"
298             [entryId]="map.code()" [entryLabel]="map.value()">
299           </eg-combobox-entry>
300         </eg-combobox>
301       </ng-template>
302       <ng-container *ngTemplateOutlet="batchAttr;
303         context:{field:'circ_as_type',template:circAsTypeTemplate}">
304       </ng-container>
305     </div>
306
307     <div *ngIf="displayAttr('circ_modifier')">
308       <ng-template #circModifierTemplate>
309         <select class="form-select" id='circ_modifier-input' 
310           [(ngModel)]="values['circ_modifier']">
311           <option [value]="null" i18n>&lt;Unset&gt;</option>
312           <option *ngFor="let mod of volcopy.commonData.acp_circ_modifier"
313             value="{{mod.code()}}">{{mod.name()}}</option>
314         </select>
315       </ng-template>
316       <ng-container *ngTemplateOutlet="batchAttr;
317         context:{field:'circ_modifier',template:circModifierTemplate}">
318       </ng-container>
319     </div>
320
321   </div>
322
323   <!-- COLUMN 4 -->
324
325   <div class="flex-1 p-1">
326     <div class="p-1"><h4 class="fw-bold" i18n>Miscellaneous</h4></div>
327
328     <!-- Adding this for sites that still use alert messages (we do)
329     <div>
330       <ng-template #alertMessageTemplate>
331         <textarea rows="3" class="form-control" id="alert-message-input"
332           [(ngModel)]="values['alert_message']">
333         </textarea>
334       </ng-template>
335       <eg-batch-item-attr label="Alert Message" i18n-label
336         editInputDomId="alert-message-input"
337         [editTemplate]="alertMessageTemplate"
338         [labelCounts]="itemAttrCounts('alert_message')"
339         (changesSaved)="applyCopyValue('alert_message')">
340       </eg-batch-item-attr>
341     </div>
342     -->
343
344     <div class="border rounded m-1" *ngIf="displayAttr('copy_alerts')">
345       <eg-copy-alerts-dialog #copyAlertsDialog></eg-copy-alerts-dialog>
346       <div class="batch-header fw-bold p-2" i18n>Add Item Alerts</div>
347       <div class="p-1">
348         <button type="button" class="btn btn-outline-dark" (click)="openCopyAlerts()" i18n>
349           Item Alerts
350         </button>
351       </div>
352     </div>
353
354     <div *ngIf="displayAttr('deposit')">
355       <ng-template #depositTemplate>
356         <ng-container *ngTemplateOutlet="yesNoSelect;context:{field:'deposit'}">
357         </ng-container>
358       </ng-template>
359       <ng-container *ngTemplateOutlet="batchAttr;
360         context:{field:'deposit',required:true,template:depositTemplate,displayAs:'bool'}">
361       </ng-container>
362     </div>
363
364     <div *ngIf="displayAttr('deposit_amount')">
365       <ng-template #depositAmountTemplate>
366         <input type="number" class="form-control" 
367           id="deposit_amount-input" [(ngModel)]="values['deposit_amount']"/>
368       </ng-template>
369       <ng-container *ngTemplateOutlet="batchAttr;
370         context:{field:'deposit_amount',required:true,template:depositAmountTemplate,displayAs:'currency'}">
371       </ng-container>
372     </div>
373
374     <div *ngIf="displayAttr('price')">
375       <ng-template #priceTemplate>
376         <input type="number" class="form-control" 
377           id="price-input" [(ngModel)]="values['price']"/>
378       </ng-template>
379       <ng-container *ngTemplateOutlet="batchAttr;
380         context:{field:'price',template:priceTemplate,displayAs:'currency'}">
381       </ng-container>
382     </div>
383
384     <div *ngIf="displayAttr('opac_visible')">
385       <ng-template #opacVisibleTemplate>
386         <ng-container *ngTemplateOutlet="yesNoSelect;context:{field:'opac_visible'}">
387         </ng-container>
388       </ng-template>
389       <ng-container *ngTemplateOutlet="batchAttr;
390         context:{field:'opac_visible',required:true,template:opacVisibleTemplate,displayAs:'bool'}">
391       </ng-container>
392     </div>
393
394     <div *ngIf="displayAttr('ref')">
395       <ng-template #refTemplate>
396         <ng-container *ngTemplateOutlet="yesNoSelect;context:{field:'ref'}">
397         </ng-container>
398       </ng-template>
399       <ng-container *ngTemplateOutlet="batchAttr;
400         context:{field:'ref',required:true,template:refTemplate,displayAs:'bool'}">
401       </ng-container>
402     </div>
403
404     <div *ngIf="displayAttr('cost')">
405       <ng-template #costTemplate>
406         <input type="number" class="form-control" 
407           id="cost-input" [(ngModel)]="values['cost']"/>
408       </ng-template>
409       <ng-container *ngTemplateOutlet="batchAttr;
410         context:{field:'cost',template:costTemplate,displayAs:'currency'}">
411       </ng-container>
412     </div>
413
414     <div *ngIf="displayAttr('mint_condition')">
415       <ng-template #mintConditionTemplate>
416         <select class="form-select" 
417           id="mint_condition-input" [(ngModel)]="values['mint_condition']">
418           <option value="t" i18n>{{mintConditionYes.text}}</option>
419           <option value="f" i18n>{{mintConditionNo.text}}</option>
420         </select>
421       </ng-template>
422       <ng-container *ngTemplateOutlet="batchAttr;
423         context:{field:'mint_condition',template:mintConditionTemplate}">
424       </ng-container>
425     </div>
426
427   </div>
428
429   <!-- COLUMN 5 -->
430   <div class="flex-1 p-1">
431     <div class="p-1"><h4 class="fw-bold" i18n>Statistics</h4></div>
432
433     <div class="border rounded m-1" *ngIf="displayAttr('copy_tags')">
434       <eg-copy-tags-dialog #copyTagsDialog></eg-copy-tags-dialog>
435       <div class="batch-header fw-bold p-2" i18n>Add Item Tags</div>
436       <div class="p-1">
437         <button type="button" class="btn btn-outline-dark" (click)="openCopyTags()" i18n>
438           Item Tags
439         </button>
440       </div>
441     </div>
442
443     <div class="border rounded m-1" *ngIf="displayAttr('copy_notes')">
444       <eg-copy-notes-dialog #copyNotesDialog></eg-copy-notes-dialog>
445       <div class="batch-header fw-bold p-2" i18n>Add Item Notes</div>
446       <div class="p-1">
447         <button type="button" class="btn btn-outline-dark" (click)="openCopyNotes()" i18n>
448           Item Notes
449         </button>
450       </div>
451     </div>
452
453     <div class="border rounded m-1" *ngIf="displayAttr('statcat_filter')">
454       <div class="batch-header font-weight-bold p-2">
455         <label for="statcat_filter-select" class="form-label" i18n>Stat Cat Filter</label>
456       </div>
457       <div class="p-1">
458         <eg-org-select
459           domId="statcat_filter-select"
460           placeholder="Stat Cat Filter..." i18n-placeholder
461           [initialOrgId]="statCatFilter"
462           (onChange)="statCatFilter = $event ? $event.id() : null">
463         </eg-org-select>
464       </div>
465     </div>
466
467     <ng-container *ngIf="displayAttr('statcats')">
468       <div *ngFor="let cat of statCats()">
469         <ng-template #statCatTemplate>
470           <eg-combobox domId="stat-cat-input-{{cat.id()}}"
471             (ngModelChange)="statCatValues[cat.id()] = $event ? $event.id : null"
472             [ngModel]="statCatValues[cat.id()]">
473             <eg-combobox-entry *ngFor="let entry of cat.entries()"
474               [entryId]="entry.id()" [entryLabel]="entry.value()">
475             </eg-combobox-entry>
476           </eg-combobox>
477         </ng-template>
478         <eg-batch-item-attr label="{{cat.name()}} ({{orgSn(cat.owner())}})" i18n-label
479           name="stat_cat_{{cat.id()}}" editInputDomId="stat-cat-input-{{cat.id()}}"
480           [valueRequired]="cat.required() === 't'"
481           [editTemplate]="statCatTemplate"
482           [labelCounts]="statCatCounts(cat.id())"
483           (valueCleared)="statCatChanged(cat.id(), true)"
484           (changesSaved)="statCatChanged(cat.id())">
485         </eg-batch-item-attr>
486       </div>
487     </ng-container>
488   </div>
489 </div>
490
491