1 (function(angular
, $, _
) {
4 angular
.module('searchAdmin').controller('searchList', function($scope
, savedSearches
, crmApi4
) {
5 var ts
= $scope
.ts
= CRM
.ts(),
6 ctrl
= $scope
.$ctrl
= this;
7 this.savedSearches
= savedSearches
;
8 this.entityTitles
= _
.transform(CRM
.vars
.search
.schema
, function(titles
, entity
) {
9 titles
[entity
.name
] = entity
.titlePlural
;
12 this.deleteSearch = function(search
) {
13 var index
= _
.findIndex(savedSearches
, {id
: search
.id
});
16 ['Group', 'delete', {where
: [['saved_search_id', '=', search
.id
]]}],
17 ['SavedSearch', 'delete', {where
: [['id', '=', search
.id
]]}]
19 savedSearches
.splice(index
, 1);
24 })(angular
, CRM
.$, CRM
._
);