Subversion Repositories SmartDukaan

Rev

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

Rev 24739 Rev 24753
Line 167... Line 167...
167
	$(".closeOrder").live("click", function(e) {
167
	$(".closeOrder").live("click", function(e) {
168
		orderid = $(this).data('orderid');
168
		orderid = $(this).data('orderid');
169
		if (confirm("Are you sure you want to close the order") == true) {
169
		if (confirm("Are you sure you want to close the order") == true) {
170
 
170
 
171
			doPostAjaxRequestHandler(context + "/closeOrder?orderId="
171
			doPostAjaxRequestHandler(context + "/closeOrder?orderId="
172
					+ orderid, function(response) {
172
					+ orderd, function(response) {
173
				if (response == 'true') {
173
				if (response == 'true') {
174
					alert("successfully close");
174
					alert("successfully close");
175
					loadtabOrder("main-content");
175
					loadtabOrder("main-content");
176
				}
176
				}
177
			});
177
			});
Line 275... Line 275...
275
	});
275
	});
276
}
276
}
277
 
277
 
278
function cancelOrder(orderId,status) {
278
function cancelOrder(orderId,status) {
279
	console.log(orderId);
279
	console.log(orderId);
-
 
280
	
-
 
281
	
-
 
282
	var dialog = bootbox
-
 
283
	.dialog({
-
 
284
		title : "Are you sure want to cancel the order",
-
 
285
		message : "<div class=form-inline'>"
-
 
286
				+ "<label for='reason'>Reason:</label>"
-
 
287
				+ "<textarea class='form-control' rows='1' id='reason'></textarea>"
-
 
288
				+ "</div>",
-
 
289
		buttons : {
-
 
290
			cancel : {
-
 
291
				label : "cancel",
-
 
292
				className : 'btn-danger',
-
 
293
				callback : function() {
-
 
294
					loadOrder("main-content");
-
 
295
				}
-
 
296
			},
-
 
297
			ok : {
-
 
298
				label : "ok",
-
 
299
				className : 'btn-info',
-
 
300
				callback : function() {
-
 
301
					reason = $('#reason').val();
-
 
302
					console.log(reason);
-
 
303
					if (reason == ""
-
 
304
							|| reason == null
-
 
305
							|| reason == undefined) {
-
 
306
						alert("reason field can't be empty");
-
 
307
						return false;
-
 
308
					}
-
 
309
						
-
 
310
					doPostAjaxRequestHandler(context + "/cancelOrder?orderId="
-
 
311
							+ orderId + "&reason=" + reason+ "&orderStatus=" + status, function(response) {
-
 
312
						if (response == 'true') {
-
 
313
							alert("successfully cancel");
-
 
314
 
-
 
315
							loadOrder("main-content");
-
 
316
						}
-
 
317
					});
280
 
318
 
281
	bootbox.prompt("reason", function(result) {
-
 
282
		if (result != null) {
-
 
283
			console.log(result);
-
 
284
			if (confirm("Are you sure you want to cancel the order") == true) {
-
 
285
 
-
 
286
				doPostAjaxRequestHandler(context + "/cancelOrder?orderId="
-
 
287
						+ orderId + "&reason=" + result+ "&orderStatus=" + status, function(response) {
-
 
288
					if (response == 'true') {
-
 
289
						alert("successfully cancel");
-
 
290
 
319
 
291
						loadOrder("main-content");
-
 
292
					}
320
				}
293
				});
-
 
294
			}
321
			}
295
		} else {
-
 
296
			bootbox.alert("reason is required");
-
 
297
		}
322
		}
298
	});
323
	});
299
 
324
 
300
}
325
}