| 23506 |
amit.gupta |
1 |
$(function() {
|
|
|
2 |
$("a.view-returns").live('click', function() {
|
|
|
3 |
viewReturns("main-content");
|
|
|
4 |
});
|
|
|
5 |
$("a.pending-returns").live('click', function() {
|
|
|
6 |
viewPendingReturns("main-content");
|
|
|
7 |
});
|
|
|
8 |
$("a.approved-returns").live('click', function() {
|
|
|
9 |
viewApprovedReturns("main-content");
|
|
|
10 |
});
|
|
|
11 |
|
|
|
12 |
$("a.wh-display-name").live('click', function() {
|
|
|
13 |
var whId = $(this).closest('tr').data('id');
|
|
|
14 |
$("#approved-returns-container").find("tr.filter").hide().filter('[data-id="' + whId + '"]').show();
|
|
|
15 |
$(this).closest('tr').removeClass('warning');
|
|
|
16 |
$(this).closest('tr').addClass('warning');
|
|
|
17 |
});
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
$("a.request-return").live('click', function() {
|
|
|
21 |
if(confirm("Are you sure?")) {
|
|
|
22 |
createReturnRequest($(this).data("inventoryitemid"), $(this));
|
|
|
23 |
}
|
|
|
24 |
});
|
|
|
25 |
$("a.approve-return").live('click', function() {
|
|
|
26 |
if(confirm("Are you sure to Approve?")) {
|
|
|
27 |
approveReturnRequest($(this).closest('td').data("inventoryitemid"), $(this).closest('td'));
|
|
|
28 |
}
|
|
|
29 |
});
|
|
|
30 |
$("a.deny-return").live('click', function() {
|
|
|
31 |
if(confirm("Are you sure to Deny?")) {
|
|
|
32 |
denyReturnRequest($(this).closest('td').data("inventoryitemid"), $(this).closest('td'));
|
|
|
33 |
}
|
|
|
34 |
});
|
|
|
35 |
$("a.view-debit-note").live('click', function() {
|
|
|
36 |
viewDebitNote($(this).closest('tr').data("id"));
|
|
|
37 |
});
|
| 23532 |
amit.gupta |
38 |
/*$("a.generate-debit-note").live('click', function() {
|
| 23506 |
amit.gupta |
39 |
if(confirm("Are you sure?")) {
|
|
|
40 |
generateDebitNote($(this).closest('tr').data("id"));
|
|
|
41 |
}
|
| 23532 |
amit.gupta |
42 |
});*/
|
| 23506 |
amit.gupta |
43 |
});
|
|
|
44 |
|
|
|
45 |
function viewReturns(domId){
|
|
|
46 |
doAjaxRequestHandler(context+"/return/inventory", "GET", function(response){
|
|
|
47 |
$('#' + domId).html(response);
|
|
|
48 |
});
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
function viewPendingReturns(domId){
|
|
|
52 |
doAjaxRequestHandler(context+"/return/pending", "GET", function(response){
|
|
|
53 |
$('#' + domId).html(response);
|
|
|
54 |
});
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
function viewApprovedReturns(domId){
|
|
|
58 |
doAjaxRequestHandler(context+"/return/approved", "GET", function(response){
|
|
|
59 |
$('#' + domId).html(response);
|
|
|
60 |
$("#approved-returns").find('a:first').click();
|
|
|
61 |
});
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
function createReturnRequest(inventoryItemId, container){
|
|
|
65 |
doAjaxRequestHandler(context+"/return/inventory/" + inventoryItemId, "PUT", function(response){
|
|
|
66 |
if(response=='true') {
|
|
|
67 |
container.closest('td').html('Return requested');
|
|
|
68 |
}
|
|
|
69 |
});
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
function approveReturnRequest(inventoryItemId, container){
|
|
|
73 |
doAjaxRequestHandler(context+"/return/inventory/approve/" + inventoryItemId, "PUT", function(response){
|
|
|
74 |
if(response=='true') {
|
|
|
75 |
container.closest('td').html('Return Approved');
|
|
|
76 |
}
|
|
|
77 |
});
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
function denyReturnRequest(inventoryItemId, container){
|
|
|
81 |
doAjaxRequestHandler(context+"/return/inventory/deny/" + inventoryItemId, "PUT", function(response){
|
|
|
82 |
if(response=='true') {
|
|
|
83 |
container.closest('td').html('Return denied');
|
|
|
84 |
}
|
|
|
85 |
});
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
function viewDebitNote(warehouseId){
|
|
|
89 |
doAjaxRequestHandler(context+"/return/debit-note/view/" + warehouseId, "GET", function(response){
|
|
|
90 |
//Download PDF code
|
|
|
91 |
});
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
function generateDebitNote(warehouseId){
|
|
|
95 |
doAjaxRequestHandler(context+"/return/debit-note/generate/" + warehouseId, "PUT", function(response){
|
|
|
96 |
if(response=='true') {
|
|
|
97 |
//Download the pdf
|
|
|
98 |
}
|
|
|
99 |
});
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
function getDebitNote(debitNotedId) {
|
|
|
103 |
doAjaxRequestHandler(context+"/return/debit-note/" + debitNotedId, "GET", function(response){
|
|
|
104 |
|
|
|
105 |
});
|
|
|
106 |
}
|
|
|
107 |
|