Subversion Repositories SmartDukaan

Rev

Rev 23343 | Rev 23377 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23343 Rev 23347
Line 1... Line -...
1
$(function() {
-
 
2
	
-
 
3
	$("#retailerDocumentForm").submit(function(event) {
-
 
4
		event.preventDefault();
-
 
5
		var emailIdOrMobileNumber = $('#retailer-details-search-text').val();
-
 
6
		var file = $("#retailerDocument").val();
-
 
7
		uploadRetailerDocument("retailer-details-container", file, emailIdOrMobileNumber);
-
 
8
	});
-
 
9
	
-
 
10
	$("#retailer-details-search-button").live('click', function() {
-
 
11
		searchContent = $("#retailer-details-search-text").val();
-
 
12
		if (typeof (searchContent) == "undefined" || !searchContent){
-
 
13
			searchContent = "";
-
 
14
		}
-
 
15
		getRetailerDetailsByEmailIdOrMobileNumber("retailer-details-container", searchContent);
-
 
16
    });
-
 
17
	
-
 
18
	$(".retailer-info").live('click', function() {
-
 
19
		retailerInfo("main-content");
-
 
20
	});
-
 
21
	
-
 
22
	$("#retailer-details-search-text").live("keyup", function(e) {
-
 
23
		var keyCode = e.keyCode || e.which;
-
 
24
    	if(keyCode == 13){
-
 
25
        	$("#retailer-details-search-button").click();
-
 
26
    	}
-
 
27
	});
-
 
28
	
-
 
29
	$('#retailerAddressState').live('change', function() { 
-
 
30
	    var stateName = $(this).find('option:selected').text();
-
 
31
	    loadDistrictNames(stateName);
-
 
32
	});
-
 
33
	
-
 
34
});	
-
 
35
 
-
 
36
$().ready(function() {
1
$().ready(function() {
37
	$("form#update-retailer-details-form input").each(function(){
2
	$("form#update-retailer-details-form input").each(function(){
38
		$(this).attr('autocomplete', 'off');
3
		$(this).attr('autocomplete', 'off');
39
	});
4
	});
40
});
5
});
Line 155... Line 120...
155
							'</div>'+
120
							'</div>'+
156
						'</div>';
121
						'</div>';
157
	return shopAddressUi;
122
	return shopAddressUi;
158
}
123
}
159
 
124
 
160
 
-
 
161
function processSameAsRetailerAddressEvent(counter){
125
function processSameAsRetailerAddressEvent(counter){
162
	$('#shopAddressName'+counter).val($('#retailerAddressName').val());
126
	$('#shopAddressName'+counter).val($('#retailerAddressName').val());
163
	$('#shopAddressLine1'+counter).val($('#retailerAddressLine1').val());
127
	$('#shopAddressLine1'+counter).val($('#retailerAddressLine1').val());
164
	$('#shopAddressLine2'+counter).val($('#retailerAddressLine2').val());
128
	$('#shopAddressLine2'+counter).val($('#retailerAddressLine2').val());
165
	$('#shopAddressCity'+counter).val($('#retailerAddressCity').val());
129
	$('#shopAddressCity'+counter).val($('#retailerAddressCity').val());
166
	$('#shopAddressPinCode'+counter).val($('#retailerAddressPinCode').val());
130
	$('#shopAddressPinCode'+counter).val($('#retailerAddressPinCode').val());
167
	$('#shopAddressState'+counter).val($('#retailerAddressState').val());
131
	$('#shopAddressState'+counter).val($('#retailerAddressState').val());
168
}
132
}
169
 
133
 
-
 
134
$('#fofoPartner').on('change', function() { 
-
 
135
    if (this.checked) {
-
 
136
    	$('#fofoPartner').val('true');
-
 
137
    }else{
-
 
138
    	$('#fofoPartner').val('false');
-
 
139
    }
-
 
140
});
-
 
141
 
-
 
142
 
-
 
143
$('#active').on('change', function() { 
-
 
144
    if (this.checked) {
-
 
145
    	$('#active').val('true');
-
 
146
    }else{
-
 
147
    	$('#active').val('false');
-
 
148
    }
-
 
149
});
-
 
150
 
170
 
151
 
