| 34480 |
tejus.loha |
1 |
<div class="modal-header ">
|
|
|
2 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
3 |
<h4 class="modal-title">Edit Scratch Offer</h4>
|
|
|
4 |
</div>
|
|
|
5 |
<div class="modal-body">
|
|
|
6 |
<form id="editofferForm">
|
|
|
7 |
<input type="hidden" name="id" value="$!offer.id">
|
|
|
8 |
<div class="row">
|
|
|
9 |
<div class="col-md-6">
|
|
|
10 |
<div class="form-group">
|
|
|
11 |
<label>Offer Name *</label>
|
|
|
12 |
<input type="text" class="form-control" name="name"
|
|
|
13 |
value="$!offer.name" required>
|
|
|
14 |
</div>
|
|
|
15 |
<div class="form-group">
|
|
|
16 |
<label>Description</label>
|
|
|
17 |
<textarea class="form-control" name="description"
|
|
|
18 |
rows="3">$!offer.description</textarea>
|
|
|
19 |
</div>
|
|
|
20 |
<div class="form-group">
|
|
|
21 |
<label>Offer Images *</label>
|
|
|
22 |
<div class="offer-images-container" style="display: flex; align-items: center">
|
|
|
23 |
#foreach($imageId in $offer.offerImage.split(","))
|
|
|
24 |
<div class="offer-image-entry " style="margin-right: 10px">
|
|
|
25 |
## <input type="file" class="form-control offer-image-file"
|
|
|
26 |
## accept="image/*" required>
|
|
|
27 |
## <input type="hidden" class="offer-image-id"
|
|
|
28 |
## name="offerImageIds[]" value="$imageId">
|
|
|
29 |
<img src="/document/$imageId" width="50"
|
|
|
30 |
class="mt-2 existing-image">
|
|
|
31 |
</div>
|
|
|
32 |
#end
|
|
|
33 |
</div>
|
|
|
34 |
## <button type="button" class="btn btn-xs btn-success add-offer-image">
|
|
|
35 |
## <i class="fa fa-plus"></i> Add Another Image
|
|
|
36 |
## </button>
|
|
|
37 |
</div>
|
|
|
38 |
</div>
|
|
|
39 |
<div class="col-md-6">
|
|
|
40 |
<div class="form-group">
|
|
|
41 |
<label>Offer Period *</label>
|
|
|
42 |
<div class="input-daterange input-group">
|
|
|
43 |
<input type="date" class="form-control date-picker"
|
|
|
44 |
name="start_date" value="$!offer.startDate" required>
|
|
|
45 |
<span class="input-group-addon">to</span>
|
|
|
46 |
<input type="date" class="form-control date-picker"
|
|
|
47 |
name="end_date" value="$!offer.endDate" required>
|
|
|
48 |
</div>
|
|
|
49 |
</div>
|
|
|
50 |
<div class="form-group">
|
|
|
51 |
<label>Product Category *</label>
|
|
|
52 |
<select class="form-control productCategory" name="productCategory" multiple required>
|
|
|
53 |
#foreach($category in $categoryList)
|
|
|
54 |
#set($categoryIdString = $category.id.toString())
|
|
|
55 |
#set($selectedCategories = $offer.productCategory.split(","))
|
|
|
56 |
<option value="$category.id"
|
|
|
57 |
#if($selectedCategories.contains($categoryIdString))
|
|
|
58 |
selected="selected"
|
|
|
59 |
#end>
|
|
|
60 |
$category.displayName
|
|
|
61 |
</option>
|
|
|
62 |
#end
|
|
|
63 |
</select>
|
|
|
64 |
</div>
|
|
|
65 |
<div class="form-group">
|
| 34798 |
ranu |
66 |
$offer.paymentMethod
|
|
|
67 |
<label>Payment Method <span class="text-danger">*</span></label>
|
|
|
68 |
<select class="form-control paymentMethod" name="paymentMethod" required multiple>
|
|
|
69 |
#foreach($paymentMethod in $paymentMethods)
|
|
|
70 |
#set($paymentMethod = $paymentMethod.toString())
|
|
|
71 |
<option value="$paymentMethod"
|
|
|
72 |
#if($paymentMethod.contains($paymentMethod))
|
|
|
73 |
selected="selected"
|
|
|
74 |
#end
|
|
|
75 |
>$paymentMethod</option>
|
|
|
76 |
#end
|
| 34480 |
tejus.loha |
77 |
</select>
|
|
|
78 |
</div>
|
| 34798 |
ranu |
79 |
|
| 34480 |
tejus.loha |
80 |
<div class="form-group">
|
|
|
81 |
<label>Offer Classification <span class="text-danger">*</span></label>
|
|
|
82 |
<select class="form-control classification" name="classification" required>
|
|
|
83 |
<option value="">Select Classification</option>
|
|
|
84 |
#foreach($classification in $classifications)
|
|
|
85 |
#set($classification = $classification.toString())
|
|
|
86 |
<option value="$classification"
|
|
|
87 |
#if($offer.classification == $classification)
|
|
|
88 |
selected="selected"
|
|
|
89 |
#end>$classification</option>
|
|
|
90 |
#end
|
|
|
91 |
</select>
|
|
|
92 |
</div>
|
|
|
93 |
|
|
|
94 |
</div>
|
|
|
95 |
</div>
|
|
|
96 |
<div class="row">
|
|
|
97 |
<div class="col-md-6">
|
|
|
98 |
<div class="form-group">
|
|
|
99 |
<label>User Limit</label>
|
|
|
100 |
<input type="number" class="form-control" name="userLimit"
|
|
|
101 |
value="$!offer.userLimit">
|
|
|
102 |
</div>
|
|
|
103 |
</div>
|
|
|
104 |
<div class="col-md-6">
|
|
|
105 |
<div class="form-group">
|
|
|
106 |
<label>Scratch Validity (Days)</label>
|
|
|
107 |
<input type="number" class="form-control" name="scratchValidity"
|
|
|
108 |
value="$!offer.scratchValidity">
|
|
|
109 |
</div>
|
|
|
110 |
</div>
|
|
|
111 |
</div>
|
|
|
112 |
<div class="table-responsive">
|
|
|
113 |
<table class="table dynamic-table" id="giftsContainer">
|
|
|
114 |
<thead>
|
|
|
115 |
<tr>
|
|
|
116 |
<th colspan="2">Gift Configuration</th>
|
|
|
117 |
<th colspan="3" class="text-end">
|
|
|
118 |
<button type="button" class="btn btn-sm btn-success add-gift">
|
|
|
119 |
<i class="fa fa-plus"></i> Add Gift
|
|
|
120 |
</button>
|
|
|
121 |
</th>
|
|
|
122 |
</tr>
|
|
|
123 |
<tr>
|
|
|
124 |
<th colspan="2">Basic Information</th>
|
|
|
125 |
<th colspan="3">Additional Details</th>
|
|
|
126 |
</tr>
|
|
|
127 |
</thead>
|
|
|
128 |
<tbody>
|
|
|
129 |
#foreach($gift in $giftList)
|
|
|
130 |
<tr class="gift-row">
|
|
|
131 |
<!-- Basic Information Column -->
|
|
|
132 |
<td colspan="2">
|
| 35268 |
aman |
133 |
<div class="mb-3">
|
|
|
134 |
<label class="fw-bold"> <strong class="text-black">Default</strong></label>
|
|
|
135 |
<input type="radio" name="defaultGift" class="default-gift-radio" #if($gift.default)
|
|
|
136 |
checked #end>
|
|
|
137 |
</div>
|
| 34480 |
tejus.loha |
138 |
<div class="row">
|
|
|
139 |
<div class="mb-3 col-md-12">
|
|
|
140 |
<label>Gift Name <span class="text-danger">*</span></label>
|
|
|
141 |
<input type="text" class="form-control gift-name"
|
|
|
142 |
name="gifts[].name" value="$gift.name" required>
|
|
|
143 |
<input type="hidden" name="gifts[].id" value="$gift.id">
|
|
|
144 |
</div>
|
|
|
145 |
</div>
|
|
|
146 |
<div class="row">
|
|
|
147 |
<div class="col-md-6 mb-3">
|
|
|
148 |
<label>Min Cart Value <span class="text-danger">*</span></label>
|
|
|
149 |
<input type="number" step="0.01" class="form-control gift-min-cart"
|
|
|
150 |
name="gifts[].minCartValue" value="$gift.minCartValue" required>
|
|
|
151 |
</div>
|
|
|
152 |
<div class="col-md-6 mb-3">
|
|
|
153 |
<label>Max Cart Value <span class="text-danger">*</span></label>
|
|
|
154 |
<input type="number" step="0.01" class="form-control gift-max-cart"
|
|
|
155 |
name="gifts[].maxCartValue" value="$gift.maxCartValue" required>
|
|
|
156 |
</div>
|
|
|
157 |
</div>
|
|
|
158 |
<div class="row">
|
|
|
159 |
<div class="col-md-6 mb-3">
|
|
|
160 |
<label>Gift Quantity <span class="text-danger">*</span></label>
|
|
|
161 |
<input type="number" class="form-control gift-redemptions"
|
|
|
162 |
name="gifts[].maxRedemptions" value="$gift.maxRedemptions" required>
|
|
|
163 |
</div>
|
|
|
164 |
<div class="mb-3 col-md-6">
|
| 36080 |
aman |
165 |
<label> Select Partner Store OR <span class="text-danger">*</span></label>
|
| 34480 |
tejus.loha |
166 |
<select class="form-control fofo-store-id mb-2 partnerInfo" name="partnerInfo"
|
|
|
167 |
multiple
|
|
|
168 |
required>
|
|
|
169 |
#foreach($retailer in $retailerInfo)
|
|
|
170 |
#set($retailerIdString = $retailer.getPartnerId().toString())
|
|
|
171 |
#set($selectedPartner = $gift.fofoStore.split(","))
|
|
|
172 |
<option value="$retailer.getPartnerId()"
|
|
|
173 |
#if($selectedPartner.contains($retailerIdString))
|
|
|
174 |
selected="selected"
|
|
|
175 |
#end>
|
|
|
176 |
$retailer.getBusinessName()
|
|
|
177 |
</option>
|
|
|
178 |
#end
|
|
|
179 |
</select>
|
|
|
180 |
</div>
|
|
|
181 |
</div>
|
|
|
182 |
</td>
|
|
|
183 |
|
|
|
184 |
<!-- Additional Details Column -->
|
|
|
185 |
<td colspan="3">
|
|
|
186 |
<div class="mb-3">
|
|
|
187 |
<label>Gift Image <span class="text-danger">*</span></label>
|
|
|
188 |
<input type="file" class="form-control gift-thumbnail-file" accept="image/*">
|
|
|
189 |
<input type="hidden" class="gift-thumbnail-id"
|
|
|
190 |
name="gifts[].thumbnailDocumentId" value="$gift.thumbnailUrl">
|
|
|
191 |
<img src="/document/$gift.thumbnailUrl" width="50"
|
|
|
192 |
class="mt-2 existing-thumbnail">
|
|
|
193 |
</div>
|
|
|
194 |
|
|
|
195 |
<div class="mb-3">
|
|
|
196 |
<label>Product Category <span class="text-danger">*</span></label>
|
|
|
197 |
<select class="form-control gift-product-category" name="GiftProductCategory" multiple
|
|
|
198 |
required>
|
|
|
199 |
#foreach($category in $categoryList)
|
|
|
200 |
#set($categoryIdString = $category.id.toString())
|
|
|
201 |
#set($selectedCategories = $gift.productCategory.split(","))
|
|
|
202 |
<option value="$category.id"
|
|
|
203 |
#if($selectedCategories.contains($categoryIdString))
|
|
|
204 |
selected="selected"
|
|
|
205 |
#end>
|
|
|
206 |
$category.displayName
|
|
|
207 |
</option>
|
|
|
208 |
#end
|
|
|
209 |
</select>
|
|
|
210 |
</div>
|
|
|
211 |
<div class="mb-3">
|
|
|
212 |
<label> Upload CSV<span class="text-danger">*</span></label>
|
|
|
213 |
<input type="file" class="form-control fofo-store-file" accept=".csv">
|
|
|
214 |
<input type="hidden" class="fofo-store-id"
|
|
|
215 |
name="gifts[].fofoStore" value="$gift.fofoStore">
|
|
|
216 |
<small class="text-muted">CSV format: S.No,Partner Name,FofoId,Code</small>
|
|
|
217 |
#if($gift.fofoStoreId)
|
|
|
218 |
<div class="mt-1">
|
|
|
219 |
<small class="text-success">Existing CSV uploaded</small>
|
|
|
220 |
</div>
|
|
|
221 |
#end
|
|
|
222 |
</div>
|
|
|
223 |
<div class="text-end">
|
|
|
224 |
<button type="button" class="btn btn-sm btn-danger delete-gift"
|
|
|
225 |
value="$gift.id">
|
|
|
226 |
<i class="fa fa-times"></i> Delete Gift
|
|
|
227 |
</button>
|
|
|
228 |
</div>
|
|
|
229 |
</td>
|
|
|
230 |
</tr>
|
|
|
231 |
#end
|
|
|
232 |
</tbody>
|
|
|
233 |
</table>
|
|
|
234 |
</div>
|
|
|
235 |
<div class="form-group">
|
|
|
236 |
<label>Terms & Conditions</label>
|
|
|
237 |
<textarea class="form-control" name="termsCondition"
|
|
|
238 |
rows="3">$!offer.termsCondition</textarea>
|
|
|
239 |
</div>
|
|
|
240 |
</form>
|
|
|
241 |
</div>
|
|
|
242 |
<div class="modal-footer">
|
|
|
243 |
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
|
|
244 |
<button type="button" class="btn btn-primary update-offer" value="$offer.id" data-offer-id="$offer.id">Update
|
|
|
245 |
Offer
|
|
|
246 |
</button>
|
|
|
247 |
</div>
|
|
|
248 |
|
|
|
249 |
<script>
|
|
|
250 |
$(function () {
|
|
|
251 |
initMultiselect('.productCategory', 'Categories')
|
|
|
252 |
initMultiselect('.gift-product-category', 'Categories')
|
|
|
253 |
initMultiselect('.paymentMethod', 'Payment method')
|
|
|
254 |
initMultiselect('.partnerInfo', 'Partner')
|
|
|
255 |
})
|
| 35104 |
vikas |
256 |
|
| 35268 |
aman |
257 |
|
| 35104 |
vikas |
258 |
function toggleCsvOnPartnerChange(row) {
|
|
|
259 |
const partnerSelect = row.find('.partnerInfo');
|
|
|
260 |
const csvInput = row.find('.fofo-store-file');
|
|
|
261 |
|
|
|
262 |
if (partnerSelect.val() && partnerSelect.val().length > 0) {
|
|
|
263 |
csvInput.prop('disabled', true).val('');
|
|
|
264 |
} else {
|
|
|
265 |
csvInput.prop('disabled', false);
|
|
|
266 |
}
|
|
|
267 |
}
|
|
|
268 |
|
| 35268 |
aman |
269 |
|
| 35104 |
vikas |
270 |
$(document).on('change', '.partnerInfo', function () {
|
|
|
271 |
const row = $(this).closest('tr.gift-row');
|
|
|
272 |
toggleCsvOnPartnerChange(row);
|
|
|
273 |
});
|
|
|
274 |
|
| 35268 |
aman |
275 |
|
| 35104 |
vikas |
276 |
$('#editOfferModal').on('shown.bs.modal', function () {
|
|
|
277 |
$(this).find('tr.gift-row').each(function () {
|
|
|
278 |
toggleCsvOnPartnerChange($(this));
|
|
|
279 |
});
|
|
|
280 |
});
|
| 35268 |
aman |
281 |
$(document).on('change', '.default-gift-radio', function () {
|
|
|
282 |
if ($(this).is(':checked')) {
|
|
|
283 |
$('.default-gift-radio').not(this).prop('checked', false);
|
|
|
284 |
}
|
|
|
285 |
});
|
| 34480 |
tejus.loha |
286 |
</script>
|