| Line 138... |
Line 138... |
| 138 |
alert("Offer is now inactive");
|
138 |
alert("Offer is now inactive");
|
| 139 |
$clicked.closest("li").html(`<a class="mk_offer_active" href="javascript:void(0)">Mark Active</a>`);
|
139 |
$clicked.closest("li").html(`<a class="mk_offer_active" href="javascript:void(0)">Mark Active</a>`);
|
| 140 |
});
|
140 |
});
|
| 141 |
}
|
141 |
}
|
| 142 |
});
|
142 |
});
|
| - |
|
143 |
$(document).on('click', 'a.delete_offer', function () {
|
| - |
|
144 |
let $clicked = $(this);
|
| - |
|
145 |
let offerId = $clicked.closest('tr').data("offerid");
|
| - |
|
146 |
if (confirm(`Are you sure you want to delete offer ${offerId}? This cannot be undone.`)) {
|
| - |
|
147 |
doDeleteAjaxRequestHandler(`${context}/offer/delete/${offerId}`, function (response) {
|
| - |
|
148 |
alert("Offer deleted");
|
| - |
|
149 |
$clicked.closest('tr').remove();
|
| - |
|
150 |
});
|
| - |
|
151 |
}
|
| - |
|
152 |
});
|
| - |
|
153 |
$(document).on('click', '#publish-all-btn', function () {
|
| - |
|
154 |
let yearMonth = $("#yearmonth").val();
|
| - |
|
155 |
if (!yearMonth) {
|
| - |
|
156 |
yearMonth = new Date().toISOString().slice(0, 7);
|
| - |
|
157 |
}
|
| - |
|
158 |
if (confirm(`Publish all unpublished offers for ${yearMonth}?`)) {
|
| - |
|
159 |
doPostAjaxRequestHandler(`${context}/offers/publishAll?yearMonth=${yearMonth}`, function (response) {
|
| - |
|
160 |
alert(response);
|
| - |
|
161 |
loadOfferHistory('#main-content', yearMonth);
|
| - |
|
162 |
});
|
| - |
|
163 |
}
|
| - |
|
164 |
});
|
| 143 |
$(document).on('click', 'button.slab-add', function () {
|
165 |
$(document).on('click', 'button.slab-add', function () {
|
| 144 |
newTargetSlab = $(targetSlabTemplate);
|
166 |
newTargetSlab = $(targetSlabTemplate);
|
| 145 |
$('div.targetslabscontainer').append(newTargetSlab);
|
167 |
$('div.targetslabscontainer').append(newTargetSlab);
|
| 146 |
newTargetSlab.find("select.criteria-brands").toggle().next().remove();
|
168 |
newTargetSlab.find("select.criteria-brands").toggle().next().remove();
|
| 147 |
newTargetSlab.find("select.criteria-brands").chosen({no_results_text: "Oops, nothing found!"});
|
169 |
newTargetSlab.find("select.criteria-brands").chosen({no_results_text: "Oops, nothing found!"});
|