| 32390 |
amit.gupta |
1 |
$(function () {
|
| 28300 |
tejbeer |
2 |
|
| 32390 |
amit.gupta |
3 |
$(document).on('click', ".submit-inactive", function () {
|
| 28300 |
tejbeer |
4 |
|
| 32390 |
amit.gupta |
5 |
var id = $(this).data('id');
|
| 32551 |
amit.gupta |
6 |
if (confirm("Are you sure you want to In Active this Supplier")) {
|
| 28504 |
amit.gupta |
7 |
|
| 32390 |
amit.gupta |
8 |
doPostAjaxRequestHandler(context + "/setStatusInActive?id=" + id,
|
|
|
9 |
function (response) {
|
| 32551 |
amit.gupta |
10 |
if (response === "true") {
|
| 28493 |
tejbeer |
11 |
|
| 32390 |
amit.gupta |
12 |
getAllSupplier("main-content");
|
|
|
13 |
}
|
|
|
14 |
});
|
|
|
15 |
}
|
| 28300 |
tejbeer |
16 |
|
| 32390 |
amit.gupta |
17 |
});
|
| 28300 |
tejbeer |
18 |
|
| 32390 |
amit.gupta |
19 |
$(document).on('click', ".myFile", function () {
|
| 28300 |
tejbeer |
20 |
|
| 32390 |
amit.gupta |
21 |
console.log("hello");
|
|
|
22 |
if (confirm('Confirm upload ?')) {
|
|
|
23 |
var fileSelector = $(this)[0];
|
|
|
24 |
if (fileSelector != undefined) {
|
|
|
25 |
var url = `${context}/csvFileUploader`;
|
|
|
26 |
console.log(url);
|
|
|
27 |
var file = $(".fileTaxation")[0].files[0];
|
|
|
28 |
let fileInput = $(this);
|
|
|
29 |
console.log("file" + file);
|
|
|
30 |
console.log("fileInput" + fileInput);
|
|
|
31 |
doAjaxUploadRequestHandler(
|
|
|
32 |
url,
|
|
|
33 |
'POST',
|
|
|
34 |
file, function (response) {
|
| 28300 |
tejbeer |
35 |
|
| 32390 |
amit.gupta |
36 |
console.log("reponse" + response);
|
|
|
37 |
});
|
| 28300 |
tejbeer |
38 |
|
| 32390 |
amit.gupta |
39 |
}
|
|
|
40 |
} else {
|
|
|
41 |
// Do nothing!
|
|
|
42 |
}
|
|
|
43 |
});
|
| 28300 |
tejbeer |
44 |
|
|
|
45 |
|
| 32390 |
amit.gupta |
46 |
$(document).on('click', ".submit-active", function () {
|
| 28300 |
tejbeer |
47 |
|
| 32390 |
amit.gupta |
48 |
var id = $(this).data('id');
|
| 32551 |
amit.gupta |
49 |
if (confirm("Are you sure you want to Active this Supplier")) {
|
| 32390 |
amit.gupta |
50 |
doPostAjaxRequestHandler(context + "/setStatusActive?id=" + id,
|
|
|
51 |
function (response) {
|
| 32551 |
amit.gupta |
52 |
if (response === "true") {
|
| 32390 |
amit.gupta |
53 |
getAllInActiveSupplier("main-content");
|
|
|
54 |
}
|
|
|
55 |
});
|
|
|
56 |
}
|
| 28300 |
tejbeer |
57 |
|
| 32390 |
amit.gupta |
58 |
});
|
| 34329 |
aman.kumar |
59 |
//
|
|
|
60 |
$(document).on('click', ".supplier-edit", function () {
|
|
|
61 |
let supplierId = $(this).data('id');
|
|
|
62 |
let formData = objectifyForm($('form#new-supplier-create-form').serializeArray());
|
|
|
63 |
console.log("Form Data: ", formData);
|
|
|
64 |
doGetAjaxRequestHandler(`${context}/supplier/edit/${supplierId}`,
|
|
|
65 |
function (response) {
|
|
|
66 |
loadMainContent(response);
|
|
|
67 |
});
|
| 32549 |
tejbeer |
68 |
|
| 34329 |
aman.kumar |
69 |
});
|
| 32549 |
tejbeer |
70 |
|
| 34329 |
aman.kumar |
71 |
function objectifyForm(formArray) {
|
|
|
72 |
return formArray.reduce(function (result, item) {
|
|
|
73 |
if (item.name) {
|
|
|
74 |
result[item.name] = item.value;
|
|
|
75 |
}
|
|
|
76 |
return result;
|
|
|
77 |
}, {});
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
$(document).on('click', ".submit-supplier-edit", function () {
|
|
|
81 |
const supplierId = $(this).data('dd');
|
|
|
82 |
const form = $('#new-supplier-create-form');
|
|
|
83 |
const formData = new FormData(form[0]);
|
|
|
84 |
const jsonData = {};
|
|
|
85 |
formData.forEach((value, key) => {
|
|
|
86 |
if (key === 'inputWarehouseLocation') {
|
|
|
87 |
jsonData[key] = Array.from(form.find(`[name="${key}"]`)[0].selectedOptions)
|
|
|
88 |
.map(option => parseInt(option.value));
|
|
|
89 |
} else {
|
|
|
90 |
jsonData[key] = value;
|
|
|
91 |
}
|
|
|
92 |
});
|
|
|
93 |
doPostAjaxRequestWithJsonHandler(
|
|
|
94 |
`${context}/supplier/update/${supplierId}`,
|
|
|
95 |
JSON.stringify(jsonData),
|
|
|
96 |
function (response) {
|
|
|
97 |
alert("Supplier updated successfully");
|
|
|
98 |
getAllSupplier("main-content");
|
|
|
99 |
}
|
|
|
100 |
);
|
|
|
101 |
});
|
|
|
102 |
|
| 32390 |
amit.gupta |
103 |
$(document).on('click', ".taxation", function () {
|
|
|
104 |
loadTaxation("main-content");
|
|
|
105 |
});
|
| 28300 |
tejbeer |
106 |
|
|
|
107 |
|
| 32390 |
amit.gupta |
108 |
$(document).on('click', ".create-warehouse", function () {
|
|
|
109 |
loadCreateWarehouse("main-content");
|
|
|
110 |
});
|
| 28300 |
tejbeer |
111 |
|
| 32390 |
amit.gupta |
112 |
$(document).on('click', ".warehouses", function () {
|
|
|
113 |
loadWarehouses("main-content");
|
|
|
114 |
});
|
| 28300 |
tejbeer |
115 |
|
| 32390 |
amit.gupta |
116 |
$(document).on('click', ".instruction-items", function () {
|
|
|
117 |
getAuthorisedWarehouses(function (warehouseId) {
|
|
|
118 |
loadInstructionItems(warehouseId, "main-content");
|
|
|
119 |
});
|
|
|
120 |
});
|
|
|
121 |
$(document).on('click', ".supplier-inactive", function () {
|
|
|
122 |
getAllInActiveSupplier("main-content");
|
|
|
123 |
});
|
| 28300 |
tejbeer |
124 |
|
| 32390 |
amit.gupta |
125 |
$(document).on('click', ".supplier", function () {
|
|
|
126 |
getAllSupplier("main-content");
|
|
|
127 |
});
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
$(document).on('click', ".add-remove-warehouse", function () {
|
|
|
131 |
loadAddRemoveWarehouse("main-content");
|
|
|
132 |
});
|
|
|
133 |
|
|
|
134 |
$(document).on('click', "#warehouses-paginated .next", function () {
|
|
|
135 |
loadPaginatedNextItems('/getPaginatedWarehouses', null, 'warehouses-paginated', 'warehouses-table', null);
|
|
|
136 |
$(this).blur();
|
|
|
137 |
});
|
|
|
138 |
|
|
|
139 |
$(document).on('click', "#warehouses-paginated .previous", function () {
|
|
|
140 |
loadPaginatedPreviousItems('/getPaginatedWarehouses', null, 'warehouses-paginated', 'warehouses-table', null);
|
|
|
141 |
$(this).blur();
|
|
|
142 |
});
|
|
|
143 |
|
|
|
144 |
$(document).on('click', ".add-remove-warehouse-button", function () {
|
|
|
145 |
var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
|
|
|
146 |
var warehouseIds = $('#user-warehouses').val();
|
|
|
147 |
addRemoveWarehouses("main-content", emailIdOrMobileNumber, warehouseIds);
|
|
|
148 |
});
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
$(document).on('click', "#instructionItemButton", function () {
|
|
|
152 |
var warehouseId = $("#warehouseId").val();
|
|
|
153 |
var userId = $("#instructionItemModel .userId").val();
|
|
|
154 |
var itemIdQuantityMap = {};
|
|
|
155 |
$("#instructionItemsContainer .instruction-item-item-id-quantity").each(function () {
|
|
|
156 |
var $itemIdQuantity = $(this);
|
|
|
157 |
var itemId = $itemIdQuantity.find('.itemId').val();
|
|
|
158 |
console.log('itemId : ' + itemId);
|
|
|
159 |
var quantity = $itemIdQuantity.find('.quantity').val();
|
| 32551 |
amit.gupta |
160 |
if (quantity === null || quantity <= 0) {
|
| 32390 |
amit.gupta |
161 |
quantity = 1;
|
|
|
162 |
}
|
|
|
163 |
console.log('quantity : ' + quantity);
|
|
|
164 |
itemIdQuantityMap[itemId] = quantity;
|
|
|
165 |
});
|
|
|
166 |
submitInstructionItem(warehouseId, userId, itemIdQuantityMap);
|
|
|
167 |
return false;
|
|
|
168 |
});
|
|
|
169 |
|
| 23783 |
ashik.ali |
170 |
});
|
|
|
171 |
|
| 28300 |
tejbeer |
172 |
function configureUserWarehousesDropDown() {
|
| 32390 |
amit.gupta |
173 |
$(document).ready(function () {
|
|
|
174 |
$('#user-warehouses').multiselect({
|
|
|
175 |
includeSelectAllOption: true,
|
|
|
176 |
maxHeight: 200,
|
|
|
177 |
buttonWidth: '280px',
|
|
|
178 |
numberDisplayed: 1,
|
|
|
179 |
nonSelectedText: 'Warehouses',
|
|
|
180 |
nSelectedText: ' - Warehouses Selected',
|
|
|
181 |
allSelectedText: 'All Warehouses Selected',
|
|
|
182 |
enableFiltering: true
|
|
|
183 |
});
|
|
|
184 |
});
|
| 23882 |
ashik.ali |
185 |
}
|
|
|
186 |
|
| 28300 |
tejbeer |
187 |
function instructionItemDialog() {
|
| 32390 |
amit.gupta |
188 |
var warehouseId = $('#admin-warehouses').val();
|
|
|
189 |
var warehouseName = $('#admin-warehouses option:selected').text();
|
|
|
190 |
var itemIdItemDescriptionDiv = '<div>';
|
|
|
191 |
$("#warehouse-instruction-items option:selected").each(function () {
|
|
|
192 |
console.log(this);
|
|
|
193 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '<div class="row instruction-item-item-id-quantity">';
|
|
|
194 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '<div class="col-lg-6">';
|
|
|
195 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '<input class="itemId" hidden value="' + this.value + '"/>';
|
|
|
196 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '<p class="form-control">' + this.text + '</p>';
|
|
|
197 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '</div>';
|
|
|
198 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '<div class="col-lg-2">';
|
|
|
199 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '<input type="text" class="form-control quantity" placeholder="Quantity" />';
|
|
|
200 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '</div>';
|
|
|
201 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '</div>';
|
|
|
202 |
});
|
|
|
203 |
itemIdItemDescriptionDiv = itemIdItemDescriptionDiv + '</div>';
|
| 23882 |
ashik.ali |
204 |
|
| 32390 |
amit.gupta |
205 |
var userId = $('#fofo-users').val();
|
|
|
206 |
var userEmailId = $('#fofo-users option:selected').text();
|
| 23882 |
ashik.ali |
207 |
|
| 32390 |
amit.gupta |
208 |
console.log("warehouseId : " + warehouseId);
|
|
|
209 |
console.log("warehouseName : " + warehouseName);
|
|
|
210 |
console.log("userId : " + userId);
|
|
|
211 |
console.log("userEmailId : " + userEmailId);
|
| 28300 |
tejbeer |
212 |
|
| 32390 |
amit.gupta |
213 |
$("#instructionItemModel .warehouseId").val(warehouseId);
|
|
|
214 |
$("#instructionItemModel .userId").val(userId);
|
| 28300 |
tejbeer |
215 |
|
| 32390 |
amit.gupta |
216 |
//$(".modal-body .warehouseInformation>span").text(warehouseName);
|
|
|
217 |
$(".modal-body .userInformation>span").text(userEmailId);
|
|
|
218 |
$("#instructionItemsContainer").empty();
|
|
|
219 |
$("#instructionItemsContainer").html(itemIdItemDescriptionDiv);
|
| 28300 |
tejbeer |
220 |
|
| 23882 |
ashik.ali |
221 |
}
|
|
|
222 |
|
| 28300 |
tejbeer |
223 |
function submitInstructionItem(warehouseId, userId, itemIdQuantityMap) {
|
| 32390 |
amit.gupta |
224 |
var postData = JSON.stringify({
|
|
|
225 |
"warehouseId": parseInt(warehouseId),
|
|
|
226 |
"userId": userId,
|
|
|
227 |
"itemIdQuantityMap": itemIdQuantityMap
|
|
|
228 |
});
|
|
|
229 |
doPostAjaxRequestWithJsonHandler(context + "/instructionItem", postData, function (response) {
|
|
|
230 |
$('#main-content').html(response);
|
| 32549 |
tejbeer |
231 |
alert("Instruction created successfully");
|
| 32390 |
amit.gupta |
232 |
});
|
| 23882 |
ashik.ali |
233 |
}
|
|
|
234 |
|
| 28300 |
tejbeer |
235 |
function configureWarehouseInstructionItemsDropDown() {
|
| 32390 |
amit.gupta |
236 |
$(document).ready(function () {
|
|
|
237 |
$('#warehouse-instruction-items').multiselect({
|
|
|
238 |
multiple: true,
|
|
|
239 |
includeSelectAllOption: true,
|
|
|
240 |
maxHeight: 200,
|
|
|
241 |
buttonWidth: '200px',
|
|
|
242 |
numberDisplayed: 1,
|
|
|
243 |
nonSelectedText: 'Items',
|
|
|
244 |
nSelectedText: ' - Items Selected',
|
|
|
245 |
allSelectedText: 'All Items Selected',
|
|
|
246 |
enableFiltering: true
|
|
|
247 |
});
|
|
|
248 |
});
|
| 23882 |
ashik.ali |
249 |
}
|
|
|
250 |
|
| 28300 |
tejbeer |
251 |
function configureWarehousesDropDown() {
|
| 32390 |
amit.gupta |
252 |
$(document).ready(function () {
|
|
|
253 |
$('#admin-warehouses').multiselect({
|
|
|
254 |
multiple: false,
|
|
|
255 |
includeSelectAllOption: true,
|
|
|
256 |
maxHeight: 200,
|
|
|
257 |
buttonWidth: '200px',
|
|
|
258 |
numberDisplayed: 1,
|
|
|
259 |
nonSelectedText: 'Warehouses',
|
|
|
260 |
nSelectedText: ' - Warehouses Selected',
|
|
|
261 |
allSelectedText: 'All Warehouses Selected',
|
|
|
262 |
enableFiltering: true
|
|
|
263 |
});
|
|
|
264 |
});
|
| 23882 |
ashik.ali |
265 |
}
|
|
|
266 |
|
| 28300 |
tejbeer |
267 |
function loadCreateWarehouse(domId) {
|
| 32390 |
amit.gupta |
268 |
doGetAjaxRequestHandler(context + "/createWarehouse", function (response) {
|
| 32549 |
tejbeer |
269 |
loadMainContent(response);
|
| 32390 |
amit.gupta |
270 |
});
|
| 23783 |
ashik.ali |
271 |
}
|
|
|
272 |
|
| 28493 |
tejbeer |
273 |
function loadTaxation(domId) {
|
| 32390 |
amit.gupta |
274 |
doGetAjaxRequestHandler(context + "/createTaxation", function (response) {
|
| 32549 |
tejbeer |
275 |
loadMainContent(response);
|
| 32390 |
amit.gupta |
276 |
});
|
| 28493 |
tejbeer |
277 |
}
|
|
|
278 |
|
| 28300 |
tejbeer |
279 |
function loadWarehouses(domId) {
|
| 32390 |
amit.gupta |
280 |
doGetAjaxRequestHandler(context + "/getWarehouses", function (response) {
|
|
|
281 |
$('#' + domId).html(response);
|
|
|
282 |
});
|
| 23783 |
ashik.ali |
283 |
}
|
|
|
284 |
|
| 28300 |
tejbeer |
285 |
function loadWarehouseInstructionItemsByWarehouseId(domId, warehouseId) {
|
| 32390 |
amit.gupta |
286 |
doGetAjaxRequestHandler(context + "/getInstructionItemsByWarehouseId?warehouseId=" + warehouseId, function (response) {
|
|
|
287 |
$('#' + domId).html(response);
|
|
|
288 |
configureWarehouseInstructionItemsDropDown();
|
|
|
289 |
});
|
| 23882 |
ashik.ali |
290 |
}
|
|
|
291 |
|
| 28300 |
tejbeer |
292 |
function loadInstructionItems(warehouseId, domId) {
|
| 32390 |
amit.gupta |
293 |
doGetAjaxRequestHandler(context + "/getInstructionItems/" + warehouseId, function (response) {
|
|
|
294 |
$('#' + domId).html(response);
|
|
|
295 |
});
|
| 23882 |
ashik.ali |
296 |
}
|
|
|
297 |
|
| 28300 |
tejbeer |
298 |
function loadAddRemoveWarehouse(domId) {
|
| 32390 |
amit.gupta |
299 |
doGetAjaxRequestHandler(context + "/getAddRemoveWarehouse", function (response) {
|
|
|
300 |
$('#' + domId).html(response);
|
|
|
301 |
});
|
| 23882 |
ashik.ali |
302 |
}
|
|
|
303 |
|
| 28300 |
tejbeer |
304 |
function getAllSupplier(domId) {
|
| 32390 |
amit.gupta |
305 |
doGetAjaxRequestHandler(context + "/getAllSupplier", function (response) {
|
|
|
306 |
$('#' + domId).html(response);
|
|
|
307 |
});
|
| 28300 |
tejbeer |
308 |
}
|
|
|
309 |
|
|
|
310 |
function getAllInActiveSupplier(domId) {
|
| 32390 |
amit.gupta |
311 |
doGetAjaxRequestHandler(context + "/getAllInActiveSupplier", function (response) {
|
|
|
312 |
$('#' + domId).html(response);
|
|
|
313 |
});
|
| 28300 |
tejbeer |
314 |
}
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
function addRemoveWarehouses(domId, emailIdOrMobileNumber, warehouseIds) {
|
| 32551 |
amit.gupta |
318 |
if (confirm("Are you sure you want to add or remove warehouses!")) {
|
| 32390 |
amit.gupta |
319 |
doPostAjaxRequestWithJsonHandler(context + "/addRemoveWarehouses?emailIdOrMobileNumber=" + emailIdOrMobileNumber, JSON.stringify(warehouseIds), function (response) {
|
|
|
320 |
$('#' + domId).html(response);
|
|
|
321 |
$('#emailIdOrMobileNumber').val(emailIdOrMobileNumber);
|
|
|
322 |
getWarehousesByEmailIdOrMobileNumber();
|
|
|
323 |
});
|
|
|
324 |
}
|
| 23882 |
ashik.ali |
325 |
}
|
|
|
326 |
|
| 28300 |
tejbeer |
327 |
function getWarehousesByEmailIdOrMobileNumber() {
|
| 32390 |
amit.gupta |
328 |
var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
|
|
|
329 |
console.log("emailIdOrMobileNumber = " + emailIdOrMobileNumber);
|
|
|
330 |
if (emailIdOrMobileNumber != "") {
|
|
|
331 |
loadWarehousesByEmailIdOrMobileNumber("warehouses-container", emailIdOrMobileNumber);
|
|
|
332 |
}
|
| 23882 |
ashik.ali |
333 |
}
|
|
|
334 |
|
| 28300 |
tejbeer |
335 |
function loadWarehousesByEmailIdOrMobileNumber(domId, emailIdOrMobileNumber) {
|
| 32390 |
amit.gupta |
336 |
doGetAjaxRequestHandler(context + "/userWarehouses?emailIdOrMobileNumber=" + emailIdOrMobileNumber, function (response) {
|
|
|
337 |
$('#' + domId).html(response);
|
|
|
338 |
configureUserWarehousesDropDown();
|
|
|
339 |
});
|
| 23882 |
ashik.ali |
340 |
}
|
|
|
341 |
|
| 32390 |
amit.gupta |
342 |
$(document).on('click', "#new-supplier", function () {
|
| 28493 |
tejbeer |
343 |
|
| 32390 |
amit.gupta |
344 |
doGetAjaxRequestHandler(context + "/getCreateNewSupplier", function (response) {
|
|
|
345 |
$("#main-content").html(response);
|
| 28493 |
tejbeer |
346 |
|
| 32390 |
amit.gupta |
347 |
});
|
| 28493 |
tejbeer |
348 |
|
|
|
349 |
|
| 32390 |
amit.gupta |
350 |
});
|
| 28493 |
tejbeer |
351 |
|
| 32390 |
amit.gupta |
352 |
|
| 34329 |
aman.kumar |
353 |
$(document).on('change', '#warehouseCheckbox', function () {
|
| 32549 |
tejbeer |
354 |
let warehouseContainer = document.getElementById("warehouseId");
|
|
|
355 |
warehouseContainer.disabled = !this.checked;
|
|
|
356 |
});
|
| 32390 |
amit.gupta |
357 |
$(document).on('click', ".create-supplier-submit", function () {
|
|
|
358 |
console.log("hello");
|
|
|
359 |
var name = $("form#new-supplier-create-form input[name=inputName]").val();
|
|
|
360 |
if (name === "") {
|
|
|
361 |
alert("Name is required");
|
|
|
362 |
return false;
|
|
|
363 |
}
|
| 32565 |
tejbeer |
364 |
var phone = $("form#new-supplier-create-form input[name=CheinputPhone]").val();
|
| 32390 |
amit.gupta |
365 |
if (phone === "") {
|
|
|
366 |
alert("phone is required");
|
|
|
367 |
return false;
|
|
|
368 |
}
|
|
|
369 |
var gst = $("form#new-supplier-create-form input[name=inputGst]").val();
|
|
|
370 |
if (gst === "") {
|
|
|
371 |
alert("gst is required");
|
|
|
372 |
return false;
|
|
|
373 |
}
|
|
|
374 |
var pan = $("form#new-supplier-create-form input[name=inputPan]").val();
|
|
|
375 |
if (pan === "") {
|
|
|
376 |
alert("Pan is required");
|
|
|
377 |
return false;
|
|
|
378 |
}
|
|
|
379 |
var headName = $("form#new-supplier-create-form input[name=inputHeadName]").val();
|
|
|
380 |
if (headName === "") {
|
|
|
381 |
alert("Head Name is required");
|
|
|
382 |
return false;
|
|
|
383 |
}
|
| 32549 |
tejbeer |
384 |
var headDesign = $("form#new-supplier-create-form input[name=inputHeadDesign]").val();
|
| 32390 |
amit.gupta |
385 |
if (headDesign === "") {
|
|
|
386 |
alert("Head Designation is required");
|
|
|
387 |
return false;
|
|
|
388 |
}
|
|
|
389 |
|
|
|
390 |
var headEmail = $("form#new-supplier-create-form input[name=inputHeadEmail]").val();
|
|
|
391 |
if (headEmail === "") {
|
|
|
392 |
alert("Head Email is required");
|
|
|
393 |
return false;
|
|
|
394 |
}
|
|
|
395 |
var contactPerson = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
|
|
|
396 |
if (contactPerson === "") {
|
|
|
397 |
alert("Contact Person is required");
|
|
|
398 |
return false;
|
|
|
399 |
}
|
| 32549 |
tejbeer |
400 |
var contactPhone = $("form#new-supplier-create-form input[name=inputContactPhone]").val();
|
| 34329 |
aman.kumar |
401 |
if (contactPhone === "") {
|
|
|
402 |
alert("Contact Phone is required");
|
|
|
403 |
return false;
|
|
|
404 |
}
|
| 32390 |
amit.gupta |
405 |
var registeredAddress = $("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
|
|
|
406 |
if (registeredAddress === "") {
|
|
|
407 |
alert("Registered Address is required");
|
|
|
408 |
return false;
|
|
|
409 |
}
|
|
|
410 |
var communicationAddress = $("form#new-supplier-create-form input[name=inputCommunicationAddress]").val();
|
|
|
411 |
|
|
|
412 |
if (communicationAddress === "") {
|
|
|
413 |
alert("Communication Address is required");
|
|
|
414 |
return false;
|
|
|
415 |
}
|
|
|
416 |
var warehouseId = $("#warehouseLocation").val();
|
|
|
417 |
if (warehouseId === "") {
|
|
|
418 |
alert("Warehouse Location is required");
|
|
|
419 |
return false;
|
|
|
420 |
}
|
| 32549 |
tejbeer |
421 |
var warehouseName = $("#warehouseId").val();
|
| 34329 |
aman.kumar |
422 |
if (warehouseName === "") {
|
|
|
423 |
alert("warehouseName is required");
|
|
|
424 |
return false;
|
|
|
425 |
}
|
| 32390 |
amit.gupta |
426 |
|
|
|
427 |
var state = $("#stateId").val();
|
|
|
428 |
if (state === "") {
|
|
|
429 |
alert("state is required");
|
|
|
430 |
return false;
|
|
|
431 |
}
|
|
|
432 |
var pOValidityLimit = $("form#new-supplier-create-form input[name=inputPOValidityLimit]").val();
|
|
|
433 |
if (pOValidityLimit === "") {
|
|
|
434 |
alert("pOValidityLimit is required");
|
|
|
435 |
return false;
|
|
|
436 |
}
|
|
|
437 |
var termConditions = $("form#new-supplier-create-form input[name=inputTermConditions]").val();
|
|
|
438 |
if (termConditions === "") {
|
|
|
439 |
alert("termConditions is required");
|
|
|
440 |
return false;
|
|
|
441 |
}
|
| 32549 |
tejbeer |
442 |
var internalWarehouse = $("#internalWarehouseId").val();
|
| 34329 |
aman.kumar |
443 |
if (internalWarehouse === "") {
|
|
|
444 |
alert("internalWarehouse is required");
|
|
|
445 |
return false;
|
|
|
446 |
}
|
| 32390 |
amit.gupta |
447 |
|
| 32549 |
tejbeer |
448 |
var json = newSupplierCreateObjectJson();
|
| 32390 |
amit.gupta |
449 |
|
|
|
450 |
|
| 32549 |
tejbeer |
451 |
if (confirm("Are you sure you want to create supplier")) {
|
| 32390 |
amit.gupta |
452 |
doAjaxRequestWithJsonHandler(context + "/submitNewSupplier", "POST", json, function (response) {
|
| 34329 |
aman.kumar |
453 |
if (response) {
|
| 32549 |
tejbeer |
454 |
alert("Supplier created successfully. Its inactive as of now, pls check inactive section");
|
| 32390 |
amit.gupta |
455 |
|
|
|
456 |
$("#main-content").html(response);
|
|
|
457 |
}
|
|
|
458 |
}
|
| 32549 |
tejbeer |
459 |
);
|
| 32390 |
amit.gupta |
460 |
}
|
|
|
461 |
});
|
|
|
462 |
|
| 32549 |
tejbeer |
463 |
function newSupplierCreateObjectJson() {
|
| 32551 |
amit.gupta |
464 |
let newSupplierCreateObject = {};
|
| 28493 |
tejbeer |
465 |
|
| 32549 |
tejbeer |
466 |
|
| 32390 |
amit.gupta |
467 |
newSupplierCreateObject['name'] = $("form#new-supplier-create-form input[name=inputName]").val();
|
|
|
468 |
|
| 28493 |
tejbeer |
469 |
newSupplierCreateObject['phone'] = $("form#new-supplier-create-form input[name=inputPhone]").val();
|
|
|
470 |
newSupplierCreateObject['gst'] = $("form#new-supplier-create-form input[name=inputGst]").val();
|
|
|
471 |
newSupplierCreateObject['pan'] = $("form#new-supplier-create-form input[name=inputPan]").val();
|
|
|
472 |
newSupplierCreateObject['fax'] = $("form#new-supplier-create-form input[name=inputFax]").val();
|
|
|
473 |
newSupplierCreateObject['headName'] = $("form#new-supplier-create-form input[name=inputHeadName]").val();
|
|
|
474 |
newSupplierCreateObject['headDesign'] = $("form#new-supplier-create-form input[name=inputHeadDesig]").val();
|
|
|
475 |
newSupplierCreateObject['headEmail'] = $("form#new-supplier-create-form input[name=inputHeadEmail]").val();
|
|
|
476 |
newSupplierCreateObject['contactPerson'] = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
|
| 32549 |
tejbeer |
477 |
newSupplierCreateObject['contactPhone'] = $("form#new-supplier-create-form input[name=inputContactPhone]").val();
|
| 28493 |
tejbeer |
478 |
newSupplierCreateObject['contactEmail'] = $("form#new-supplier-create-form input[name=inputContactEmail]").val();
|
|
|
479 |
newSupplierCreateObject['contactFax'] = $("form#new-supplier-create-form input[name=inputContactFax]").val();
|
|
|
480 |
newSupplierCreateObject['registeredAddress'] = $("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
|
|
|
481 |
newSupplierCreateObject['communicationAddress'] = $("form#new-supplier-create-form input[name=inputCommunicationAddress]").val();
|
|
|
482 |
newSupplierCreateObject['termConditions'] = $("form#new-supplier-create-form input[name=inputTermConditions]").val();
|
|
|
483 |
newSupplierCreateObject['warehouseId'] = $("#warehouseLocation").val();
|
| 32549 |
tejbeer |
484 |
newSupplierCreateObject['internalWarehouseId'] = $("#internalWarehouse").val();
|
| 28493 |
tejbeer |
485 |
newSupplierCreateObject['state'] = $("#stateId").val();
|
|
|
486 |
newSupplierCreateObject['pOValidityLimit'] = $("form#new-supplier-create-form input[name=inputPOValidityLimit]").val();
|
|
|
487 |
|
|
|
488 |
|
| 32390 |
amit.gupta |
489 |
return JSON.stringify(newSupplierCreateObject);
|
| 32549 |
tejbeer |
490 |
}
|