Subversion Repositories SmartDukaan

Rev

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

Rev 28300 Rev 28493
Line 13... Line 13...
13
				}
13
				}
14
			});
14
			});
15
}
15
}
16
 
16
 
17
	});
17
	});
-
 
18
$(document).on('click', ".myFile", function() {
-
 
19
        
-
 
20
        console.log("hello");
-
 
21
		if (confirm('Confirm upload ?')) {
-
 
22
			var fileSelector = $(".fileTaxation").val();
-
 
23
			 console.log("fileSelector"+fileSelector);
-
 
24
			
-
 
25
			doPostAjaxRequestHandler(context + "/csvFileUploader?fileSelector=" + fileSelector,
-
 
26
				function(response) {
-
 
27
 
-
 
28
					console.log("reponse" + response);
-
 
29
				});
-
 
30
		
-
 
31
			 
-
 
32
		}
-
 
33
		else {
-
 
34
		// Do nothing!
-
 
35
		}
-
 
36
});
-
 
37
	
18
	
38
	
19
	$(document).on('click', ".submit-active", function() {
39
	$(document).on('click', ".submit-active", function() {
20
		
40
		
21
		var id = $(this).data('id');
41
		var id = $(this).data('id');
22
			if (confirm("Are you sure you want to Active this Supplier") == true){
42
			if (confirm("Are you sure you want to Active this Supplier") == true){
Line 27... Line 47...
27
				}
47
				}
28
			});
48
			});
29
}
49
}
30
 
50
 
31
	});
51
	});
32
 
-
 
-
 
52
$(document).on('click', ".taxation", function() {
-
 
53
		loadTaxation("main-content");
33
 
54
	});
34
 
55
 
35
 
56
 
36
	$(document).on('click', ".create-warehouse", function() {
57
	$(document).on('click', ".create-warehouse", function() {
37
		loadCreateWarehouse("main-content");
58
		loadCreateWarehouse("main-content");
38
	});
59
	});
Line 192... Line 213...
192
	doGetAjaxRequestHandler(context + "/createWarehouse", function(response) {
213
	doGetAjaxRequestHandler(context + "/createWarehouse", function(response) {
193
		$('#' + domId).html(response);
214
		$('#' + domId).html(response);
194
	});
215
	});
195
}
216
}
196
 
217
 
-
 
218
function loadTaxation(domId) {
-
 
219
	doGetAjaxRequestHandler(context + "/createTaxation", function(response) {
-
 
220
		$('#' + domId).html(response);
-
 
221
	});
-
 
222
}
-
 
223
 
197
function loadWarehouses(domId) {
224
function loadWarehouses(domId) {
198
	doGetAjaxRequestHandler(context + "/getWarehouses", function(response) {
225
	doGetAjaxRequestHandler(context + "/getWarehouses", function(response) {
199
		$('#' + domId).html(response);
226
		$('#' + domId).html(response);
200
	});
227
	});
201
}
228
}
Line 256... Line 283...
256
		$('#' + domId).html(response);
283
		$('#' + domId).html(response);
257
		configureUserWarehousesDropDown();
284
		configureUserWarehousesDropDown();
258
	});
285
	});
259
}
286
}
260
 
287
 
-
 
288
$(document).on('click', "#new-supplier", function() {
-
 
289
		
-
 
290
			doGetAjaxRequestHandler(context + "/getCreateNewSupplier", function(response){
-
 
291
			$("#main-content").html(response);
-
 
292
			
-
 
293
			});
-
 
294
 
-
 
295
 
-
 
296
	});
-
 
297
 
-
 
298
 
-
 
