var crmMailingAB = angular.module('crmMailingAB', ['ngRoute', 'ui.utils']);
-
-//-------------------------------------------------------------------------------------------------------
crmMailingAB.config(['$routeProvider',
function($routeProvider) {
$routeProvider.when('/mailing', {
}
});
-
$routeProvider.when('/mailing/abtesting', {
-
templateUrl: partialUrl('helloworld.html'),
controller: 'TabsDemoCtrl',
resolve: {
mailingList: function($route, crmApi) {
return crmApi('Mailing', 'get', {});
}
-
}
-
-
});
-
-
}
]);
//-----------------------------------------
$scope.groups = metaData.values;
$scope.mailings = mailingList.values;
- $scope.adi=0;
+ $scope.tab_val=0;
$scope.campaign_clicked= function(){
- if($scope.adi >= 0 ){
- $scope.adi =0;
+ if($scope.tab_val >= 0 ){
+ $scope.tab_val =0;
}
};
$scope.compose_clicked=function(){
- if($scope.adi >=1){
- $scope.adi =1;
+ if($scope.tab_val >=1){
+ $scope.tab_val =1;
}
};
$scope.rec_clicked=function(){
- if($scope.adi >=2){
- $scope.adi =2;
+ if($scope.tab_val >=2){
+ $scope.tab_val =2;
}
};
$scope.preview_clicked=function(){
- if($scope.adi>=3){
- $scope.adi=3;
+ if($scope.tab_val>=3){
+ $scope.tab_val=3;
}
};
$scope.templates =
$scope.slide_value = 0;
- $scope.$watch("automated", function() {
-
- console.log("Smsdd");
-
- });
-
$scope.setifyes= function(val){
if(val ==1) {
$scope.ifyes = true;
$scope.send_date ="10/4/2004";
-
-
});
crmMailingAB.directive('nexttab', function() {
$(element).parent().parent().parent().tabs(scope.$eval(attrs.nexttab));
var myarr = new Array(1,2,3)
$(element).parent().parent().parent().tabs({disabled:myarr});
- //$(element).parent().parent().parent().tabs({"enable":1});
$(element).on("click",function() {
- scope.adi=scope.adi +1;
+ scope.tab_val=scope.tab_val +1;
var myArray1 = new Array( );
- for ( var i = scope.adi+1; i < 4; i++ ) {
+ for ( var i = scope.tab_val+1; i < 4; i++ ) {
myArray1.push(i);
console.log( "try " + i );
}
$(element).parent().parent().parent().tabs( "option", "disabled", myArray1 );
- $(element).parent().parent().parent().tabs({active:scope.adi});
+ $(element).parent().parent().parent().tabs({active:scope.tab_val});
console.log("adiroxxx");
});
}
crmMailingAB.directive('groupselect',function(){
return {
-
restrict : 'AE',
-
link: function(scope,element, attrs){
-
$(element).select2({width:"400px",placeholder: "Select the groups you wish to include"});
$(element).select2("data",groups)
-
-
-
-
}
};
crmMailingAB.directive('sliderbar',function(){
return{
-
restrict: 'AE',
-
link: function(scope,element, attrs){
-
$(element).slider({min:1});
$(element).slider({
slide: function( event, ui ) {
scope.slide_value = ui.value;
scope.$apply();
-
}
});
-
}
-
};
-
});
-
-
crmMailingAB.directive('tpmax',function(){
return {
-
restrict: 'E',
-
-
-
link: function(scope,element,attr){
-
-
-
scope.$watch('automated', function(val) {
if(val=="Yes") {
- console.log("yo");
-
$(element).dialog({
title: 'Automated A/B Testing',
width: 800,
closed: false,
cache: false,
modal: true
-
});
-
-
-
-
-
}
-
});
$(element).find("#closebutton").on("click",function(){
- console.log("you can do it");
$(element).dialog("close");
-
});
-
-
-
-
-
}
-
};
-
-
-
});
crmMailingAB.directive('numbar',function(){
return{
-
restrict: 'AE',
-
link: function(scope,element, attrs){
-
$(element).spinner({max:attrs.numbar,min:0});
-
-
-
}
-
};
-
});
crmMailingAB.directive('datepick',function(){
-
return {
scope :{
foo : '=send_date'
},
-
-
restrict: 'AE',
-
-
- link: function(scope,element,attrs){
-
+ link: function(scope,element,attrs){
$(element).datepicker({
onSelect: function(date) {
$(".ui-datepicker a").removeAttr("href");
});
}
};
-
-
});
-
-
-
-
-
-
-
-
-
-
-
-
-
})(angular, CRM.$, CRM._);
\ No newline at end of file
-
-
-
<div>
-
-
- <ul>
- <li ng-repeat="a in groups">{{a.title}}</li>
- </ul>
- <ul>
- <li ng-repeat="b in mailings">{{b.name}}</li>
- </ul>
<div ui-jq="tabs" id="alltabs" >
-
<ul>
<li><a href="#tabs-1" ng-click="campaign_clicked()" >Campaign</a></li>
<li><a href="#tabs-4" ng-click="preview_clicked()">Preview and Send</a></li>
</ul>
-
<div id="tabs-1" >
<form name="myForm" >
<h3 style ="text-decoration:underline"> What would you like to test ?</h3><br><br>
-
  <input type="radio" ng-model="template" ng-value="templates[0]"> Subject Lines <br/><br>
  <input type="radio" ng-model="template" ng-value="templates[1]"> From Names <br/><br>
  <input type="radio" ng-model="template" ng-value="templates[2]"> Two different Emails <br/><br>
<form>
<div ng-include="template.url">
-
</div>
-
-
-
-
<button id="campaignbutton" nexttab={{adi}} >Done</button><br>
-
</form>
-
</div>
<div id="tabs-3">
<form name="impform" ng-submit="submitForm(userForm.$valid)" novalidate>
<h3 style="text-decoration: underline;">Select the groups you would like to add</h3><br>
-
-
 <select multiple groupselect required name ="grps" required ng-model="groups_selected">
<option ng-repeat="grp in groups" value={{grp.title}} >{{grp.title}}</option>
-
</select><br><br>
<p ng-show=" impform.grps.$pristine" >You name is required.</p>
<h3 style="text-decoration: underline;">Select the size of your test group</h3><br>
-
  Percentage Selected - {{slide_value}}%
<div sliderbar id="trial" style="margin: 10px;"></div>
  <input type="radio" ng-model="winner_criteria" value="Total Unique Clicks" name="cri" checked="checked" > Total Unique Clicks <br/><br>
  <input type="radio" ng-model="winner_criteria" value="Total Clicks on a particular link" name="cri" > Total Clicks on a particular link <br/><br>
-
-
<h3 style="text-decoration: underline;">Do you want the A/B test to be automated </h3>
 <input type="radio" ng-model="automated" value="Yes" ng-click="setifyes(1)" name="auto" required>Yes  
 <input type="radio" ng-model="automated" value="No" ng-click="setifyes(2)" name="auto" checked="checked"> No <br/><br>
<br>
<br>
-
<button type="submit" class="btn btn-primary" ng-disabled="((days == null || days ==0 ) && (hours==null|| hours == 0 ) && (minutes==null || minutes ==0 )|| days>99 || minutes>59 || hours >23)" value=">> Compose" id="campaignbutton" nexttab={{adi}} >Next</button> <br>
</form>
</div>
<div id="tabs-4">
<h3 style="text-decoration: underline;">Details</h3><br>
-
<table>
<tr>
<td>Test Criteria</td>
<td>{{template.name}}</td>
</tr>
- <tr>
+ <tr>
<td>Groups Selected</td>
<td>{{groups_selected}}</td>
- </tr>
- <tr>
+ </tr>
+ <tr>
<td>Size of Test Group</td>
<td>{{slide_value}}</td>
-
- </tr>
- <tr>
- <td>Winner Criteria</td>
- <td>{{winner_criteria}}</td>
- </tr>
- <tr>
- <td>Automated</td>
- <td>{{automated}}</td>
-
- </tr>
- <tr ng-show="automated=='Yes'">
- <td>Minum Confidence Level</td>
- <td>{{conf}}%</td>
- </tr>
- <tr ng-show="automated=='Yes'">
- <td>If Level not Achieved</td>
- <td>{{ifnot}}</td>
- </tr>
- <tr>
- <td>Declare Winner in</td>
- <td>{{days}} Days {{hours}} Hours {{minutes}} Minutes</td>
-
- </tr>
-
-
+ </tr>
+ <tr>
+ <td>Winner Criteria</td>
+ <td>{{winner_criteria}}</td>
+ </tr>
+ <tr>
+ <td>Automated</td>
+ <td>{{automated}}</td>
+ </tr>
+ <tr ng-show="automated=='Yes'">
+ <td>Minum Confidence Level</td>
+ <td>{{conf}}%</td>
+ </tr>
+ <tr ng-show="automated=='Yes'">
+ <td>If Level not Achieved</td>
+ <td>{{ifnot}}</td>
+ </tr>
+ <tr>
+ <td>Declare Winner in</td>
+ <td>{{days}} Days {{hours}} Hours {{minutes}} Minutes</td>
+ </tr>
</table>
<h3 style="text-decoration: underline;"><a href="#">Preview Mailing</a></h3><br>
    <input type="date" ng-show="start=='later'" ng-model="send_date" datepick>
</div>
-
-
<br><br>
<button id="campaignbutton" nexttab={{adi}} >Submit & Send</button> <br>
</div>
-
-
</div>
-
-
-
</div>
\ No newline at end of file