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
805 rajveer 32
        },
33
		conditions: {
34
			required: true
35
		}
794 rajveer 36
      }
37
    });}
38
    if(document.getElementById("txtDateOfBirth")){
39
    $("#txtDateOfBirth").datepicker({
40
      inline: true,
41
      changeMonth: true,
42
      changeYear: true,
43
      minDate: -20, 
44
      maxDate: "+1M +10D" 
45
    });
46
  }
839 vikas 47
 
48
 
49
    if (document.getElementById("frmShippingAddress")) {
50
		$("#frmShippingAddress").validate( {
51
			rules : {
52
				name : "required",
53
				line1 : "required",
54
				state : {
55
					required : true,
56
					minlength : 1
57
				},
58
				city : "required",
59
				pincode : {
60
					required : true,
61
					digits : true,
62
					minlength : 6,
63
					maxlength : 6
64
				},
65
				phone : {
66
					required : true,
67
					digits : true,
68
					minlength : 10,
69
					maxlength : 10
70
				}
71
			}
72
		});
73
	}
794 rajveer 74
 
75
  if(document.getElementById("#frmLogin")) {
76
		$("#frmLogin").validate({
77
			rules: {
78
				email: {
79
					required: true,
80
					email: true
81
				},
82
				password: {
83
					required: true,
84
					minlength: 6,
85
					maxlength: 20
86
				}
87
			}
88
		}); 
89
	}
90
	if(document.getElementById("#datepicker")) {	 
91
    $("#datepicker").datepicker({ });
92
  }
93
  // Research "delete" Item
94
  $('.add-research-pane5').click(function() {
95
    addResearch('pane5', 'multi');
96
  });  
97
  $('.add-to-cart-pane5').click(function() {
98
    addToCart('pane5', 'multi')
99
  });
809 rajveer 100
  $('.add-to-cart-pane1').click(function() {
794 rajveer 101
    addToCart('pane1', 'multi')
102
  });
103
  $('#signinClass').click(function() {
104
    changeSignInClass();
105
  });    
106
  $('.add-to-cart-icon').click(function() {
107
    var items = this.id;
108
    var itemsarray = items.split('-');
109
    addToCart(itemsarray[1], itemsarray[0]); 
110
    return false;
111
  });  
112
  $('.add-to-research-icon').click(function() {
113
    var items = this.id;
114
    var itemsarray = items.split('-');
115
    addResearch(itemsarray[1], itemsarray[0]);
116
    return false;
117
  });      
118
  $("#research_delete").click(function(){
119
    var research_tot=$("#research_total").val();
120
 
121
    var seldata="";
122
    var tot=0;
123
    var saprt="";    
124
    var containerdiv = "#pane1";     
125
    var par= containerdiv + " input[type=checkbox]:checked";
126
    $(par).each(function(){
127
      saprt = (tot>0)? "_":"";
128
      seldata += saprt+$(this).val();
129
      tot++
130
    });
131
    if(tot>0){
132
      var t=(research_tot*1)-(tot*1);
133
      $("#research_total").val(t);
134
 
135
      //alert("AJAX request to delete products in research. Product ID: "+seldata+" and total: "+tot); 
136
      jQuery.ajax({
137
        type: "GET",
138
        url: "/myresearch/" + seldata + "?_method=delete",
139
        data: "productid="+seldata,
140
        success: function(msg){
141
        //   alert( "Data Saved: " + msg );
142
        }
143
      });
144
      var arrayprod_id=seldata.split("_");
145
      jQuery.each(arrayprod_id,function(intIndex, objValue){
146
        var tableref="#"+objValue;
147
        var tblid="#"+objValue+ " td";
148
        $(tblid).animate({ 
149
          backgroundColor: "#fcffb3" 
150
        }, 'slow');
151
        $(tblid).animate({ 
152
          backgroundColor: "#F5F5F5" 
153
        }, 'slow', function() { 
154
          $(this).fadeOut('slow', function() { 
155
            $(this).remove();
156
            if(t === 0){ 
157
              $("#research_default").css("display","block");
158
            } 
159
          } ) 
160
        }); 
161
 
162
      });
163
    }else{
164
      alert("Please select atleast one product");
165
    }
166
  });
167
});
168
 
169