removed console logs
authoraditya-nambiar <aditya.nambiar007@gmail.com>
Mon, 18 Aug 2014 11:25:01 +0000 (16:55 +0530)
committeraditya-nambiar <aditya.nambiar007@gmail.com>
Mon, 18 Aug 2014 11:25:01 +0000 (16:55 +0530)
js/angular-crmMailingAB.js
partials/abtesting/tab3.html

index 93ee512fd3235f9501e5073d0db159e43d700f85..42532f49cd8b60237c9360b3b491559d1ea7aa82 100755 (executable)
@@ -46,7 +46,6 @@
               return crmApi('MailingAB', 'getsingle', {id: $route.current.params.id});
             }
             else {
-              console.log("created");
               //created_id has been set to my id. Does not save without created_id. Needs to made generic based on the user
               return { just_created: "1"
               };
@@ -87,7 +86,6 @@
         y: 11
       }
     ]
-    console.log(selectedABTest);
     if (selectedABTest.winner_criteria_id == 1) {
       $scope.winnercriteria = "Open";
     }
       $scope.r.push(data.values[selectedABTest.mailing_id_a]["Unique Clicks"].toString());
      $scope.$apply();
     });
-    console.log($scope.rtt)
 
     $scope.d=[];
     result = crmApi('Mailing','stats',{mailing_id : selectedABTest.mailing_id_b});
       $scope.d.push(data.values[selectedABTest.mailing_id_b]["Unique Clicks"].toString());
       $scope.$apply();
     });
-    console.log($scope.d);
 
     var numdiv = 5;
 
     for (i = 0; i < numdiv; i++) {
       var result = crmApi('MailingAB', 'graph_stats',{id : selectedABTest.id, stats_count : numdiv, stat_count_select : i});
       result.success(function (data) {
-       console.log(data);
       });
     }
 
     }
     else {
       $scope.sparestuff.template = $scope.templates[0];
+      $scope.currentABTest.testing_criteria_id=1;
     }
 
 
     };
 
     $scope.tab_val = 0;
+    if($scope.sparestuff.isnew==true)
     $scope.max_tab = 0;
