Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
794 rajveer 1
// Ebizon Move script js into the file
2
 
3
$(document).ready(function() {
4
    if(document.getElementById("frmRegister")){
5
    $("#frmRegister").validate({
6
      rules: {
7
        nameOfUser: "required",
8
        email: {
9
          required: true,
10
          email: true
11
        },
12
        txtPassword: {
13
          required: true,
14
          minlength: 6,
15
          maxlength: 20
16
        },
17
        confirmPassword: {
18
          required: true,
19
          minlength: 6,
20
          maxlength: 20,
21
          equalTo: "#txtPassword"
22
        },
23
        communicationEmail: {
24
          required: true,
25
          email: true
26
        },
27
        mobileNumber: {
28
          required: false,
29
          digits: true,
30
          minlength: 10,
31
          maxlength: 10
32
        }
33
      }
34
    });}
35
    if(document.getElementById("txtDateOfBirth")){
36
    $("#txtDateOfBirth").datepicker({
37
      inline: true,
38
      changeMonth: true,
39
      changeYear: true,
40
      minDate: -20, 
41
      maxDate: "+1M +10D" 
42
    });
43
  }
44
 
45
  if(document.getElementById("#frmLogin")) {
46
		$("#frmLogin").validate({
47
			rules: {
48
				email: {
49
					required: true,
50
					email: true
51
				},
52
				password: {
53
					required: true,
54
					minlength: 6,
55
					maxlength: 20
56
				}
57
			}
58
		}); 
59
	}
60
	if(document.getElementById("#datepicker")) {	 
61
    $("#datepicker").datepicker({ });
62
  }
63
  // Research "delete" Item
64
  $('.add-research-pane5').click(function() {
65
    addResearch('pane5', 'multi');
66
  });  
67
  $('.add-to-cart-pane5').click(function() {
68
    addToCart('pane5', 'multi')
69
  });
70
  $('#add-to-cart-pane1').click(function() {
71
    addToCart('pane1', 'multi')
72
  });
73
  $('#signinClass').click(function() {
74
    changeSignInClass();
75
  });    
76
  $('.add-to-cart-icon').click(function() {
77
    var items = this.id;
78
    var itemsarray = items.split('-');
79
    addToCart(itemsarray[1], itemsarray[0]); 
80
    return false;
81
  });  
82
  $('.add-to-research-icon').click(function() {
83
    var items = this.id;
84
    var itemsarray = items.split('-');
85
    addResearch(itemsarray[1], itemsarray[0]);
86
    return false;
87
  });      
88
  $("#research_delete").click(function(){
89
    var research_tot=$("#research_total").val();
90
 
91
    var seldata="";
92
    var tot=0;
93
    var saprt="";    
94
    var containerdiv = "#pane1";     
95
    var par= containerdiv + " input[type=checkbox]:checked";
96
    $(par).each(function(){
97
      saprt = (tot>0)? "_":"";
98
      seldata += saprt+$(this).val();
99
      tot++
100
    });
101
    if(tot>0){
102
      var t=(research_tot*1)-(tot*1);
103
      $("#research_total").val(t);
104
 
105
      //alert("AJAX request to delete products in research. Product ID: "+seldata+" and total: "+tot); 
106
      jQuery.ajax({
107
        type: "GET",
108
        url: "/myresearch/" + seldata + "?_method=delete",
109
        data: "productid="+seldata,
110
        success: function(msg){
111
        //   alert( "Data Saved: " + msg );
112
        }
113
      });
114
      var arrayprod_id=seldata.split("_");
115
      jQuery.each(arrayprod_id,function(intIndex, objValue){
116
        var tableref="#"+objValue;
117
        var tblid="#"+objValue+ " td";
118
        $(tblid).animate({ 
119
          backgroundColor: "#fcffb3" 
120
        }, 'slow');
121
        $(tblid).animate({ 
122
          backgroundColor: "#F5F5F5" 
123
        }, 'slow', function() { 
124
          $(this).fadeOut('slow', function() { 
125
            $(this).remove();
126
            if(t === 0){ 
127
              $("#research_default").css("display","block");
128
            } 
129
          } ) 
130
        }); 
131
 
132
      });
133
    }else{
134
      alert("Please select atleast one product");
135
    }
136
  });
137
});
138
 
139