--- /dev/null
+
+<eg-grid #acqSearchProviderGrid
+ persistKey="acq.provider.addresses.grid"
+ idlClass="acqpa" [dataSource]="gridSource"
+ [sortable]="true"
+ [cellTextGenerator]="cellTextGenerator">
+</eg-grid>
+
--- /dev/null
+import {Component, OnInit, Input, ViewChild} from '@angular/core';
+import {empty, throwError, Observable} from 'rxjs';
+import {map} from 'rxjs/operators';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {Pager} from '@eg/share/util/pager';
+import {IdlObject} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {AuthService} from '@eg/core/auth.service';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid';
+// ??? import {AcqProviderStateService} from './acq-provider-search.service';
+import {AcqProviderSearchFormComponent} from './acq-provider-search-form.component';
+
+@Component({
+ selector: 'eg-provider-addresses',
+ templateUrl: 'provider-addresses.component.html',
+ providers: [AcqProviderStateService]
+})
+export class ProviderResultsComponent implements OnInit {
+
+ @Input() provider: any;
+ addresses: any[] = [];
+
+ gridSource: GridDataSource;
+ @ViewChild('acqProviderAddressesGrid', { static: true }) providerAddressesGrid: GridComponent;
+
+ cellTextGenerator: GridCellTextGenerator;
+
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private net: NetService,
+ private auth: AuthService,
+ private providerState: AcqProviderStateService) {
+ }
+
+ ngOnInit() {
+ this.gridSource = this.getDataSource()
+ this.cellTextGenerator = {};
+ }
+
+ getDataSource(): GridDataSource {
+ const gridSource = new GridDataSource();
+
+ gridSource.getRows = (pager: Pager, sort: any[]) => {
+ let addresses = this.provider.addresses()
+
+ if (sort.length > 0) {
+ addresses = addresses.sort((a, b) => {
+ for (let i = 0; i < sort.length; i++) {
+ let lt = -1;
+ let sfield = sort[i].name;
+ if (sort[i].dir.substring(0,1).toLowerCase() === 'd') {
+ lt *= -1;
+ }
+ if (a[sfield]() < b[sfield]()) { return lt }
+ if (a[sfield]() > b[sfield]()) { return lt * -1 }
+ }
+ return 0;
+ });
+
+ }
+
+ return Observable.from(addresses.slice(pager.offset, pager.offset + pager.limit - 1));
+ };
+ return gridSource;
+ }
+
+}
--- /dev/null
+
+<ng-template #emailTmpl let-contact="row">
+ <a href="mailto:{{contact.email()}}">{{contact.email()}}</a>
+</ng-template>
+
+<ng-template #phoneTmpl let-contact="row">
+ <a href="mailto:{{contact.phone()}}">{{contact.phone()}}</a>
+</ng-template>
+
+<eg-grid #acqSearchProviderGrid
+ persistKey="acq.provider.contacts.grid"
+ idlClass="acqpc" [dataSource]="gridSource"
+ [sortable]="true"
+ [cellTextGenerator]="cellTextGenerator">
+ <eg-grid-column path="email" [cellTemplate]="emailTmpl" [disableTooltip]="true"></eg-grid-column>
+ <eg-grid-column path="phone" [cellTemplate]="phoneTmpl" [disableTooltip]="true"></eg-grid-column>
+</eg-grid>
+
--- /dev/null
+import {Component, OnInit, Input, ViewChild} from '@angular/core';
+import {empty, throwError, Observable} from 'rxjs';
+import {map} from 'rxjs/operators';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {Pager} from '@eg/share/util/pager';
+import {IdlObject} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {AuthService} from '@eg/core/auth.service';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid';
+// ??? import {AcqProviderStateService} from './acq-provider-search.service';
+import {AcqProviderSearchFormComponent} from './acq-provider-search-form.component';
+
+@Component({
+ selector: 'eg-provider-contacts',
+ templateUrl: 'provider-contacts.component.html',
+ providers: [AcqProviderStateService]
+})
+export class ProviderResultsComponent implements OnInit {
+
+ @Input() provider: any;
+ contacts: any[] = [];
+
+ gridSource: GridDataSource;
+ @ViewChild('acqProviderContactsGrid', { static: true }) providerContactsGrid: GridComponent;
+
+ cellTextGenerator: GridCellTextGenerator;
+
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private net: NetService,
+ private auth: AuthService,
+ private providerState: AcqProviderStateService) {
+ }
+
+ ngOnInit() {
+ this.gridSource = this.getDataSource()
+ this.cellTextGenerator = {};
+ }
+
+ getDataSource(): GridDataSource {
+ const gridSource = new GridDataSource();
+
+ gridSource.getRows = (pager: Pager, sort: any[]) => {
+ let contacts = this.provider.contacts()
+
+ if (sort.length > 0) {
+ contacts = contacts.sort((a, b) => {
+ for (let i = 0; i < sort.length; i++) {
+ let lt = -1;
+ let sfield = sort[i].name;
+ if (sort[i].dir.substring(0,1).toLowerCase() === 'd') {
+ lt *= -1;
+ }
+ if (a[sfield]() < b[sfield]()) { return lt }
+ if (a[sfield]() > b[sfield]()) { return lt * -1 }
+ }
+ return 0;
+ });
+
+ }
+
+ return Observable.from(contacts.slice(pager.offset, pager.offset + pager.limit - 1));
+ };
+ return gridSource;
+ }
+
+}