</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">
<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>
<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>
.reduce((pv, cv) => pv + (cv || 0));
}
- receiveAllItems(dryRun?: boolean) {
+ receiveAllItems() {
this.receiving = true;
- this.dryRun = dryRun;
this.receiveResponse = {
progress: 0,
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())
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;
+ }
}