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