Merge pull request #18770 from civicrm/5.31
[civicrm-core.git] / ext / search / ang / search / crmSearchActions / crmSearchActionDelete.ctrl.js
1 (function(angular, $, _) {
2 "use strict";
3
4 angular.module('search').controller('crmSearchActionDelete', function($scope, crmApi4, dialogService, searchMeta) {
5 var ts = $scope.ts = CRM.ts(),
6 model = $scope.model,
7 ctrl = $scope.$ctrl = this;
8
9 this.entity = searchMeta.getEntity(model.entity);
10
11 this.cancel = function() {
12 dialogService.cancel('crmSearchAction');
13 };
14
15 this.delete = function() {
16 crmApi4(model.entity, 'Delete', {
17 where: [['id', 'IN', model.ids]],
18 }).then(function() {
19 dialogService.close('crmSearchAction');
20 });
21 };
22
23 });
24 })(angular, CRM.$, CRM._);