Commit | Line | Data |
---|---|---|
25523059 CW |
1 | (function(angular, $, _) { |
2 | "use strict"; | |
3 | ||
44402a2e | 4 | angular.module('crmSearchActions').controller('crmSearchActionDelete', function($scope, crmApi4, dialogService, searchMeta) { |
25523059 CW |
5 | var ts = $scope.ts = CRM.ts(), |
6 | model = $scope.model, | |
7 | ctrl = $scope.$ctrl = this; | |
8 | ||
9 | this.entity = searchMeta.getEntity(model.entity); | |
8e4920a5 | 10 | this.entityTitle = model.ids.length === 1 ? this.entity.title : this.entity.titlePlural; |
25523059 CW |
11 | |
12 | this.cancel = function() { | |
13 | dialogService.cancel('crmSearchAction'); | |
14 | }; | |
15 | ||
16 | this.delete = function() { | |
17 | crmApi4(model.entity, 'Delete', { | |
18 | where: [['id', 'IN', model.ids]], | |
19 | }).then(function() { | |
20 | dialogService.close('crmSearchAction'); | |
21 | }); | |
22 | }; | |
23 | ||
24 | }); | |
25 | })(angular, CRM.$, CRM._); |