LH#41: add column to EDI account table to indicate which account is the provider...
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 14 Aug 2020 17:59:21 +0000 (13:59 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 14 Aug 2020 17:59:21 +0000 (13:59 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/provider/provider-edi-accounts.component.html
Open-ILS/src/eg2/src/app/staff/acq/provider/provider-edi-accounts.component.ts
Open-ILS/src/eg2/src/app/staff/acq/provider/provider-record.service.ts

index 4841e1e..af7bb1d 100644 (file)
@@ -33,6 +33,7 @@
   </eg-grid-toolbar-action>
   <eg-grid-toolbar-action label="View EDI Messages" i18n-label (onClick)="displayEdiMessages($event)" [disableOnRows]="notOneSelectedRow">
   </eg-grid-toolbar-action>
+  <eg-grid-column [filterable]="false" [sortable]="false" i18n-label label="Is Default?" path="_is_default" datatype="bool"></eg-grid-column>
 </eg-grid>
 
 <ng-container *ngIf="viewEdiMessages">
index e5af35d..284d7c4 100644 (file)
@@ -222,8 +222,12 @@ export class ProviderEdiAccountsComponent implements OnInit, AfterViewInit {
                             .then(str => this.toast.danger(str));
                     },
                     () => {
-                        this.providerRecord.refreshCurrent(),
-                        this.summarize.emit(this.provider.id());
+                        this.providerRecord.refreshCurrent().then(
+                            () => {
+                                this.providerEdiAccountsGrid.reload();
+                                this.summarize.emit(this.provider.id());
+                            }
+                        );
                     }
                 );
             });
index 45a550d..990dbeb 100644 (file)
@@ -56,6 +56,14 @@ export class ProviderRecordService {
             {}
         ).pipe(map(acqpro => {
             const provider = new ProviderRecord(acqpro);
+            acqpro.edi_accounts().forEach(acct => {
+                acct['_is_default'] = false;
+                if (acqpro.edi_default()) {
+                    if (acct.id() === acqpro.edi_default().id()) {
+                        acct['_is_default'] = true;
+                    }
+                }
+            });
             this.currentProvider = provider;
             this.checkIfCanDelete(provider);
             return provider;