Subversion Repositories SmartDukaan

Rev

Rev 35962 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35962 Rev 35982
Line 572... Line 572...
572
function deactivateStore(domId, fofoId, storeCode) {
572
function deactivateStore(domId, fofoId, storeCode) {
573
	doPostAjaxRequestHandler(context + "/deactivateStore?fofoId=" + fofoId,
573
	doPostAjaxRequestHandler(context + "/deactivateStore?fofoId=" + fofoId,
574
		function(response) {
574
		function(response) {
575
			if (response == "true") {
575
			if (response == "true") {
576
				alert("Store marked inactive successfully!");
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);
577
				storeInfo(domId);
590
					} else {
-
 
591
						storeInfo(domId);
-
 
592
					}
-
 
593
				} else {
-
 
594
					storeInfo(domId);
578
				askClosureConfirmation(domId, fofoId, storeCode);
595
				}
-
 
596
			}
579
			}
597
		});
580
		});
598
}
581
}
-
 
582
 
-
 
583
function askClosureConfirmation(domId, fofoId, storeCode) {
-
 
584
	var inputCode = prompt("To also PERMANENTLY close this store (cannot be undone), type the store code: " + storeCode + "\n\nPress Cancel to skip.");
-
 
585
	if (inputCode === null) {
-
 
586
		return;
-
 
587
	}
-
 
588
	if (inputCode.trim() === "") {
-
 
589
		alert("Store code is required to confirm closure.");
-
 
590
		askClosureConfirmation(domId, fofoId, storeCode);
-
 
591
		return;
-
 
592
	}
-
 
593
	if (inputCode.trim() !== storeCode) {
-
 
594
		alert("Store code does not match. Closure cancelled.");
-
 
595
		return;
-
 
596
	}
-
 
597
	doPostAjaxRequestHandler(context + "/closeStore?fofoId=" + fofoId + "&storeCode=" + encodeURIComponent(inputCode.trim()),
-
 
598
		function(closeResponse) {
-
 
599
			if (closeResponse == "true") {
-
 
600
				alert("Store permanently closed.");
-
 
601
			}
-
 
602
			storeInfo(domId);
-
 
603
		});
-
 
604
}
599
function activateStoreForever(domId, fofoId) {
605
function activateStoreForever(domId, fofoId) {
600
	doPostAjaxRequestHandler(context + "/activateStoreForever?fofoId=" + fofoId,
606
	doPostAjaxRequestHandler(context + "/activateStoreForever?fofoId=" + fofoId,
601
		function(response) {
607
		function(response) {
602
			if (response == "true") {
608
			if (response == "true") {
603
				alert("successfully activated!");
609
				alert("successfully activated!");