6e8a6e51f52ab16d1cd9bc401e783065a0a14108
[Evergreen.git] /
1 <ng-template #dialogContent>
2   <div class="modal-header bg-info">
3     <h3 *ngIf="mode === 'create'" class="modal-title" i18n>New Distribution Formula</h3>
4     <h3 *ngIf="mode === 'update'" class="modal-title" i18n>Modify Distribution Formula</h3>
5     <h3 *ngIf="mode === 'clone'" class="modal-title" i18n>Clone Distribution Formula (from {{clonedLabel}})</h3>
6     <button type="button" class="btn-close btn-close-white"
7       i18n-aria-label aria-label="Close" (click)="close()"></button>
8   </div>
9   <div class="modal-body">
10     <form #myForm="ngForm" role="form" class="form-validated">
11       <div class="form-group row mt-2" *ngIf="formula">
12         <label for="formula-name" class="form-label col-sm-1 col-form-label" i18n>Formula Name
13         </label>
14         <div class="col-sm-2">
15           <input class="form-control" type="text" id="formula-name"
16             required="required" pattern="[\s\S]*\S[\s\S]*"
17             [ngModel]="formula.name()" name="name"
18             (ngModelChange)="formula.name($event)">
19         </div>
20         <label for="formula-owner" class="form-label col-sm-1 col-form-owner" i18n>Formula Owner
21         </label>
22         <div class="col-sm-2">
23           <eg-org-select
24             placeholder="Owner..."
25             i18n-placeholder
26             domId="formula-owner"
27             [applyOrgId]="formula.owner()"
28             [limitPerms]="['ADMIN_ACQ_DISTRIB_FORMULA']"
29             (onChange)="formula.owner($event); myForm.form.markAsDirty()">
30           </eg-org-select>
31         </div>
32       </div>
33       <div class="row mt-2">
34         <div class="col-sm-1"></div>
35         <div class="col-sm-1" i18n>Owning Library</div>
36         <div class="col-sm-2" i18n>Shelving Location</div>
37         <div class="col-sm-2" i18n>Fund</div>
38         <div class="col-sm-2" i18n>Circ Modifier</div>
39         <div class="col-sm-1" i18n>Collection Code</div>
40         <div class="col-sm-1" i18n>Item Count</div>
41         <div class="col-sm-1"></div>
42       </div>
43       <div class="form-group row mt-2" *ngFor="let entry of formula?.entries(); index as idx; last as isLast; first as isFirst; count as count">
44         <div class="col-sm-1">
45           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
46             (click)="removeRow(idx)"
47             i18n-title title="Remove Entry"><span class="visually-hidden">Remove Entry</span>
48             <span class="material-icons" aria-hidden="true">delete</span>
49           </button>
50         </div>
51         <div class="col-sm-1">
52           <eg-org-select
53             placeholder="Owning Library..."
54             i18n-placeholder
55             domId="entry-owning-lib-{{idx}}"
56             [applyOrgId]="entry.owning_lib()"
57             [limitPerms]="['ADMIN_ACQ_DISTRIB_FORMULA']"
58             (onChange)="entry.owning_lib($event); myForm.form.markAsDirty()">
59           </eg-org-select>
60         </div>
61         <div class="col-sm-2">
62           <eg-item-location-select
63             permFilter="ADMIN_ACQ_DISTRIB_FORMULA" [contextOrgId]="entry.owning_lib()"
64             [ngModel]="entry.location()" name="location-{{idx}}"
65             (ngModelChange)="entry.location($event)"
66             (valueChange)="myForm.form.markAsDirty()">
67           </eg-item-location-select>
68         </div>
69         <div class="col-sm-2">
70           <eg-combobox i18n-placeholder placeholder="Fund..." idlClass="acqf"
71             [idlBaseQuery]="{'active':{'=':'t'}}"
72             id="entry-fund-{{idx}}"
73             [asyncSupportsEmptyTermClick]="true"
74             [selectedId]="entry.fund()"
75             name="fund-{{idx}}"
76             (onChange)="entry.fund($event.id)">
77           </eg-combobox>
78         </div>
79         <div class="col-sm-2">
80           <eg-combobox i18n-placeholder placeholder="Circ Modifier..." idlClass="ccm"
81             id="entry-circ_modifier-{{idx}}"
82             [asyncSupportsEmptyTermClick]="true"
83             [selectedId]="entry.circ_modifier()"
84             name="circ_modifier-{{idx}}"
85             (onChange)="entry.circ_modifier($event.id)">
86           </eg-combobox>
87         </div>
88         <div class="col-sm-1">
89           <input class="form-control" type="text" i18n-placeholder placeholder="Collection Code..."
90             id="entry-collection-code-{{idx}}" pattern="[\s\S]*\S[\s\S]*"
91             [ngModel]="entry.collection_code()" name="collection_code-{{idx}}"
92             (ngModelChange)="entry.collection_code($event)">
93         </div>
94         <div class="col-sm-1">
95           <input class="form-control" type="number" min="0" pattern="^[0-9]+$"
96             [ngModel]="entry.item_count()" name="item_count-{{idx}}"
97             (ngModelChange)="entry.item_count($event)">
98         </div>
99         <div class="col-sm-1">
100           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
101             [disabled]="isFirst"
102             (click)="moveUp(idx)"
103             i18n-title title="Move Up"><span class="visually-hidden">Move Up</span>
104             <span class="material-icons" aria-hidden="true">keyboard_arrow_up</span>
105           </button>
106           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
107             (click)="moveDown(idx)"
108             [disabled]="count < 3 || idx === count - 2"
109             i18n-title title="Move Down"><span class="visually-hidden">Move Down</span>
110             <span class="material-icons" aria-hidden="true">keyboard_arrow_down</span>
111           </button>
112           <button *ngIf="isLast" type="button" class="btn btn-info" (click)="addRow()" i18n>Add</button>
113         </div>
114       </div>
115     </form>
116   </div>
117   <div class="modal-footer">
118     <button type="button" class="btn btn-info" [disabled]="!myForm?.valid || !(myForm?.dirty)"
119       (click)="save()" i18n>Save</button>
120     <button type="button" class="btn btn-warning"
121       (click)="close()" i18n>Cancel</button>
122   </div>
123 </ng-template>
124
125 <ng-template #defaultCloneLabelTmpl i18n>{{clonedLabel}} (clone)</ng-template>
126 <eg-string #defaultCloneLabel [template]="defaultCloneLabelTmpl"></eg-string>