webstaff: fix grid refresh upon linking binding template
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 22 May 2017 20:25:13 +0000 (16:25 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 May 2017 16:06:48 +0000 (12:06 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/serials/directives/subscription_manager.js

index 000afac..a4209ea 100644 (file)
@@ -355,6 +355,8 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
                 }
                 var promises = [];
                 angular.forEach(resp,function(sdist) {
+                    var promise = $q.defer();
+                    promises.push(promise.promise);
                     sdist.ischanged(true);
                     sdist.bind_unit_template(
                         typeof args.bind_unit_template[sdist.holding_lib()] == 'undefined'
@@ -372,10 +374,12 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
                                 console.log('success',resp2);
                                 ngToast.success(egCore.strings.SERIALS_DISTRIBUTION_SUCCESS_BINDING_TEMPLATE);
                             }
+                            promise.resolve();
                         },
                         function(resp2) {
                             console.log('failure',resp2);
-                            ngToast.danger(egCore.strings.SERIALS_DISTRIBUTION_FAIL_LINK_MFHD);
+                            ngToast.danger(egCore.strings.SERIALS_DISTRIBUTION_FAIL_BINDING_TEMPLATE);
+                            promise.resolve();
                         }
                     );
                 });