Subversion Repositories SmartDukaan

Rev

Rev 34798 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
34480 tejus.loha 1
<div class="modal-header ">
2
    <button type="button" class="close" data-dismiss="modal">&times;</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">
66
                    <label>Payment Method *</label>
67
                    <select class="form-control paymentMethod" name="paymentMethod" multiple required>
68
                        <option value="POD"
69
                            #if($offer.paymentMethod && $offer.paymentMethod.contains("POD"))
70
                                selected
71
                            #end
72
                        >Pay On Delivery
73
                        </option>
74
                        <option value="EMIOD"
75
                            #if($offer.paymentMethod && $offer.paymentMethod.contains("EMIOD"))
76
                                selected
77
                            #end
78
                        >EMI On Delivery
79
                        </option>
80
                        <option value="RZ"
81
                            #if($offer.paymentMethod && $offer.paymentMethod.contains("RZ"))
82
                                selected
83
                            #end
84
                        >Wallet/Cards/Netbanking/UPI
85
                        </option>
86
                        <option value="CCAVE"
87
                            #if($offer.paymentMethod && $offer.paymentMethod.contains("CCAVE"))
88
                                selected
89
                            #end
90
                        >Other Online Payments
91
                        </option>
92
                    </select>
93
                </div>
94
                <div class="form-group">
95
                    <label>Offer Classification <span class="text-danger">*</span></label>
96
                    <select class="form-control classification" name="classification" required>
97
                        <option value="">Select Classification</option>
98
                        #foreach($classification in $classifications)
99
                            #set($classification = $classification.toString())
100
                            <option value="$classification"
101
                                #if($offer.classification == $classification)
102
                                    selected="selected"
103
                                #end>$classification</option>
104
                        #end
105
                    </select>
106
                </div>
107
 
108
            </div>
109
        </div>
110
        <div class="row">
111
            <div class="col-md-6">
112
                <div class="form-group">
113
                    <label>User Limit</label>
114
                    <input type="number" class="form-control" name="userLimit"
115
                           value="$!offer.userLimit">
116
                </div>
117
            </div>
118
            <div class="col-md-6">
119
                <div class="form-group">
120
                    <label>Scratch Validity (Days)</label>
121
                    <input type="number" class="form-control" name="scratchValidity"
122
                           value="$!offer.scratchValidity">
123
                </div>
124
            </div>
125
        </div>
126
        <div class="table-responsive">
127
            <table class="table dynamic-table" id="giftsContainer">
128
                <thead>
129
                <tr>
130
                    <th colspan="2">Gift Configuration</th>
131
                    <th colspan="3" class="text-end">
132
                        <button type="button" class="btn btn-sm btn-success add-gift">
133
                            <i class="fa fa-plus"></i> Add Gift
134
                        </button>
135
                    </th>
136
                </tr>
137
                <tr>
138
                    <th colspan="2">Basic Information</th>
139
                    <th colspan="3">Additional Details</th>
140
                </tr>
141
                </thead>
142
                <tbody>
143
                    #foreach($gift in $giftList)
144
                    <tr class="gift-row">
145
                        <!-- Basic Information Column -->
146
                        <td colspan="2">
147
                            <div class="row">
148
                                <div class="mb-3 col-md-12">
149
                                    <label>Gift Name <span class="text-danger">*</span></label>
150
                                    <input type="text" class="form-control gift-name"
151
                                           name="gifts[].name" value="$gift.name" required>
152
                                    <input type="hidden" name="gifts[].id" value="$gift.id">
153
                                </div>
154
                            </div>
155
                            <div class="row">
156
                                <div class="col-md-6 mb-3">
157
                                    <label>Min Cart Value <span class="text-danger">*</span></label>
158
                                    <input type="number" step="0.01" class="form-control gift-min-cart"
159
                                           name="gifts[].minCartValue" value="$gift.minCartValue" required>
160
                                </div>
161
                                <div class="col-md-6 mb-3">
162
                                    <label>Max Cart Value <span class="text-danger">*</span></label>
163
                                    <input type="number" step="0.01" class="form-control gift-max-cart"
164
                                           name="gifts[].maxCartValue" value="$gift.maxCartValue" required>
165
                                </div>
166
                            </div>
