server template : angular admin ui
authorBill Erickson <berickxx@gmail.com>
Thu, 18 Apr 2019 21:37:09 +0000 (17:37 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 19 Apr 2019 17:31:22 +0000 (13:31 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.html
Open-ILS/src/eg2/src/app/staff/admin/server/print-template.component.ts

index c061cc7..32cba62 100644 (file)
@@ -3,6 +3,11 @@
 <eg-staff-banner bannerText="Print Template Administration" i18n-bannerText>
 </eg-staff-banner>
 
+<eg-fm-record-editor #editDialog idlClass="cpt" 
+    [preloadLinkedValues]="true" hiddenFields="template">
+</eg-fm-record-editor>
+
+
 <div class="row mb-3">
   <div class="col-lg-3">
     <div class="input-group">
 </div>
 
 <ngb-tabset *ngIf="template" #tabs (tabChange)="onTabChange($event)">
-  <ngb-tab title="Template Info" i18n-title id='info'>
-    <ng-template ngbTabContent>
-    </ng-template>
-  </ngb-tab>
   <ngb-tab title="Template" i18n-title id='template'>
     <ng-template ngbTabContent>
       <div class="row">
-        <div class="col-lg-6 d-flex justify-content-end mt-3">
-          <button class="btn btn-success" (click)="applyChanges()" i18n>
-            Save and Refresh 
+        <div class="col-lg-6 mt-3">
+          <button class="btn btn-success" (click)="openEditDialog()" i18n>
+            Edit Template Attributes
+          </button>
+          <button class="btn btn-info ml-2" (click)="applyChanges()" i18n>
+            Save Template and Refresh Preview
           </button>
         </div>
       </div>
index c692f6e..13b8996 100644 (file)
@@ -9,6 +9,7 @@ import {ComboboxComponent, ComboboxEntry
 import {PrintService} from '@eg/share/print/print.service';
 import {LocaleService} from '@eg/core/locale.service';
 import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
 
 const SAMPLE_JSON_DATA: any = {
     patron: {
@@ -52,6 +53,7 @@ export class PrintTemplateComponent implements OnInit {
 
     @ViewChild('templateSelector') templateSelector: ComboboxComponent;
     @ViewChild('tabs') tabs: NgbTabset;
+    @ViewChild('editDialog') editDialog: FmRecordEditorComponent;
 
     // Define some sample data that can be used for various templates
 
@@ -128,6 +130,7 @@ export class PrintTemplateComponent implements OnInit {
             const data = SAMPLE_TEMPLATE_DATA[t.name()];
             if (data) {
                 this.sampleJson = JSON.stringify(data, null, 2);
+                this.refreshPreview();
             }
         });
     }
@@ -166,6 +169,14 @@ export class PrintTemplateComponent implements OnInit {
         this.pcrud.update(this.template).toPromise()
             .then(() =>this.refreshPreview());
     }
+
+    openEditDialog() {
+        // TODO: PENDING EXTERNAL FIXES
+        //this.editDialog.record = this.template;
+        this.editDialog.recordId = this.template.id();
+        this.editDialog.mode = 'update';
+        this.editDialog.open({size: 'lg'});
+    }
 }