| 34480 |
tejus.loha |
1 |
<!-- offer_scratch.vm -->
|
|
|
2 |
<style>
|
|
|
3 |
.gift-row td {
|
|
|
4 |
vertical-align: top !important;
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
.dynamic-table {
|
|
|
8 |
margin-top: 15px;
|
|
|
9 |
}
|
|
|
10 |
|
|
|
11 |
.date-picker {
|
|
|
12 |
background: white !important;
|
|
|
13 |
cursor: pointer;
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
body.modal-open {
|
|
|
17 |
overflow: hidden;
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
</style>
|
|
|
21 |
|
|
|
22 |
<style>
|
|
|
23 |
/* The switch container */
|
|
|
24 |
.switch-small {
|
|
|
25 |
position: relative;
|
|
|
26 |
display: inline-block;
|
|
|
27 |
width: 40px;
|
|
|
28 |
height: 20px;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
/* Hide default HTML checkbox */
|
|
|
32 |
.switch-small input {
|
|
|
33 |
opacity: 0;
|
|
|
34 |
width: 0;
|
|
|
35 |
height: 0;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
/* The slider */
|
|
|
39 |
.slider-small {
|
|
|
40 |
position: absolute;
|
|
|
41 |
cursor: pointer;
|
|
|
42 |
top: 0;
|
|
|
43 |
left: 0;
|
|
|
44 |
right: 0;
|
|
|
45 |
bottom: 0;
|
|
|
46 |
background-color: #ccc;
|
|
|
47 |
transition: .4s;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
/* The slider knob */
|
|
|
51 |
.slider-small:before {
|
|
|
52 |
position: absolute;
|
|
|
53 |
content: "";
|
|
|
54 |
height: 16px;
|
|
|
55 |
width: 16px;
|
|
|
56 |
left: 2px;
|
|
|
57 |
bottom: 2px;
|
|
|
58 |
background-color: white;
|
|
|
59 |
transition: .4s;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
/* Change background when checked (blue by default) */
|
|
|
63 |
.switch-small input:checked + .slider-small {
|
|
|
64 |
background-color: #2196F3;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
/* Focus effect */
|
|
|
68 |
.switch-small input:focus + .slider-small {
|
|
|
69 |
box-shadow: 0 0 1px #2196F3;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
/* Move the slider knob when checked */
|
|
|
73 |
.switch-small input:checked + .slider-small:before {
|
|
|
74 |
transform: translateX(20px);
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
/* Rounded slider */
|
|
|
78 |
.slider-small.round {
|
|
|
79 |
border-radius: 20px;
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
.slider-small.round:before {
|
|
|
83 |
border-radius: 50%;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
.switch-small input:checked + .slider-small {
|
|
|
87 |
background-color: #28a745; /* Bright green for active */
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
.switch-small input:not(:checked) + .slider-small {
|
|
|
91 |
background-color: #dc3545; /* Bright red for inactive */
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
</style>
|
|
|
95 |
|
|
|
96 |
<section class="wrapper">
|
|
|
97 |
<div class="row">
|
|
|
98 |
<div class="col-lg-12">
|
|
|
99 |
<h3 class="page-header"><i class="fa fa-gift"></i> Scratch Offers</h3>
|
|
|
100 |
<ol class="breadcrumb">
|
|
|
101 |
<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
|
|
|
102 |
<li><i class="fa fa-gift"></i>Offers</li>
|
|
|
103 |
<li class="pull-right">
|
|
|
104 |
<button class="btn btn-primary new-offer-btn" data-toggle="modal" data-target="#offerModal">
|
|
|
105 |
<i class="fa fa-plus-circle"></i> Create New Offer
|
|
|
106 |
</button>
|
|
|
107 |
</li>
|
|
|
108 |
</ol>
|
|
|
109 |
</div>
|
|
|
110 |
</div>
|
|
|
111 |
<div class="table-responsive">
|
|
|
112 |
<table class="table table-striped table-bordered" id="scratchOfferTable">
|
|
|
113 |
<thead>
|
|
|
114 |
<tr>
|
|
|
115 |
<th>Offer Name</th>
|
|
|
116 |
<th>Offer Type</th>
|
|
|
117 |
<th>Scratch Validity</th>
|
|
|
118 |
<th>Offer Duration</th>
|
|
|
119 |
<th>Offer Classification</th>
|
|
|
120 |
<th>Offer Image</th>
|
|
|
121 |
<th>Active</th>
|
|
|
122 |
<th>Action</th>
|
|
|
123 |
</tr>
|
|
|
124 |
</thead>
|
|
|
125 |
<tbody>
|
|
|
126 |
#foreach($offer in $offerList)
|
|
|
127 |
<tr>
|
|
|
128 |
<td>$offer.name</td>
|
|
|
129 |
<td>$offer.offerType</td>
|
|
|
130 |
<td>$offer.scratchValidity Days</td>
|
|
|
131 |
<td>$offer.startDate - $offer.endDate</td>
|
|
|
132 |
<td>$offer.classification</td>
|
|
|
133 |
<td>
|
|
|
134 |
#foreach($imageId in $offer.offerImage.split(","))
|
|
|
135 |
<img src="/document/$imageId" width="50" style="margin: 2px;">
|
|
|
136 |
#end
|
|
|
137 |
</td>
|
|
|
138 |
<td>
|
|
|
139 |
<label class="switch-small" data-offer-id="$offer.id">
|
|
|
140 |
<input type="checkbox" name="isActive" #if($offer.active) checked #end>
|
|
|
141 |
<span class="slider-small round"></span>
|
|
|
142 |
</label>
|
|
|
143 |
</td>
|
|
|
144 |
|
|
|
145 |
<td class="text-center align-middle">
|
|
|
146 |
<button class="delete-offer btn btn-sm btn-danger" value="$offer.id">
|
|
|
147 |
<i class="fa fa-trash"></i>
|
|
|
148 |
</button>
|
|
|
149 |
<button class="edit-offer btn btn-sm btn-primary" data-toggle="modal"
|
|
|
150 |
data-target="#editOfferModal" value="$offer.id"><i class="fa fa-pencil-square-o"></i>
|
|
|
151 |
</button>
|
|
|
152 |
</td>
|
|
|
153 |
</tr>
|
|
|
154 |
#end
|
|
|
155 |
</tbody>
|
|
|
156 |
</table>
|
|
|
157 |
</div>
|
|
|
158 |
</section>
|
|
|
159 |
<div class="modal fade" id="offerModal" tabindex="-1" role="dialog" style="height: auto; overflow-y: scroll">
|
|
|
160 |
<div class="modal-dialog modal-lg" role="document">
|
|
|
161 |
<div class="modal-content">
|
|
|
162 |
<div class="modal-header">
|
|
|
163 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
164 |
<h4 class="modal-title">Create New Scratch Offer</h4>
|
|
|
165 |
</div>
|
|
|
166 |
<div class="modal-body">
|
|
|
167 |
<form id="offerForm">
|
|
|
168 |
<div class="row">
|
|
|
169 |
<div class="col-md-6">
|
|
|
170 |
<div class="form-group">
|
|
|
171 |
<label>Offer Name <span class="text-danger">*</span> </label>
|
|
|
172 |
<input type="text" class="form-control" name="name" required placeholder="Offer Name">
|
|
|
173 |
</div>
|
|
|
174 |
<div class="form-group">
|
|
|
175 |
<label>Description <span class="text-danger">*</span></label>
|
|
|
176 |
<textarea class="form-control" name="description" rows="3"
|
|
|
177 |
placeholder="Short description visible to customers"></textarea>
|
|
|
178 |
</div>
|
|
|
179 |
<div class="form-group">
|
|
|
180 |
<label>Offer Images <span class="text-danger">*</span></label>
|
|
|
181 |
<small class="text-danger text-small"> Multiple Images Accepted</small>
|
|
|
182 |
<div class="offer-images-container">
|
|
|
183 |
<div class="offer-image-entry">
|
|
|
184 |
<input type="file" class="form-control offer-image-file"
|
|
|
185 |
accept="image/*" multiple required>
|
|
|
186 |
<input type="hidden" class="offer-image-id" name="offerImageIds[]">
|
|
|
187 |
</div>
|
|
|
188 |
</div>
|
|
|
189 |
|
|
|
190 |
</div>
|
|
|
191 |
</div>
|
|
|
192 |
|
|
|
193 |
<div class="col-md-6">
|
|
|
194 |
<div class="form-group">
|
|
|
195 |
<label>Offer Period <span class="text-danger">*</span></label>
|
|
|
196 |
<div class="input-daterange input-group">
|
|
|
197 |
<input type="date" class="form-control date-picker" name="start_date" required>
|
|
|
198 |
<span class="input-group-addon">to</span>
|
|
|
199 |
<input type="date" class="form-control date-picker" name="end_date" required>
|
|
|
200 |
</div>
|
|
|
201 |
</div>
|
|
|
202 |
<div class="form-group">
|
|
|
203 |
<label>Product Category <span class="text-danger">*</span></label>
|
|
|
204 |
<select class="form-control" name="productCategory" multiple required>
|
|
|
205 |
#foreach($category in $categoryList)
|
|
|
206 |
<option value="$category.id">$category.displayName</option>
|
|
|
207 |
#end
|
|
|
208 |
</select>
|
|
|
209 |
</div>
|
|
|
210 |
<div class="form-group">
|
|
|
211 |
<label>Payment Method <span class="text-danger">*</span></label>
|
|
|
212 |
<select class="form-control" name="paymentMethod" required multiple>
|
| 34798 |
ranu |
213 |
#foreach($paymentMethod in $paymentMethods)
|
|
|
214 |
<option value="$paymentMethod">$paymentMethod</option>
|
|
|
215 |
#end
|
| 34480 |
tejus.loha |
216 |
</select>
|
|
|
217 |
</div>
|
|
|
218 |
<div class="form-group">
|
|
|
219 |
<label>Offer Classification <span class="text-danger">*</span></label>
|
|
|
220 |
<select class="form-control classification" name="classification" required>
|
|
|
221 |
<option selected disabled value="">Select Classification</option>
|
|
|
222 |
#foreach($classification in $classifications)
|
|
|
223 |
<option value="$classification">$classification</option>
|
|
|
224 |
#end
|
|
|
225 |
</select>
|
|
|
226 |
</div>
|
|
|
227 |
</div>
|
|
|
228 |
</div>
|
|
|
229 |
|
|
|
230 |
<div class="row">
|
|
|
231 |
<div class="col-md-6">
|
|
|
232 |
<div class="form-group">
|
|
|
233 |
<label>User Limit <span class="text-danger">*</span></label>
|
|
|
234 |
<input type="number" class="form-control" name="userLimit"
|
|
|
235 |
placeholder="Max redemptions per day">
|
|
|
236 |
</div>
|
|
|
237 |
</div>
|
|
|
238 |
<div class="col-md-6">
|
|
|
239 |
<div class="form-group">
|
|
|
240 |
<label>Scratch Validity (Days) <span class="text-danger">*</span></label>
|
|
|
241 |
<input type="number" class="form-control" name="scratchValidity"
|
|
|
242 |
placeholder="Scratch Validity">
|
|
|
243 |
</div>
|
|
|
244 |
</div>
|
|
|
245 |
</div>
|
|
|
246 |
<div class="form-check form-switch hidden">
|
|
|
247 |
<p class="">Offer Status</p>
|
|
|
248 |
<input
|
|
|
249 |
class="form-check-input"
|
|
|
250 |
type="checkbox"
|
|
|
251 |
id="flexSwitchCheckActive"
|
|
|
252 |
name="isActive"
|
|
|
253 |
checked>
|
|
|
254 |
<label class="form-check-label" for="flexSwitchCheckActive">
|
|
|
255 |
Active
|
|
|
256 |
</label>
|
|
|
257 |
</div>
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
<div class="table-responsive">
|
|
|
261 |
<table class="table dynamic-table">
|
|
|
262 |
<thead>
|
|
|
263 |
<tr>
|
|
|
264 |
<th colspan="2">Gift Configuration</th>
|
|
|
265 |
<th colspan="3" class="text-end">
|
|
|
266 |
<button type="button" class="btn btn-sm btn-success add-gift">
|
|
|
267 |
<i class="fa fa-plus"></i> Add Gift
|
|
|
268 |
</button>
|
|
|
269 |
</th>
|
|
|
270 |
</tr>
|
|
|
271 |
<tr>
|
|
|
272 |
<th colspan="2">Basic Information</th>
|
|
|
273 |
<th colspan="3">Additional Details</th>
|
|
|
274 |
</tr>
|
|
|
275 |
</thead>
|
|
|
276 |
<tbody>
|
|
|
277 |
<tr class="gift-row">
|
|
|
278 |
<!-- First Column -->
|
|
|
279 |
<td colspan="2">
|
| 35268 |
aman |
280 |
<div class="mb-3">
|
|
|
281 |
<label class="fw-bold"> <strong class="text-black">Default</strong></label>
|
|
|
282 |
<input type="radio" name="defaultGift" class="default-gift-radio" checked>
|
|
|
283 |
</div>
|
| 34480 |
tejus.loha |
284 |
<div class="row">
|
|
|
285 |
<div class="col-md-12 mb-3">
|
|
|
286 |
<label>Gift Name <span class="text-danger">*</span></label>
|
|
|
287 |
<input type="text" class="form-control gift-name" name="name"
|
|
|
288 |
placeholder="Gift Name" required>
|
|
|
289 |
</div>
|
|
|
290 |
</div>
|
|
|
291 |
<div class="row">
|
|
|
292 |
<div class="col-md-6 mb-3">
|
|
|
293 |
<label>Min Cart Value <span class="text-danger">*</span></label>
|
|
|
294 |
<input type="number" step="0.01" class="form-control gift-min-cart"
|
|
|
295 |
name="minCartValue" placeholder="Min Cart Value" required>
|
|
|
296 |
</div>
|
|
|
297 |
<div class="col-md-6 mb-3">
|
|
|
298 |
<label>Max Cart Value <span class="text-danger">*</span></label>
|
|
|
299 |
<input type="number" step="0.01" class="form-control gift-max-cart"
|
|
|
300 |
name="maxCartValue" placeholder="Max Cart Value" required>
|
|
|
301 |
</div>
|
|
|
302 |
</div>
|
|
|
303 |
<div class="row">
|
|
|
304 |
|
|
|
305 |
<div class="col-md-6 mb-3">
|
|
|
306 |
<label>Gift Quantity <span class="text-danger">*</span></label>
|
|
|
307 |
<input type="number" class="form-control gift-redemptions"
|
|
|
308 |
name="maxRedemptions" placeholder="Gift Quantity" required>
|
|
|
309 |
</div>
|
|
|
310 |
<div class="mb-3 col-md-6">
|
| 36080 |
aman |
311 |
<label> Select Partner Store OR <span class="text-danger">*</span></label>
|
| 34480 |
tejus.loha |
312 |
<select class="form-control partnerInfo mb-2" name="partnerInfo" multiple>
|
|
|
313 |
#foreach($retailer in $retailerInfo)
|
|
|
314 |
<option value="$retailer.getPartnerId()">$retailer.getBusinessName()</option>
|
|
|
315 |
#end
|
|
|
316 |
</select>
|
|
|
317 |
</div>
|
|
|
318 |
</div>
|
|
|
319 |
</td>
|
|
|
320 |
<!-- Second Column -->
|
|
|
321 |
<td colspan="3">
|
|
|
322 |
<div class="mb-3">
|
|
|
323 |
<label>Gift Image <span class="text-danger">*</span></label>
|
|
|
324 |
<input type="file" class="form-control gift-thumbnail-file" accept="image/*"
|
|
|
325 |
required>
|
|
|
326 |
<input type="hidden" class="gift-thumbnail-id" name="thumbnailDocumentId">
|
|
|
327 |
</div>
|
|
|
328 |
<div class="mb-3">
|
|
|
329 |
<label>Product Category <span class="text-danger ">*</span></label>
|
|
|
330 |
<select class="form-control gift-product-category" name="productCategory"
|
|
|
331 |
multiple required>
|
|
|
332 |
|
|
|
333 |
#foreach($category in $categoryList)
|
|
|
334 |
<option value="$category.id">$category.displayName</option>
|
|
|
335 |
#end
|
|
|
336 |
</select>
|
|
|
337 |
</div>
|
|
|
338 |
<div class="mb-3 ">
|
|
|
339 |
<label for="fofo-store-id" class="text-center">Upload CSV</label>
|
|
|
340 |
<input type="file" class="form-control fofo-store-file mt-2" accept=".csv">
|
|
|
341 |
<input type="hidden" class="fofo-store-id" name="fofoStore">
|
|
|
342 |
<small class="text-muted">CSV format: S.No,Partner Name,FofoId,Code</small>
|
|
|
343 |
</div>
|
|
|
344 |
</td>
|
|
|
345 |
</tr>
|
|
|
346 |
</tbody>
|
|
|
347 |
</table>
|
|
|
348 |
</div>
|
|
|
349 |
|
|
|
350 |
<div class="form-group">
|
|
|
351 |
<label>Terms & Conditions <span class="text-danger">*</span></label>
|
|
|
352 |
<textarea class="form-control" name="termsCondition" rows="3"
|
|
|
353 |
placeholder="Terms & Conditions"></textarea>
|
|
|
354 |
</div>
|
|
|
355 |
</form>
|
|
|
356 |
</div>
|
|
|
357 |
<div class="modal-footer">
|
|
|
358 |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
|
|
359 |
<button type="button" class="btn btn-primary submit-offer">Save Offer</button>
|
|
|
360 |
</div>
|
|
|
361 |
</div>
|
|
|
362 |
</div>
|
|
|
363 |
</div>
|
|
|
364 |
<div class="modal fade" id="editOfferModal" tabindex="-1" role="dialog" style="height: auto; overflow-y: scroll">
|
|
|
365 |
<div class="modal-dialog modal-lg" role="document">
|
|
|
366 |
<div class="modal-content modal-dialog-scrollable" id="edit-modal-content">
|
|
|
367 |
|
|
|
368 |
</div>
|
|
|
369 |
</div>
|
|
|
370 |
</div>
|
|
|
371 |
|
|
|
372 |
<script>
|
|
|
373 |
$(function () {
|
|
|
374 |
initMultiselect('select[name="productCategory"]', 'Categories')
|
|
|
375 |
initMultiselect('select[name="partnerInfo"]', 'Partner')
|
|
|
376 |
initMultiselect('select[name="paymentMethod"]', 'Payment method')
|
|
|
377 |
})
|
| 35104 |
vikas |
378 |
$(document).on('change', '.partnerInfo', function () {
|
|
|
379 |
const partnerSelect = $(this);
|
|
|
380 |
const csvInput = partnerSelect.closest('tr').find('.fofo-store-file');
|
|
|
381 |
|
|
|
382 |
if (partnerSelect.val() && partnerSelect.val().length > 0) {
|
|
|
383 |
// Partner selected → disable CSV
|
|
|
384 |
csvInput.prop('disabled', true).val('');
|
|
|
385 |
} else {
|
|
|
386 |
// No partner selected → enable CSV
|
|
|
387 |
csvInput.prop('disabled', false);
|
|
|
388 |
}
|
|
|
389 |
});
|
|
|
390 |
|
| 34480 |
tejus.loha |
391 |
</script>
|
|
|
392 |
<script>
|
|
|
393 |
$(function () {
|
|
|
394 |
$('#scratchOfferTable').DataTable({
|
|
|
395 |
"bPaginate": true,
|
|
|
396 |
"bLengthChange": true,
|
|
|
397 |
"bFilter": true,
|
|
|
398 |
"bInfo": false,
|
|
|
399 |
"bAutoWidth": false,
|
|
|
400 |
"pageLength": 20,
|
|
|
401 |
});
|
|
|
402 |
});
|
|
|
403 |
|
| 35268 |
aman |
404 |
$(document).on('change', '.default-gift-radio', function () {
|
|
|
405 |
if ($(this).is(':checked')) {
|
|
|
406 |
$('.default-gift-radio').not(this).prop('checked', false);
|
|
|
407 |
}
|
|
|
408 |
});
|
|
|
409 |
|
| 35104 |
vikas |
410 |
</script>
|