167
                            <div class="row">
168
                                <div class="col-md-6 mb-3">
169
                                    <label>Gift Quantity <span class="text-danger">*</span></label>
170
                                    <input type="number" class="form-control gift-redemptions"
171
                                           name="gifts[].maxRedemptions" value="$gift.maxRedemptions" required>
172
                                </div>
173
                                <div class="mb-3 col-md-6">
174
                                    <label> Select Fofo Store OR <span class="text-danger">*</span></label>
175
                                    <select class="form-control fofo-store-id mb-2 partnerInfo" name="partnerInfo"
176
                                            multiple
177
                                            required>
178
                                        #foreach($retailer in $retailerInfo)
179
                                            #set($retailerIdString = $retailer.getPartnerId().toString())
180
                                            #set($selectedPartner = $gift.fofoStore.split(","))
181
                                            <option value="$retailer.getPartnerId()"
182
                                                #if($selectedPartner.contains($retailerIdString))
183
                                                    selected="selected"
184
                                                #end>
185
                                                $retailer.getBusinessName()
186
                                            </option>
187
                                        #end
188
                                    </select>
189
                                </div>
190
                            </div>
191
                        </td>
192
 
193
                        <!-- Additional Details Column -->
194
                        <td colspan="3">
195
                            <div class="mb-3">
196
                                <label>Gift Image <span class="text-danger">*</span></label>
197
                                <input type="file" class="form-control gift-thumbnail-file" accept="image/*">
198
                                <input type="hidden" class="gift-thumbnail-id"
199
                                       name="gifts[].thumbnailDocumentId" value="$gift.thumbnailUrl">
200
                                <img src="/document/$gift.thumbnailUrl" width="50"
201
                                     class="mt-2 existing-thumbnail">
202
                            </div>
203
 
204
                            <div class="mb-3">
205
                                <label>Product Category <span class="text-danger">*</span></label>
206
                                <select class="form-control gift-product-category" name="GiftProductCategory" multiple
207
                                        required>
208
                                    #foreach($category in $categoryList)
209
                                        #set($categoryIdString = $category.id.toString())
210
                                        #set($selectedCategories = $gift.productCategory.split(","))
211
                                        <option value="$category.id"
212
                                            #if($selectedCategories.contains($categoryIdString))
213
                                                selected="selected"
214
                                            #end>
215
                                            $category.displayName
216
                                        </option>
217
                                    #end
218
                                </select>
219
                            </div>
220
                            <div class="mb-3">
221
                                <label> Upload CSV<span class="text-danger">*</span></label>
222
                                <input type="file" class="form-control fofo-store-file" accept=".csv">
223
                                <input type="hidden" class="fofo-store-id"
224
                                       name="gifts[].fofoStore" value="$gift.fofoStore">
225
                                <small class="text-muted">CSV format: S.No,Partner Name,FofoId,Code</small>
226
                                #if($gift.fofoStoreId)
227
                                    <div class="mt-1">
228
                                        <small class="text-success">Existing CSV uploaded</small>
229
                                    </div>
230
                                #end
231
                            </div>
232
                            <div class="text-end">
233
                                <button type="button" class="btn btn-sm btn-danger delete-gift"
234
                                        value="$gift.id">
235
                                    <i class="fa fa-times"></i> Delete Gift
236
                                </button>
237
                            </div>
238
                        </td>
239
                    </tr>
240
                    #end
241
                </tbody>
242
            </table>
243
        </div>
244
        <div class="form-group">
245
            <label>Terms & Conditions</label>
246
            <textarea class="form-control" name="termsCondition"
247
                      rows="3">$!offer.termsCondition</textarea>
248
        </div>
249
    </form>
250
</div>
251
<div class="modal-footer">
252
    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
253
    <button type="button" class="btn btn-primary update-offer" value="$offer.id" data-offer-id="$offer.id">Update
254
        Offer
255
    </button>
256
</div>
257
 
258
<script>
259
    $(function () {
260
        initMultiselect('.productCategory', 'Categories')
261
        initMultiselect('.gift-product-category', 'Categories')
262
        initMultiselect('.paymentMethod', 'Payment method')
263
        initMultiselect('.partnerInfo', 'Partner')
264
    })
265
</script>