1 (function(angular
, $, _
) {
3 angular
.module('crmMailingAB').controller('CrmMailingABWinnerDialogCtrl', function($scope
, $timeout
, dialogService
, crmMailingMgr
, crmStatus
) {
4 var ts
= $scope
.ts
= CRM
.ts(null);
5 var abtest
= $scope
.abtest
= $scope
.model
.abtest
;
6 var mailingName
= $scope
.model
.mailingName
;
8 var titles
= {a
: ts('Mailing A'), b
: ts('Mailing B')};
9 $scope
.mailingTitle
= titles
[mailingName
];
12 // When using dialogService with a button bar, the major button actions
13 // need to be registered with the dialog widget (and not embedded in
14 // the body of the dialog).
17 text
: ts('Submit final mailing'),
18 icons
: {primary
: 'fa-paper-plane'},
20 crmMailingMgr
.mergeInto(abtest
.mailings
.c
, abtest
.mailings
[mailingName
], [
25 crmStatus({start
: ts('Saving...'), success
: ''}, abtest
.save())
27 return crmStatus({start
: ts('Submitting...'), success
: ts('Submitted')},
28 abtest
.submitFinal().then(function(r
) {
29 delete abtest
.$CrmMailingABReportCnt
;
34 dialogService
.close('selectWinnerDialog', abtest
);
40 icons
: {primary
: 'fa-times'},
42 dialogService
.cancel('selectWinnerDialog');
46 dialogService
.setButtons('selectWinnerDialog', buttons
);
52 })(angular
, CRM
.$, CRM
._
);