| 26674 |
tejbeer |
1 |
<style>
|
| 27875 |
amit.gupta |
2 |
.table-striped > tbody > tr:nth-child(odd) > td {
|
|
|
3 |
background: white;
|
|
|
4 |
background-color: white;
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
.table-striped > tbody > tr:nth-child(even) > td {
|
|
|
8 |
background: white;
|
|
|
9 |
background-color: white;
|
|
|
10 |
}
|
|
|
11 |
|
|
|
12 |
.table-striped > tbody > tr:hover > td,
|
|
|
13 |
.table-striped > tbody > tr:hover {
|
|
|
14 |
background-color: #e98c8f;
|
|
|
15 |
color: white;
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
.btn:hover {
|
|
|
19 |
color: grey;
|
|
|
20 |
text-decoration: none;
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
.btn-primary:hover {
|
|
|
24 |
color: grey;
|
|
|
25 |
text-decoration: none;
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
.sale-details {
|
|
|
29 |
cursor: pointer;
|
|
|
30 |
}
|
| 26674 |
tejbeer |
31 |
</style>
|
|
|
32 |
|
|
|
33 |
<section class="wrapper">
|
| 27875 |
amit.gupta |
34 |
<div class="row">
|
|
|
35 |
<div class="col-lg-12">
|
| 35858 |
amit |
36 |
<h3 class="page-header"><i class="icon_document_alt"></i>OFFER HISTORY
|
|
|
37 |
<button class="btn btn-success btn-sm" id="publish-all-btn" type="button" style="margin-left:15px;">Publish All</button>
|
| 36703 |
amit |
38 |
<a class="btn btn-warning btn-sm refresh-offer-cache" href="javascript:void(0)" style="margin-left:5px;">Refresh Cache</a>
|
| 35858 |
amit |
39 |
</h3>
|
| 27875 |
amit.gupta |
40 |
<ol class="breadcrumb">
|
|
|
41 |
<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
|
| 32381 |
jai.hind |
42 |
<li><i class="icon_document_alt"></i>OFFERS</li>
|
| 27875 |
amit.gupta |
43 |
</ol>
|
|
|
44 |
</div>
|
|
|
45 |
</div>
|
|
|
46 |
|
|
|
47 |
<table style="Width:100%">
|
|
|
48 |
|
|
|
49 |
<td align="left" style="Width:20%">
|
| 26719 |
tejbeer |
50 |
</td>
|
| 27875 |
amit.gupta |
51 |
|
| 26719 |
tejbeer |
52 |
<td style="Width:80%">
|
| 27875 |
amit.gupta |
53 |
<div id="offer-search">
|
|
|
54 |
<div class="row">
|
|
|
55 |
<div class="col-lg-12">
|
| 35858 |
amit |
56 |
<div class="col-md-3 col-sm-3 col-xs-12 form-group pull-right top_search">
|
| 32381 |
jai.hind |
57 |
<div class="input-group">
|
|
|
58 |
<span class="input-group-btn">
|
|
|
59 |
<button class="btn btn-primary submit" id="offer-file-submit" type="button">Add Offers Using Targets</button>
|
|
|
60 |
</span>
|
|
|
61 |
</div>
|
|
|
62 |
</div>
|
| 27875 |
amit.gupta |
63 |
<div class="col-md-3 col-sm-3 col-xs-12 form-group pull-right top_search">
|
|
|
64 |
<div class="input-group">
|
| 29680 |
amit.gupta |
65 |
<input type="file" class="form-control" id="offer-file"
|
| 32349 |
amit.gupta |
66 |
placeholder="Upload Target Offers"/>
|
| 32381 |
jai.hind |
67 |
|
| 29680 |
amit.gupta |
68 |
</div>
|
|
|
69 |
</div>
|
| 32381 |
jai.hind |
70 |
|
| 29680 |
amit.gupta |
71 |
<div class="col-md-3 col-sm-3 col-xs-12 form-group pull-right top_search">
|
|
|
72 |
<div class="input-group">
|
| 27875 |
amit.gupta |
73 |
<input type="month" class="form-control" id="yearmonth"
|
| 30651 |
amit.gupta |
74 |
placeholder="YYYY-MM"/>
|
| 27875 |
amit.gupta |
75 |
<span class="input-group-btn">
|
| 30651 |
amit.gupta |
76 |
<button class="btn btn-primary submit" id="yearmonth-submit"
|
|
|
77 |
type="button">Go!</button>
|
| 29680 |
amit.gupta |
78 |
</span>
|
| 27875 |
amit.gupta |
79 |
</div>
|
|
|
80 |
</div>
|
|
|
81 |
</div>
|
| 26719 |
tejbeer |
82 |
</div>
|
| 27875 |
amit.gupta |
83 |
</div>
|
|
|
84 |
</td>
|
|
|
85 |
</table>
|
|
|
86 |
<div id="offer-listings-table">
|
|
|
87 |
<div class="row">
|
|
|
88 |
<div class="col-lg-12">
|
| 37794 |
ranu |
89 |
<!-- Offer & Scheme Radar: bulk-select offers to send a WhatsApp
|
|
|
90 |
digest to HO users (RBMs / sales). Backed by
|
|
|
91 |
OfferRadarNotificationController#sendRadarNotification. -->
|
|
|
92 |
<div class="offer-radar-bar" style="display:flex; align-items:center; gap:12px; margin-bottom:10px;">
|
|
|
93 |
<button type="button"
|
|
|
94 |
id="offerRadarSendBtn"
|
|
|
95 |
class="btn btn-primary"
|
|
|
96 |
data-radar-kind="offer"
|
|
|
97 |
disabled>
|
|
|
98 |
Send WhatsApp Radar (<span id="offerRadarSelectedCount">0</span>)
|
|
|
99 |
</button>
|
|
|
100 |
<span class="text-muted" style="font-size:12px;">
|
|
|
101 |
Tick any offers below, then send. Recipients: all HO users with a mobile number.
|
|
|
102 |
</span>
|
|
|
103 |
</div>
|
| 27875 |
amit.gupta |
104 |
<table class="table table-striped table-advance table-hover">
|
|
|
105 |
<tbody>
|
|
|
106 |
<tr>
|
| 37794 |
ranu |
107 |
<th style="width:28px;">
|
|
|
108 |
<input type="checkbox" id="offerRadarSelectAll" title="Select all">
|
|
|
109 |
</th>
|
| 27875 |
amit.gupta |
110 |
<th>Id</th>
|
|
|
111 |
<th>Name</th>
|
| 36452 |
amit |
112 |
<th>Reference</th>
|
| 28556 |
amit.gupta |
113 |
<th>Payout Type</th>
|
| 27875 |
amit.gupta |
114 |
<th>Scheme Type</th>
|
| 32027 |
amit.gupta |
115 |
<th>Discount</th>
|
| 27875 |
amit.gupta |
116 |
<th>Partner Criteria</th>
|
|
|
117 |
<th>Item Criteria</th>
|
|
|
118 |
<th>Start</th>
|
|
|
119 |
<th>End</th>
|
|
|
120 |
<th>Created</th>
|
| 31605 |
amit.gupta |
121 |
<th>Processed</th>
|
| 27875 |
amit.gupta |
122 |
<th>Actions</th>
|
|
|
123 |
</tr>
|
| 30651 |
amit.gupta |
124 |
#if(!$offers.isEmpty())
|
|
|
125 |
#foreach( $offer in $offers )
|
|
|
126 |
<tr class="offer-details" data-offerid="$offer.getId()" data-offer-title="">
|
| 37794 |
ranu |
127 |
<td>
|
|
|
128 |
<input type="checkbox"
|
|
|
129 |
class="offer-radar-check"
|
|
|
130 |
value="$offer.getId()">
|
|
|
131 |
</td>
|
| 35745 |
amit |
132 |
<td><a class="mk_offer_detail" href="javascript:void(0)">$offer.getId()</a></td>
|
| 30651 |
amit.gupta |
133 |
<td><a class="mk_partner_view" href="javascript:void(0)">$offer.getName()</a></td>
|
| 36452 |
amit |
134 |
<td>#if($offer.getReference())$offer.getReference()#else-#end</td>
|
| 30651 |
amit.gupta |
135 |
<td>$offer.getPayoutType()</td>
|
|
|
136 |
<td>$offer.getSchemeType()</td>
|
| 32027 |
amit.gupta |
137 |
<td>
|
|
|
138 |
#if ($offer.isDiscount())
|
|
|
139 |
Discount
|
|
|
140 |
#else
|
|
|
141 |
Non Discount
|
|
|
142 |
#end
|
|
|
143 |
</td>
|
| 30651 |
amit.gupta |
144 |
<td>$offer.getPartnerCriteriaString()</td>
|
|
|
145 |
<td>$offer.getItemCriteriaString()</td>
|
|
|
146 |
<td>$offer.getStartDate().format($dateFormatter)</td>
|
|
|
147 |
<td>$offer.getEndDate().format($dateFormatter)</td>
|
|
|
148 |
<td>$offer.getCreatedOn().format($dateTimeFormatter)</td>
|
| 31608 |
amit.gupta |
149 |
#if($offer.getProcessTimestamp())
|
| 36522 |
amit |
150 |
<td class="processed-timestamp">$offer.getProcessTimestamp().format($dateTimeFormatter)</td>
|
| 31605 |
amit.gupta |
151 |
#else
|
| 36522 |
amit |
152 |
<td class="processed-timestamp"> -</td>
|
| 31605 |
amit.gupta |
153 |
#end
|
| 30651 |
amit.gupta |
154 |
<td>
|
|
|
155 |
<ul>
|
|
|
156 |
<li>
|
|
|
157 |
#if($offer.isActive())
|
|
|
158 |
<a class="mk_offer_inactive" href="javascript:void(0)">Mark Inactive</a>
|
|
|
159 |
#else
|
|
|
160 |
<a class="mk_offer_active" href="javascript:void(0)">Mark Active</a>
|
|
|
161 |
#end
|
|
|
162 |
</li>
|
|
|
163 |
<li><a href="/offerDownload?offerId=$offer.getId()">Download
|
|
|
164 |
Report</a></li>
|
| 30729 |
amit.gupta |
165 |
<li><a class="process_offer" href="javascript:void(0)">Process Offer</a>
|
|
|
166 |
</li>
|
| 35886 |
amit |
167 |
<li><a class="manage_offer_partners" href="javascript:void(0)">Manage Partners</a></li>
|
| 35857 |
amit |
168 |
#if(!$offer.isActive())
|
|
|
169 |
<li><a class="delete_offer" href="javascript:void(0)" style="color:red;">Delete</a></li>
|
|
|
170 |
#end
|
| 30651 |
amit.gupta |
171 |
#if(!$currentMonth)
|
|
|
172 |
#end
|
|
|
173 |
</ul>
|
|
|
174 |
</td>
|
|
|
175 |
</tr>
|
|
|
176 |
#end
|
|
|
177 |
#else
|
|
|
178 |
<tr>
|
| 37794 |
ranu |
179 |
<td colspan="14" style="text-align:center;">NO MATCHING DATA FOUND FOR CRITERIA</td>
|
| 30651 |
amit.gupta |
180 |
</tr>
|
|
|
181 |
#end
|
| 27875 |
amit.gupta |
182 |
</tbody>
|
|
|
183 |
</table>
|
|
|
184 |
</div>
|
| 26719 |
tejbeer |
185 |
</div>
|
| 26674 |
tejbeer |
186 |
</div>
|
| 27875 |
amit.gupta |
187 |
|
| 30651 |
amit.gupta |
188 |
<div class="modal" id="offerDescription">
|
|
|
189 |
<div class="modal-dialog modal-lg">
|
|
|
190 |
<div class="modal-content">
|
|
|
191 |
</div>
|
|
|
192 |
</div>
|
|
|
193 |
</div>
|
| 27875 |
amit.gupta |
194 |
</section>
|
|
|
195 |
|
|
|
196 |
<script type="text/javascript">
|
| 30651 |
amit.gupta |
197 |
$(function () {
|
|
|
198 |
$("#offerDescription").modal('hide');
|
|
|
199 |
$('#offerDescription').on('hide.bs.modal', function () {
|
|
|
200 |
$(this).find(".modal-content").html("");
|
|
|
201 |
});
|
|
|
202 |
$("#offer-file-submit").on('click', function () {
|
|
|
203 |
var fileSelector = $('#offer-file')[0];
|
|
|
204 |
if (fileSelector != undefined && fileSelector.files[0] != undefined) {
|
|
|
205 |
if (confirm("Confirm Upload?")) {
|
|
|
206 |
doAjaxUploadRequestHandler(context + "/offers/upload",
|
|
|
207 |
"POST", fileSelector.files[0], function (
|
|
|
208 |
response) {
|
|
|
209 |
if (response) {
|
|
|
210 |
alert("Offer added successfully");
|
|
|
211 |
loadOfferHistory('#main-content', moment(new Date()).format("YYYY-MM"));
|
|
|
212 |
}
|
|
|
213 |
});
|
|
|
214 |
}
|
|
|
215 |
} else {
|
|
|
216 |
alert("Please upload file");
|
|
|
217 |
}
|
|
|
218 |
});
|
| 37794 |
ranu |
219 |
|
|
|
220 |
// ── Offer Radar bulk-send wiring ──────────────────────────────
|
|
|
221 |
// Wrapped in Velocity's #[[ … ]]# unparsed block because the jQuery
|
|
|
222 |
// convention here uses $-prefixed vars (e.g. $count, $btn) which
|
|
|
223 |
// Velocity would otherwise try to parse as template variables and
|
|
|
224 |
// choke on the following .method(…) call. Inside #[[ ]]# the whole
|
|
|
225 |
// block is emitted verbatim, so jQuery's $ still works at runtime.
|
|
|
226 |
#
|
|
|
227 |
[[
|
|
|
228 |
var $selectAll = $("#offerRadarSelectAll");
|
|
|
229 |
var $btn = $("#offerRadarSendBtn");
|
|
|
230 |
var $count = $("#offerRadarSelectedCount");
|
|
|
231 |
|
|
|
232 |
function selectedOfferIds() {
|
|
|
233 |
var ids = [];
|
|
|
234 |
$(".offer-radar-check:checked").each(function () {
|
|
|
235 |
var v = parseInt(this.value, 10);
|
|
|
236 |
if (!isNaN(v)) ids.push(v);
|
|
|
237 |
});
|
|
|
238 |
return ids;
|
|
|
239 |
}
|
|
|
240 |
|
|
|
241 |
function refreshRadarUi() {
|
|
|
242 |
var ids = selectedOfferIds();
|
|
|
243 |
$count.text(ids.length);
|
|
|
244 |
$btn.prop("disabled", ids.length === 0);
|
|
|
245 |
var total = $(".offer-radar-check").length;
|
|
|
246 |
var picked = ids.length;
|
|
|
247 |
$selectAll.prop("indeterminate", picked > 0 && picked < total);
|
|
|
248 |
$selectAll.prop("checked", picked > 0 && picked === total);
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
$selectAll.on("change", function () {
|
|
|
252 |
$(".offer-radar-check").prop("checked", this.checked);
|
|
|
253 |
refreshRadarUi();
|
|
|
254 |
});
|
|
|
255 |
$(document).on("change", ".offer-radar-check", refreshRadarUi);
|
|
|
256 |
|
|
|
257 |
$btn.on("click", function () {
|
|
|
258 |
var ids = selectedOfferIds();
|
|
|
259 |
if (ids.length === 0) return;
|
|
|
260 |
if (!confirm("Send WhatsApp Radar digest for " + ids.length + " offer(s) to all HO users?")) return;
|
|
|
261 |
|
|
|
262 |
var $self = $(this);
|
|
|
263 |
$self.prop("disabled", true).text("Sending…");
|
|
|
264 |
$.ajax({
|
|
|
265 |
url: "/offerRadar/sendNotification",
|
|
|
266 |
method: "POST",
|
|
|
267 |
contentType: "application/json",
|
|
|
268 |
data: JSON.stringify({offerIds: ids, schemeIds: []})
|
|
|
269 |
}).done(function (resp) {
|
|
|
270 |
var r = (resp && resp.response) || resp || {};
|
|
|
271 |
alert("Sent to " + (r.sent || 0) + " user(s). Skipped: " + (r.skipped || 0)
|
|
|
272 |
+ ", Failed: " + (r.failed || 0)
|
|
|
273 |
+ "\nRegion: " + (r.regionSummary || "-")
|
|
|
274 |
+ " | Offers added: " + (r.offersAdded || 0)
|
|
|
275 |
+ " | Schemes added: " + (r.schemesAdded || 0)
|
|
|
276 |
+ " | Revisions: " + (r.revisions || 0)
|
|
|
277 |
+ " | Ending soon: " + (r.endingSoon || 0));
|
|
|
278 |
}).fail(function (xhr) {
|
|
|
279 |
var msg = (xhr.responseJSON && (xhr.responseJSON.response || xhr.responseJSON.message)) || xhr.statusText;
|
|
|
280 |
alert("Radar send failed: " + msg);
|
|
|
281 |
}).always(function () {
|
|
|
282 |
$self.html('Send WhatsApp Radar (<span id="offerRadarSelectedCount">' + ids.length + '</span>)');
|
|
|
283 |
refreshRadarUi();
|
|
|
284 |
});
|
|
|
285 |
});
|
|
|
286 |
|
|
|
287 |
refreshRadarUi();
|
|
|
288 |
]]#
|
| 30651 |
amit.gupta |
289 |
});
|
| 27875 |
amit.gupta |
290 |
</script>
|
|
|
291 |
|
| 26719 |
tejbeer |
292 |
|
|
|
293 |
|