+    else $scope.max_tab = 4;
+
     $scope.campaign_clicked = function () {
       if ($scope.max_tab >= 0) {
         $scope.tab_val = 0;
     $scope.savea = function (dat) {
 
       var result = crmApi('Mailing', 'create', dat, true);
-      console.log(result);
       result.success(function (data) {
         if (data.is_error == 0) {
           $scope.mailA.id = data.id;
           $scope.currentABTest.mailing_id_a = $scope.mailA.id;
-          console.log("Mail a Id " + $scope.mailA.id);
         }
       });
     };
       result.success(function (data) {
         if (data.is_error == 0) {
           $scope.mailB.id = data.id;
-          console.log("Mail b Id " + $scope.mailB.id);
           $scope.currentABTest.mailing_id_b = $scope.mailB.id;
           $scope.append_mails();
         }
 
     $scope.savec = function (dat) {
       var flag = 0;
-      console.log("C is called");
       var result = crmApi('Mailing', 'create', dat, true);
-      console.log(result);
       result.success(function (data) {
         if (data.is_error == 0) {
           $scope.mailC.id = data.id;
-          console.log("Mail C Id " + $scope.mailC.id);
           $scope.currentABTest.mailing_id_c = $scope.mailC.id;
           $scope.append_mails();
         }
     }
 
     $scope.setdate = function (par) {
-      console.log("called")
-      console.log("av " + par)
       $scope.send_date = par;
       $scope.dt = par;
       $scope.apply();
       $scope.currentABTest.testing_criteria_id = $scope.sparestuff.template.val;
 
       if ($scope.abId == "") {
-        console.log("bb");
         result = crmApi('MailingAB', 'create', {name: $scope.currentABTest.name, testing_criteria_id: $scope.sparestuff.template.val});
       }
       else {
-        console.log("aa");
         if (typeof $scope.currentABTest.mailing_id_a == 'undefined') {
           result = crmApi('MailingAB', 'create', {name: $scope.currentABTest.name,id: $scope.abId, testing_criteria_id: $scope.sparestuff.template.val});
         }
       result.success(function (data) {
         if (data.is_error == 0) {
           $scope.abId = data.id;
-          console.log("ID " + $scope.abId);
         }
       });
     };
 
       resulta.success(function (data) {
         if (data.is_error == 0) {
-          console.log("came");
           $scope.sparestuff.previewa = data.values.html;
         }
       });
 
       resulta.success(function (data) {
         if (data.is_error == 0) {
-          console.log("came");
           $scope.sparestuff.previewb = data.values.html;
         }
       });
     };*/
 
     $scope.$watch('preview', function () {
-      console.log("dsfdfsfds");
       if ($scope.preview == true) {
         $('#prevmail').dialog({
           title: 'Preview Mailing',
           },
 
           close: function () {
-            console.log("close");
             $scope.preview = false;
             $scope.$apply();
           }
             }
           },
           close: function () {
-            console.log("close");
             $scope.sendtest = false;
             $scope.$apply()
           }
 
         $(element).on("click", function () {
           if (scope.tab_val == 0) {
-            console.log("att");
+
             scope.create_abtest();
 
-            console.log("tt");
+
           }
           else {
             if (scope.tab_val == 2) {
           var temp = scope.tab_val - 1;
           scope.tab_upd_dec();
           scope.$apply();
-          console.log(temp);
           if (temp != 3) {
             $(".crmABTestingAllTabs").tabs("option", "active", temp);
           }
 
         $(element).on('select2-selecting', function (e) {
           var a = e.val.split(" ");
-          console.log(e);
           var l = a.length;
           if (a[2] == "include") {
             var str = "";
           }
 
           scope.$apply();
-         // console.log(scope.incGroup);
 
         });
         $(element).on("select2-removed", function (e) {
             scope.$apply();
           }
 
-         // console.log(scope.incGroup);
           scope.$apply();
         });
       }
       restrict: 'AE',
       link: function (scope, element, attrs) {
         if (typeof scope.currentABTest.group_percentage != 'undefined') {
-          console.log("Yay");
           $(element).slider({value: scope.currentABTest.group_percentage});
         }
         $(element).slider({min: 1});
             $(".ui-datepicker a").removeAttr("href");
             scope.sparestuff.date = date.toString();
             scope.$apply();
-            console.log(scope.sparestuff.date);
           }
         });
       }
       priority: 1000,
       link: function (scope, element, attrs) {
         $(element).on("click", function () {
-          console.log("clicked");
           scope.savea({
             id: scope.mailA.id,
             name: "mailing a",
           });
 
           if (scope.whatnext == "3") {
-            console.log("sdf");
             scope.mailB.name = scope.mailA.name;
             scope.mailB.visibility = scope.mailA.visibility;
             scope.mailB.created_id = scope.mailA.created_id;
             scope.mailB.resubscribe_id = scope.mailA.resubscribe_id;
             scope.mailB.body_html = scope.mailA.body_html;
             scope.mailB.body_text = scope.mailA.body_text;
-            scope.mailB.scheduled_date = scope.mailA.scheduled_date;
             scope.mailB.scheduled_id = scope.mailA.scheduled_id;
             scope.mailB.campaign_id = scope.mailA.campaign_id == null ? "" : scope.mailA.campaign_id;
             scope.mailB.header_id = scope.mailA.header_id;
               scope.mailB.resubscribe_id = scope.mailA.resubscribe_id;
               scope.mailB.body_html = scope.mailA.body_html;
               scope.mailB.body_text = scope.mailA.body_text;
-              scope.mailB.scheduled_date = scope.mailA.scheduled_date;
               scope.mailB.scheduled_id = scope.mailA.scheduled_id;
               scope.mailB.campaign_id = scope.mailA.campaign_id == null ? "" : scope.mailA.campaign_id;
               scope.mailB.header_id = scope.mailA.header_id;
               scope.mailB.is_completed = scope.mailA.is_completed;
             }
           }
-          console.log("call B");
           scope.saveb({
             id: scope.mailB.id,
             name: "mailing b",
             resubscribe_id: scope.mailB.resubscribe_id,
             body_html: scope.mailB.body_html,
             body_text: scope.mailB.body_text,
-            scheduled_date: scope.mailB.scheduled_date,
             scheduled_id: scope.mailB.scheduled_id,
             campaign_id: scope.mailB.campaign_id == null ? "" : scope.mailB.campaign_id,
             header_id: scope.mailB.header_id,
             is_completed: scope.mailA.is_completed
           });
 
-          console.log("call C");
           scope.savec({
             id: scope.mailC.id,
             name: "mailing c",
             $(".ui-datepicker a").removeAttr("href");
             scope.currentABTest.date = date.toString();
             scope.$apply();
-            console.log(scope.currentABTest.date);
           }
         });
       }
         // map one colour each to x, y and z
         // keys grabs the key value or heading of each key value pair in the json
         // but not time
-       // console.log("Key");
 
         //console.log(d3.keys(data[0]));
         color.domain(d3.keys(data[0]).filter(function (key) {
         $(element).select2({width:"200px", data: mltokens, placeholder:"Insert Token"});
         $(element).on('select2-selecting', function(e) {
 
-          scope.$evalAsync('_resetSelection()');console.log(mltokens);
+          scope.$evalAsync('_resetSelection()');
           var a = $(element).attr('id');
           if(a=="htgroupcompose"){scope.tokenfunc("body_html",e,scope.mailA.body_html);}
           else if(a=="htgroupcomposetwob"){scope.tokenfunc("twomailbbody_html",e,scope.mailB.body_html);}
index 57c74d6c64bbd7ef309ba60d2008fe7e186d4d26..3e5c9d086b5b2d6f1f1eaab3bcef3b88aebaf885 100755 (executable)
@@ -17,8 +17,8 @@
     <div sliderbar id="trial" style="margin: 10px;" required></div>
 
     <h3>How will the winner be decided</h3><br>
-    &nbsp <input type="radio" ng-model="currentABTest.winner_criteria_id" value=1 name="cri" required> Open <br/><br>
-    &nbsp <input type="radio" ng-model="currentABTest.winner_criteria_id" value=2 name="cri" checked="checked">
+    &nbsp <input type="radio" ng-model="currentABTest.winner_criteria_id" value=1 name="cri" required ng-checked="true"> Open <br/><br>
+    &nbsp <input type="radio" ng-model="currentABTest.winner_criteria_id" value=2 name="cri" >
     Total Unique Clicks <br/><br>
     &nbsp <input type="radio" ng-model="currentABTest.winner_criteria_id" value=3 name="cri"> Total
     Clicks on a particular link <br/>