LPXXX Angular Volcopy
authorBill Erickson <berickxx@gmail.com>
Wed, 17 Jun 2020 19:21:49 +0000 (15:21 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 17 Jun 2020 19:21:49 +0000 (15:21 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts
Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.html

index 483a99e..9b0bc01 100644 (file)
@@ -4,21 +4,12 @@
 <div class="row">
 </div>
 
-<!-- List of Edit Templates -->
-
-<div class="row d-flex">
-  <div class="flex-1 p-1"><h4 class="font-weight-bold" i18n>Identification</h4></div>
-  <div class="flex-1 p-1"><h4 class="font-weight-bold" i18n>Location</h4></div>
-  <div class="flex-1 p-1"><h4 class="font-weight-bold" i18n>Circulation</h4></div>
-  <div class="flex-1 p-1"><h4 class="font-weight-bold" i18n>Miscellaneous</h4></div>
-  <div class="flex-1 p-1"><h4 class="font-weight-bold" i18n>Statistics</h4></div>
-</div>
-
 
 <div class="row d-flex">
 
   <!-- COLUMN 1 -->
   <div class="flex-1 p-1">
+    <div class="p-1"><h4 class="font-weight-bold" i18n>Identification</h4></div>
 
     <div class="mb-1">
       <eg-batch-item-attr label="Status" i18n-label [readOnly]="true"
@@ -67,6 +58,7 @@
 
   <!-- COLUMN 2 -->
   <div class="flex-1 p-1">
+    <div class="p-1"><h4 class="font-weight-bold" i18n>Location</h4></div>
 
     <div>
       <ng-template #locationTemplate>
   <!-- COLUMN 3 -->
 
   <div class="flex-1 p-1">
+    <div class="p-1"><h4 class="font-weight-bold" i18n>Circulation</h4></div>
 
     <div>
                        <ng-template #circulateTemplate>
   <!-- COLUMN 4 -->
 
   <div class="flex-1 p-1">
+
+    <div class="p-1"><h4 class="font-weight-bold" i18n>Miscellaneous</h4></div>
+
+    <div>
+                       <ng-template #alertMessageTemplate>
+                               <textarea rows="3" class="form-control" 
+          [(ngModel)]="values['alert_message']">
+        </textarea>
+                       </ng-template>
+      <eg-batch-item-attr label="Alert Message" i18n-label
+        [emptyIsUnset]="true"
+        [editTemplate]="alertMessageTemplate"
+        [labelCounts]="itemAttrCounts('alert_message')"
+        (changesSaved)="applyCopyValue('alert_message')">
+      </eg-batch-item-attr>
+    </div>
+
+    <div>
+                       <ng-template #depositTemplate>
+                               <select class="form-control" [(ngModel)]="values['deposit']">
+                                       <option value="yes" i18n>Yes</option>
+                                       <option value="no" i18n>No</option>
+                               </select>
+                       </ng-template>
+      <eg-batch-item-attr label="Deposit" i18n-label
+        displayAs="bool"
+        [editTemplate]="depositTemplate"
+        [labelCounts]="itemAttrCounts('deposit')"
+        (changesSaved)="applyCopyValue('deposit',
+          values['deposit'] === 'yes' ? 't': 'f')">
+      </eg-batch-item-attr>
+    </div>
+
+    <div>
+                       <ng-template #depositAmountTemplate>
+                               <input type="number" class="form-control" 
+          [(ngModel)]="values['deposit_amount']"/>
+                       </ng-template>
+      <eg-batch-item-attr label="Deposit Amount" i18n-label
+        displayAs="currency"
+        [editTemplate]="depositAmountTemplate"
+        [labelCounts]="itemAttrCounts('deposit_amount')"
+        (changesSaved)="applyCopyValue('deposit_amount')">
+      </eg-batch-item-attr>
+    </div>
+
+    <div>
+                       <ng-template #priceTemplate>
+                               <input type="number" class="form-control" 
+          [(ngModel)]="values['price']"/>
+                       </ng-template>
+      <eg-batch-item-attr label="Price" i18n-label
+        displayAs="currency"
+        [editTemplate]="priceTemplate"
+        [labelCounts]="itemAttrCounts('price')"
+        (changesSaved)="applyCopyValue('price')">
+      </eg-batch-item-attr>
+    </div>
+
+    <div>
+                       <ng-template #opacVisibleTemplate>
+                               <select class="form-control" [(ngModel)]="values['opac_visible']">
+                                       <option value="yes" i18n>Yes</option>
+                                       <option value="no" i18n>No</option>
+                               </select>
+                       </ng-template>
+      <eg-batch-item-attr label="OPAC Visible" i18n-label
+        displayAs="bool"
+        [editTemplate]="opacVisibleTemplate"
+        [labelCounts]="itemAttrCounts('opac_visible')"
+        (changesSaved)="applyCopyValue('opac_visible',
+          values['opac_visible'] === 'yes' ? 't': 'f')">
+      </eg-batch-item-attr>
+    </div>
+
+    <div>
+                       <ng-template #refTemplate>
+                               <select class="form-control" [(ngModel)]="values['ref']">
+                                       <option value="yes" i18n>Yes</option>
+                                       <option value="no" i18n>No</option>
+                               </select>
+                       </ng-template>
+      <eg-batch-item-attr label="Reference" i18n-label
+        displayAs="bool"
+        [editTemplate]="refTemplate"
+        [labelCounts]="itemAttrCounts('ref')"
+        (changesSaved)="applyCopyValue(
+          'ref', values['ref'] === 'yes' ? 't': 'f')">
+      </eg-batch-item-attr>
+    </div>
+
+    <div>
+                       <ng-template #costTemplate>
+                               <input type="number" class="form-control" 
+          [(ngModel)]="values['cost']"/>
+                       </ng-template>
+      <eg-batch-item-attr label="Acquisition Cost" i18n-label
+        [emptyIsUnset]="true"
+        displayAs="currency"
+        [editTemplate]="costTemplate"
+        [labelCounts]="itemAttrCounts('cost')"
+        (changesSaved)="applyCopyValue('cost')">
+      </eg-batch-item-attr>
+    </div>
+
+    <div>
+      <eg-string #mintConditionYes i18n-text text="Good"></eg-string>
+      <eg-string #mintConditionNo i18n-text text="Damaged"></eg-string>
+
+                       <ng-template #mintConditionTemplate>
+                               <select class="form-control" [(ngModel)]="values['mint_condition']">
+          <option value="t" i18n>{{mintConditionYes.text}}</option>
+          <option value="f" i18n>{{mintConditionNo.text}}</option>
+                               </select>
+                       </ng-template>
+      <eg-batch-item-attr label="Quality" i18n-label
+        [emptyIsUnset]="true"
+        [editTemplate]="mintConditionTemplate"
+        [labelCounts]="itemAttrCounts('mint_condition')"
+        (changesSaved)="applyCopyValue('mint_condition')">
+      </eg-batch-item-attr>
+    </div>
+
   </div>
 
   <!-- COLUMN 5 -->
   <div class="flex-1 p-1">
