| 28102 |
tejbeer |
1 |
$(function() {
|
|
|
2 |
$(document).on('click', ".price-circular", function() {
|
|
|
3 |
loadPriceCircular("main-content");
|
|
|
4 |
});
|
|
|
5 |
|
|
|
6 |
$(document).on('click', ".partner-price-circular", function() {
|
|
|
7 |
loadPartnerPriceCircular("main-content");
|
|
|
8 |
});
|
|
|
9 |
|
|
|
10 |
$(document).on('change', 'select.criteria-item-brands', function() {
|
|
|
11 |
changed = true;
|
|
|
12 |
});
|
|
|
13 |
$(document).on('click', 'select.criteria-item-model-catalogids+div > button', function() {
|
|
|
14 |
if (changed) {
|
|
|
15 |
let brands = $('.criteria-item-brands').val();
|
|
|
16 |
console.log(brands);
|
|
|
17 |
$brandsContainer = $(this);
|
|
|
18 |
var url = `${context}/entity?brands=${brands.join(",")}&categoryId=3&limit=0`;
|
|
|
19 |
$select = $('.criteria-item-model-catalogids');
|
|
|
20 |
console.log($select)
|
|
|
21 |
$select.html('');
|
|
|
22 |
if (brands.length > 0) {
|
|
|
23 |
doGetAjaxRequestHandler(url, function(response) {
|
|
|
24 |
data = JSON.parse(response);
|
|
|
25 |
console.log(data)
|
|
|
26 |
for (i = 0; i < data.length; i++) {
|
|
|
27 |
$select.append(`<option value="${data[i].catalogId_i}">${data[i].title_s}</option>`);
|
|
|
28 |
}
|
|
|
29 |
$select.multiselect('rebuild');
|
|
|
30 |
});
|
|
|
31 |
} else {
|
|
|
32 |
$select.html('');
|
|
|
33 |
$select.multiselect('rebuild');
|
|
|
34 |
}
|
|
|
35 |
changed = !changed;
|
|
|
36 |
}
|
|
|
37 |
});
|
|
|
38 |
|
|
|
39 |
$(document).on('click', ".submit-circular-request", function() {
|
|
|
40 |
var brand = $("#brands").val();
|
|
|
41 |
doGetAjaxRequestHandler(context + "/priceCircularByBrand?brand=" + brand,
|
|
|
42 |
function(response) {
|
|
|
43 |
console.log(response)
|
|
|
44 |
$('.price-circular-container').html(response);
|
|
|
45 |
});
|
|
|
46 |
});
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
});
|
|
|
51 |
|
|
|
52 |
function loadPriceCircular(domId) {
|
|
|
53 |
doGetAjaxRequestHandler(context + "/priceCircular",
|
|
|
54 |
function(response) {
|
|
|
55 |
$('#' + domId).html(response);
|
|
|
56 |
});
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
function loadPartnerPriceCircular(domId) {
|
|
|
60 |
doGetAjaxRequestHandler(context + "/partnerPriceCircular",
|
|
|
61 |
function(response) {
|
|
|
62 |
$('#' + domId).html(response);
|
|
|
63 |
});
|
|
|
64 |
}
|