dialogTitle="Finalize Blanket Order?"
dialogBody="This will disencumber all blanket charges and mark the PO as received.">
</eg-confirm-dialog>
+<eg-confirm-dialog #confirmActivate
+ i18n-dialogTitle i18n-dialogBody
+ dialogTitle="Confirm Order Activation?"
+ dialogBody="Please confirm that you want to activate the order; there are warnings.">
+</eg-confirm-dialog>
+
<div *ngIf="po()" class="p-1 border border-secondary rounded">
</span>
</ng-container>
+ <!-- activation warnings -->
+ <ng-container *ngIf='activationWarnings.length'>
+ <span i18n> (Warning: </span>
+ <ng-container *ngFor="let evt of activationWarnings">
+ <ng-container
+ *ngIf="evt.textcode == 'ACQ_FUND_EXCEEDS_WARN_PERCENT'">
+ <span class="bg-warning" i18n>
+ Fund exceeds warning percent:
+ {{evt.payload.fund.code()}} ({{evt.payload.fund.year()}}).
+ </span>
+ </ng-container>
+ </ng-container>
+ <span i18n>)</span>
+ </ng-container>
+
<!-- activation blocks -->
<div class="text-danger" *ngFor="let evt of activationBlocks">
<ng-container
- *ngIf="evt.textcode == 'ACQ_FUND_EXCEEDS_STOP_PERCENT'; else fundWarn">
+ *ngIf="evt.textcode == 'ACQ_FUND_EXCEEDS_STOP_PERCENT'; else noPrice">
<span i18n>
Fund exceeds stop percent:
{{evt.payload.fund.code()}} ({{evt.payload.fund.year()}}).
</span>
</ng-container>
- <ng-template #fundWarn>
- <ng-container
- *ngIf="evt.textcode == 'ACQ_FUND_EXCEEDS_WARN_PERCENT'; else noPrice">
- <span i18n>
- Fund exceeds warning percent:
- {{evt.payload.fund.code()}} ({{evt.payload.fund.year()}}).
- </span>
- </ng-container>
- </ng-template>
<ng-template #noPrice>
<ng-container
*ngIf="evt.textcode == 'ACQ_LINEITEM_NO_PRICE'; else noCopies">
import {CancelDialogComponent} from '../lineitem/cancel-dialog.component';
import {LinkInvoiceDialogComponent} from '../lineitem/link-invoice-dialog.component';
+const PO_ACTIVATION_WARNINGS = [
+ 'ACQ_FUND_EXCEEDS_WARN_PERCENT'
+];
+
@Component({
templateUrl: 'summary.component.html',
selector: 'eg-acq-po-summary'
showLegacyLinks = false;
activationBlocks: EgEvent[] = [];
+ activationWarnings: EgEvent[] = [];
activationEvent: EgEvent;
nameEditEnterToggled = false;
stateChangeSub: Subscription;
@ViewChild('linkInvoiceDialog') linkInvoiceDialog: LinkInvoiceDialogComponent;
@ViewChild('progressDialog') progressDialog: ProgressDialogComponent;
@ViewChild('confirmFinalize') confirmFinalize: ConfirmDialogComponent;
+ @ViewChild('confirmActivate') confirmActivate: ConfirmDialogComponent;
constructor(
private router: Router,
setCanActivate() {
this.canActivate = null;
this.activationBlocks = [];
+ this.activationWarnings = [];
if (!(this.po().state().match(/new|pending/))) {
this.canActivate = false;
).pipe(tap(resp => {
const evt = this.evt.parse(resp);
- if (evt) { this.activationBlocks.push(evt); }
+ if (evt) {
+ if (PO_ACTIVATION_WARNINGS.includes(evt.textcode)) {
+ this.activationWarnings.push(evt);
+ } else {
+ this.activationBlocks.push(evt);
+ }
+ }
})).toPromise().then(_ => {
}
activatePo(noAssets?: boolean) {
+ if (this.activationWarnings.length) {
+ this.confirmActivate.open().subscribe(confirmed => {
+ if (!confirmed) { return; }
+
+ this._activatePo(noAssets);
+ });
+ } else {
+ this._activatePo(noAssets);
+ }
+ }
+
+ _activatePo(noAssets?: boolean) {
this.activationEvent = null;
this.progressDialog.open();
this.progressDialog.update({max: this.po().lineitem_count() * 3});