1 (function(angular
, $, _
) {
4 angular
.module('crmSearchActions').directive('saveSmartGroup', function() {
12 controller: function ($scope
, $element
, dialogService
) {
13 var ts
= $scope
.ts
= CRM
.ts(),
16 $scope
.saveGroup = function () {
20 visibility
: 'User and User Admin Only',
22 id
: ctrl
.load
? ctrl
.load
.id
: null,
23 api_entity
: ctrl
.entity
,
24 api_params
: _
.cloneDeep(angular
.extend({}, ctrl
.params
, {version
: 4}))
26 delete model
.api_params
.orderBy
;
27 if (ctrl
.load
&& ctrl
.load
.api_params
&& ctrl
.load
.api_params
.select
&& ctrl
.load
.api_params
.select
[0]) {
28 model
.api_params
.select
.unshift(ctrl
.load
.api_params
.select
[0]);
30 var options
= CRM
.utils
.adjustDialogDefaults({
32 title
: ts('Save smart group')
34 dialogService
.open('saveSearchDialog', '~/crmSearchActions/saveSmartGroup.html', model
, options
);
40 })(angular
, CRM
.$, CRM
._
);