};
var mltokens = [];
var crmMailingAB = angular.module('crmMailingAB', ['ngRoute', 'ui.utils', 'ngSanitize']);
- var mltokens = [];
crmMailingAB.run(function ($rootScope, $templateCache) {
$rootScope.$on('$viewContentLoaded', function () {
crmApi('Mailing', 'create', mail);
});
$location.path('mailing/abtesting');
- }
+ };
var result = crmApi('Mailing', 'stats', {mailing_id: selectedABTest.mailing_id_a});
$scope.r = [];
result.success(function (data) {
$scope.aastop = false;
$scope.asure = function () {
$scope.aastop = true;
- }
+ };
$scope.bbstop = false;
$scope.bsure = function () {
$scope.bbstop = true;
- }
+ };
var numdiv = 5;
var keep_cnt = 0;
$scope.graph_data[temp - 1] = {
time: tp,
x: data.values.A[temp].count,
- y: data.values.B[temp].count}
+ y: data.values.B[temp].count
+ };
if (keep_cnt == numdiv) {
$scope.graphload = true;
.text("Time");
svg.append("text") // text label for the x axis
-
.style("text-anchor", "middle")
.text($scope.winnercriteria).attr("transform",function (d) {
return "rotate(-90)"
}).attr("x", -height / 2)
.attr("y", -30);
- ;
+
// create a variable called series and bind the date
// for each series append a g element and class it as series for css styling
var series = svg.selectAll(".series")
}
});
-
-
}
else {
$scope.sparestuff.isnew = true;
};
$scope.tab_val = 0;
- if ($scope.sparestuff.isnew == true) {
- $scope.max_tab = 0;
- }
- else {
- $scope.max_tab = 4;
- }
+ $scope.max_tab = ($scope.sparestuff.isnew == true) ? 0 : 4;
$scope.campaign_clicked = function () {
if ($scope.max_tab >= 0) {
$scope.slide_value = 0;
$scope.setifyes = function (val) {
- if (val == 1) {
- $scope.ifyes = true;
- }
- else {
- $scope.ifyes = false;
- }
+ $scope.ifyes = val == 1;
};
/* $scope.reply = function () {
};
$scope.trackr = function (trackreplies) {
- if (trackreplies == "1") {
- return true;
- }
- else {
- return false;
- }
- }
+ return trackreplies == "1";
+ };
$scope.sendTestMailing = function () {
$scope.sendtest = true;
- }
+ };
$scope.isHeader = function (hf) {
return hf.component_type == "Header";
};
$scope.append_mails = function () {
- crmApi('MailingAB', 'create', {id: $scope.abId, mailing_id_a: $scope.mailA.id, mailing_id_b: $scope.mailB.id, mailing_id_c: $scope.mailC.id});
+ crmApi('MailingAB', 'create', {
+ id: $scope.abId,
+ mailing_id_a: $scope.mailA.id,
+ mailing_id_b: $scope.mailB.id,
+ mailing_id_c: $scope.mailC.id
+ });
$scope.currentABTest.id = $scope.abId;
};
$scope.saveb = function (dat) {
- var flag = 0;
var result = crmApi('Mailing', 'create', dat, true);
result.success(function (data) {
if (data.is_error == 0) {
};
$scope.savec = function (dat) {
- var flag = 0;
var result = crmApi('Mailing', 'create', dat, true);
result.success(function (data) {
$scope.sparestuff.previewa = "";
$scope.pre = function () {
$scope.preview = true;
- }
+ };
$scope.init = function (par) {
if (par == "3") {
$scope.sparestuff.template.url = partialUrl('two_emails.html');
}
}
- $scope.whatnext = par.toString()
+ $scope.whatnext = par.toString();
};
$scope.tab_upd = function () {
$scope.tab_val = $scope.tab_val + 1;
$scope.max_tab = Math.max($scope.tab_val, $scope.max_tab);
- }
+ };
$scope.tab_upd_dec = function () {
$scope.tab_val = $scope.tab_val - 1;
- }
+ };
$scope.setdate = function (par) {
$scope.send_date = par;
$scope.tp1.include = $scope.incGroupids;
$scope.tp1.exclude = $scope.excGroupids;
console.log($scope.tp1);
- var result = crmApi('MailingAB', 'recipients_update', {
+ crmApi('MailingAB', 'recipients_update', {
id: $scope.currentABTest.id,
groups: $scope.tp1
});
if (typeof $scope.sparestuff.date == 'undefined') {
$scope.sparestuff.date = 'now';
}
- var result = crmApi('MailingAB', 'send_mail', {id: $scope.abId,
+ crmApi('MailingAB', 'send_mail', {id: $scope.abId,
scheduled_date: $scope.sparestuff.date, scheduled_date_time: $scope.currentABTest.latertime});
-
- }
+ };
angular.forEach($scope.incGroup, function (value) {
$scope.sparestuff.ingrps += value.toString() + ", ";
if ($scope.sparestuff.excgrps.length != 0) {
$scope.sparestuff.excgrps = $scope.sparestuff.excgrps.substr(0, $scope.sparestuff.excgrps.length - 2);
}
-
- }
-
+ };
$scope.update_abtest = function () {
$scope.currentABTest.declare_winning_time = $scope.currentABTest.date + " " + $scope.currentABTest.time;
- result = crmApi('MailingAB', 'create', {
+ crmApi('MailingAB', 'create', {
id: $scope.abId,
testing_criteria_id: $scope.sparestuff.template.val,
mailing_id_a: $scope.currentABTest.mailing_id_a,
}
}
}
- }
+ };
/*$scope.tmp = function (tst){
$scope.currentMailing.msg_template_id=tst;
$scope.call = function () {
$scope.$apply();
- var result = crmApi('Mailing', 'send_test', {
+ crmApi('Mailing', 'send_test', {
mailing_id: $scope.currentABTest.mailing_id_a,
test_email: $scope.sparestuff.emailadd
});
- var result = crmApi('Mailing', 'send_test', {
+ crmApi('Mailing', 'send_test', {
mailing_id: $scope.currentABTest.mailing_id_b,
test_email: $scope.sparestuff.emailadd
})
- }
+ };
$scope.$watch('sendtest', function () {
if ($scope.sendtest == true) {
var tabselector = $(".crmABTestingAllTabs");
tabselector.tabs(scope.$eval(attrs.nexttab));
- var myarr = new Array(1, 2, 3)
// disable remaining tabs
if (scope.sparestuff.isnew == true) {
- tabselector.tabs({disabled: myarr});
+ tabselector.tabs({disabled: [1, 2, 3]});
}
$(element).on("click", function () {
scope.tab_upd();
- var myArray1 = new Array();
+ var myArray1 = [];
for (var i = scope.max_tab + 1; i < 4; i++) {
myArray1.push(i);
}
});
$(element).on("select2-removed", function (e) {
if (e.val.split(" ")[2] == "exclude") {
- var index = scope.excGroup.indexOf(e.val.split(" ")[3]);
- scope.excGroup.splice(index, 1);
- scope.excGroupids.splice(index, 1);
+ var excIndex = scope.excGroup.indexOf(e.val.split(" ")[3]);
+ scope.excGroup.splice(excIndex, 1);
+ scope.excGroupids.splice(excIndex, 1);
scope.$apply();
}
else {
- var index = scope.incGroup.indexOf(e.val.split(" ")[3]);
- scope.incGroup.splice(index, 1);
- scope.incGroupids.splice(index, 1);
+ var incIndex = scope.incGroup.indexOf(e.val.split(" ")[3]);
+ scope.incGroup.splice(incIndex, 1);
+ scope.incGroupids.splice(incIndex, 1);
scope.$apply();
}
});
}
};
-
});
crmMailingAB.directive('sliderbar', function () {