4cfe7baf21ddd823960a86b40329c8554e5dc813
[evergreen-equinox.git] / Open-ILS / src / eg2 / src / app / staff / admin / local / course-reserves / course-associate-material.component.html
1 <eg-string #materialDeleteFailedString i18n-text text="Disassociation of Course Material failed or was not allowed">
2 </eg-string>
3 <eg-string #materialDeleteSuccessString i18n-text text="Disassociation of Course Material succeeded"></eg-string>
4 <eg-string #materialAddSuccessString i18n-text text="Association of Course Material succeeded"></eg-string>
5 <eg-string #materialAddFailedString i18n-text text="Association of Course Material failed or was not allowed">
6 </eg-string>
7 <eg-string #materialEditSuccessString i18n-text text="Update of Course Material succeeded"></eg-string>
8 <eg-string #materialEditFailedString i18n-text text="Update of Course Material failed or was not allowed"></eg-string>
9
10 <eg-alert-dialog #otherLibraryNoPermissionsAlert
11   i18n-dialogTitle i18n-dialogBody
12   dialogTitle="Insufficient permissions"
13   dialogBody="This material has {{itemCircLib}} as its circulation library, where you do not have UPDATE_COPY permissions.  You cannot attach this item without UPDATE_COPY permissions.">
14 </eg-alert-dialog>
15
16 <eg-confirm-dialog #confirmOtherLibraryDialog
17   i18n-dialogTitle i18n-dialogBody
18   dialogTitle="Material from a different library"
19   dialogBody="This material has {{itemCircLib}} as its circulation library. Are you sure you want to add it to {{currentCourse.course_number()}}?">
20 </eg-confirm-dialog>
21
22 <ng-template #dialogContent>
23   <div class="modal-header bg-info" [ngClass]="isDialog() ? 'modal-header' : 'alert mt-3'">
24     <h4 class="modal-title" i18n>Course Materials</h4>
25     <ng-container *ngIf="isDialog()">
26       <button type="button" class="btn-close btn-close-white" i18n-aria-label aria-label="Close" (click)="close()">      </button>
27     </ng-container>
28   </div>
29   <div [ngClass]="isDialog() ? 'modal-body' : ''">
30     <div class="row">
31       <div [ngClass]="isDialog() ? 'col-md-12' : 'col-md-4'">
32         <ul ngbNav #associateNav="ngbNav" class="nav-tabs" [keyboard]="true" [roles]="false" role="tablist">
33           <li role="presentation" ngbNavItem>
34             <a role="tab" ngbNavLink i18n>Associate item</a>
35             <ng-template ngbNavContent>
36               <div class="row" [ngClass]="isDialog() ? '' : 'mt-3'">
37                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12'">
38                   <div class="input-group">
39                     <input type="text" class="flex-grow-1" id="associate-item-barcode"
40                       [(ngModel)]="barcodeInput" (click)="$event.target.select()"
41                       [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
42                       />
43                   </div>
44                 </div>
45                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12 mt-3'">
46                   <div class="input-group">
47                     <label for="associate-item-relationship" class="form-label input-group-text" i18n>Relationship</label>
48                     <input type="text" [(ngModel)]="relationshipInput" id="associate-item-relationship"
49                       [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'" placeholder-i18n
50                       placeholder="e.g. Required" class="flex-grow-1" />
51                   </div>
52                 </div>
53               </div>
54               <div class="row justify-content-center mt-3">
55                 <div class="col">
56                   <h5 i18n>The following fields will be applied to the material
57                     added, and reverted once the course is no longer associated
58                     with the material.</h5>
59                 </div>
60               </div>
61               <div class="row mt-3">
62                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12'">
63                   <div class="input-group">
64                     <div class="input-group-text">
65                         <label class="form-label" for="associate-item-temp-call-number" i18n>Call Number</label>
66                     </div>
67                     <input type="text" [(ngModel)]="tempCallNumber" id="associate-item-temp-call-number"
68                       [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
69                       (input)="isModifyingCallNumber = true" class="flex-grow-1" />
70                       <div class="input-group-text">
71                         <input type="checkbox" [(ngModel)]="isModifyingCallNumber"
72                           [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
73                           aria-label="Checkbox for setting a temporary Call Number" />
74                     </div>
75                   </div>
76                 </div>
77                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12 mt-3'">
78                   <div class="input-group">
79                     <label class="form-label input-group-text" for="temp-circ-mod" i18n>Circulation Modifier</label>
80                     <eg-combobox i18n-placeholder placeholder="Circulation Modifier..." idlClass="ccm" idlField="name"
81                       [displayTemplate]="idlClassLabel" [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
82                       [asyncSupportsEmptyTermClick]="true" class="flex-grow-1"
83                       domId="temp-circ-mod"
84                       (onChange)="tempCircMod = $event.id; isModifyingCircMod = true">
85                     </eg-combobox>
86                     <div class="input-group-text">
87                         <input type="checkbox" [(ngModel)]="isModifyingCircMod"
88                           [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
89                           aria-label="Checkbox for setting a temporary Circulation Modifier" />
90                     </div>
91                   </div>
92                 </div>
93               </div>
94               <div class="row mt-3">
95                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12'">
96                   <div class="input-group">
97                     <label class="form-label input-group-text" for="temp-item-status" i18n>Item Status</label>
98                     <eg-combobox i18n-placeholder placeholder="Item Status..." idlClass="ccs" idlField="name"
99                       [displayTemplate]="idlClassLabel" [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
100                       [asyncSupportsEmptyTermClick]="true" class="flex-grow-1"
101                       domId="temp-item-status"
102                       (onChange)="tempStatus = $event.id; isModifyingStatus = true">
103                     </eg-combobox>
104                     <div class="input-group-text">
105                         <input type="checkbox" [(ngModel)]="isModifyingStatus"
106                           [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
107                           aria-label="Checkbox for setting a temporary Item Status" />
108                     </div>
109                   </div>
110                 </div>
111                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12 mt-3'">
112                   <div class="input-group">
113                     <label class="form-label input-group-text" for="temp-location" i18n>Shelving Location</label>
114                     <eg-item-location-select permFilter="MANAGE_RESERVES" class="flex-grow-1" domId="temp-location"
115                       [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'" [(ngModel)]="tempLocation"
116                       (valueChange)="isModifyingLocation = true">
117                     </eg-item-location-select>
118                     <div class="input-group-text">
119                         <input type="checkbox" [(ngModel)]="isModifyingLocation"
120                           [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
121                           aria-label="Checkbox for setting a temporary Shelving Location" />
122                     </div>
123                   </div>
124                 </div>
125               </div>
126               <div class="row mt-3">
127                 <div class="col-lg-12 text-end">
128                   <button class="btn btn-primary" [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'"
129                     (click)="associateItem(barcodeInput, relationshipInput)" i18n [disabled]="!barcodeInput">
130                     Add Material
131                   </button>
132                 </div>
133               </div>
134             </ng-template>
135           </li>
136           <li role="presentation" ngbNavItem>
137             <a role="tab" ngbNavLink i18n>Associate brief record</a>
138             <ng-template ngbNavContent>
139               <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12 mt-3'">
140                 <div class="input-group">
141                     <label class="form-label input-group-text" for="brief-relationship" i18n>Relationship</label>
142                   <input type="text" [(ngModel)]="relationshipInput" id="brief-relationship"
143                     [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'" placeholder-i18n
144                     placeholder="e.g. Required" class="flex-grow-1" />
145                 </div>
146               </div>
147               <eg-marc-simplified-editor (xmlRecordEvent)="associateBriefRecord($event)"
148               buttonLabel="Add material" i18n-buttonLabel defaultMarcForm="o">
149                 <eg-marc-simplified-editor-field tag="245" ind1="0" ind2="0">
150                   <eg-marc-simplified-editor-subfield code="a"></eg-marc-simplified-editor-subfield>
151                 </eg-marc-simplified-editor-field>
152                 <eg-marc-simplified-editor-field tag="856" ind1="4" ind2="0">
153                   <eg-marc-simplified-editor-subfield code="u"></eg-marc-simplified-editor-subfield>
154                   <eg-marc-simplified-editor-subfield code="y"></eg-marc-simplified-editor-subfield>
155                   <eg-marc-simplified-editor-subfield code="9" [defaultValue]="currentCourse.owning_lib().shortname()"></eg-marc-simplified-editor-subfield>
156                 </eg-marc-simplified-editor-field>
157                 <eg-marc-simplified-editor-field tag="990">
158                   <eg-marc-simplified-editor-subfield code="a" i18n-defaultValue
159                     defaultValue="This record was created using the Course Materials Module -- please edit it there">
160                   </eg-marc-simplified-editor-subfield>
161                 </eg-marc-simplified-editor-field>
162               </eg-marc-simplified-editor>
163             </ng-template>
164           </li>
165           <li role="presentation" ngbNavItem>
166             <a ngbNavLink role="tab">Associate electronic resource from catalog</a>
167             <ng-template ngbNavContent>
168               <div class="row" [ngClass]="isDialog() ? '' : 'mt-3'">
169                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12 mt-3'">
170                   <div class="input-group">
171                       <label for="bib-id" class="form-label input-group-text" i18n>Bibliographic Record ID</label>
172                     <input type="text" [(ngModel)]="bibId" id="bib-id"
173                       [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'" class="flex-grow-1" />
174                   </div>
175                 </div>
176                 <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12 mt-3'">
177                   <div class="input-group">
178                       <label class="form-label input-group-text" for="electronic-relationship" i18n>Relationship</label>
179                     <input type="text" [(ngModel)]="relationshipInput" id="electronic-relationship"
180                       [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'" class="flex-grow-1" />
181                   </div>
182                 </div>
183               </div>
184               <div class="row mt-3">
185                 <div class="col-lg-12 text-end">
186                   <button class="btn btn-primary" i18n (click)="associateElectronicBibRecord()"
187                     [disabled]="currentCourse && (courseIsArchived || currentCourse.is_archived()) === 't'">
188                     Add Material
189                   </button>
190                 </div>
191               </div>
192             </ng-template>
193           </li>
194         </ul>
195         <div [ngbNavOutlet]="associateNav"></div>
196       </div>
197
198       <div class="mt-3" [ngClass]="isDialog() ? 'col-md-12' : 'col-md-8'">
199         <eg-grid #materialsGrid [dataSource]="materialsDataSource" [useLocalSort]="true" [disablePaging]="true">
200           <eg-grid-toolbar-action label="Remove Selected" i18n-label (onClick)="deleteSelectedMaterials($event)">
201           </eg-grid-toolbar-action>
202           <eg-grid-toolbar-action label="Edit Selected" i18n-label (onClick)="editSelectedMaterials($event)">
203           </eg-grid-toolbar-action>
204           <eg-grid-column path="id" [index]=true [hidden]="true" label="ID" i18n-label></eg-grid-column>
205           <eg-grid-column label="Barcode" i18n-label name="barcode" [cellTemplate]="barcodeCellTemplate"></eg-grid-column>
206           <eg-grid-column label="Title" i18n-label name="title" flex="3" [cellTemplate]="titleCellTemplate"></eg-grid-column>
207           <eg-grid-column path="item.call_number.label" label="Call Number" i18n-label></eg-grid-column>
208           <eg-grid-column path="item.call_number.prefix.label" [hidden]="true" label="Call Number Prefix" i18n-label hidden>
209           </eg-grid-column>
210           <eg-grid-column path="item.call_number.suffix.label" [hidden]="true" label="Call Number Suffix" i18n-label hidden>
211           </eg-grid-column>
212           <eg-grid-column path="item.circ_modifier.name" [hidden]="true" label="Circulation Modifier" i18n-label></eg-grid-column>
213           <eg-grid-column path="item.circ_lib.shortname" label="Circulation Library" i18n-label></eg-grid-column>
214           <eg-grid-column path="item.location.name" [hidden]="true" label="Shelving Location" i18n-label></eg-grid-column>
215           <eg-grid-column path="item.status.name" [hidden]="true" label="Item Status" i18n-label></eg-grid-column>
216           <eg-grid-column path="original_circ_modifier.name" [hidden]="true" label="Original Circulation Modifier" i18n-label></eg-grid-column>
217           <eg-grid-column path="original_location.name" [hidden]="true" label="Original Shelving Location" i18n-label></eg-grid-column>
218           <eg-grid-column path="original_status.name" [hidden]="true" label="Original Item Status" i18n-label></eg-grid-column>
219           <eg-grid-column path="relationship" label="Relationship" i18n-label></eg-grid-column>
220         </eg-grid>
221       </div>
222     </div>
223   </div>
224 </ng-template>
225 <ng-template #barcodeCellTemplate let-entry="row">
226   <span *ngIf="entry.item()">
227     <a class="ps-1" href="/eg/staff/cat/item/{{entry.item().id()}}">
228       {{entry.item().barcode()}}
229     </a>
230   </span>
231 </ng-template>
232 <ng-template #titleCellTemplate let-entry="row">
233   <a class="ps-1" routerLink="/staff/catalog/record/{{entry.record().id()}}">
234     {{entry.record().wide_display_entry().title()}}
235   </a>
236 </ng-template>
237 <ng-template #idlClassLabel let-r="result" i18n>
238   {{r.label}}
239 </ng-template>
240 <ng-template #acmcTemplate
241   let-field="field" let-record="record">
242   <eg-combobox idlClass="acmc" [required]="true"
243     [selectedId]="record['course']()"
244     (onChange)="($event) ? record['course']($event.id) : ''">
245   </eg-combobox>
246 </ng-template>
247
248 <ng-container *ngIf="!isDialog()">
249   <!-- in "inline" mode, render the grid pane right here -->
250   <ng-container *ngTemplateOutlet="dialogContent">
251   </ng-container>
252 </ng-container>
253
254 <eg-fm-record-editor #editDialog idlClass='acmcm' [fieldOptions]="{course: {customTemplate:{template:acmcTemplate}}}"
255   [preloadLinkedValues]="true"
256   hiddenFields="id,item,original_callnumber,original_status,original_location,original_circ_modifier,record,temporary_record">
257 </eg-fm-record-editor>