VOLCOPY Item attr batch component
authorBill Erickson <berickxx@gmail.com>
Wed, 17 Jun 2020 15:48:41 +0000 (11:48 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 17 Jun 2020 15:48:41 +0000 (11:48 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.html
Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.ts

index 1d673b4..3927094 100644 (file)
@@ -1,8 +1,8 @@
 
-<div class="border rounded p-1">
-  <div class="font-weight-bold">{{label}}</div>
-  <div *ngIf="!editing" tabindex="0" class="p-1"
-    [ngClass]="{'bg-info': hasChanged}" (click)="toggleEditMode()">
+<div class="border rounded m-1">
+  <div class="font-weight-bold header p-2">{{label}}</div>
+  <div *ngIf="!editing" tabindex="0" class="p-2"
+    [ngClass]="{'has-changes': hasChanged}" (click)="toggleEditMode()">
     <div class="d-flex" 
       *ngFor="let count of labelCounts | keyvalue">
       <div class="flex-1">
           {{count.key | currency}}
         </ng-container>
         <ng-container *ngIf="displayAs == null">
-          {{count.key}}
+          <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>
         </ng-container>
       </div>
       <div i18n>{{count.value}} copies</div>
index 46b8958..fe10d34 100644 (file)
@@ -9,7 +9,11 @@ import {StringComponent} from '@eg/share/string/string.component';
 
 @Component({
   selector: 'eg-batch-item-attr',
-  templateUrl: 'batch-item-attr.component.html'
+  templateUrl: 'batch-item-attr.component.html',
+  styles: [
+    `.header { background-color: #d9edf7; }`,
+    `.has-changes { background-color: #dff0d8; }`
+  ]
 })
 
 export class BatchItemAttrComponent {
@@ -33,6 +37,9 @@ export class BatchItemAttrComponent {
     // Display only
     @Input() readOnly = false;
 
+    // If true, null/undefined/empty-string display as <Unset>
+    @Input() emptyIsUnset: boolean;
+
     @Output() changesSaved: EventEmitter<void> = new EventEmitter<void>();
     @Output() changesCanceled: EventEmitter<void> = new EventEmitter<void>();