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
  }
47
 
48
  if(document.getElementById("#frmLogin")) {
49
		$("#frmLogin").validate({
50
			rules: {
51
				email: {
52
					required: true,
53
					email: true
54
				},
55
				password: {
56
					required: true,
57
					minlength: 6,
58
					maxlength: 20
59
				}
60
			}
61
		}); 
62
	}
63
	if(document.getElementById("#datepicker")) {	 
64
    $("#datepicker").datepicker({ });
65
  }
66
  // Research "delete" Item
67
  $('.add-research-pane5').click(function() {
68
    addResearch('pane5', 'multi');
69
  });  
70
  $('.add-to-cart-pane5').click(function() {
71
    addToCart('pane5', 'multi')
72
  });
809 rajveer 73
  $('.add-to-cart-pane1').click(function() {
794 rajveer 74
    addToCart('pane1', 'multi')
75
  });
76
  $('#signinClass').click(function() {
77
    changeSignInClass();
78
  });    
79
  $('.add-to-cart-icon').click(function() {
80
    var items = this.id;
81
    var itemsarray = items.split('-');
82
    addToCart(itemsarray[1], itemsarray[0]); 
83
    return false;
84
  });  
85
  $('.add-to-research-icon').click(function() {
86
    var items = this.id;
87
    var itemsarray = items.split('-');
88
    addResearch(itemsarray[1], itemsarray[0]);
89
    return false;
90
  });      
91
  $("#research_delete").click(function(){
92
    var research_tot=$("#research_total").val();
93
 
94
    var seldata="";
95
    var tot=0;
96
    var saprt="";    
97
    var containerdiv = "#pane1";     
98
    var par= containerdiv + " input[type=checkbox]:checked";
99
    $(par).each(function(){
100
      saprt = (tot>0)? "_":"";
101
      seldata += saprt+$(this).val();
102
      tot++
103
    });
104
    if(tot>0){
105
      var t=(research_tot*1)-(tot*1);
106
      $("#research_total").val(t);
107
 
108
      //alert("AJAX request to delete products in research. Product ID: "+seldata+" and total: "+tot); 
109
      jQuery.ajax({
110
        type: "GET",
111
        url: "/myresearch/" + seldata + "?_method=delete",
112
        data: "productid="+seldata,
113
        success: function(msg){
114
        //   alert( "Data Saved: " + msg );
115
        }
116
      });
117
      var arrayprod_id=seldata.split("_");
118
      jQuery.each(arrayprod_id,function(intIndex, objValue){
119
        var tableref="#"+objValue;
120
        var tblid="#"+objValue+ " td";
121
        $(tblid).animate({ 
122
          backgroundColor: "#fcffb3" 
123
        }, 'slow');
124
        $(tblid).animate({ 
125
          backgroundColor: "#F5F5F5" 
126
        }, 'slow', function() { 
127
          $(this).fadeOut('slow', function() { 
128
            $(this).remove();
129
            if(t === 0){ 
130
              $("#research_default").css("display","block");
131
            } 
132
          } ) 
133
        }); 
134
 
135
      });
136
    }else{
137
      alert("Please select atleast one product");
138
    }
139
  });
140
});
141
 
142