171
function validateRetailerDetails(){
152
function validateRetailerDetails(){
172
	console.log("validating Retailer Details...");
153
	console.log("validating Retailer Details...");
173
	var error = false;
154
	var error = false;
174
	
155
	
Line 467... Line 448...
467
	shopAddressObject['line2'] = $("form#update-retailer-details-form input[name=shopAddressLine2"+counter+"]").val();
448
	shopAddressObject['line2'] = $("form#update-retailer-details-form input[name=shopAddressLine2"+counter+"]").val();
468
	shopAddressObject['city'] = $("form#update-retailer-details-form input[name=shopAddressCity"+counter+"]").val();
449
	shopAddressObject['city'] = $("form#update-retailer-details-form input[name=shopAddressCity"+counter+"]").val();
469
	shopAddressObject['pinCode'] = $("form#update-retailer-details-form input[name=shopAddressPinCode"+counter+"]").val();
450
	shopAddressObject['pinCode'] = $("form#update-retailer-details-form input[name=shopAddressPinCode"+counter+"]").val();
470
	shopAddressObject['state'] = $("#shopAddressState"+counter+" option:selected").val();
451
	shopAddressObject['state'] = $("#shopAddressState"+counter+" option:selected").val();
471
	return shopAddressObject;
452
	return shopAddressObject;
472
}
-
 
473
 
-
 
474
 
-
 
475
$('#fofoPartner').on('change', function() { 
-
 
476
    if (this.checked) {
-
 
477
    	$('#fofoPartner').val('true');
-
 
478
    }else{
-
 
479
    	$('#fofoPartner').val('false');
-
 
480
    }
-
 
481
});
-
 
482
 
-
 
483
 
-
 
484
$('#active').on('change', function() { 
-
 
485
    if (this.checked) {
-
 
486
    	$('#active').val('true');
-
 
487
    }else{
-
 
488
    	$('#active').val('false');
-
 
489
    }
-
 
490
});
-
 
491
 
-
 
492
function getRetailerDetailsByEmailIdOrMobileNumber(domId, emailIdOrMobileNumber){
-
 
493
	doAjaxRequestHandler(context+"/retailerDetail/?emailIdOrMobileNumber="+emailIdOrMobileNumber, "GET", function(response){
-
 
494
		$('#' + domId).html(response);
-
 
495
	});
-
 
496
}
-
 
497
 
-
 
498
function loadDistrictNames(stateName){
-
 
499
	if(undefined != $("#districtName")){
-
 
500
		doAjaxRequestHandler(context+"/district/all/stateName?stateName="+stateName, "GET", function(response){
-
 
501
			var districtMasters = response.response;
-
 
502
			//districtMasters = districtMasters.response;
-
 
503
			var districtNameElements = '<option value="" disabled selected>District Name</option>';
-
 
504
			for(index = 0; index < districtMasters.length; index++){
-
 
505
				districtNameElements = districtNameElements + '<option value="'+districtMasters[index].name+'">'+districtMasters[index].name+'</option>';
-
 
506
			}
-
 
507
			$('#districtName').html(districtNameElements);
-
 
508
		});
-
 
509
		
-
 
510
	}
-
 
511
}
-
 
512
 
-
 
513
function retailerInfo(domId){
-
 
514
	doAjaxRequestHandler(context+"/retailerInfo", "GET", function(response){
-
 
515
		$('#' + domId).html(response);
-
 
516
	});
-
 
517
}
-
 
518
 
-
 
519
function updateRetailerDocument(){
-
 
520
	//$("#updateRetailerShopDocument0").click( function() {
-
 
521
	console.log("Update Retailer Document Clicked");
-
 
522
	//console.log(ownerId);
-
 
523
	var emailIdOrMobileNumber = $('#retailer-details-search-text').val();
-
 
524
	console.log("emailIdOrMobileNumber: "+ emailIdOrMobileNumber);
-
 
525
	var file = $('#retailerDocument')[0].files[0];
-
 
526
	console.log("file : "+file.name);
-
 
527
	uploadRetailerDocument("retailer-details-container", file, emailIdOrMobileNumber);
-
 
528
}
-
 
529
 
-
 
530
function updateRetailerShopDocument(ownerId){
-
 
531
	//$("#updateRetailerShopDocument0").click( function() {
-
 
532
	console.log("Update Retailer Shop Document Clicked");
-
 
533
	console.log(ownerId);
-
 
534
	var shopSize = parseInt($("#shopDetailsSize").attr('size'));
-
 
535
	console.log("size : "+shopSize);
-
 
536
	for(var index = 0; index < shopSize; index++){
-
 
537
		if("updateRetailerShopDocument"+index == ownerId){
-
 
538
			var emailIdOrMobileNumber = $('#retailer-details-search-text').val();
-
 
539
			console.log("emailIdOrMobileNumber: "+ emailIdOrMobileNumber);
-
 
540
			var shopId = $('#retailerShopDocument'+index).attr("shopId");
-
 
541
			console.log("shopId : "+shopId);
-
 
542
			var file = $('#retailerShopDocument'+index)[0].files[0];
-
 
543
			console.log("file : "+file.name);
-
 
544
			uploadRetailerShopDocument("retailer-details-container", file, emailIdOrMobileNumber, shopId);
-
 
545
		}
-
 
546
	}
-
 
547
}
453
}
548
454