import {LinkInvoiceDialogComponent} from './link-invoice-dialog.component';
import {ExportAttributesDialogComponent} from './export-attributes-dialog.component';
import {ClaimPolicyDialogComponent} from './claim-policy-dialog.component';
+import {LineitemAlertDialogComponent} from './lineitem-alert-dialog.component';
const DELETABLE_STATES = [
'new', 'selector-ready', 'order-ready', 'approved', 'pending-order'
@ViewChild('noActionableLIs', { static: true }) private noActionableLIs: AlertDialogComponent;
@ViewChild('selectorReadyConfirmDialog', { static: true }) selectorReadyConfirmDialog: ConfirmDialogComponent;
@ViewChild('orderReadyConfirmDialog', { static: true }) orderReadyConfirmDialog: ConfirmDialogComponent;
+ @ViewChild('confirmAlertsDialog') confirmAlertsDialog: LineitemAlertDialogComponent;
constructor(
private router: Router,
markReceived(liIds: number[]) {
if (liIds.length === 0) { return; }
- this.net.request(
- 'open-ils.acq',
- 'open-ils.acq.lineitem.receive.batch',
- this.auth.token(), liIds
- ).toPromise().then(resp => this.postBatchAction(resp, liIds));
+ const lis: IdlObject[] = [];
+ this.liService.getFleshedLineitems(liIds, { fromCache: true }).subscribe(
+ liStruct => lis.push(liStruct.lineitem),
+ err => {},
+ () => {
+ this.liService.checkLiAlerts(lis, this.confirmAlertsDialog).then(ok => {
+ this.net.request(
+ 'open-ils.acq',
+ 'open-ils.acq.lineitem.receive.batch',
+ this.auth.token(), liIds
+ ).toPromise().then(resp => this.postBatchAction(resp, liIds));
+ }, err => {}); // avoid console errors
+ }
+ );
}
markUnReceived(liIds: number[]) {