585a7afab478c75a20b9e1b256848402799af7a6
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / admin / server / print-template.component.html
1
2 <eg-title i18n-prefix prefix="Print Template Administration"></eg-title>
3 <eg-staff-banner bannerText="Print Template Administration" i18n-bannerText>
4 </eg-staff-banner>
5
6 <eg-fm-record-editor #editDialog idlClass="cpt" 
7     [preloadLinkedValues]="true" hiddenFields="template">
8 </eg-fm-record-editor>
9
10 <eg-confirm-dialog #confirmDelete
11   i18n-dialogTitle i18n-dialogBody
12   dialogTitle="Confirm Delete?"
13   dialogBody="Delete Template '{{template ? template.label() : ''}}'?">
14 </eg-confirm-dialog>
15
16 <div class="row mb-3">
17   <div class="col-lg-4">
18     <eg-org-family-select
19       [selectedOrgId]="initialOrg"
20       [limitPerms]="['ADMIN_PRINT_TEMPLATE']"
21       labelText="Owner" i18n-labelText
22       (ngModelChange)="orgOnChange($event)"
23       ngModel #orgFamily="ngModel">
24     </eg-org-family-select>
25   </div>
26   <div class="col-lg-3">
27     <div class="input-group">
28       <div class="input-group-prepend">
29         <span class="input-group-text" i18n>Template</span>
30       </div>
31       <ng-template #entryTemplate let-r="result" let-owner="getOwnerName">
32         {{r.label}} ({{getOwnerName(r.id)}})
33       </ng-template>
34       <eg-combobox #templateSelector
35         [entries]="entries" [displayTemplate]="entryTemplate"
36         (onChange)="selectTemplate($event ? $event.id : null)">
37       </eg-combobox>
38     </div>
39   </div>
40   <div class="col-lg-3" *ngIf="localeEntries.length > 0">
41     <div class="input-group">
42       <div class="input-group-prepend">
43         <span class="input-group-text" i18n>Locale</span>
44       </div>
45       <eg-combobox [entries]="localeEntries"
46         [startId]="localeCode"
47         (onChange)="localeOnChange($event ? $event.id : null)">
48       </eg-combobox>
49     </div>
50   </div>
51 </div>
52
53 <ngb-tabset *ngIf="template" #tabs (tabChange)="onTabChange($event)">
54   <ngb-tab title="Template" i18n-title id='template'>
55     <ng-template ngbTabContent>
56       <div class="row">
57         <div class="col-lg-12 mt-3 d-flex">
58           <button class="btn btn-info" (click)="openEditDialog()" i18n>
59             Edit Template Attributes
60           </button>
61           <button class="btn btn-success ml-2" (click)="applyChanges()" i18n>
62             Save Template Changes
63           </button>
64           <button class="btn btn-info ml-2" (click)="cloneTemplate()" i18n>
65             Clone Template
66           </button>
67           <div class="flex-1"> </div>
68           <button class="btn btn-danger ml-2" (click)="deleteTemplate()" i18n>
69             Delete Template
70           </button>
71           <span *ngIf="invalidJson" class="badge badge-danger ml-2" i18n>
72             Invalid Sample JSON!
73           </span>
74         </div>
75       </div>
76       <div class="row mt-2">
77         <div class="col-lg-6">
78           <h4 i18n>
79             Template for "{{template.label()}} ({{getOwnerName(template.id())}})"
80             <span class="pl-2 text-warning" *ngIf="template.active() == 'f'">
81               (Inactive)
82             </span>
83           </h4>
84          <textarea rows="30" class="form-control"
85            spellcheck="false"
86            [ngModel]="template.template()"
87            (ngModelChange)="template.template($event); template.ischanged(true)">
88          </textarea>
89         </div>
90         <div class="col-lg-6">
91           <h4 i18n>Preview</h4>
92           <div class="border border-dark w-100" id="template-preview-pane">
93           </div>
94           <h4 class="mt-3" i18n>Compiled Content</h4>
95           <div class="border border-dark w-100">
96             <pre class="p-1">{{compiledContent}}</pre>
97           </div>
98         </div>
99       </div>
100     </ng-template>
101   </ngb-tab>
102   <ngb-tab title="Sample Data" i18n-title id='data'>
103     <ng-template ngbTabContent>
104       <textarea rows="20" [(ngModel)]="sampleJson" 
105         spellcheck="false" class="form-control">
106       </textarea>
107     </ng-template>
108   </ngb-tab>
109 </ngb-tabset>
110