| 32074 |
tejbeer |
1 |
$(function() {
|
|
|
2 |
$(document).on('click', ".vendor-catalog-pricing", function() {
|
|
|
3 |
loadCreateVendorCatalogPricing("main-content");
|
|
|
4 |
});
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
$(document).on('click', ".vendor-catalog-pricing-request", function() {
|
|
|
8 |
loadVendorCatalogPricingRequests("main-content");
|
|
|
9 |
});
|
|
|
10 |
|
|
|
11 |
$(document).on('click', ".vendor-price-circular", function() {
|
|
|
12 |
loadVendorPriceCircular("main-content");
|
|
|
13 |
});
|
|
|
14 |
|
| 33465 |
ranu |
15 |
$(document).on('click', ".create-bulk-vendor-catalog-pricing", function () {
|
|
|
16 |
createBulkPricing("main-content");
|
|
|
17 |
});
|
| 32074 |
tejbeer |
18 |
|
| 33465 |
ranu |
19 |
|
| 32074 |
tejbeer |
20 |
$(document).on('click', ".vendorcatalogpricing", function() {
|
| 32676 |
shampa |
21 |
if (typeof currentModel === 'undefined' || currentModel === null || currentModel === '') {
|
|
|
22 |
alert('Please search for the right model');
|
|
|
23 |
} else {
|
|
|
24 |
doGetAjaxRequestHandler(context + "/getVendorCatalogPricingByModel?catalogId=" + currentModel, function(response) {
|
|
|
25 |
$('.vendorCatatlogPricingView').html(response);
|
|
|
26 |
});
|
|
|
27 |
}
|
|
|
28 |
});
|
| 32074 |
tejbeer |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
$(document).on('click', ".createvendorcatalogpricing", function() {
|
|
|
34 |
|
|
|
35 |
var row = $(this).closest("tr");
|
|
|
36 |
|
|
|
37 |
var vendorId = $(this).data('vendorid');
|
|
|
38 |
|
|
|
39 |
console.log(vendorId)
|
|
|
40 |
|
|
|
41 |
var transferPrice = $(row).find(".transferp").val();
|
|
|
42 |
var dealerPrice = $(row).find(".dealerp").val();
|
|
|
43 |
var mop = $(row).find(".mopp").val();
|
|
|
44 |
var effectedOn = $(row).find(".effectedDate").val();
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
if (transferPrice === "" && dealerPrice === "" && mop === "" && effectedOn === "") {
|
|
|
48 |
alert("Field can't be empty");
|
|
|
49 |
return;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
if (transferPrice === "") {
|
|
|
54 |
alert("Transfer Price is required");
|
|
|
55 |
return;
|
|
|
56 |
}
|
|
|
57 |
if (dealerPrice === "") {
|
|
|
58 |
alert("Dealer Price is required");
|
|
|
59 |
return;
|
|
|
60 |
}
|
|
|
61 |
if (mop === "") {
|
|
|
62 |
alert("Mop is required");
|
|
|
63 |
return;
|
|
|
64 |
}
|
|
|
65 |
if (effectedOn === "") {
|
|
|
66 |
alert("EffectedOn Date is required");
|
|
|
67 |
return;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
var vendorCatalogPricing = {};
|
|
|
71 |
vendorCatalogPricing['vendorId'] = vendorId;
|
|
|
72 |
vendorCatalogPricing['catalogId'] = currentModel
|
|
|
73 |
vendorCatalogPricing['tp'] = transferPrice
|
|
|
74 |
vendorCatalogPricing['dp'] = dealerPrice
|
|
|
75 |
vendorCatalogPricing['mop'] = mop
|
|
|
76 |
vendorCatalogPricing['effectedOn'] = effectedOn
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
console.log(JSON.stringify(vendorCatalogPricing))
|
|
|
80 |
doAjaxRequestWithJsonHandler(context + "/createVendorCatalogPricing", 'POST', JSON.stringify(vendorCatalogPricing), function(response) {
|
|
|
81 |
if (response == "true") {
|
|
|
82 |
alert("Successfully Done")
|
|
|
83 |
$(".vendorcatalogpricing").click();
|
|
|
84 |
|
|
|
85 |
}
|
|
|
86 |
});
|
|
|
87 |
|
|
|
88 |
});
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
$(document).on('click', ".createnewvendorcatalogpricing", function() {
|
|
|
92 |
|
|
|
93 |
var vendorId = $('#vendorId').val();
|
|
|
94 |
|
|
|
95 |
var transferPrice = $('#transferPrice').val();
|
|
|
96 |
var dealerPrice = $('#dealerPrice').val();
|
|
|
97 |
var mop = $('#mop').val();
|
|
|
98 |
var effectedOn = $('#effectedOn').val();
|
|
|
99 |
|
|
|
100 |
if (transferPrice === "" && dealerPrice === "" && mop === "" && effectedOn === "") {
|
|
|
101 |
alert("Field can't be empty");
|
|
|
102 |
return;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
if (transferPrice === "") {
|
|
|
107 |
alert("Transfer Price is required");
|
|
|
108 |
return;
|
|
|
109 |
}
|
|
|
110 |
if (dealerPrice === "") {
|
|
|
111 |
alert("Dealer Price is required");
|
|
|
112 |
return;
|
|
|
113 |
}
|
|
|
114 |
if (mop === "") {
|
|
|
115 |
alert("Mop is required");
|
|
|
116 |
return;
|
|
|
117 |
}
|
|
|
118 |
if (effectedOn === "") {
|
|
|
119 |
alert("EffectedOn Date is required");
|
|
|
120 |
return;
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
var vendorCatalogPricing = {};
|
|
|
124 |
vendorCatalogPricing['vendorId'] = vendorId;
|
|
|
125 |
vendorCatalogPricing['catalogId'] = currentModel
|
|
|
126 |
vendorCatalogPricing['tp'] = transferPrice
|
|
|
127 |
vendorCatalogPricing['dp'] = dealerPrice
|
|
|
128 |
vendorCatalogPricing['mop'] = mop
|
|
|
129 |
vendorCatalogPricing['effectedOn'] = effectedOn
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
doAjaxRequestWithJsonHandler(context + "/createVendorCatalogPricing", 'POST', JSON.stringify(vendorCatalogPricing), function(response) {
|
|
|
133 |
if (response == "true") {
|
|
|
134 |
alert("Successfully Done")
|
|
|
135 |
$(".vendorcatalogpricing").click();
|
|
|
136 |
loadCreateVendorCatalogPricing("main-content")
|
|
|
137 |
}
|
|
|
138 |
});
|
|
|
139 |
|
|
|
140 |
});
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
$(document).on('click', ".vendor-pricing-approve-request-send", function() {
|
|
|
144 |
var row = $(this).closest("tr");
|
|
|
145 |
console.log(row);
|
|
|
146 |
var rowIndex = $(this).closest('tr').prevAll().length;
|
|
|
147 |
console.log(rowIndex);
|
|
|
148 |
var id = $(this).data('id');
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
if (confirm("Are you sure you want to approve the request") == true) {
|
|
|
152 |
doPostAjaxRequestHandler(context + "/verifyVendorCatalogPricingRequest?id=" + id + "&status=" + 'APPROVED',
|
|
|
153 |
function(response) {
|
|
|
154 |
|
|
|
155 |
console.log(response);
|
|
|
156 |
if (response == 'true') {
|
|
|
157 |
alert("successfully approved");
|
|
|
158 |
loadVendorCatalogPricingRequests("main-content")
|
|
|
159 |
}
|
|
|
160 |
});
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
});
|
|
|
166 |
|
|
|
167 |
|
|
|
168 |
$(document).on('click', ".vendor-pricing-rejected-request-send", function() {
|
|
|
169 |
var row = $(this).closest("tr");
|
|
|
170 |
console.log(row);
|
|
|
171 |
var rowIndex = $(this).closest('tr').prevAll().length;
|
|
|
172 |
console.log(rowIndex);
|
|
|
173 |
|
|
|
174 |
var id = $(this).data('id');
|
|
|
175 |
|
|
|
176 |
if (confirm("Are you sure you want to rejected the request") == true) {
|
|
|
177 |
doPostAjaxRequestHandler(context + "/verifyVendorCatalogPricingRequest?id=" + id + "&status=" + 'REJECTED',
|
|
|
178 |
function(response) {
|
|
|
179 |
|
|
|
180 |
console.log(response);
|
|
|
181 |
if (response == 'true') {
|
|
|
182 |
alert("successfully rejected");
|
|
|
183 |
loadVendorCatalogPricingRequests("main-content")
|
|
|
184 |
}
|
|
|
185 |
});
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
});
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
$(document).on('click', ".vendorpricecircular", function() {
|
|
|
195 |
|
|
|
196 |
var vendorId = $('#vendorId').val();
|
|
|
197 |
var effectedDate = $('#effectedDate').val();
|
|
|
198 |
|
|
|
199 |
if (vendorId === "" && effectedDate === "") {
|
|
|
200 |
alert("Field can't be empty");
|
|
|
201 |
return;
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
|
| 33183 |
shampa |
205 |
// if (vendorId === "") {
|
|
|
206 |
// alert("Please select the vendor");
|
|
|
207 |
// return;
|
|
|
208 |
// }
|
| 32074 |
tejbeer |
209 |
if (effectedDate === "") {
|
|
|
210 |
alert("Please choose date");
|
|
|
211 |
return;
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
doGetAjaxRequestHandler(context + "/getVendorPriceCircular?vendorId=" + vendorId + "&effectedDate=" + effectedDate, function(response) {
|
|
|
215 |
$('.vendorpricecircularview').html(response);
|
|
|
216 |
|
|
|
217 |
});
|
|
|
218 |
|
|
|
219 |
});
|
| 33183 |
shampa |
220 |
|
|
|
221 |
$(document).on('click', '.download-price-circular-report', function() {
|
|
|
222 |
var startDate = $("#effectedDate").val();
|
|
|
223 |
if (startDate == "" || startDate == undefined) {
|
|
|
224 |
alert("start date is not be empty!!");
|
|
|
225 |
return;
|
|
|
226 |
}
|
|
|
227 |
|
|
|
228 |
let endPoint = `${context}/downloadPriceCircularReport?startDate=${startDate}`;
|
|
|
229 |
|
|
|
230 |
window.location.href = endPoint;
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
});
|
| 32074 |
tejbeer |
234 |
});
|
|
|
235 |
|
|
|
236 |
function loadCreateVendorCatalogPricing(domId) {
|
|
|
237 |
doGetAjaxRequestHandler(context + "/vendorCatalogPricing", function(response) {
|
|
|
238 |
$('#' + domId).html(response);
|
|
|
239 |
});
|
|
|
240 |
}
|
|
|
241 |
|
|
|
242 |
function loadVendorCatalogPricingRequests(domId) {
|
|
|
243 |
doGetAjaxRequestHandler(context + "/vendorCatalogPricingRequests", function(response) {
|
|
|
244 |
$('#' + domId).html(response);
|
|
|
245 |
});
|
|
|
246 |
}
|
|
|
247 |
|
|
|
248 |
function loadVendorPriceCircular(domId) {
|
|
|
249 |
doGetAjaxRequestHandler(context + "/vendorPriceCircular", function(response) {
|
|
|
250 |
$('#' + domId).html(response);
|
|
|
251 |
});
|
| 33465 |
ranu |
252 |
}
|
|
|
253 |
|
|
|
254 |
function createBulkPricing(domId) {
|
|
|
255 |
doGetAjaxRequestHandler(context + "/createBulkPricing",
|
|
|
256 |
function (response) {
|
|
|
257 |
$('#' + domId).html(response);
|
|
|
258 |
});
|
| 32074 |
tejbeer |
259 |
}
|