From: Galen Charlton Date: Tue, 14 Dec 2021 23:20:10 +0000 (-0500) Subject: LP#1942220: implement LI search receive and un-receive actions X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=106f11c35b0ac18dde416d97ace6cb2db5ff1706;p=working%2FEvergreen.git LP#1942220: implement LI search receive and un-receive actions Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html index d348ba34f5..0b443b9b82 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html @@ -6,6 +6,8 @@ + + @@ -128,10 +130,10 @@ (onClick)="applyClaimPolicy($event)" [disableOnRows]="noSelectedRows"> + (onClick)="markReceived($event)" [disableOnRows]="noSelectedRows"> + (onClick)="markUnReceived($event)" [disableOnRows]="noSelectedRows"> diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts index 2cb7b675bc..bea5ca54ea 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts @@ -31,6 +31,8 @@ export class LineitemResultsComponent implements OnInit { @ViewChild('exportAttributesDialog') exportAttributesDialog: ExportAttributesDialogComponent; @ViewChild('claimPolicyDialog') claimPolicyDialog: ClaimPolicyDialogComponent; @ViewChild('claimPolicyAppliedString', { static: false }) claimPolicyAppliedString: StringComponent; + @ViewChild('lineItemsReceivedString', { static: false }) lineItemsReceivedString: StringComponent; + @ViewChild('lineItemsUnReceivedString', { static: false }) lineItemsUnReceivedString: StringComponent; @ViewChild('noActionableLIs', { static: true }) private noActionableLIs: AlertDialogComponent; noSelectedRows: (rows: IdlObject[]) => boolean; @@ -146,4 +148,45 @@ export class LineitemResultsComponent implements OnInit { this.liService.doExportSingleAttributeList(ids, attr); }); } + + markReceived(rows: IdlObject[]) { + // must be on-order + const lis = rows.filter(l => l.state() === 'on-order'); + if (lis.length === 0) { + this.noActionableLIs.open(); + return; + } + + const ids = rows.map(x => Number(x.id())); + this.net.request( + 'open-ils.acq', + 'open-ils.acq.lineitem.receive.batch', + this.auth.token(), ids + ).toPromise().then(resp => { + this.lineItemsReceivedString.current() + .then(str => this.toast.success(str)); + this.lineitemResultsGrid.reload(); + }); + } + + markUnReceived(rows: IdlObject[]) { + // must be received + const lis = rows.filter(l => l.state() === 'received'); + if (lis.length === 0) { + this.noActionableLIs.open(); + return; + } + + const ids = rows.map(x => Number(x.id())); + this.net.request( + 'open-ils.acq', + 'open-ils.acq.lineitem.receive.rollback.batch', + this.auth.token(), ids + ).toPromise().then(resp => { + this.lineItemsUnReceivedString.current() + .then(str => this.toast.success(str)); + this.lineitemResultsGrid.reload(); + }); + } + }