Subversion Repositories SmartDukaan

Rev

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

Rev 23076 Rev 23080
Line 1178... Line 1178...
1178
	retailerDetailsObject['shops'] = [];
1178
	retailerDetailsObject['shops'] = [];
1179
	var shopDetailsSize = $("#shopDetailsSize").attr("size");
1179
	var shopDetailsSize = $("#shopDetailsSize").attr("size");
1180
	
1180
	
1181
	for(var i = 0; i < shopDetailsSize; i++){
1181
	for(var i = 0; i < shopDetailsSize; i++){
1182
		var shopObject = {};
1182
		var shopObject = {};
1183
		shopObject['shopId'] = $("form#update-retailer-details-form input[name=shopName"+i+"]").attr('shopId');
1183
		var shopId = $("form#update-retailer-details-form input[name=shopName"+i+"]").attr('shopId');
-
 
1184
		shopObject['shopId'] = shopId;
1184
		shopObject['name'] = $("form#update-retailer-details-form input[name=shopName"+i+"]").val();
1185
		shopObject['name'] = $("form#update-retailer-details-form input[name=shopName"+i+"]").val();
1185
		
1186
		
1186
		var fileSelector = $('#retailerShopDocument'+i)[0];
1187
		var fileSelector = $('#retailerShopDocument'+i)[0];
1187
		if(fileSelector != undefined && fileSelector.files[0] != undefined){
1188
		if(fileSelector != undefined && fileSelector.files[0] != undefined){
1188
			var documentId = uploadDocument(fileSelector.files[0]);
1189
			var documentId = uploadDocument(fileSelector.files[0]);
1189
			shopObject['documentId'] = documentId;
1190
			shopObject['documentId'] = documentId;
1190
		}else{
1191
		}else{
1191
			shopObject['documentId'] = 0;
1192
			shopObject['documentId'] = 0;
1192
		}
1193
		}
-
 
1194
		var sameAsRetailerAddress = $("form#update-retailer-details-form input[name=sameAsRetailerAddress"+i+"]").val();
1193
		
1195
		
1194
		//shopObject['file'] = $('#retailerShopDocument'+i)[0].files[0];
1196
		if(shopId == 0 && sameAsRetailerAddress == 'true'){
1195
		var shopAddressObject = {};
1197
			shopObject['address'] = null;
1196
		shopAddressObject['name'] = $("form#update-retailer-details-form input[name=shopAddressName"+i+"]").val();
-
 
1197
		shopAddressObject['line1'] = $("form#update-retailer-details-form input[name=shopAddressLine1"+i+"]").val();
-
 
1198
		shopAddressObject['line2'] = $("form#update-retailer-details-form input[name=shopAddressLine2"+i+"]").val();
-
 
1199
		shopAddressObject['city'] = $("form#update-retailer-details-form input[name=shopAddressCity"+i+"]").val();
-
 
1200
		shopAddressObject['pinCode'] = $("form#update-retailer-details-form input[name=shopAddressPinCode"+i+"]").val();
-
 
1201
		shopAddressObject['state'] = $("form#update-retailer-details-form input[name=shopAddressState"+i+"]").val();
-
 
-
 
1198
		}else{
1202
		shopObject['address'] = shopAddressObject;
1199
			shopObject['address'] = getShopAddressObject(i);
-
 
1200
		}
1203
		retailerDetailsObject['shops'].push(shopObject);
1201
		retailerDetailsObject['shops'].push(shopObject);
-
 
1202
		
1204
	}
1203
	}
1205
	
1204
	
1206
	return JSON.stringify(retailerDetailsObject);
1205
	return JSON.stringify(retailerDetailsObject);
1207
}
1206
}
1208
 
1207
 
-
 
1208
function getShopAddressObject(counter){
-
 
1209
	var shopAddressObject = {};
-
 
1210
	shopAddressObject['name'] = $("form#update-retailer-details-form input[name=shopAddressName"+counter+"]").val();
-
 
1211
	shopAddressObject['line1'] = $("form#update-retailer-details-form input[name=shopAddressLine1"+counter+"]").val();
-
 
1212
	shopAddressObject['line2'] = $("form#update-retailer-details-form input[name=shopAddressLine2"+counter+"]").val();
-
 
1213
	shopAddressObject['city'] = $("form#update-retailer-details-form input[name=shopAddressCity"+counter+"]").val();
-
 
1214
	shopAddressObject['pinCode'] = $("form#update-retailer-details-form input[name=shopAddressPinCode"+counter+"]").val();
-
 
1215
	shopAddressObject['state'] = $("form#update-retailer-details-form input[name=shopAddressState"+counter+"]").val();
-
 
1216
	return shopAddressObject;
-
 
1217
}
-
 
1218
 
1209
function schemeDetailsJson(){
1219
function schemeDetailsJson(){
1210
	console.log("schemeDetailsJson")
1220
	console.log("schemeDetailsJson")
1211
	var schemeObject = {};
1221
	var schemeObject = {};
1212
	schemeObject['name'] = $("form#create-scheme-form input[name=schemeName]").val();
1222
	schemeObject['name'] = $("form#create-scheme-form input[name=schemeName]").val();
1213
	schemeObject['description'] = $("form#create-scheme-form input[name=description]").val();
1223
	schemeObject['description'] = $("form#create-scheme-form input[name=description]").val();