| 27190 |
amit.gupta |
1 |
<style>
|
| 30122 |
amit.gupta |
2 |
.btn:hover {
|
|
|
3 |
color: grey;
|
|
|
4 |
text-decoration: none;
|
|
|
5 |
}
|
| 28055 |
tejbeer |
6 |
|
| 30122 |
amit.gupta |
7 |
.btn-info:hover {
|
|
|
8 |
color: grey;
|
|
|
9 |
text-decoration: none;
|
|
|
10 |
}
|
| 27190 |
amit.gupta |
11 |
</style>
|
| 28055 |
tejbeer |
12 |
<section class="wrapper">
|
| 30122 |
amit.gupta |
13 |
<div class="row">
|
|
|
14 |
<div class="col-lg-12">
|
|
|
15 |
<h3 class="page-header">
|
|
|
16 |
<i class="icon_document_alt"></i>Catalog Item Management
|
|
|
17 |
</h3>
|
|
|
18 |
<ol class="breadcrumb">
|
|
|
19 |
<li><i class="fa fa-home"></i><a
|
|
|
20 |
href="${rc.contextPath}/dashboard">Home</a></li>
|
|
|
21 |
<li><i class="icon_document_alt"></i>PriceDrop</li>
|
|
|
22 |
<li>
|
|
|
23 |
<button type="button" data-toggle="modal"
|
|
|
24 |
class="btn btn-sm btn-primary mk_download_pricing"
|
|
|
25 |
data-target="#addPricing">Download Pricing
|
|
|
26 |
</button>
|
|
|
27 |
</li>
|
|
|
28 |
<li>
|
|
|
29 |
<button type="button" data-toggle="modal" class="btn btn-sm btn-primary"
|
|
|
30 |
data-target="#addPriceModal">
|
|
|
31 |
Add/Update Pricing
|
|
|
32 |
</button>
|
|
|
33 |
</li>
|
|
|
34 |
</ol>
|
|
|
35 |
</div>
|
|
|
36 |
</div>
|
|
|
37 |
<div class="form-group row">
|
|
|
38 |
<div class="col-lg-6">
|
|
|
39 |
<label for="typeaheaditem1">Item:</label> <input
|
|
|
40 |
placeholder="Search Item" type="text" class="form-control typeahead"
|
|
|
41 |
id="typeaheaditem1" name="Item" data-provide="typeahead"
|
|
|
42 |
autocomplete="off">
|
|
|
43 |
</div>
|
|
|
44 |
<div class="col-lg-1">
|
|
|
45 |
<div> </div>
|
|
|
46 |
<button type="button" class="btn btn-primary mk_pause_button">Active/Pause</button>
|
|
|
47 |
</div>
|
| 28055 |
tejbeer |
48 |
|
| 30122 |
amit.gupta |
49 |
<div class="col-lg-4">
|
|
|
50 |
<div> </div>
|
|
|
51 |
<button type="button" class="btn btn-primary mk_hotdeal_button">Add/Remove
|
|
|
52 |
Hotdeals
|
|
|
53 |
</button>
|
|
|
54 |
</div>
|
|
|
55 |
</div>
|
| 27190 |
amit.gupta |
56 |
</section>
|
|
|
57 |
<script type="text/javascript">
|
| 30122 |
amit.gupta |
58 |
$(document).ready(function () {
|
|
|
59 |
var start = moment().subtract(29, 'days');
|
|
|
60 |
var end = moment();
|
| 28055 |
tejbeer |
61 |
|
| 30122 |
amit.gupta |
62 |
priceDropTable = $('#priceDrop').find('table').DataTable({
|
|
|
63 |
pageLength: 20,
|
|
|
64 |
order: [[5, 'desc']]
|
|
|
65 |
});
|
| 28055 |
tejbeer |
66 |
|
| 30122 |
amit.gupta |
67 |
getItemAheadOptions($("#typeaheaditem"), true, function (
|
|
|
68 |
selectedItem) {
|
|
|
69 |
currentItem = selectedItem;
|
|
|
70 |
doGetAjaxRequestHandler(context + "/item-pricing/"
|
|
|
71 |
+ currentItem.itemId, function (response) {
|
|
|
72 |
response = JSON.parse(response);
|
|
|
73 |
$('#oldDp').html(response.dp);
|
|
|
74 |
$('#oldMop').html(response.mop);
|
|
|
75 |
$('#oldTp').html(response.tp);
|
|
|
76 |
$('#oldNlc').html(response.nlc);
|
|
|
77 |
});
|
|
|
78 |
});
|
|
|
79 |
getItemAheadOptions($("#typeaheaditem1"), true, function (
|
|
|
80 |
selectedItem) {
|
|
|
81 |
currentItem = selectedItem;
|
|
|
82 |
doGetAjaxRequestHandler(context + "/item-pricing/"
|
|
|
83 |
+ currentItem.itemId,
|
|
|
84 |
function (response) {
|
|
|
85 |
$('.mk_pause_button').data("id",
|
|
|
86 |
currentItem.catalogId);
|
|
|
87 |
$('.mk_pause_button').data("description",
|
|
|
88 |
currentItem.itemDescription);
|
|
|
89 |
$('.mk_hotdeal_button').data("id",
|
|
|
90 |
currentItem.catalogId);
|
|
|
91 |
$('.mk_hotdeal_button').data("description",
|
|
|
92 |
currentItem.itemDescription);
|
| 28055 |
tejbeer |
93 |
|
| 30122 |
amit.gupta |
94 |
response = JSON.parse(response);
|
|
|
95 |
$("#mop").val(response.mop);
|
|
|
96 |
$("#mrp").val(response.mrp);
|
|
|
97 |
$("#dp").val(response.dp);
|
|
|
98 |
$("#tp").val(response.tp);
|
|
|
99 |
$('#dpValue').html("DP -" + response.dp);
|
|
|
100 |
$('#mopValue').html("MOP -" + response.mop);
|
|
|
101 |
$('#mrpValue').html("MRP -" + response.mrp);
|
|
|
102 |
$('#tpValue').html("TP -" + response.tp);
|
|
|
103 |
});
|
|
|
104 |
});
|
|
|
105 |
affectedDateInput = $('#affectedDate');
|
|
|
106 |
affectedDateInput.daterangepicker(getSingleDatePicker(),
|
|
|
107 |
dateRangeCallback);
|
|
|
108 |
$("#newPriceDropModal").on('hidden.bs.modal', function () {
|
|
|
109 |
$("#pdForm").trigger("reset");
|
|
|
110 |
});
|
|
|
111 |
$("#addPriceModal").on('hidden.bs.modal', function () {
|
|
|
112 |
$("#pdForm1").trigger("reset");
|
|
|
113 |
});
|
|
|
114 |
});
|
| 28055 |
tejbeer |
115 |
|
| 30122 |
amit.gupta |
116 |
$(document).on('click', 'button.mk_hotdeal_button', function () {
|
|
|
117 |
let clickedButton = $(this);
|
|
|
118 |
let description = clickedButton.data("description");
|
|
|
119 |
let catalogId = clickedButton.data("id");
|
|
|
120 |
getHotdealsForItems(catalogId, 0, `Add/Remove ${description}`, function (catalogIds) {
|
|
|
121 |
console.log(catalogIds);
|
|
|
122 |
if (catalogIds != null) {
|
|
|
123 |
bootbox.confirm(`Confirm Update ${clickedButton.data("description")}?`, function (result) {
|
|
|
124 |
if (result) {
|
|
|
125 |
coloredItems.forEach(function (item) {
|
|
|
126 |
item.hotDeals = catalogIds.indexOf(item.id + "") >= 0;
|
|
|
127 |
});
|
|
|
128 |
doPostAjaxRequestWithJsonHandler(`${context}/indent/confirm-hotdeals-pause/`, JSON.stringify(coloredItems), function (response) {
|
|
|
129 |
if (response) {
|
|
|
130 |
bootbox.alert("Item/s Updated Successfully");
|
|
|
131 |
} else {
|
|
|
132 |
bootbox.alert("Could not pause item");
|
|
|
133 |
}
|
|
|
134 |
});
|
|
|
135 |
}
|
|
|
136 |
});
|
|
|
137 |
}
|
|
|
138 |
});
|
|
|
139 |
});
|
| 27190 |
amit.gupta |
140 |
</script>
|