Search ext: group tab
[civicrm-core.git] / ext / search / ang / crmSearchActions / crmSearchActionDelete.ctrl.js
1 (function(angular, $, _) {
2 "use strict";
3
4 angular.module('crmSearchActions').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 this.entityTitle = model.ids.length === 1 ? this.entity.title : this.entity.titlePlural;
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._);