Subversion Repositories SmartDukaan

Rev

Rev 35192 | Rev 35458 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35192 Rev 35232
Line 169... Line 169...
169
            </tbody>
169
            </tbody>
170
 
170
 
171
        </table>;
171
        </table>;
172
    }
172
    }
173
 
173
 
-
 
174
    /* planChecked = (e) => {
-
 
175
         //debugger;
-
 
176
         let $itemDetails = $('div.itemdetails');
-
 
177
         if ($itemDetails.find('.dgram').val() === '') {
-
 
178
             bootbox.alert('Mobile RAM is required');
-
 
179
             return;
-
 
180
         }
-
 
181
         if ($itemDetails.find('.dgmemory').val() === '') {
-
 
182
             bootbox.alert('Mobile Memory is required');
-
 
183
             return;
-
 
184
         }
-
 
185
         if ($itemDetails.find('#dgmfgdate').val() === '') {
-
 
186
             bootbox.alert('Mobile Mfg Date is required');
-
 
187
             return;
-
 
188
         }
-
 
189
         let $orderItemRow = $(this.props.elePlanCheckedOn).closest('td');
-
 
190
         $orderItemRow.find('.insuranceid').val($(e.target).data('key'));
-
 
191
         $orderItemRow.find('.correlationid').val($(e.target).data('correlationid'));
-
 
192
         $orderItemRow.find('.insuranceamount').val($(e.target).data('amount'));
-
 
193
         $orderItemRow.find('.ram').val($itemDetails.find('.dgram').val());
-
 
194
         $orderItemRow.find('.memory').val($itemDetails.find('.dgmemory').val());
-
 
195
         // $orderItemRow.find('.mfgdate').val(window.mfgDate);
-
 
196
         $orderItemRow.find('.mfgdate').val($itemDetails.find('.dgmfgdate').val());
-
 
197
         $('#mobilePlansModal').modal('hide');
-
 
198
         calculateTotalAmount();
-
 
199
     }*/
-
 
200
 
174
    planChecked = (e) => {
201
    planChecked = (e) => {
175
        //debugger;
-
 
176
        let $itemDetails = $('div.itemdetails');
202
        let $itemDetails = $('div.itemdetails');
-
 
203
 
177
        if ($itemDetails.find('.dgram').val() === '') {
204
        if ($itemDetails.find('.dgram').val() === '') {
178
            bootbox.alert('Mobile RAM is required');
205
            bootbox.alert('Mobile RAM is required');
179
            return;
206
            return;
180
        }
207
        }
181
        if ($itemDetails.find('.dgmemory').val() === '') {
208
        if ($itemDetails.find('.dgmemory').val() === '') {
Line 184... Line 211...
184
        }
211
        }
185
        if ($itemDetails.find('#dgmfgdate').val() === '') {
212
        if ($itemDetails.find('#dgmfgdate').val() === '') {
186
            bootbox.alert('Mobile Mfg Date is required');
213
            bootbox.alert('Mobile Mfg Date is required');
187
            return;
214
            return;
188
        }
215
        }
-
 
216
 
189
        let $orderItemRow = $(this.props.elePlanCheckedOn).closest('td');
217
        let $orderItemRow = $(this.props.elePlanCheckedOn).closest('td');
-
 
218
 
-
 
219
        // read existing values
-
 
220
        let existingIds = $orderItemRow.find('.insuranceid').val() || "";
-
 
221
        let existingAmounts = $orderItemRow.find('.insuranceamount').data('all-amounts') || ""; // store individual amounts in data attribute
-
 
222
        let existingCorrelation = $orderItemRow.find('.correlationid').val() || "";
-
 
223
 
-
 
224
        // new selected values
-
 
225
        let newId = $(e.target).data('key');
-
 
226
        let newAmount = $(e.target).data('amount');
-
 
227
        let newCorrelation = $(e.target).data('correlationid');
-
 
228
 
-
 
229
        // append IDs
-
 
230
        let updatedIds = existingIds ? existingIds + "," + newId : newId;
-
 
231
 
-
 
232
        // append individual amounts (for tooltip)
-
 
233
        let updatedAmountsList = existingAmounts ? existingAmounts + "," + newAmount : newAmount;
-
 
234
 
-
 
235
        // calculate total
-
 
236
        let totalAmount = updatedAmountsList.split(',').reduce((sum, val) => sum + parseFloat(val || 0), 0);
-
 
237
 
-
 
238
        // correlation ID logic
-
 
239
        let updatedCorrelation = existingCorrelation;
-
 
240
        if (newCorrelation && newCorrelation.trim() !== "") {
-
 
241
            updatedCorrelation = newCorrelation;
-
 
242
        }
-
 
243
 
-
 
244
        // assign back
190
        $orderItemRow.find('.insuranceid').val($(e.target).data('key'));
245
        $orderItemRow.find('.insuranceid').val(updatedIds);
191
        $orderItemRow.find('.correlationid').val($(e.target).data('correlationid'));
246
        $orderItemRow.find('.insuranceamount').val(totalAmount.toFixed(2))  // sum total
-
 
247
            .data('all-amounts', updatedAmountsList)                          // save individual amounts
-
 
248
            .attr('title', updatedAmountsList);                               // tooltip for user
192
        $orderItemRow.find('.insuranceamount').val($(e.target).data('amount'));
249
        $orderItemRow.find('.correlationid').val(updatedCorrelation);
193
        $orderItemRow.find('.ram').val($itemDetails.find('.dgram').val());
250
        $orderItemRow.find('.ram').val($itemDetails.find('.dgram').val());
194
        $orderItemRow.find('.memory').val($itemDetails.find('.dgmemory').val());
251
        $orderItemRow.find('.memory').val($itemDetails.find('.dgmemory').val());
195
        // $orderItemRow.find('.mfgdate').val(window.mfgDate);
-
 
196
        $orderItemRow.find('.mfgdate').val($itemDetails.find('.dgmfgdate').val());
252
        $orderItemRow.find('.mfgdate').val($itemDetails.find('.dgmfgdate').val());
197
        $('#mobilePlansModal').modal('hide');
253
        $(e.target).text("Added");
-
 
254
        $(e.target).prop("disabled", true);
198
        calculateTotalAmount();
255
        calculateTotalAmount();
199
    }
256
    };
-
 
257
 
-
 
258
 
200
 
259
 
201
    checkQuote = (e, plan, planName) => {
260
    checkQuote = (e, plan, planName) => {
202
        //debugger;
261
        //debugger;
203
        let $itemDetails = $('div.itemdetails');
262
        let $itemDetails = $('div.itemdetails');
204
        if ($itemDetails.find('.dgram').val() === '') {
263
        if ($itemDetails.find('.dgram').val() === '') {