1 (function(angular
, $, _
) {
4 angular
.module('searchActions').directive('saveSmartGroup', function() {
11 controller: function ($scope
, $element
, dialogService
) {
12 var ts
= $scope
.ts
= CRM
.ts(),
15 $scope
.saveGroup = function () {
19 visibility
: 'User and User Admin Only',
21 id
: ctrl
.load
? ctrl
.load
.id
: null,
22 api_entity
: ctrl
.entity
,
23 api_params
: _
.cloneDeep(angular
.extend({}, ctrl
.params
, {version
: 4}))
25 delete model
.api_params
.orderBy
;
26 if (ctrl
.load
&& ctrl
.load
.api_params
&& ctrl
.load
.api_params
.select
&& ctrl
.load
.api_params
.select
[0]) {
27 model
.api_params
.select
.unshift(ctrl
.load
.api_params
.select
[0]);
29 var options
= CRM
.utils
.adjustDialogDefaults({
31 title
: ts('Save smart group')
33 dialogService
.open('saveSearchDialog', '~/searchActions/saveSmartGroup.html', model
, options
)
36 ctrl
.load
.saved
= true;
44 })(angular
, CRM
.$, CRM
._
);