update provider contacts component to reflect updates in provider record service
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 25 Mar 2020 14:54:47 +0000 (10:54 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 25 Mar 2020 14:54:47 +0000 (10:54 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/provider/provider-contacts.component.ts

index e42e3a7..238bafe 100644 (file)
@@ -10,7 +10,6 @@ import {GridComponent} from '@eg/share/grid/grid.component';
 import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid';
 import {ProviderRecordService} from './provider-record.service';
 import {AcqProviderSearchFormComponent} from './acq-provider-search-form.component';
-import {PcrudService} from '@eg/core/pcrud.service';
 import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
 import {StringComponent} from '@eg/share/string/string.component';
 import {ToastService} from '@eg/share/toast/toast.service';
@@ -54,7 +53,6 @@ export class ProviderContactsComponent implements OnInit, AfterViewInit {
         private auth: AuthService,
         private idl: IdlService,
         private providerRecord: ProviderRecordService,
-        private pcrud: PcrudService,
         private toast: ToastService) {
 
     }
@@ -64,7 +62,7 @@ export class ProviderContactsComponent implements OnInit, AfterViewInit {
         this.cellTextGenerator = {};
         this.deleteSelected = (idlThings: IdlObject[]) => {
             idlThings.forEach(idlThing => idlThing.isdeleted(true));
-            this.pcrud.autoApply(idlThings).subscribe(
+            this.providerRecord.batchUpdate(idlThings).subscribe(
                 val => {
                     console.debug('deleted: ' + val);
                     this.deleteSuccessString.current()
@@ -74,7 +72,11 @@ export class ProviderContactsComponent implements OnInit, AfterViewInit {
                     this.deleteFailedString.current()
                         .then(str => this.toast.danger(str));
                 },
-                ()  => this.providerContactsGrid.reload()
+                ()  => {
+                    this.providerRecord.refreshCurrent().then(
+                        () => this.providerContactsGrid.reload()
+                    );
+                }
             );
         };
         this.providerContactsGrid.onRowActivate.subscribe(
@@ -125,7 +127,9 @@ export class ProviderContactsComponent implements OnInit, AfterViewInit {
                 result => {
                     this.successString.current()
                         .then(str => this.toast.success(str));
-                    this.providerContactsGrid.reload();
+                    this.providerRecord.refreshCurrent().then(
+                        () => this.providerContactsGrid.reload()
+                    );
                     resolve(result);
                 },
                 error => {
@@ -159,7 +163,9 @@ export class ProviderContactsComponent implements OnInit, AfterViewInit {
             ok => {
                 this.createString.current()
                     .then(str => this.toast.success(str));
-                this.providerContactsGrid.reload();
+                this.providerRecord.refreshCurrent().then(
+                    () => this.providerContactsGrid.reload()
+                );
             },
             rejection => {
                 if (!rejection.dismissed) {