LP1952931 Receiving...
authorBill Erickson <berickxx@gmail.com>
Wed, 2 Feb 2022 21:55:44 +0000 (16:55 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 2 Feb 2022 21:55:44 +0000 (16:55 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.html
Open-ILS/src/eg2/src/app/staff/acq/asn/receive.component.ts

index 993a605..a7dc22b 100644 (file)
@@ -112,7 +112,7 @@ across different vendors to match a container code.
 </ng-template>
 
 <div class="row" *ngIf="receiving">
-  <div class="col-lg-6 offset-lg-3">
+  <div class="col-lg-8 offset-lg-2">
     <div class="card">
       <div class="card-header" i18n>Receiving Items <span *ngIf="dryRun"> (Dry Run)</span></div>
       <div class="card-body">
@@ -120,10 +120,25 @@ across different vendors to match a container code.
           <li class="list-group-item">
             <eg-progress-inline min="0" max="0" #progress></eg-progress-inline>
           </li>
-          <li class="list-group-item" *ngFor="let li of receiveResponse.lineitems">
-            {{li.lids.length}} item(s) received for line item
-            <a target="_blank" fragment="{{li.id}}" 
-              routerLink="/staff/acq/po/{{li.po}}">#{{li.id}}</a>.
+
+          <li class="list-group-item d-flex font-weight-bold">
+            <div class="flex-1" i18n>Lineitem</div>
+            <div class="flex-1" i18n>Notified</div>
+            <div class="flex-1" i18n>Received</div>
+          </li>
+
+          <li class="list-group-item d-flex" *ngFor="let li of receiveResponse.lineitems">
+            <div class="flex-1">
+              <a routerLink="/staff/acq/po/{{li.po}}/lineitem/{{li.id}}/items"
+                target="_blank">#{{li.id}}</a>
+            </div>
+            <div class="flex-1">{{liWantedCount(li.id)}}</div>
+            <div class="flex-1" 
+              [ngClass]="{
+                'text-success': liWantedCount(li.id) == li.lids.length,
+                'text-danger': liWantedCount(li.id) < li.lids.length
+              }">
+              {{li.lids.length}}</div>
           </li>
         </ul>
       </div>
@@ -140,11 +155,11 @@ across different vendors to match a container code.
 <eg-grid *ngIf="container && !receiving" #grid [dataSource]="gridDataSource" 
   pageSize="50" (onRowActivate)="openLi($event)">
 
-  <eg-grid-toolbar-button i18n-label label="Receive All Items (Dry Run)"
-    (onClick)="receiveAllItems(true)"></eg-grid-toolbar-button> 
-
   <eg-grid-toolbar-button i18n-label label="Receive All Items"
     (onClick)="receiveAllItems()"></eg-grid-toolbar-button> 
+    
+  <eg-grid-toolbar-checkbox i18n-label label="Dry Run" [initialValue]="true" 
+    (onChange)="dryRun = !dryRun"></eg-grid-toolbar-checkbox> 
 
   <eg-grid-column i18n-label label="Entry ID" path="entry.id" 
     [index]="true" [hidden]="true"></eg-grid-column>
index 916c714..2562066 100644 (file)
@@ -150,9 +150,8 @@ export class AsnReceiveComponent implements OnInit {
             .reduce((pv, cv) => pv + (cv || 0));
     }
 
-    receiveAllItems(dryRun?: boolean) {
+    receiveAllItems() {
         this.receiving = true;
-        this.dryRun = dryRun;
 
         this.receiveResponse = {
             progress: 0,
@@ -165,7 +164,7 @@ export class AsnReceiveComponent implements OnInit {
             this.progress.update({value: 0, max: this.affectedItemsCount()}));
 
         let method = 'open-ils.acq.shipment_notification.receive_items';
-        if (dryRun) { method += '.dry_run'; }
+        if (this.dryRun) { method += '.dry_run'; }
 
         this.net.request('open-ils.acq',
             method, this.auth.token(), this.container.id())
@@ -186,5 +185,11 @@ export class AsnReceiveComponent implements OnInit {
         this.receiving = false;
         this.findContainer();
     }
+
+    liWantedCount(liId: number): number {
+        const entry = this.entries.filter(e => e.lineitem().id())[0];
+        if (entry) { return entry.item_count(); }
+        return 0;
+    }
 }