diff --git a/ext/search/ang/crmSearchActions.ang.php b/ext/search/ang/crmSearchActions.ang.php index 6f62570aa282..31e6290bf312 100644 --- a/ext/search/ang/crmSearchActions.ang.php +++ b/ext/search/ang/crmSearchActions.ang.php @@ -9,6 +9,9 @@ 'partials' => [ 'ang/crmSearchActions', ], + 'css' => [ + 'css/crmSearchActions.css', + ], 'basePages' => [], 'requires' => ['crmUi', 'crmUtil', 'dialogService', 'api4', 'checklist-model'], 'settingsFactory' => ['\Civi\Search\Actions', 'getActionSettings'], diff --git a/ext/search/ang/crmSearchActions/crmSearchActionDelete.ctrl.js b/ext/search/ang/crmSearchActions/crmSearchActionDelete.ctrl.js index d7c3f4828213..6408a5918fc6 100644 --- a/ext/search/ang/crmSearchActions/crmSearchActionDelete.ctrl.js +++ b/ext/search/ang/crmSearchActions/crmSearchActionDelete.ctrl.js @@ -1,7 +1,7 @@ (function(angular, $, _) { "use strict"; - angular.module('crmSearchActions').controller('crmSearchActionDelete', function($scope, crmApi4, dialogService) { + angular.module('crmSearchActions').controller('crmSearchActionDelete', function($scope, dialogService) { var ts = $scope.ts = CRM.ts(), model = $scope.model, ctrl = $scope.$ctrl = this; @@ -13,11 +13,18 @@ }; this.delete = function() { - crmApi4(model.entity, 'Delete', { - where: [['id', 'IN', model.ids]], - }).then(function() { - dialogService.close('crmSearchAction'); - }); + $('.ui-dialog-titlebar button').hide(); + ctrl.run = {}; + }; + + this.onSuccess = function() { + CRM.alert(ts('Successfully deleted %1 %2.', {1: model.ids.length, 2: ctrl.entityTitle}), ts('Deleted'), 'success'); + dialogService.close('crmSearchAction'); + }; + + this.onError = function() { + CRM.alert(ts('An error occurred while attempting to delete %1 %2.', {1: model.ids.length, 2: ctrl.entityTitle}), ts('Error'), 'error'); + dialogService.close('crmSearchAction'); }; }); diff --git a/ext/search/ang/crmSearchActions/crmSearchActionDelete.html b/ext/search/ang/crmSearchActions/crmSearchActionDelete.html index 40d657cfef43..340fdae9e13e 100644 --- a/ext/search/ang/crmSearchActions/crmSearchActionDelete.html +++ b/ext/search/ang/crmSearchActions/crmSearchActionDelete.html @@ -2,9 +2,19 @@