| 23506 |
amit.gupta |
1 |
$(function() {
|
|
|
2 |
$("a.view-returns").live('click', function() {
|
| 23638 |
amit.gupta |
3 |
viewReturnStores("main-content");
|
| 23506 |
amit.gupta |
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 |
|
| 23539 |
amit.gupta |
12 |
$("a.view-debit-note").live('click', function() {
|
|
|
13 |
viewDebitNotes("main-content");
|
|
|
14 |
});
|
|
|
15 |
|
| 23506 |
amit.gupta |
16 |
$("a.wh-display-name").live('click', function() {
|
|
|
17 |
var whId = $(this).closest('tr').data('id');
|
|
|
18 |
$("#approved-returns-container").find("tr.filter").hide().filter('[data-id="' + whId + '"]').show();
|
| 23540 |
amit.gupta |
19 |
$(this).closest('table').find('tr').removeClass('warning');
|
| 23506 |
amit.gupta |
20 |
$(this).closest('tr').addClass('warning');
|
|
|
21 |
});
|
| 23539 |
amit.gupta |
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();
|
| 23540 |
amit.gupta |
26 |
$(this).closest('table').find('tr').removeClass('warning');
|
| 23539 |
amit.gupta |
27 |
$(this).closest('tr').addClass('warning');
|
|
|
28 |
});
|
| 23506 |
amit.gupta |
29 |
|
|
|
30 |
|
|
|
31 |
$("a.request-return").live('click', function() {
|
|
|
32 |
if(confirm("Are you sure?")) {
|
|
|
33 |
createReturnRequest($(this).data("inventoryitemid"), $(this));
|
|
|
34 |
}
|
|
|
35 |
});
|
|
|
36 |
$("a.approve-return").live('click', function() {
|
|
|
37 |
if(confirm("Are you sure to Approve?")) {
|
| 23638 |
amit.gupta |
38 |
approveReturnRequest($(this).closest('td').data("returnid"), $(this).closest('td'));
|
| 23506 |
amit.gupta |
39 |
}
|
|
|
40 |
});
|
|
|
41 |
$("a.deny-return").live('click', function() {
|
|
|
42 |
if(confirm("Are you sure to Deny?")) {
|
|
|
43 |
denyReturnRequest($(this).closest('td').data("inventoryitemid"), $(this).closest('td'));
|
|
|
44 |
}
|
|
|
45 |
});
|
| 23532 |
amit.gupta |
46 |
/*$("a.generate-debit-note").live('click', function() {
|
| 23506 |
amit.gupta |
47 |
if(confirm("Are you sure?")) {
|
|
|
48 |
generateDebitNote($(this).closest('tr').data("id"));
|
|
|
49 |
}
|
| 23532 |
amit.gupta |
50 |
});*/
|
| 23638 |
amit.gupta |
51 |
$('#store-container').find('a').live('click', function (){
|
|
|
52 |
fofoId=$(this).data('id');
|
|
|
53 |
doAjaxRequestHandler(context+"/return/inventory/" + fofoId, "GET", function(response){
|
|
|
54 |
inventoryTable.rows().remove().rows.add($(response)).draw(false);
|
|
|
55 |
});
|
|
|
56 |
});
|
|
|
57 |
$('#inventory-container').find('a').live('click', function (){
|
|
|
58 |
itemId=$(this).data('id');
|
|
|
59 |
doAjaxRequestHandler(context+"/return/inventory/" + fofoId + "/" + itemId, "GET", function(response){
|
|
|
60 |
returnsTable.rows().remove().rows.add($(response)).draw(false);
|
|
|
61 |
});
|
|
|
62 |
});
|
| 23506 |
amit.gupta |
63 |
});
|
|
|
64 |
|
| 23638 |
amit.gupta |
65 |
function viewReturnStores(domId){
|
|
|
66 |
doAjaxRequestHandler(context+"/return/stores", "GET", function(response){
|
| 23506 |
amit.gupta |
67 |
$('#' + domId).html(response);
|
|
|
68 |
});
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
function viewPendingReturns(domId){
|
|
|
72 |
doAjaxRequestHandler(context+"/return/pending", "GET", function(response){
|
|
|
73 |
$('#' + domId).html(response);
|
|
|
74 |
});
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
function viewApprovedReturns(domId){
|
|
|
78 |
doAjaxRequestHandler(context+"/return/approved", "GET", function(response){
|
|
|
79 |
$('#' + domId).html(response);
|
|
|
80 |
$("#approved-returns").find('a:first').click();
|
|
|
81 |
});
|
|
|
82 |
}
|
|
|
83 |
|
| 23539 |
amit.gupta |
84 |
function viewDebitNotes(domId){
|
|
|
85 |
doAjaxRequestHandler(context+"/return/debit-note-created", "GET", function(response){
|
|
|
86 |
$('#' + domId).html(response);
|
|
|
87 |
$("#debit-notes").find('a:first').click();
|
|
|
88 |
});
|
|
|
89 |
}
|
|
|
90 |
|
| 23506 |
amit.gupta |
91 |
function createReturnRequest(inventoryItemId, container){
|
|
|
92 |
doAjaxRequestHandler(context+"/return/inventory/" + inventoryItemId, "PUT", function(response){
|
|
|
93 |
if(response=='true') {
|
|
|
94 |
container.closest('td').html('Return requested');
|
|
|
95 |
}
|
|
|
96 |
});
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
function approveReturnRequest(inventoryItemId, container){
|
|
|
100 |
doAjaxRequestHandler(context+"/return/inventory/approve/" + inventoryItemId, "PUT", function(response){
|
|
|
101 |
if(response=='true') {
|
|
|
102 |
container.closest('td').html('Return Approved');
|
|
|
103 |
}
|
|
|
104 |
});
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
function denyReturnRequest(inventoryItemId, container){
|
|
|
108 |
doAjaxRequestHandler(context+"/return/inventory/deny/" + inventoryItemId, "PUT", function(response){
|
|
|
109 |
if(response=='true') {
|
|
|
110 |
container.closest('td').html('Return denied');
|
|
|
111 |
}
|
|
|
112 |
});
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
function viewDebitNote(warehouseId){
|
|
|
116 |
doAjaxRequestHandler(context+"/return/debit-note/view/" + warehouseId, "GET", function(response){
|
|
|
117 |
//Download PDF code
|
|
|
118 |
});
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
function generateDebitNote(warehouseId){
|
|
|
122 |
doAjaxRequestHandler(context+"/return/debit-note/generate/" + warehouseId, "PUT", function(response){
|
|
|
123 |
if(response=='true') {
|
|
|
124 |
//Download the pdf
|
|
|
125 |
}
|
|
|
126 |
});
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
function getDebitNote(debitNotedId) {
|
|
|
130 |
doAjaxRequestHandler(context+"/return/debit-note/" + debitNotedId, "GET", function(response){
|
|
|
131 |
|
|
|
132 |
});
|
|
|
133 |
}
|
|
|
134 |
|