+    <div class="p-1"><h4 class="font-weight-bold" i18n>Statistics</h4></div>
   </div>
 </div>
 
index 6053e7b..ccfe284 100644 (file)
@@ -47,6 +47,10 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
     @ViewChild('fineLevelHigh', {static: false})
         fineLevelHigh: StringComponent;
 
+    @ViewChild('mintConditionYes', {static: false})
+        mintConditionYes: StringComponent;
+    @ViewChild('mintConditionNo', {static: false})
+        mintConditionNo: StringComponent;
 
     constructor(
         private router: Router,
@@ -107,8 +111,6 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
             this.circModifiers = this.circModifiers.sort(
                 (a, b) => a.name() < b.name() ? -1 : 1);
 
-            console.log('MODS', this.circModifiers);
-
         }).then(_ => {
 
             return this.pcrud.retrieveAll('citm')
@@ -155,7 +157,8 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
                 return this.volcopy.copyStatuses[value].name();
 
             case 'location':
-                return value.name();
+                return value.name() +
+                    ' (' + this.org.get(value.owning_lib()).shortname() + ')';
 
             case 'edit_date':
             case 'create_date':
@@ -195,6 +198,11 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
                 const mod = this.circModifiers.filter(
                     m => m.code() === value)[0];
                 return mod ? mod.name() : '';
+
+            case 'mint_condition':
+                if (!this.mintConditionYes) { return ''; }
+                return value === 't' ?
+                    this.mintConditionYes.text : this.mintConditionNo.text;
         }
 
         return value;
index 3927094..8597d91 100644 (file)
@@ -1,6 +1,8 @@
 
 <div class="border rounded m-1">
-  <div class="font-weight-bold header p-2">{{label}}</div>
+  <div class="font-weight-bold header p-2" i18n>
+    {{label}} <span *ngIf="hasChanged" class="text-danger">*</span>
+  </div>
   <div *ngIf="!editing" tabindex="0" class="p-2"
     [ngClass]="{'has-changes': hasChanged}" (click)="toggleEditMode()">
     <div class="d-flex" 
           <span *ngIf="count.key == 'f'" i18n>No</span>
         </ng-container>
         <ng-container *ngIf="displayAs == 'currency'">
-          {{count.key | currency}}
+          <ng-container 
+            *ngIf="emptyIsUnset && !count.key && count.key !== 0; else defaultCurrency">
+            <span i18n>&lt;Unset&gt;</span>
+          </ng-container>
+          <ng-template #defaultCurrency>{{count.key | currency}}</ng-template>
         </ng-container>
         <ng-container *ngIf="displayAs == null">
-          <ng-container *ngIf="emptyIsUnset && !count.key && count.key !== 0; else default">
+          <ng-container 
+            *ngIf="emptyIsUnset && !count.key && count.key !== 0; else default">
             <span i18n>&lt;Unset&gt;</span>
           </ng-container>
           <ng-template #default>{{count.key}}</ng-template>