13238c6bc1aed2ae9f0c5c292578cc7a9e5c67ed
[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             [limitPerms]="['ADMIN_ACQ_DISTRIB_FORMULA']"
31             (onChange)="formula.owner($event); myForm.form.markAsDirty()">
32           </eg-org-select>
33         </div>
34       </div>
35       <div class="row mt-2">
36         <div class="col-sm-1"></div>
37         <div class="col-sm-1" i18n>Owning Library</div>
38         <div class="col-sm-2" i18n>Shelving Location</div>
39         <div class="col-sm-2" i18n>Fund</div>
40         <div class="col-sm-2" i18n>Circ Modifier</div>
41         <div class="col-sm-1" i18n>Collection Code</div>
42         <div class="col-sm-1" i18n>Item Count</div>
43         <div class="col-sm-1"></div>
44       </div>
45       <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">
46         <div class="col-sm-1">
47           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
48             (click)="removeRow(idx)"
49             i18n-title title="Remove Entry"><span class="sr-only">Remove Entry</span>
50             <span class="material-icons" aria-hidden="true">delete</span>
51           </button>
52         </div>
53         <div class="col-sm-1">
54           <eg-org-select
55             placeholder="Owning Library..."
56             i18n-placeholder
57             domId="entry-owning-lib-{{idx}}"
58             [applyOrgId]="entry.owning_lib()"
59             [limitPerms]="['ADMIN_ACQ_DISTRIB_FORMULA']"
60             (onChange)="entry.owning_lib($event); myForm.form.markAsDirty()">
61           </eg-org-select>
62         </div>
63         <div class="col-sm-2">
64           <eg-item-location-select
65             permFilter="ADMIN_ACQ_DISTRIB_FORMULA"
66             [ngModel]="entry.location()" name="location-{{idx}}"
67             (ngModelChange)="entry.location($event)"
68             (valueChange)="myForm.form.markAsDirty()">
69           </eg-item-location-select>
70         </div>
71         <div class="col-sm-2">
72           <eg-combobox i18n-placeholder placeholder="Fund..." idlClass="acqf"
73             id="entry-fund-{{idx}}"
74             [asyncSupportsEmptyTermClick]="true"
75             [selectedId]="entry.fund()"
76             name="fund-{{idx}}"
77             (onChange)="entry.fund($event.id)">
78           </eg-combobox>
79         </div>
80         <div class="col-sm-2">
81           <eg-combobox i18n-placeholder placeholder="Circ Modifier..." idlClass="ccm"
82             id="entry-circ_modifier-{{idx}}"
83             [asyncSupportsEmptyTermClick]="true"
84             [selectedId]="entry.circ_modifier()"
85             name="circ_modifier-{{idx}}"
86             (onChange)="entry.circ_modifier($event.id)">
87           </eg-combobox>
88         </div>
89         <div class="col-sm-1">
90           <input class="form-control" type="text" i18n-placeholder placeholder="Collection Code..."
91             id="entry-collection-code-{{idx}}"
92             [ngModel]="entry.collection_code()" name="collection_code-{{idx}}"
93             (ngModelChange)="entry.collection_code($event)">
94         </div>
95         <div class="col-sm-1">
96           <input class="form-control" type="number" min="0" pattern="^[0-9]+$"
97             [ngModel]="entry.item_count()" name="item_count-{{idx}}"
98             (ngModelChange)="entry.item_count($event)">
99         </div>
100         <div class="col-sm-1">
101           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
102             [disabled]="isFirst"
103             (click)="moveUp(idx)"
104             i18n-title title="Move Up"><span class="sr-only">Move Up</span>
105             <span class="material-icons" aria-hidden="true">keyboard_arrow_up</span>
106           </button>
107           <button *ngIf="!isLast" class="btn btn-sm material-icon-button" type="button"
108             (click)="moveDown(idx)"
109             [disabled]="count < 3 || idx === count - 2"
110             i18n-title title="Move Down"><span class="sr-only">Move Down</span>
111             <span class="material-icons" aria-hidden="true">keyboard_arrow_down</span>
112           </button>
113           <button *ngIf="isLast" type="button" class="btn btn-info" (click)="addRow()" i18n>Add</button>
114         </div>
115       </div>
116     </form>
117   </div>
118   <div class="modal-footer">
119     <button type="button" class="btn btn-info" [disabled]="!myForm?.valid || !(myForm?.dirty)"
120       (click)="save()" i18n>Save</button>
121     <button type="button" class="btn btn-warning"
122       (click)="close()" i18n>Cancel</button>
123   </div>
124 </ng-template>
125
126 <ng-template #defaultCloneLabelTmpl i18n>{{clonedLabel}} (clone)</ng-template>
127 <eg-string #defaultCloneLabel [template]="defaultCloneLabelTmpl"></eg-string>