From: Galen Charlton Date: Wed, 15 Dec 2021 20:18:49 +0000 (-0500) Subject: LP#1942220: implement Mark Selector Ready and Mark Order Ready actions X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c851fab55ef72486913317ec2da547b78b91179b;p=working%2FEvergreen.git LP#1942220: implement Mark Selector Ready and Mark Order Ready 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 e37a1f1f18..ade7c80134 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 @@ -13,11 +13,23 @@ + + + + + + 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 e64e2c3649..8240717d1d 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 @@ -15,6 +15,7 @@ import {ExportAttributesDialogComponent} from '../lineitem/export-attributes-dia import {AcqSearchFormComponent} from './acq-search-form.component'; import {StringComponent} from '@eg/share/string/string.component'; import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; +import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; import {ClaimPolicyDialogComponent} from '../lineitem/claim-policy-dialog.component'; import {CancelDialogComponent} from '../lineitem/cancel-dialog.component'; import {DeleteLineitemsDialogComponent} from '../lineitem/delete-lineitems-dialog.component'; @@ -41,7 +42,10 @@ export class LineitemResultsComponent implements OnInit { @ViewChild('lineItemsUnReceivedString', { static: false }) lineItemsUnReceivedString: StringComponent; @ViewChild('lineItemsCancelledString', { static: false }) lineItemsCancelledString: StringComponent; @ViewChild('lineItemsDeletedString', { static: false }) lineItemsDeletedString: StringComponent; + @ViewChild('lineItemsUpdatedString', { static: false }) lineItemsUpdatedString: StringComponent; @ViewChild('noActionableLIs', { static: true }) private noActionableLIs: AlertDialogComponent; + @ViewChild('selectorReadyConfirmDialog', { static: true }) selectorReadyConfirmDialog: ConfirmDialogComponent; + @ViewChild('orderReadyConfirmDialog', { static: true }) orderReadyConfirmDialog: ConfirmDialogComponent; noSelectedRows: (rows: IdlObject[]) => boolean; @@ -248,6 +252,70 @@ export class LineitemResultsComponent implements OnInit { }); } + markOrderReady(rows: IdlObject[]) { + const lis = rows.filter(l => l.state() === 'selector-ready' || l.state() === 'new'); + if (lis.length === 0) { + this.noActionableLIs.open(); + return; + } + const ids = rows.map(x => Number(x.id())); + + this.orderReadyConfirmDialog.open().subscribe(doIt => { + if (!doIt) { return; } + const lisToUpdate: IdlObject[] = []; + this.liService.getFleshedLineitems(ids, { fromCache: true }).subscribe( + liStruct => { + liStruct.lineitem.state('order-ready'); + lisToUpdate.push(liStruct.lineitem); + }, + err => { }, + () => { + this.net.request( + 'open-ils.acq', + 'open-ils.acq.lineitem.update', + this.auth.token(), lisToUpdate + ).toPromise().then(resp => { + this.lineItemsUpdatedString.current() + .then(str => this.toast.success(str)); + this.lineitemResultsGrid.reload(); + }); + } + ); + }); + } + + markSelectorReady(rows: IdlObject[]) { + const lis = rows.filter(l => l.state() === 'new'); + if (lis.length === 0) { + this.noActionableLIs.open(); + return; + } + const ids = rows.map(x => Number(x.id())); + + this.selectorReadyConfirmDialog.open().subscribe(doIt => { + if (!doIt) { return; } + const lisToUpdate: IdlObject[] = []; + this.liService.getFleshedLineitems(ids, { fromCache: true }).subscribe( + liStruct => { + liStruct.lineitem.state('selector-ready'); + lisToUpdate.push(liStruct.lineitem); + }, + err => { }, + () => { + this.net.request( + 'open-ils.acq', + 'open-ils.acq.lineitem.update', + this.auth.token(), lisToUpdate + ).toPromise().then(resp => { + this.lineItemsUpdatedString.current() + .then(str => this.toast.success(str)); + this.lineitemResultsGrid.reload(); + }); + } + ); + }); + } + markReceived(rows: IdlObject[]) { // must be on-order const lis = rows.filter(l => l.state() === 'on-order');