LP1849212: Use a set list of roles for course users
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / admin / local / course-reserves / course-associate-users.component.html
1 <eg-string #userDeleteFailedString i18n-text text="Removal of User failed or was not allowed"></eg-string>
2 <eg-string #userDeleteSuccessString i18n-text text="Removal of User succeeded"></eg-string>
3 <eg-string #userAddSuccessString i18n-text text="Addition of User succeeded"></eg-string>
4 <eg-string #userAddFailedString i18n-text text="Addition of User failed or was not allowed"></eg-string>
5 <eg-string #userEditSuccessString i18n-text text="Update of User succeeded"></eg-string>
6 <eg-string #userEditFailedString i18n-text text="Update of User failed or was not allowed"></eg-string>
7
8 <ng-template #dialogContent>
9 <div class="modal-header bg-info"
10   [ngClass]="isDialog() ? 'modal-header' : 'alert mt-3'">
11   <h4 class="modal-title" i18n>Course Users</h4>
12   <ng-container *ngIf="isDialog()">
13   <button type="button" class="close"
14     i18n-aria-label aria-label="Close" (click)="close()">
15     <span aria-hidden="true">&times;</span>
16   </button>
17   </ng-container>
18 </div>
19 <div [ngClass]="isDialog() ? 'modal-body' : ''">
20   <div class="row">
21     <div [ngClass]="isDialog() ? 'col-md-12' : 'col-md-4'">
22       <div class="row" [ngClass]="isDialog() ? '' : 'mt-3'">
23         <div class="d-flex"  [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12'">
24           <div class="input-group">
25             <div class="input-group-prepend">
26               <label for="associate-user-barcode" class="input-group-text" i18n>Patron Barcode</label>
27             </div>
28             <input type="text" class="flex-grow-1" id="associate-user-barcode"
29               [(ngModel)]="userBarcode" (click)="$event.target.select()"
30               [disabled]="currentCourse && currentCourse.is_archived() == 't'"
31               (keyup.enter)="associateUser(userBarcode)" />
32           </div>
33         </div>
34         <div class="d-flex" [ngClass]="isDialog() ? 'col-md-6' : 'col-md-12 mt-3'">
35           <div class="input-group">
36             <div class="input-group-prepend">
37               <label for="associate-user-role" class="input-group-text" i18n>Role</label>
38             </div>
39             <eg-combobox idlClass="acmr" [(ngModel)]="userRoleInput"
40             [disabled]="currentCourse && currentCourse.is_archived() == 't'">
41             </eg-combobox>
42           </div>
43         </div>
44       </div>
45       <div class="row mt-3">
46         <div class="text-right" [ngClass]="isDialog() ? 'col-md-2' : 'col-md-6'">
47           <button class="btn btn-primary"
48             [disabled]="currentCourse && currentCourse.is_archived() == 't'"
49             i18n [disabled]="!userBarcode" (click)="associateUser(userBarcode)">
50             Add User
51           </button>
52         </div>
53       </div>
54     </div>
55     <div class="mt-3" [ngClass]="isDialog() ? 'col-md-12' : 'col-md-8'">
56       <eg-grid #usersGrid [dataSource]="usersDataSource" [useLocalSort]="true">
57         <eg-grid-toolbar-action label="Remove Selected" i18n-label (onClick)="deleteSelectedUsers($event)">
58         </eg-grid-toolbar-action>
59         <eg-grid-toolbar-action label="Edit Selected" i18n-label (onClick)="editSelectedUsers($event)">
60         </eg-grid-toolbar-action>
61         <eg-grid-column label="User ID" path="usr.id" [index]=true [hidden]="true" i18n-label></eg-grid-column>
62         <eg-grid-column label="First Name" path="usr.first_given_name" i18n-label></eg-grid-column>
63         <eg-grid-column label="Second Name" path="usr.second_given_name" i18n-label></eg-grid-column>
64         <eg-grid-column label="Last Name" path="usr.family_name" i18n-label></eg-grid-column>
65         <eg-grid-column label="Prefix" path="usr.pref_prefix" [hidden]="true" i18n-label></eg-grid-column>
66         <eg-grid-column label="Preferred First Name" path="usr.pref_first_given_name"[hidden]="true"  i18n-label></eg-grid-column>
67         <eg-grid-column label="Preferred Second Name" path="usr.pref_second_given_name"[hidden]="true"  i18n-label></eg-grid-column>
68         <eg-grid-column label="Preferred Family Name" path="usr.pref_family_name"[hidden]="true"  i18n-label></eg-grid-column>
69         <eg-grid-column label="Preferred Suffix" path="usr.pref_suffix" [hidden]="true" i18n-label></eg-grid-column>
70         <eg-grid-column label="User Role" path="usr_role.name" i18n-label></eg-grid-column>
71         <eg-grid-column label="Viewable on OPAC" path="usr_role.is_public" i18n-label datatype="bool"></eg-grid-column>
72       </eg-grid>
73     </div>
74   </div>
75 </div>
76 </ng-template>
77
78 <ng-container *ngIf="!isDialog()">
79   <!-- in "inline" mode, render the grid pane right here -->
80   <ng-container *ngTemplateOutlet="dialogContent">
81   </ng-container>
82 </ng-container>
83
84 <eg-fm-record-editor #editDialog
85   idlClass='acmcu'
86   [fieldOptions]="{course: {linkedSearchField: 'course_number'}}"
87   [preloadLinkedValues]="true"
88   hiddenFields="id,usr">
89 </eg-fm-record-editor>