Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
23026 ashik.ali 1
$().ready(function() {
2
	$("form#update-retailer-details-form input").each(function(){
3
		$(this).attr('autocomplete', 'off');
4
	});
5
});
6
$().ready(function() {
7
        $('#update-retailer-details-form').validate({
8
			submitHandler: function (form, event) {
9
				event.preventDefault();
10
				if(validateRetailerDetails()){
11
					alert("Please fix errors");
12
					return false;
13
				}
14
				var json = retailerDetailsJson();
15
				console.log("retailerJson = " + json);
16
				if(confirm("Are you sure you want to update Retailer Details!") == true){
23032 ashik.ali 17
					var response = doPutAjaxRequestWithJson("retailerDetails",json);
18
					$('#retailer-details-container').html(response);
23026 ashik.ali 19
		             return false; // required to block normal submit since you used ajax
20
				}
21
	       }
22
	});
23
 
23076 ashik.ali 24
});
25
 
26
$().ready(function(){
27
	$('#shops').click(function(e){
28
		//console.log(e.target + " clicked");
29
		var shopDetailsSize = $("#shopDetailsSize").attr("size");
30
		for(var i = 0; i < shopDetailsSize; i++){
31
			if($(e.target).is('#sameAsRetailerAddress'+i)){
32
				console.log("sameAsRetailerAddress"+ i +" Clicked!");
33
				if (e.target.checked) {
34
					processSameAsRetailerAddressEvent(i);
35
				}
36
			}
37
		}
38
	});
39
})
40
 
41
function processSameAsRetailerAddressEvent(counter){
42
	$('#shopAddressName'+counter).val($('#retailerAddressName').val());
43
	$('#shopAddressLine1'+counter).val($('#retailerAddressLine1').val());
44
	$('#shopAddressLine2'+counter).val($('#retailerAddressLine2').val());
45
	$('#shopAddressCity'+counter).val($('#retailerAddressCity').val());
46
	$('#shopAddressPinCode'+counter).val($('#retailerAddressPinCode').val());
47
	$('#shopAddressState'+counter).val($('#retailerAddressState').val());
48
}