| Line 2... |
Line 2... |
| 2 |
doGetAjaxRequestHandler(`${context}/pur-sale-ratio-panel`, function (response) {
|
2 |
doGetAjaxRequestHandler(`${context}/pur-sale-ratio-panel`, function (response) {
|
| 3 |
$('#main-content').html(response);
|
3 |
$('#main-content').html(response);
|
| 4 |
});
|
4 |
});
|
| 5 |
});
|
5 |
});
|
| 6 |
|
6 |
|
| 7 |
$(document).on('change', 'select[name="brand"]', function () {
|
7 |
$(document).on('change', 'input[name="endDate"], input[name="startDate"], select[name="brand"]', function () {
|
| - |
|
8 |
console.log("change clicked...");
|
| 8 |
let startDate = $('input[name="startDate"]').val();
|
9 |
let startDate = $('input[name="startDate"]').val();
|
| 9 |
let endDate = $('input[name="endDate"]').val();
|
10 |
let endDate = $('input[name="endDate"]').val();
|
| 10 |
let brand = $(this).val();
|
11 |
let brand = $('select[name="brand"]').val();
|
| - |
|
12 |
let supplierId = $('select[name="supplier"]').val();
|
| - |
|
13 |
|
| - |
|
14 |
if (!startDate) {
|
| - |
|
15 |
alert("Please select start date");
|
| - |
|
16 |
return;
|
| - |
|
17 |
}
|
| - |
|
18 |
if (!endDate) {
|
| - |
|
19 |
alert("Please select end date");
|
| - |
|
20 |
return;
|
| - |
|
21 |
}
|
| - |
|
22 |
if (!brand) {
|
| - |
|
23 |
alert("Please select brand");
|
| - |
|
24 |
return;
|
| - |
|
25 |
}
|
| - |
|
26 |
|
| - |
|
27 |
if (!supplierId) {
|
| 11 |
let supplierId = 0;
|
28 |
supplierId = 0;
|
| - |
|
29 |
} else {
|
| - |
|
30 |
supplierId = supplierId;
|
| - |
|
31 |
}
|
| 12 |
doGetAjaxRequestHandler(`${context}/brandSuppliers?startDate=${startDate}&endDate=${endDate}&brand=${brand}`, function (response) {
|
32 |
doGetAjaxRequestHandler(`${context}/brandSuppliers?startDate=${startDate}&endDate=${endDate}&brand=${brand}&supplierId=${supplierId}`, function (response) {
|
| - |
|
33 |
if (response.hasOwnProperty('purchaseSaleQuantities') && response.purchaseSaleQuantities.length) {
|
| - |
|
34 |
createPurchaseSaleBarChart(response.purchaseSaleQuantities, startDate, endDate, brand, supplierId);
|
| - |
|
35 |
}
|
| - |
|
36 |
|
| 13 |
if (response.hasOwnProperty('brandWiseSuppliers') && response.brandWiseSuppliers.length) {
|
37 |
if (response.hasOwnProperty('brandWiseSuppliers') && response.brandWiseSuppliers.length) {
|
| 14 |
$('.suppliersList').empty();
|
38 |
$('.suppliersList').empty();
|
| 15 |
$('.suppliersList').append(`<option selected disabled>Select Supplier</option>`);
|
39 |
$('.suppliersList').append(`<option selected disabled>Select Supplier</option>`);
|
| 16 |
response.brandWiseSuppliers.forEach(function (supplier) {
|
40 |
response.brandWiseSuppliers.forEach(function (supplier) {
|
| 17 |
$('.suppliersList').append(`<option value="${supplier.supplierId}">${supplier.supplierName}</option>`);
|
41 |
$('.suppliersList').append(`<option value="${supplier.supplierId}">${supplier.supplierName}</option>`);
|
| 18 |
});
|
42 |
});
|
| 19 |
}
|
43 |
}
|
| 20 |
if (response.hasOwnProperty('purchaseSaleQuantities') && response.purchaseSaleQuantities.length) {
|
- |
|
| 21 |
createPurchaseSaleBarChart(response.purchaseSaleQuantities, startDate, endDate, brand, supplierId, false);
|
- |
|
| 22 |
}
|
- |
|
| 23 |
|
44 |
|
| 24 |
});
|
45 |
});
|
| 25 |
});
|
46 |
});
|
| 26 |
|
47 |
|
| 27 |
/*$(document).on('change', 'input[name="endDate"], input[name="startDate"], select[name="brand"], select[name="supplier"]', function () {
|
- |
|
| 28 |
console.log("change clicked...");
|
- |
|
| 29 |
let startDate = $('input[name="startDate"]').val();
|
- |
|
| 30 |
let endDate = $('input[name="endDate"]').val();
|
- |
|
| 31 |
let brand = $('select[name="brand"]').val();
|
- |
|
| 32 |
let supplierId = $('select[name="supplier"]').val();
|
- |
|
| 33 |
|
- |
|
| 34 |
if(!startDate){alert("Please select start date");return;}
|
- |
|
| 35 |
if(!endDate){alert("Please select end date");return;}
|
- |
|
| 36 |
if(!brand){alert("Please select brand");return;}
|
- |
|
| 37 |
|
- |
|
| 38 |
if(!supplierId){
|
- |
|
| 39 |
supplierId=0;
|
- |
|
| 40 |
}else {
|
- |
|
| 41 |
supplierId=supplierId;
|
- |
|
| 42 |
}
|
- |
|
| 43 |
console.log("supplierId - ", supplierId);
|
- |
|
| 44 |
// doGetAjaxRequestHandler(`${context}/brandSuppliers?startDate=${startDate}&endDate=${endDate}&brand=${brand}`, function (response) {
|
- |
|
| 45 |
// if (response.hasOwnProperty('brandWiseSuppliers') && response.brandWiseSuppliers.length) {
|
- |
|
| 46 |
// $('.suppliersList').empty();
|
- |
|
| 47 |
// $('.suppliersList').append(`<option selected disabled>Select Supplier</option>`);
|
- |
|
| 48 |
// response.brandWiseSuppliers.forEach(function (supplier) {
|
- |
|
| 49 |
// $('.suppliersList').append(`<option value="${supplier.supplierId}">${supplier.supplierName}</option>`);
|
- |
|
| 50 |
// });
|
- |
|
| 51 |
// }
|
- |
|
| 52 |
// if (response.hasOwnProperty('purchaseSaleQuantities') && response.purchaseSaleQuantities.length) {
|
- |
|
| 53 |
// createPurchaseSaleBarChart(response.purchaseSaleQuantities, startDate, endDate, brand, supplierId, false);
|
- |
|
| 54 |
// }
|
- |
|
| 55 |
//
|
- |
|
| 56 |
// });
|
- |
|
| 57 |
});*/
|
- |
|
| 58 |
|
- |
|
| 59 |
$(document).on('change', 'select[name="supplier"]', function () {
|
48 |
$(document).on('change', 'select[name="supplier"]', function () {
|
| 60 |
let startDate = $('input[name="startDate"]').val();
|
49 |
let startDate = $('input[name="startDate"]').val();
|
| 61 |
let endDate = $('input[name="endDate"]').val();
|
50 |
let endDate = $('input[name="endDate"]').val();
|
| 62 |
let brand = $('select[name="brand"]').val();
|
51 |
let brand = $('select[name="brand"]').val();
|
| 63 |
let supplierId = $(this).val();
|
52 |
let supplierId = $(this).val();
|
| 64 |
doGetAjaxRequestHandler(`${context}/pur-sale-quantity?startDate=${startDate}&endDate=${endDate}&brand=${brand}&supplierId=${supplierId}`, function (response) {
|
53 |
doGetAjaxRequestHandler(`${context}/pur-sale-quantity?startDate=${startDate}&endDate=${endDate}&brand=${brand}&supplierId=${supplierId}`, function (response) {
|
| 65 |
if (response.length) {
|
54 |
if (response.length) {
|
| 66 |
createPurchaseSaleBarChart(response, startDate, endDate, brand, supplierId, false);
|
55 |
createPurchaseSaleBarChart(response, startDate, endDate, brand, supplierId);
|
| 67 |
}
|
56 |
}
|
| 68 |
});
|
57 |
});
|
| 69 |
|
58 |
|
| 70 |
|
59 |
|
| 71 |
});
|
60 |
});
|