71a8cd426b7d6bab3d73528c710edcab830042e9
[working/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="close"
7       i18n-aria-label aria-label="Close" (click)="close()">
8       <span aria-hidden="true">&times;</span>
9     </button>
10   </div>
11   <div class="modal-body">
12     <form #myForm="ngForm" role="form" class="form-validated">
13       <div class="form-group row mt-2" *ngIf="formula">
14         <label for="formula-name" class="col-sm-1 col-form-label" i18n>Formula Name
15         </label>
16         <div class="col-sm-2">
17           <input class="form-control" type="text" id="formula-name"
18             required="required"
19             [ngModel]="formula.name()" name="name"
20             (ngModelChange)="formula.name($event)">
21         </div>
22         <label for="formula-owner" class="col-sm-1 col-form-owner" i18n>Formula Owner
23         </label>
24         <div class="col-sm-2">
25           <eg-org-select
26             placeholder="Owner..."
27             i18n-placeholder
28             domId="formula-owner"
29             [applyOrgId]="formula.owner()"
30             (onChange)="formula.owner($event); myForm.form.markAsDirty()">
31           </eg-org-select>
32         </div>
33       </div>
34       <div class="row mt-2">
35         <div class="col-sm-1"></div>
36         <div class="col-sm-1" i18n>Owning Library</div>
37         <div class="col-sm-2" i18n>Shelving Location</div>
38         <div class="col-sm-2" i18n>Fund</div>
39         <div class="col-sm-2" i18n>Circ Modifier</div>
40         <div class="col-sm-1" i18n>Collection Code</div>
41         <div class="col-sm-1" i18n>Item Count</div>
42         <div class="col-sm-1"></div>
43       </div>
44       <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">
45         <div class="col-sm-1">
46           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
47             (click)="removeRow(idx)"
48             i18n-title title="Remove Entry"><span class="sr-only">Remove Entry</span>
49             <span class="material-icons" aria-hidden="true">delete</span>
50           </button>
51         </div>
52         <div class="col-sm-1">
53           <eg-org-select
54             placeholder="Owning Library..."
55             i18n-placeholder
56             domId="entry-owning-lib-{{idx}}"
57             [applyOrgId]="entry.owning_lib()"
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="CREATE_PURCHASE_ORDER"
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             id="entry-fund-{{idx}}"
72             [asyncSupportsEmptyTermClick]="true"
73             [selectedId]="entry.fund()"
74             name="fund-{{idx}}"
75             (onChange)="entry.fund($event.id)">
76           </eg-combobox>
77         </div>
78         <div class="col-sm-2">
79           <eg-combobox i18n-placeholder placeholder="Circ Modifier..." idlClass="ccm"
80             id="entry-circ_modifier-{{idx}}"
81             [asyncSupportsEmptyTermClick]="true"
82             [selectedId]="entry.circ_modifier()"
83             name="circ_modifier-{{idx}}"
84             (onChange)="entry.circ_modifier($event.id)">
85           </eg-combobox>
86         </div>
87         <div class="col-sm-1">
88           <input class="form-control" type="text" i18n-placeholder placeholder="Collection Code..."
89             id="entry-collection-code-{{idx}}"
90             [ngModel]="entry.collection_code()" name="collection_code-{{idx}}"
91             (ngModelChange)="entry.collection_code($event)">
92         </div>
93         <div class="col-sm-1">
94           <input class="form-control" type="number" min="0" pattern="^[0-9]+$"
95             [ngModel]="entry.item_count()" name="item_count-{{idx}}"
96             (ngModelChange)="entry.item_count($event)">
97         </div>
98         <div class="col-sm-1">
99           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
100             [disabled]="isFirst"
101             (click)="moveUp(idx)"
102             i18n-title title="Move Up"><span class="sr-only">Move Up</span>
103             <span class="material-icons" aria-hidden="true">keyboard_arrow_up</span>
104           </button>
105           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
106             (click)="moveDown(idx)"
107             [disabled]="count < 3 || idx === count - 2"
108             i18n-title title="Move Down"><span class="sr-only">Move Down</span>
109             <span class="material-icons" aria-hidden="true">keyboard_arrow_down</span>
110           </button>
111           <button *ngIf="isLast" type="button" class="btn btn-info" (click)="addRow()" i18n>Add</button>
112         </div>
113       </div>
114     </form>
115   </div>
116   <div class="modal-footer">
117     <button type="button" class="btn btn-info" [disabled]="!myForm?.valid || !(myForm?.dirty)"
118       (click)="save()" i18n>Save</button>
119     <button type="button" class="btn btn-warning"
120       (click)="close()" i18n>Cancel</button>
121   </div>
122 </ng-template>
123
124 <ng-template #defaultCloneLabelTmpl i18n>{{clonedLabel}} (clone)</ng-template>
125 <eg-string #defaultCloneLabel [template]="defaultCloneLabelTmpl"></eg-string>