Subversion Repositories SmartDukaan

Rev

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

Rev 23532 Rev 23539
Line 7... Line 7...
7
	});
7
	});
8
	$("a.approved-returns").live('click', function() {
8
	$("a.approved-returns").live('click', function() {
9
		viewApprovedReturns("main-content");
9
		viewApprovedReturns("main-content");
10
	});
10
	});
11
 
11
 
-
 
12
	$("a.view-debit-note").live('click', function() {
-
 
13
		viewDebitNotes("main-content");
-
 
14
	});
-
 
15
 
12
	$("a.wh-display-name").live('click', function() {
16
	$("a.wh-display-name").live('click', function() {
13
		var whId = $(this).closest('tr').data('id');
17
		var whId = $(this).closest('tr').data('id');
14
		$("#approved-returns-container").find("tr.filter").hide().filter('[data-id="' + whId + '"]').show();
18
		$("#approved-returns-container").find("tr.filter").hide().filter('[data-id="' + whId + '"]').show();
15
		$(this).closest('tr').removeClass('warning');
19
		$(this).closest('tr').removeClass('warning');
16
		$(this).closest('tr').addClass('warning');
20
		$(this).closest('tr').addClass('warning');
17
	});
21
	});
-
 
22
 
-
 
23
	$("a.debit-note").live('click', function() {
-
 
24
		var debitNoteId = $(this).closest('tr').data('id');
-
 
25
		$("#debit-note-items").find("tr.filter").hide().filter('[data-id="' + debitNoteId + '"]').show();
-
 
26
		$(this).closest('tr').removeClass('warning');
-
 
27
		$(this).closest('tr').addClass('warning');
-
 
28
	});
18
	
29
	
19
	
30
	
20
	$("a.request-return").live('click', function() {
31
	$("a.request-return").live('click', function() {
21
		if(confirm("Are you sure?")) {
32
		if(confirm("Are you sure?")) {
22
			createReturnRequest($(this).data("inventoryitemid"), $(this));
33
			createReturnRequest($(this).data("inventoryitemid"), $(this));
Line 30... Line 41...
30
	$("a.deny-return").live('click', function() {
41
	$("a.deny-return").live('click', function() {
31
		if(confirm("Are you sure to Deny?")) {
42
		if(confirm("Are you sure to Deny?")) {
32
			denyReturnRequest($(this).closest('td').data("inventoryitemid"), $(this).closest('td'));
43
			denyReturnRequest($(this).closest('td').data("inventoryitemid"), $(this).closest('td'));
33
		}
44
		}
34
	});
45
	});
35
	$("a.view-debit-note").live('click', function() {
-
 
36
			viewDebitNote($(this).closest('tr').data("id"));
-
 
37
	});
-
 
38
	/*$("a.generate-debit-note").live('click', function() {
46
	/*$("a.generate-debit-note").live('click', function() {
39
		if(confirm("Are you sure?")) {
47
		if(confirm("Are you sure?")) {
40
			generateDebitNote($(this).closest('tr').data("id"));
48
			generateDebitNote($(this).closest('tr').data("id"));
41
		}
49
		}
42
	});*/
50
	});*/
Line 59... Line 67...
59
		$('#' + domId).html(response);
67
		$('#' + domId).html(response);
60
		$("#approved-returns").find('a:first').click();
68
		$("#approved-returns").find('a:first').click();
61
	});
69
	});
62
}
70
}
63
 
71
 
-
 
72
function viewDebitNotes(domId){
-
 
73
	doAjaxRequestHandler(context+"/return/debit-note-created", "GET", function(response){
-
 
74
		$('#' + domId).html(response);
-
 
75
		$("#debit-notes").find('a:first').click();
-
 
76
	});
-
 
77
}
-
 
78
 
64
function createReturnRequest(inventoryItemId, container){
79
function createReturnRequest(inventoryItemId, container){
65
	doAjaxRequestHandler(context+"/return/inventory/" + inventoryItemId, "PUT", function(response){
80
	doAjaxRequestHandler(context+"/return/inventory/" + inventoryItemId, "PUT", function(response){
66
		if(response=='true') {
81
		if(response=='true') {
67
			container.closest('td').html('Return requested');
82
			container.closest('td').html('Return requested');
68
		}
83
		}