1 import {Component, OnInit, Input, Output} from '@angular/core';
2 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
3 import {empty} from 'rxjs';
4 import {Pager} from '@eg/share/util/pager';
5 import {IdlObject} from '@eg/core/idl.service';
6 import {GridDataSource} from '@eg/share/grid/grid';
7 import {PcrudService} from '@eg/core/pcrud.service';
9 @Component({templateUrl: 'edi.component.html'})
10 export class PoEdiMessagesComponent implements OnInit {
13 dataSource: GridDataSource = new GridDataSource();
16 private route: ActivatedRoute,
17 private pcrud: PcrudService
21 this.dataSource.getRows = (pager: Pager, sort: any) =>
22 this.getEdiMessages(pager, sort);
24 this.route.parent.paramMap.subscribe((params: ParamMap) => {
25 this.poId = +params.get('poId');
29 getEdiMessages(pager: Pager, sort: any) {
30 if (!this.poId) { return empty(); }
32 const orderBy: any = {acqedim: 'create_time DESC'};
34 orderBy.acqedim = sort[0].name + ' ' + sort[0].dir;
37 return this.pcrud.search('acqedim', {purchase_order: this.poId}, {
42 flesh_fields: {acqedim: ['account', 'purchase_order']}