| Line -... |
Line 1... |
| - |
|
1 |
var authorisedWarehouses = [];
|
| - |
|
2 |
|
| 1 |
$(function () {
|
3 |
$(function () {
|
| 2 |
$(document).on('click', ".warehouse-management", function () {
|
4 |
$(document).on('click', ".warehouse-management", function () {
|
| 3 |
getAuthorisedWarehousesList(function (warehouseId) {
|
5 |
getAuthorisedWarehouseList(function (warehouseId) {
|
| 4 |
loadAllTransaction(warehouseId, "main-content");
|
6 |
loadAllTransaction(warehouseId, "main-content");
|
| 5 |
});
|
7 |
});
|
| 6 |
|
8 |
|
| 7 |
});
|
9 |
});
|
| 8 |
|
10 |
|
| - |
|
11 |
$(document).on('change', "#selectedWarehouse", function () {
|
| - |
|
12 |
var warehouseId = $(this).val();
|
| - |
|
13 |
loadAllTransaction(warehouseId, "main-content");
|
| - |
|
14 |
});
|
| - |
|
15 |
|
| 9 |
$(document).on('click', ".order_by_transaction", function () {
|
16 |
$(document).on('click', ".order_by_transaction", function () {
|
| 10 |
var transactionId = $(this).data("transaction");
|
17 |
var transactionId = $(this).data("transaction");
|
| 11 |
var warehouseId = $("#selectedWarehouse").val();
|
18 |
var warehouseId = $("#selectedWarehouse").val();
|
| 12 |
loadTransactionDetail(transactionId, warehouseId, "transaction-detail-container");
|
19 |
loadTransactionDetail(transactionId, warehouseId, "transaction-detail-container");
|
| 13 |
});
|
20 |
});
|
| Line 33... |
Line 40... |
| 33 |
console.log('warehouse', warehouseId);
|
40 |
console.log('warehouse', warehouseId);
|
| 34 |
console.log('itemId', itemId);
|
41 |
console.log('itemId', itemId);
|
| 35 |
doGetAjaxRequestHandler(`${context}/om/formWarehouseByItemId/?warehouseId=${warehouseId}&itemId=${itemId}`, function (response) {
|
42 |
doGetAjaxRequestHandler(`${context}/om/formWarehouseByItemId/?warehouseId=${warehouseId}&itemId=${itemId}`, function (response) {
|
| 36 |
console.log(response);
|
43 |
console.log(response);
|
| 37 |
if (response && response.response && Array.isArray(response.response)) {
|
44 |
if (response && response.response && Array.isArray(response.response)) {
|
| 38 |
console.log("response warehouse", response.response);
|
45 |
console.log("response2222 warehouse", response.response);
|
| - |
|
46 |
if (response.response.length > 1) {
|
| 39 |
var selectOptions = '';
|
47 |
var selectOptions = '';
|
| 40 |
response.response.forEach(function (warehouse) {
|
48 |
response.response.forEach(function (warehouse) {
|
| 41 |
selectOptions += `<option value="${warehouse.warehouseFrom}">${warehouse.warehouseFromName}</option>`;
|
49 |
selectOptions += `<option value="${warehouse.warehouseFrom}">${warehouse.warehouseFromName}</option>`;
|
| 42 |
});
|
50 |
});
|
| 43 |
// Populate the modal with the select dropdown
|
51 |
// Populate the modal with the select dropdown
|
| 44 |
$('#changeWarehouseModal .modal-body').html(`<select id="selectedFromBillingWarehouse" data-orderid="${orderId}" class="form-control">${selectOptions}</select>`);
|
52 |
$('#changeWarehouseModal .modal-body').html(`<select id="selectedFromBillingWarehouse" data-orderid="${orderId}" class="form-control">${selectOptions}</select>`);
|
| - |
|
53 |
$('.change-warehouse-save-mk').css("display", "block");
|
| - |
|
54 |
} else {
|
| - |
|
55 |
$('#changeWarehouseModal .modal-body').html(`No other warehouse found for change`);
|
| - |
|
56 |
$('.change-warehouse-save-mk').css("display", "none");
|
| - |
|
57 |
}
|
| 45 |
} else {
|
58 |
} else {
|
| 46 |
console.log('error: invalid response structure');
|
59 |
console.log('error: invalid response structure');
|
| 47 |
}
|
60 |
}
|
| 48 |
});
|
61 |
});
|
| 49 |
});
|
62 |
});
|
| Line 116... |
Line 129... |
| 116 |
doGetAjaxRequestHandler(context + "/om/transactions/?warehouseId=" + warehouseId + "&orderStatus=SUBMITTED_FOR_PROCESSING", function (response) {
|
129 |
doGetAjaxRequestHandler(context + "/om/transactions/?warehouseId=" + warehouseId + "&orderStatus=SUBMITTED_FOR_PROCESSING", function (response) {
|
| 117 |
$('#' + domId).html(response);
|
130 |
$('#' + domId).html(response);
|
| 118 |
var transactionId = $("#firstTxnId").val();
|
131 |
var transactionId = $("#firstTxnId").val();
|
| 119 |
$("#selectedWarehouse").val(warehouseId);
|
132 |
$("#selectedWarehouse").val(warehouseId);
|
| 120 |
console.log("Transaction ID:", transactionId);
|
133 |
console.log("Transaction ID:", transactionId);
|
| - |
|
134 |
|
| - |
|
135 |
var selectOptions = '';
|
| - |
|
136 |
authorisedWarehouses.forEach(function (warehouse) {
|
| - |
|
137 |
var selected = (warehouse.id == warehouseId) ? 'selected' : '';
|
| - |
|
138 |
|
| - |
|
139 |
selectOptions += `<option value="${warehouse.id}" ${selected}>${warehouse.name}</option>`;
|
| - |
|
140 |
});
|
| - |
|
141 |
$('#authWarehousesList').html(`<select class="form-control" id="selectedWarehouse">${selectOptions}</select>`);
|
| - |
|
142 |
|
| 121 |
loadTransactionDetail(transactionId, warehouseId, "transaction-detail-container");
|
143 |
loadTransactionDetail(transactionId, warehouseId, "transaction-detail-container");
|
| 122 |
});
|
144 |
});
|
| 123 |
}
|
145 |
}
|
| 124 |
|
146 |
|
| 125 |
function loadTransactionDetail(transactionId, warehouseId, detailContainer) {
|
147 |
function loadTransactionDetail(transactionId, warehouseId, detailContainer) {
|
| Line 130... |
Line 152... |
| 130 |
$("#selectedWarehouseId").val(warehouseId);
|
152 |
$("#selectedWarehouseId").val(warehouseId);
|
| 131 |
});
|
153 |
});
|
| 132 |
}
|
154 |
}
|
| 133 |
|
155 |
|
| 134 |
|
156 |
|
| 135 |
function getAuthorisedWarehousesList(callback) {
|
157 |
function getAuthorisedWarehouseList(callback) {
|
| 136 |
bootBoxObj = {
|
158 |
bootBoxObj = {
|
| 137 |
size: "small",
|
159 |
size: "small",
|
| 138 |
title: "Choose Warehouse",
|
160 |
title: "Choose Warehouse",
|
| 139 |
callback: callback,
|
161 |
callback: callback,
|
| 140 |
inputType: 'select',
|
162 |
inputType: 'select',
|
| 141 |
inputOptions: typeof inputOptions == "undefined" ? undefined
|
163 |
inputOptions: typeof inputOptions == "undefined" ? undefined
|
| 142 |
: inputOptions
|
164 |
: inputOptions
|
| 143 |
}
|
165 |
}
|
| 144 |
if (typeof inputOptions == "undefined") {
|
166 |
if (typeof inputOptions == "undefined") {
|
| 145 |
doGetAjaxRequestHandler(context + "/authorisedWarehouses", function (
|
167 |
doGetAjaxRequestHandler(context + "/authorisedWarehouses", function (response) {
|
| 146 |
response) {
|
- |
|
| 147 |
console.log("response warehouse", response);
|
168 |
console.log("responseeee warehouse", response);
|
| 148 |
response = JSON.parse(response);
|
169 |
authorisedWarehouses = JSON.parse(response);
|
| - |
|
170 |
|
| 149 |
inputOptions = [];
|
171 |
inputOptions = [];
|
| 150 |
response.forEach(function (warehouse) {
|
172 |
authorisedWarehouses.forEach(function (warehouse) {
|
| 151 |
inputOptions.push({
|
173 |
inputOptions.push({
|
| 152 |
text: warehouse.name,
|
174 |
text: warehouse.name,
|
| 153 |
value: warehouse.id,
|
175 |
value: warehouse.id,
|
| 154 |
});
|
176 |
});
|
| 155 |
});
|
177 |
});
|
| Line 159... |
Line 181... |
| 159 |
} else if (inputOptions.length == 1) {
|
181 |
} else if (inputOptions.length == 1) {
|
| 160 |
callback(inputOptions[0].warehouse.id);
|
182 |
callback(inputOptions[0].warehouse.id);
|
| 161 |
} else {
|
183 |
} else {
|
| 162 |
bootbox.prompt(bootBoxObj);
|
184 |
bootbox.prompt(bootBoxObj);
|
| 163 |
}
|
185 |
}
|
| 164 |
|
- |
|
| 165 |
}
|
186 |
}
|
| - |
|
187 |
|
| - |
|
188 |
|
| - |
|
189 |
|