Subversion Repositories SmartDukaan

Rev

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

Rev 23474 Rev 23494
Line 99... Line 99...
99
	var shopDetailsSize = $("#shopDetailsSize").attr("size");
99
	var shopDetailsSize = $("#shopDetailsSize").attr("size");
100
	console.log("no of shops are : "+shopDetailsSize);
100
	console.log("no of shops are : "+shopDetailsSize);
101
	$('.retailerShopDocument').change(function(){
101
	$('.retailerShopDocument').change(function(){
102
		//console.log("#retailerShopDocument"+i+" change event called");
102
		//console.log("#retailerShopDocument"+i+" change event called");
103
        //alert("Retailer Shop Document has been selected, Do you want to upload");
103
        //alert("Retailer Shop Document has been selected, Do you want to upload");
-
 
104
		console.log($(this).attr("id"));
104
        if (confirm('Retailer Shop Document has been selected, Do you want to upload ?')) {
105
        if (confirm('Retailer Shop Document has been selected, Do you want to upload ?')) {
105
        		for(var i = 0; i < shopDetailsSize; i++){
-
 
106
        			if($('#retailerShopDocument'+i).val() != undefined){
-
 
107
        				console.log("#retailerShopDocument"+i+" change event called");
-
 
108
		        		var fileSelector = $('#retailerShopDocument'+i)[0];
106
    		var fileSelector = $(this)[0];
109
		    			var url = 'http://'+ webApiHost + ':' + webApiPort + '/profitmandi-web/document-upload';
107
			var url = 'http://'+ webApiHost + ':' + webApiPort + '/profitmandi-web/document-upload';
110
		    			var file = this.files[0];
108
			var file = this.files[0];
111
		    			var retailerShopDocumentKey = "retailerShopDocument"+i;
109
			var retailerShopDocumentKey = $(this).attr("id");
112
		    			doAjaxUploadRequestHandler(url, 'POST', file, function(response){
110
			doAjaxUploadRequestHandler(url, 'POST', file, function(response){
113
		    				var documentId = response.response.document_id;
111
				var documentId = response.response.document_id;
114
		    				console.log("documentId : " + documentId);
112
				console.log("documentId : " + documentId);
115
		    				localStorage.setItem(retailerShopDocumentKey, documentId);
113
				localStorage.setItem(retailerShopDocumentKey, documentId);
116
		    			});
114
			});
117
        			}
-
 
118
        		}
-
 
119
        } else {
-
 
120
            // Do nothing!
-
 
121
        }
115
        }
122
    });
116
    });
123
    
117
    
124
});
118
});
125
 
119
 
Line 538... Line 532...
538
	shopAddressObject['line2'] = $("form#update-retailer-details-form input[name=shopAddressLine2"+counter+"]").val();
532
	shopAddressObject['line2'] = $("form#update-retailer-details-form input[name=shopAddressLine2"+counter+"]").val();
539
	shopAddressObject['city'] = $("form#update-retailer-details-form input[name=shopAddressCity"+counter+"]").val();
533
	shopAddressObject['city'] = $("form#update-retailer-details-form input[name=shopAddressCity"+counter+"]").val();
540
	shopAddressObject['pinCode'] = $("form#update-retailer-details-form input[name=shopAddressPinCode"+counter+"]").val();
534
	shopAddressObject['pinCode'] = $("form#update-retailer-details-form input[name=shopAddressPinCode"+counter+"]").val();
541
	shopAddressObject['state'] = $("#shopAddressState"+counter+" option:selected").val();
535
	shopAddressObject['state'] = $("#shopAddressState"+counter+" option:selected").val();
542
	return shopAddressObject;
536
	return shopAddressObject;
-
 
537
}
-
 
538
 
-
 
539
function downloadRetailerDocument(documentId){
-
 
540
	console.log("documentId : "+documentId);
-
 
541
	doAjaxRequestHandler(context+"/retailerDocument/documentId?documentId="+documentId, "GET", function(response){
-
 
542
		var name = response.response.name;
-
 
543
		console.log("documentName : "+name);
-
 
544
		doAjaxGetDownload(context+"/retailerDocument/download", name);
-
 
545
	});
-
 
546
	
-
 
547
}
-
 
548
 
-
 
549
function downloadRetailerShopDocument(shopId){
-
 
550
	console.log("shopId : "+shopId);
-
 
551
	doAjaxRequestHandler(context+"/retailerShopDocument/shopId?shopId="+shopId, "GET", function(response){
-
 
552
		var name = response.response.name;
-
 
553
		console.log("documentName : "+name);
-
 
554
		doAjaxGetDownload(context+"/retailerShopDocument/download?shopId="+shopId, name);
-
 
555
	});
-
 
556
	
543
}
557
}
544
558