Subversion Repositories SmartDukaan

Rev

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

Rev 35726 Rev 35962
Line 121... Line 121...
121
		}
121
		}
122
	});
122
	});
123
 
123
 
124
	$(document).on('click', ".deactivate-store", function() {
124
	$(document).on('click', ".deactivate-store", function() {
125
		var fofoId = $(this).data("fofoid");
125
		var fofoId = $(this).data("fofoid");
-
 
126
		var storeCode = $(this).data("storecode");
126
		console.log(fofoId);
127
		console.log(fofoId);
127
		if (confirm("Are you sure you want to deactivate store!") == true) {
128
		if (confirm("Are you sure you want to deactivate store!") == true) {
128
			deactivateStore("main-content", fofoId);
129
			deactivateStore("main-content", fofoId, storeCode);
129
		}
130
		}
130
 
131
 
131
	});
132
	});
132
	$(document).on('click', ".activate-store-forever", function() {
133
	$(document).on('click', ".activate-store-forever", function() {
133
		var fofoId = $(this).data("fofoid");
134
		var fofoId = $(this).data("fofoid");
Line 566... Line 567...
566
		response) {
567
		response) {
567
		$('#' + domId).html(response);
568
		$('#' + domId).html(response);
568
	});
569
	});
569
}
570
}
570
 
571
 
571
function deactivateStore(domId, fofoId) {
572
function deactivateStore(domId, fofoId, storeCode) {
572
	doPostAjaxRequestHandler(context + "/deactivateStore?fofoId=" + fofoId,
573
	doPostAjaxRequestHandler(context + "/deactivateStore?fofoId=" + fofoId,
573
		function(response) {
574
		function(response) {
574
			if (response == "true") {
575
			if (response == "true") {
575
				alert("successfully deactivated!");
576
				alert("Store marked inactive successfully!");
-
 
577
				if (confirm("Do you also want to permanently close this store? Closed stores cannot be reactivated.")) {
-
 
578
					var inputCode = prompt("To confirm permanent closure, type the store code: " + storeCode);
-
 
579
					if (inputCode !== null && inputCode === storeCode) {
-
 
580
						doPostAjaxRequestHandler(context + "/closeStore?fofoId=" + fofoId + "&storeCode=" + encodeURIComponent(inputCode),
-
 
581
							function(closeResponse) {
-
 
582
								if (closeResponse == "true") {
-
 
583
									alert("Store permanently closed.");
-
 
584
								}
-
 
585
								storeInfo(domId);
-
 
586
							});
-
 
587
					} else if (inputCode !== null) {
-
 
588
						alert("Store code does not match. Store is inactive but not closed.");
-
 
589
						storeInfo(domId);
-
 
590
					} else {
-
 
591
						storeInfo(domId);
-
 
592
					}
-
 
593
				} else {
576
				storeInfo(domId);
594
					storeInfo(domId);
-
 
595
				}
577
			}
596
			}
578
 
-
 
579
		});
597
		});
580
}
598
}
581
function activateStoreForever(domId, fofoId) {
599
function activateStoreForever(domId, fofoId) {
582
	doPostAjaxRequestHandler(context + "/activateStoreForever?fofoId=" + fofoId,
600
	doPostAjaxRequestHandler(context + "/activateStoreForever?fofoId=" + fofoId,
583
		function(response) {
601
		function(response) {