299
$(document).on('click', ".create-supplier-submit", function() {
-
 
300
		console.log("hello");
-
 
301
		var name = $("form#new-supplier-create-form input[name=inputName]").val();
-
 
302
	if (name === "") {
-
 
303
		alert("Name is required");
-
 
304
		return false;
-
 
305
	}
-
 
306
	var phone = $("form#new-supplier-create-form input[name=inputPhone]").val();
-
 
307
	if (phone === "") {
-
 
308
		alert("phone is required");
-
 
309
		return false;
-
 
310
	}
-
 
311
	var gst = $("form#new-supplier-create-form input[name=inputGst]").val();
-
 
312
	if (gst === "") {
-
 
313
		alert("gst is required");
-
 
314
		return false;
-
 
315
	}
-
 
316
	var pan =$("form#new-supplier-create-form input[name=inputPan]").val();
-
 
317
	if (pan === "") {
-
 
318
		alert("Pan is required");
-
 
319
		return false;
-
 
320
	}
-
 
321
	var headName =$("form#new-supplier-create-form input[name=inputHeadName]").val();
-
 
322
	if (headName === "") {
-
 
323
		alert("Head Name is required");
-
 
324
		return false;
-
 
325
	}
-
 
326
	var headDesign = $("form#new-supplier-create-form input[name=inputHeadDesig]").val();
-
 
327
	if (headDesign === "") {
-
 
328
		alert("Head Designation is required");
-
 
329
		return false;
-
 
330
	}
-
 
331
	
-
 
332
var headEmail = $("form#new-supplier-create-form input[name=inputHeadEmail]").val();
-
 
333
	if (headEmail === "") {
-
 
334
		alert("Head Email is required");
-
 
335
		return false;
-
 
336
	}
-
 
337
	var contactPerson = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
-
 
338
	if (contactPerson === "") {
-
 
339
		alert("Contact Person is required");
-
 
340
		return false;
-
 
341
	}
-
 
342
	var registeredAddress =$("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
-
 
343
	if (registeredAddress === "") {
-
 
344
		alert("Registered Address is required");
-
 
345
		return false;
-
 
346
	}
-
 
347
	var communicationAddress = $("form#new-supplier-create-form input[name=inputCommunicationAddress]").val();
-
 
348
	
-
 
349
	if (communicationAddress === "") {
-
 
350
		alert("Communication Address  is required");
-
 
351
		return false;
-
 
352
	}
-
 
353
	var warehouseId =  $("#warehouseLocation").val();
-
 
354
	if (warehouseId === "") {
-
 
355
		alert("Warehouse Location  is required");
-
 
356
		return false;
-
 
357
	}
-
 
358
	
-
 
359
	var state =  $("#stateId").val();
-
 
360
	if (state === "") {
-
 
361
		alert("state  is required");
-
 
362
		return false;
-
 
363
	}
-
 
364
	var pOValidityLimit =  $("form#new-supplier-create-form input[name=inputPOValidityLimit]").val();
-
 
365
	if (pOValidityLimit === "") {
-
 
366
		alert("pOValidityLimit  is required");
-
 
367
		return false;
-
 
368
	}
-
 
369
	var termConditions =  $("form#new-supplier-create-form input[name=inputTermConditions]").val();
-
 
370
	if (termConditions === "") {
-
 
371
		alert("termConditions  is required");
-
 
372
		return false;
-
 
373
	}
-
 
374
		
-
 
375
		var json = newSuppilerObjectJson();
-
 
376
		    	
-
 
377
		    	
-
 
378
	if (confirm("Are you sure you want to create supplier") == true) {
-
 
379
		doAjaxRequestWithJsonHandler(context + "/submitNewSupplier", "POST",json,  function(response){
-
 
380
			if(response== "true"){
-
 
381
			if (confirm("Are you sure you want to create New Supplier") == true){
-
 
382
			
-
 
383
				$("#main-content").html(response);
-
 
384
				}
-
 
385
				}
-
 
386
			});
-
 
387
			} 
-
 
388
     	});
-
 
389
 
-
 
390
function newSuppilerObjectJson() {
-
 
391
var newSupplierCreateObject = {};
-
 
392
 
-
 
393
	newSupplierCreateObject['name'] = $("form#new-supplier-create-form input[name=inputName]").val();
-
 
394
	
-
 
395
    newSupplierCreateObject['phone'] = $("form#new-supplier-create-form input[name=inputPhone]").val();
-
 
396
    newSupplierCreateObject['gst'] = $("form#new-supplier-create-form input[name=inputGst]").val();
-
 
397
    newSupplierCreateObject['pan'] = $("form#new-supplier-create-form input[name=inputPan]").val();
-
 
398
    newSupplierCreateObject['fax'] = $("form#new-supplier-create-form input[name=inputFax]").val();
-
 
399
    newSupplierCreateObject['headName'] = $("form#new-supplier-create-form input[name=inputHeadName]").val();
-
 
400
    newSupplierCreateObject['headDesign'] = $("form#new-supplier-create-form input[name=inputHeadDesig]").val();
-
 
401
    newSupplierCreateObject['headEmail'] = $("form#new-supplier-create-form input[name=inputHeadEmail]").val();
-
 
402
    newSupplierCreateObject['contactPerson'] = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
-
 
403
    newSupplierCreateObject['contactEmail'] = $("form#new-supplier-create-form input[name=inputContactEmail]").val();
-
 
404
    newSupplierCreateObject['contactFax'] = $("form#new-supplier-create-form input[name=inputContactFax]").val();
-
 
405
    newSupplierCreateObject['registeredAddress'] = $("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
-
 
406
    newSupplierCreateObject['communicationAddress'] = $("form#new-supplier-create-form input[name=inputCommunicationAddress]").val();
-
 
407
    newSupplierCreateObject['termConditions'] = $("form#new-supplier-create-form input[name=inputTermConditions]").val();
-
 
408
    newSupplierCreateObject['warehouseId'] = $("#warehouseLocation").val();
-
 
409
    newSupplierCreateObject['state'] = $("#stateId").val();
-
 
410
    newSupplierCreateObject['pOValidityLimit'] = $("form#new-supplier-create-form input[name=inputPOValidityLimit]").val();
-
 
411
    
-
 
412
 
-
 
413
 
-
 
414
return JSON.stringify(newSupplierCreateObject);
-
 
415
}
-
 
416
 
-
 
417
 
-
 
418
 
-
 
419
 
-
 
420
 
-
 
421
 
-
 
422