| 23343 |
ashik.ali |
1 |
<section class="wrapper">
|
| 27873 |
amit.gupta |
2 |
<div class="row">
|
|
|
3 |
<div class="col-lg-12">
|
|
|
4 |
<ol class="breadcrumb">
|
|
|
5 |
<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
|
|
|
6 |
<li><i class="icon_document_alt"></i>MARGINS</li>
|
|
|
7 |
</ol>
|
|
|
8 |
</div>
|
|
|
9 |
</div>
|
|
|
10 |
<div class="row">
|
|
|
11 |
<div class="col-lg-2 scheme-extendAll">
|
|
|
12 |
#if($isAdmin)
|
| 30122 |
amit.gupta |
13 |
#if($fullAccess)
|
|
|
14 |
<div class="input-group">
|
|
|
15 |
<input placeholder="Extend Date Time" id="extendDatetime" name="extendDatetime"
|
|
|
16 |
type="text"
|
|
|
17 |
value=""
|
|
|
18 |
class="form-control">
|
|
|
19 |
<span class="input-group-btn"> <button class="btn btn-primary submit"
|
|
|
20 |
id="extendDatetime-button"
|
|
|
21 |
type="button">Extend All</button></span>
|
|
|
22 |
</div>
|
|
|
23 |
#end
|
| 27873 |
amit.gupta |
24 |
#end
|
|
|
25 |
</div>
|
|
|
26 |
<div class="col-lg-2">
|
| 30122 |
amit.gupta |
27 |
#if($searchModel > 0)
|
| 27873 |
amit.gupta |
28 |
<div style="padding:12px">
|
| 30122 |
amit.gupta |
29 |
<span> DP - </span><span class="currency">$dp</span>,
|
|
|
30 |
<span> MOP - </span><span class="currency">$mop</span>
|
| 27873 |
amit.gupta |
31 |
</div>
|
|
|
32 |
#end
|
|
|
33 |
</div>
|
| 30122 |
amit.gupta |
34 |
<div class="col-lg-2 form-inline">
|
| 34524 |
ranu |
35 |
#if(!$isAnalysis)
|
|
|
36 |
<div id="scheme-search" class="form-group">
|
|
|
37 |
<div class="input-group top_search">
|
|
|
38 |
<input type="text" class="form-control" id="scheme-search-text"
|
|
|
39 |
placeholder="Search for schemeID..."
|
|
|
40 |
#if($searchScheme > 0)
|
|
|
41 |
value="$searchScheme"
|
|
|
42 |
#end />
|
|
|
43 |
<span class="input-group-btn">
|
| 30122 |
amit.gupta |
44 |
<button class="btn btn-primary submit" id="scheme-search-button"
|
|
|
45 |
type="button">Go!</button>
|
|
|
46 |
</span>
|
| 34524 |
ranu |
47 |
</div>
|
| 30122 |
amit.gupta |
48 |
</div>
|
| 34524 |
ranu |
49 |
#else
|
|
|
50 |
<div id="analysis-scheme-search" class="form-group">
|
|
|
51 |
<div class="input-group top_search">
|
|
|
52 |
<input type="text" class="form-control" id="analysis-scheme-search-text"
|
|
|
53 |
placeholder="Search for schemeID..."
|
|
|
54 |
#if($searchScheme > 0)
|
|
|
55 |
value="$searchScheme"
|
|
|
56 |
#end />
|
|
|
57 |
<span class="input-group-btn">
|
|
|
58 |
<button class="btn btn-primary submit" data-fofoid="$fofoId"
|
|
|
59 |
id="analysis-scheme-search-button"
|
|
|
60 |
type="button" data-fofoid="$fofoId">Go!</button>
|
|
|
61 |
</span>
|
|
|
62 |
</div>
|
|
|
63 |
</div>
|
|
|
64 |
#end
|
|
|
65 |
|
| 30122 |
amit.gupta |
66 |
</div>
|
|
|
67 |
<div class="col-lg-1">
|
| 27873 |
amit.gupta |
68 |
#if($isAdmin)
|
|
|
69 |
<div class="form-group ">
|
|
|
70 |
<select class="form-control input-sm" id="partner-category" name="partner-category"
|
|
|
71 |
placeholder="Category">
|
| 30122 |
amit.gupta |
72 |
<option disabled>Category</option>
|
| 27873 |
amit.gupta |
73 |
<option value="ALL" selected>ALL</option>
|
|
|
74 |
<option value="NEW">NEW</option>
|
|
|
75 |
<option value="BRONZE">BRONZE</option>
|
|
|
76 |
<option value="SILVER">SILVER</option>
|
|
|
77 |
<option value="GOLD">GOLD</option>
|
|
|
78 |
<option value="DIAMOND">DIAMOND</option>
|
|
|
79 |
<option value="PLATINUM">PLATINUM</option>
|
|
|
80 |
</select>
|
|
|
81 |
</div>
|
|
|
82 |
#end
|
|
|
83 |
</div>
|
|
|
84 |
<div class="form-inline col-lg-4">
|
| 34524 |
ranu |
85 |
#if(!$isAnalysis)
|
|
|
86 |
<div class="form-group">
|
|
|
87 |
<div class="input-group">
|
|
|
88 |
<input type="date" class="form-control schemes-date"
|
|
|
89 |
#if($date)
|
|
|
90 |
value="$date"
|
|
|
91 |
#else
|
| 30122 |
amit.gupta |
92 |
|
| 34524 |
ranu |
93 |
#end
|
|
|
94 |
/>
|
|
|
95 |
</div>
|
|
|
96 |
<div class="input-group top_search">
|
|
|
97 |
<input type="text" class="form-control" id="scheme-item-search-text" autocomplete="off"
|
|
|
98 |
placeholder="Search Model"
|
|
|
99 |
#if($searchModel > 0)
|
|
|
100 |
value="$modelName"
|
|
|
101 |
#end
|
|
|
102 |
/>
|
|
|
103 |
<span class="input-group-btn">
|
| 30122 |
amit.gupta |
104 |
<button class="btn btn-primary submit" id="scheme-item-search-button" type="button">Go!</button>
|
|
|
105 |
</span>
|
| 34524 |
ranu |
106 |
</div>
|
| 27873 |
amit.gupta |
107 |
</div>
|
| 34524 |
ranu |
108 |
#else
|
|
|
109 |
<div class="form-group">
|
|
|
110 |
<div class="input-group">
|
|
|
111 |
<input type="date" class="form-control analysis-schemes-date"
|
|
|
112 |
#if($date)
|
|
|
113 |
value="$date"
|
|
|
114 |
#else
|
|
|
115 |
|
|
|
116 |
#end
|
|
|
117 |
/>
|
|
|
118 |
</div>
|
|
|
119 |
<div class="input-group top_search">
|
|
|
120 |
<input type="text" class="form-control" id="analysis-scheme-item-search-text" autocomplete="off"
|
|
|
121 |
placeholder="Search Model"
|
|
|
122 |
#if($searchModel > 0)
|
|
|
123 |
value="$modelName"
|
|
|
124 |
#end
|
|
|
125 |
/>
|
|
|
126 |
<span class="input-group-btn">
|
|
|
127 |
<button class="btn btn-primary submit" id="analysis-scheme-item-search-button" type="button"
|
|
|
128 |
data-fofoid="$fofoId">Go!</button>
|
|
|
129 |
</span>
|
|
|
130 |
</div>
|
|
|
131 |
</div>
|
|
|
132 |
#end
|
| 27873 |
amit.gupta |
133 |
</div>
|
|
|
134 |
</div>
|
|
|
135 |
<div id="schemes-table">
|
|
|
136 |
<div class="row">
|
| 36421 |
amit |
137 |
<div class="col-lg-12" style="max-height:400px; overflow-y:auto;">
|
| 37794 |
ranu |
138 |
<!-- Offer & Scheme Radar: bulk-select schemes and send a WhatsApp
|
|
|
139 |
digest to all HO users. Handler:
|
|
|
140 |
OfferRadarNotificationController#sendRadarNotification. -->
|
|
|
141 |
<div class="scheme-radar-bar" style="display:flex; align-items:center; gap:12px; margin-bottom:10px;">
|
|
|
142 |
<button type="button"
|
|
|
143 |
id="schemeRadarSendBtn"
|
|
|
144 |
class="btn btn-primary"
|
|
|
145 |
data-radar-kind="scheme"
|
|
|
146 |
disabled>
|
|
|
147 |
Send WhatsApp Radar (<span id="schemeRadarSelectedCount">0</span>)
|
|
|
148 |
</button>
|
|
|
149 |
<span class="text-muted" style="font-size:12px;">
|
|
|
150 |
Tick any schemes below, then send. Recipients: all HO users with a mobile number.
|
|
|
151 |
</span>
|
|
|
152 |
</div>
|
| 27873 |
amit.gupta |
153 |
<table class="table table-striped table-advance table-hover">
|
|
|
154 |
<tbody>
|
|
|
155 |
<tr>
|
| 37794 |
ranu |
156 |
<th style="width:28px;">
|
|
|
157 |
<input type="checkbox" id="schemeRadarSelectAll" title="Select all">
|
|
|
158 |
</th>
|
| 27873 |
amit.gupta |
159 |
<th>ID</th>
|
|
|
160 |
<th>Name</th>
|
| 36452 |
amit |
161 |
<th>Reference</th>
|
| 27873 |
amit.gupta |
162 |
<th>Description</th>
|
|
|
163 |
<th>Type</th>
|
|
|
164 |
<th>Partner Type</th>
|
| 31170 |
amit.gupta |
165 |
<th>Regions</th>
|
| 27873 |
amit.gupta |
166 |
<th>Amount</th>
|
|
|
167 |
<th>Start Date</th>
|
|
|
168 |
<th>End Date</th>
|
|
|
169 |
<th>Created On</th>
|
|
|
170 |
<th>Active</th>
|
|
|
171 |
<th>Expire</th>
|
|
|
172 |
</tr>
|
|
|
173 |
#if($schemes && !$schemes.isEmpty())
|
|
|
174 |
#foreach( $scheme in $schemes )
|
| 36421 |
amit |
175 |
<tr class="scheme-details" data="$scheme.getId()" style="cursor:pointer;">
|
| 37794 |
ranu |
176 |
<td onclick="event.stopPropagation();">
|
|
|
177 |
<input type="checkbox"
|
|
|
178 |
class="scheme-radar-check"
|
|
|
179 |
value="$scheme.getId()"
|
|
|
180 |
onclick="event.stopPropagation();">
|
|
|
181 |
</td>
|
| 27873 |
amit.gupta |
182 |
<td>$scheme.getId()</td>
|
|
|
183 |
<td>$scheme.getName()</td>
|
| 36452 |
amit |
184 |
<td>#if($scheme.getReference())$scheme.getReference()#else-#end</td>
|
| 27873 |
amit.gupta |
185 |
<td>$scheme.getDescription()</td>
|
|
|
186 |
<td>$scheme.getType()</td>
|
|
|
187 |
<td>$scheme.getPartnerType()</td>
|
| 31170 |
amit.gupta |
188 |
<td>$schemeRegionMap.get($scheme.getId())</td>
|
| 27873 |
amit.gupta |
189 |
<td>$scheme.getAmountModel()</td>
|
|
|
190 |
<td>$dateFormatter.format($scheme.getStartDateTime())</td>
|
|
|
191 |
<td>$dateTimeFormatter.format($scheme.getEndDateTime())</td>
|
|
|
192 |
<td>$dateTimeFormatter.format($scheme.getCreateTimestamp())</td>
|
|
|
193 |
#if(($scheme.getActiveTimestamp()) && (!$scheme.getExpireTimestamp()))
|
|
|
194 |
<td><i class="fa fa-check" aria-hidden="true"></i></td>
|
|
|
195 |
#else
|
|
|
196 |
<td><i class="fa fa-times" aria-hidden="true"></i></td>
|
|
|
197 |
#end
|
|
|
198 |
#if($scheme.getExpireTimestamp())
|
|
|
199 |
<td><i class="fa fa-check" aria-hidden="true"></i></td>
|
|
|
200 |
#else
|
|
|
201 |
<td><i class="fa fa-times" aria-hidden="true"></i></td>
|
|
|
202 |
#end
|
|
|
203 |
</tr>
|
|
|
204 |
#end
|
|
|
205 |
#else
|
|
|
206 |
$noData
|
|
|
207 |
#end
|
|
|
208 |
</tbody>
|
|
|
209 |
</table>
|
|
|
210 |
</div>
|
| 36421 |
amit |
211 |
</div>
|
|
|
212 |
<div class="row">
|
|
|
213 |
<div class="col-lg-12" id="scheme-details-container" style="background:white;">
|
| 30122 |
amit.gupta |
214 |
</div>
|
| 27873 |
amit.gupta |
215 |
</div>
|
|
|
216 |
</div>
|
| 30122 |
amit.gupta |
217 |
#if($searchModel > 0)
|
| 27873 |
amit.gupta |
218 |
<div class="col-lg-12">
|
|
|
219 |
<h5>Note</h5>
|
|
|
220 |
<b>Hygiene Payout</b> - This is basis the customer details entered in the system, pls refer to hygiene
|
|
|
221 |
meter
|
|
|
222 |
in your Dashboard.
|
|
|
223 |
<br><b>Tertiary Payout</b> - This is basis the activation of the handset.
|
| 32910 |
shampa |
224 |
<!--<b>Investment Payout</b> - Investments in stocks should be above 90% for minimum 12 days in a month
|
|
|
225 |
to earn 2%, between 8-11 days will earn 1%, less then 8 days there will be no payout.-->
|
| 27873 |
amit.gupta |
226 |
</div>
|
|
|
227 |
#end
|
| 22860 |
ashik.ali |
228 |
</section>
|
| 27873 |
amit.gupta |
229 |
<script type="text/javascript">
|
|
|
230 |
|
| 30122 |
amit.gupta |
231 |
if ($searchModel > 0) {
|
|
|
232 |
currentItem = $searchModel;
|
|
|
233 |
}
|
| 30601 |
amit.gupta |
234 |
$('input[name="extendDatetime"]').daterangepicker(getSingleDatePicker());
|
| 27873 |
amit.gupta |
235 |
|
| 30122 |
amit.gupta |
236 |
getEntityAheadOptions($("#scheme-item-search-text"), function (selectedItem) {
|
|
|
237 |
currentItem = selectedItem.catalogId_i;
|
| 27873 |
amit.gupta |
238 |
});
|
| 34524 |
ranu |
239 |
getEntityAheadOptions($("#analysis-scheme-item-search-text"), function (selectedItem) {
|
|
|
240 |
currentItem = selectedItem.catalogId_i;
|
|
|
241 |
});
|
| 27873 |
amit.gupta |
242 |
|
|
|
243 |
$(document).ready(function () {
|
|
|
244 |
console.log('$partnerType')
|
|
|
245 |
$('#partner-category').val('$partnerType');
|
| 37794 |
ranu |
246 |
|
|
|
247 |
// ── Scheme Radar bulk-send wiring ─────────────────────────────
|
|
|
248 |
// Same shape as the offer_history version; POST payload only carries
|
|
|
249 |
// schemeIds because this table has no offers. Row click is a
|
|
|
250 |
// pre-existing scheme-details drill-down, so the checkbox cell and the
|
|
|
251 |
// input itself stopPropagation to avoid opening the drill on tick.
|
|
|
252 |
//
|
|
|
253 |
// Wrapped in #[[ … ]]# so Velocity leaves the $-prefixed jQuery vars
|
|
|
254 |
// (e.g. $schemeCount.text(…)) alone at template-parse time.
|
|
|
255 |
#
|
|
|
256 |
[[
|
|
|
257 |
var $schemeSelectAll = $("#schemeRadarSelectAll");
|
|
|
258 |
var $schemeBtn = $("#schemeRadarSendBtn");
|
|
|
259 |
var $schemeCount = $("#schemeRadarSelectedCount");
|
|
|
260 |
|
|
|
261 |
function selectedSchemeIds() {
|
|
|
262 |
var ids = [];
|
|
|
263 |
$(".scheme-radar-check:checked").each(function () {
|
|
|
264 |
var v = parseInt(this.value, 10);
|
|
|
265 |
if (!isNaN(v)) ids.push(v);
|
|
|
266 |
});
|
|
|
267 |
return ids;
|
|
|
268 |
}
|
|
|
269 |
|
|
|
270 |
function refreshSchemeRadarUi() {
|
|
|
271 |
var ids = selectedSchemeIds();
|
|
|
272 |
$schemeCount.text(ids.length);
|
|
|
273 |
$schemeBtn.prop("disabled", ids.length === 0);
|
|
|
274 |
var total = $(".scheme-radar-check").length;
|
|
|
275 |
var picked = ids.length;
|
|
|
276 |
$schemeSelectAll.prop("indeterminate", picked > 0 && picked < total);
|
|
|
277 |
$schemeSelectAll.prop("checked", picked > 0 && picked === total);
|
|
|
278 |
}
|
|
|
279 |
|
|
|
280 |
$schemeSelectAll.on("change", function (e) {
|
|
|
281 |
e.stopPropagation();
|
|
|
282 |
$(".scheme-radar-check").prop("checked", this.checked);
|
|
|
283 |
refreshSchemeRadarUi();
|
|
|
284 |
});
|
|
|
285 |
$(document).on("change", ".scheme-radar-check", function (e) {
|
|
|
286 |
e.stopPropagation();
|
|
|
287 |
refreshSchemeRadarUi();
|
|
|
288 |
});
|
|
|
289 |
|
|
|
290 |
$schemeBtn.on("click", function () {
|
|
|
291 |
var ids = selectedSchemeIds();
|
|
|
292 |
if (ids.length === 0) return;
|
|
|
293 |
if (!confirm("Send WhatsApp Radar digest for " + ids.length + " scheme(s) to all HO users?")) return;
|
|
|
294 |
|
|
|
295 |
var $self = $(this);
|
|
|
296 |
$self.prop("disabled", true).text("Sending…");
|
|
|
297 |
$.ajax({
|
|
|
298 |
url: "/offerRadar/sendNotification",
|
|
|
299 |
method: "POST",
|
|
|
300 |
contentType: "application/json",
|
|
|
301 |
data: JSON.stringify({offerIds: [], schemeIds: ids})
|
|
|
302 |
}).done(function (resp) {
|
|
|
303 |
var r = (resp && resp.response) || resp || {};
|
|
|
304 |
alert("Sent to " + (r.sent || 0) + " user(s). Skipped: " + (r.skipped || 0)
|
|
|
305 |
+ ", Failed: " + (r.failed || 0)
|
|
|
306 |
+ "\nRegion: " + (r.regionSummary || "-")
|
|
|
307 |
+ " | Offers added: " + (r.offersAdded || 0)
|
|
|
308 |
+ " | Schemes added: " + (r.schemesAdded || 0)
|
|
|
309 |
+ " | Revisions: " + (r.revisions || 0)
|
|
|
310 |
+ " | Ending soon: " + (r.endingSoon || 0));
|
|
|
311 |
}).fail(function (xhr) {
|
|
|
312 |
var msg = (xhr.responseJSON && (xhr.responseJSON.response || xhr.responseJSON.message)) || xhr.statusText;
|
|
|
313 |
alert("Radar send failed: " + msg);
|
|
|
314 |
}).always(function () {
|
|
|
315 |
$self.html('Send WhatsApp Radar (<span id="schemeRadarSelectedCount">' + ids.length + '</span>)');
|
|
|
316 |
refreshSchemeRadarUi();
|
|
|
317 |
});
|
|
|
318 |
});
|
|
|
319 |
|
|
|
320 |
refreshSchemeRadarUi();
|
|
|
321 |
]]#
|
| 27873 |
amit.gupta |
322 |
});
|
|
|
323 |
</script>
|