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