<eg-acq-cancel-dialog recordType="li" #cancelDialog></eg-acq-cancel-dialog>
<eg-acq-delete-lineitems-dialog #deleteLineitemsDialog></eg-acq-delete-lineitems-dialog>
<eg-acq-add-copies-dialog #addCopiesDialog></eg-acq-add-copies-dialog>
+<eg-acq-link-invoice-dialog #linkInvoiceDialog></eg-acq-link-invoice-dialog>
<eg-acq-claim-policy-dialog #claimPolicyDialog></eg-acq-claim-policy-dialog>
<eg-acq-export-attributes-dialog #exportAttributesDialog></eg-acq-export-attributes-dialog>
<button ngbDropdownItem (click)="deleteLineitems()"
[disabled]="!canDeleteLis() || !selectedIds().length" i18n>Delete Selected Lineitems</button>
<button ngbDropdownItem (click)="addCopiesToLineitems()"
- [disabled]="!canAddLiCopies() || !selectedIds().length" i18n>Add Items to Selected Lineitems</button>
+ [disabled]="isActivatedPo() || !selectedIds().length" i18n>Add Items to Selected Lineitems</button>
<button ngbDropdownItem (click)="exportSingleAttributeList()"
[disabled]="!selectedIds().length" i18n>Export Single Attribute List for Selected Lineitems</button>
<div class="dropdown-divider"></div>
<button ngbDropdownItem (click)="applyClaimPolicyToSelected()"
[disabled]="!poId || !selectedIds().length" i18n>Apply Claim Policy to Selected Lineitems</button>
<button ngbDropdownItem (click)="createInvoiceFromSelected()"
- [disabled]="!poId || !selectedIds().length" i18n>Create Invoice from Selected Lineitems</button>
+ [disabled]="!isActivatedPo() || !selectedIds().length" i18n>Create Invoice from Selected Lineitems</button>
+ <button ngbDropdownItem (click)="linkInvoiceFromSelected()"
+ [disabled]="!isActivatedPo() || !selectedIds().length" i18n>Link Selected Lineitems to Invoice</button>
</div>
</div>
</div>
import {CancelDialogComponent} from './cancel-dialog.component';
import {DeleteLineitemsDialogComponent} from './delete-lineitems-dialog.component';
import {AddCopiesDialogComponent} from './add-copies-dialog.component';
+import {LinkInvoiceDialogComponent} from './link-invoice-dialog.component';
import {ExportAttributesDialogComponent} from './export-attributes-dialog.component';
import {ClaimPolicyDialogComponent} from './claim-policy-dialog.component';
import {saveAs} from 'file-saver';
picklistId: number = null;
poId: number = null;
- poAllowsNewCopies = false;
+ poWasActivated = false;
poSubscription: Subscription;
recordId: number = null; // lineitems related to a bib.
@ViewChild('cancelDialog') cancelDialog: CancelDialogComponent;
@ViewChild('deleteLineitemsDialog') deleteLineitemsDialog: DeleteLineitemsDialogComponent;
@ViewChild('addCopiesDialog') addCopiesDialog: AddCopiesDialogComponent;
+ @ViewChild('linkInvoiceDialog') linkInvoiceDialog: LinkInvoiceDialogComponent;
@ViewChild('exportAttributesDialog') exportAttributesDialog: ExportAttributesDialogComponent;
@ViewChild('claimPolicyDialog') claimPolicyDialog: ClaimPolicyDialogComponent;
});
this.poSubscription = this.poService.poRetrieved.subscribe(() => {
- this.poAllowsNewCopies = this.po().order_date() ? false : true;
+ this.poWasActivated = this.po().order_date() ? true : false;
});
}
window.location.href = path;
}
+ linkInvoiceFromSelected() {
+ const liIds = this.selectedIds();
+ if (liIds.length === 0) { return; }
+
+ this.linkInvoiceDialog.liIds = liIds.map(i => Number(i));
+ this.linkInvoiceDialog.open().subscribe(invId => {
+ if (!invId) { return; }
+
+ const path = '/eg/staff/acq/legacy/invoice/view/' + invId + '?' +
+ liIds.map(x => 'attach_li=' + x.toString()).join('&');
+ window.location.href = path;
+ });
+
+ }
+
markReceived(liIds: number[]) {
if (liIds.length === 0) { return; }
});
}
- // can add lineitems unless the PO has been activated at some
- // point in the past
- canAddLiCopies(): boolean {
+ // order was activated as some point in past
+ isActivatedPo(): boolean {
if (this.picklistId) {
- return true;
+ return false; // not an order
} else {
if (this.po()) {
- this.poAllowsNewCopies = this.po().order_date() ? false : true;
+ this.poWasActivated = this.po().order_date() ? true : false;
}
- return this.poAllowsNewCopies;
+ return this.poWasActivated;
}
}
import {CancelDialogComponent} from './cancel-dialog.component';
import {DeleteLineitemsDialogComponent} from './delete-lineitems-dialog.component';
import {AddCopiesDialogComponent} from './add-copies-dialog.component';
+import {LinkInvoiceDialogComponent} from './link-invoice-dialog.component';
import {ExportAttributesDialogComponent} from './export-attributes-dialog.component';
import {ClaimPolicyDialogComponent} from './claim-policy-dialog.component';
import {MarcEditModule} from '@eg/staff/share/marc-edit/marc-edit.module';
CancelDialogComponent,
DeleteLineitemsDialogComponent,
AddCopiesDialogComponent,
+ LinkInvoiceDialogComponent,
ExportAttributesDialogComponent,
ClaimPolicyDialogComponent,
BriefRecordComponent,
CancelDialogComponent,
DeleteLineitemsDialogComponent,
AddCopiesDialogComponent,
+ LinkInvoiceDialogComponent,
ExportAttributesDialogComponent,
ClaimPolicyDialogComponent
],
--- /dev/null
+<ng-template #dialogContent>
+ <form class="form-validated">
+ <div class="modal-header bg-info">
+ <h3 class="modal-title" i18n>Link Invoice</h3>
+ <button type="button" class="close"
+ i18n-aria-label aria-label="Close" (click)="close()">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <h4 i18n *ngIf="liIds && liIds.length">Lineitem(s) selected:
+ <span *ngFor="let id of liIds; last as isLast">
+ {{id}}<span *ngIf="!isLast">,</span>
+ </span>
+ </h4>
+ <div class="d-flex">
+ <div class="flex-1">
+ <label for="provider-input" i18n>Provider</label>
+ </div>
+ <div class="flex-3">
+ <eg-combobox domId="provider-input" [(ngModel)]="provider"
+ style="border-left-width: 0px"
+ name="provider-input"
+ [required]="true"
+ [idlQueryAnd]="{active: 't'}" idlClass="acqpro">
+ </eg-combobox>
+ </div>
+ </div>
+ <div class="d-flex mt-2">
+ <div class="flex-1">
+ <label for="invoice-input" i18n>Provider</label>
+ </div>
+ <div class="flex-3">
+ <eg-combobox domId="invoice-input" [(ngModel)]="invoice"
+ style="border-left-width: 0px"
+ [readOnly]="!provider || !provider?.id"
+ name="invoice-input"
+ [required]="true"
+ idlField="inv_ident"
+ [idlQueryAnd]="{provider: provider?.id}" idlClass="acqinv">
+ </eg-combobox>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-success"
+ [disabled]="!invoice || !invoice.id"
+ (click)="close(invoice.id)" i18n>Link Invoice</button>
+ <button type="button" class="btn btn-warning"
+ (click)="close()" i18n>Cancel</button>
+ </div>
+ </form>
+</ng-template>
+
--- /dev/null
+import {Component, Input, ViewChild, TemplateRef, OnInit} from '@angular/core';
+import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
+
+@Component({
+ selector: 'eg-acq-link-invoice-dialog',
+ templateUrl: './link-invoice-dialog.component.html'
+})
+
+export class LinkInvoiceDialogComponent extends DialogComponent {
+ @Input() liIds: number[] = [];
+ @Input() poId: number = null;
+
+ provider: ComboboxEntry;
+ invoice: ComboboxEntry;
+
+ constructor(private modal: NgbModal) { super(modal); }
+}
<eg-acq-cancel-dialog recordType="po" #cancelDialog></eg-acq-cancel-dialog>
+<eg-acq-link-invoice-dialog #linkInvoiceDialog></eg-acq-link-invoice-dialog>
<eg-progress-dialog #progressDialog></eg-progress-dialog>
<eg-confirm-dialog #confirmFinalize
i18n-dialogTitle i18n-dialogBody
<span class="material-icons small mr-1">receipt</span>
<span i18n>Create Invoice</span>
</a>
+ <span class="pl-2 pr-2" i18n> | </span>
+ <a (click)="linkInvoiceFromPo()" href="javascript:;"
+ class="label-with-material-icon">
+ <span class="material-icons small mr-1">receipt</span>
+ <span i18n>Link Invoice</span>
+ </a>
</ng-container> <!-- show invoice actions -->
<span class="pl-2 pr-2" i18n> | </span>
<a routerLink="./edi" i18n>EDI Messages ({{ediMessageCount}})</a>
import {PoService} from './po.service';
import {LineitemService} from '../lineitem/lineitem.service';
import {CancelDialogComponent} from '../lineitem/cancel-dialog.component';
-
+import {LinkInvoiceDialogComponent} from '../lineitem/link-invoice-dialog.component';
@Component({
templateUrl: 'summary.component.html',
stateChangeSub: Subscription;
@ViewChild('cancelDialog') cancelDialog: CancelDialogComponent;
+ @ViewChild('linkInvoiceDialog') linkInvoiceDialog: LinkInvoiceDialogComponent;
@ViewChild('progressDialog') progressDialog: ProgressDialogComponent;
@ViewChild('confirmFinalize') confirmFinalize: ConfirmDialogComponent;
});
}
+ linkInvoiceFromPo() {
+
+ this.linkInvoiceDialog.poId = this.poId;
+ this.linkInvoiceDialog.open().subscribe(invId => {
+ if (!invId) { return; }
+
+ const path = '/eg/staff/acq/legacy/invoice/view/' + invId + '?' +
+ 'attach_po=' + this.poId;
+ window.location.href = path;
+ });
+
+ }
+
setCanActivate() {
this.canActivate = null;
this.activationBlocks = [];