Refresh contact addresses from updated service data
authorMike Rylander <mrylander@gmail.com>
Wed, 1 Apr 2020 19:23:34 +0000 (15:23 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 1 Apr 2020 19:25:01 +0000 (15:25 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/provider/provider-contact-addresses.component.ts
Open-ILS/src/eg2/src/app/staff/acq/provider/provider-contacts.component.html

index e4cb436..ee7c8cf 100644 (file)
@@ -44,7 +44,7 @@ export class ProviderContactAddressesComponent implements OnInit, AfterViewInit
 
     // Size of create/edito dialog.  Uses large by default.
     @Input() dialogSize: 'sm' | 'lg' = 'lg';
-    @Input() contact: IdlObject;
+    @Input() contactId: any;
 
     constructor(
         private router: Router,
@@ -87,17 +87,19 @@ export class ProviderContactAddressesComponent implements OnInit, AfterViewInit
 
 
     ngAfterViewInit() {
-        console.log('this.contact',this.contact);
+        console.log('this.contactId',this.contactId);
     }
 
     getDataSource(): GridDataSource {
         const gridSource = new GridDataSource();
 
         gridSource.getRows = (pager: Pager, sort: any[]) => {
-            if (!this.contact) {
+            if (!this.contactId) {
                 return empty();
             }
-            let addresses = this.contact.addresses()
+            let cid = this.contactId;
+            let contact = this.providerRecord.current().contacts().filter( c => c.id() === cid)[0];
+            let addresses = contact.addresses();
 
             if (sort.length > 0) {
                 addresses = addresses.sort((a, b) => {
@@ -157,7 +159,7 @@ export class ProviderContactAddressesComponent implements OnInit, AfterViewInit
     createNew() {
         this.editDialog.mode = 'create';
         const address = this.idl.create('acqpca');
-        address.contact(this.contact.id());
+        address.contact(this.contactId);
         address.valid(true);
         this.editDialog.record = address;
         this.editDialog.recordId = null;
index bc7987b..bc11ebe 100644 (file)
@@ -34,7 +34,7 @@
   <hr><h3 i18n>Addresses for: {{selectedContact.name()}}</h3>
   <eg-provider-contact-addresses
     #providerContactAddresses
-    [contact]="selectedContact">
+    [contactId]="selectedContact.id()">
   </eg-provider-contact-addresses>
 </ng-container>