Subversion Repositories SmartDukaan

Rev

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

Rev 34798 Rev 35104
Line 246... Line 246...
246
        initMultiselect('.productCategory', 'Categories')
246
        initMultiselect('.productCategory', 'Categories')
247
        initMultiselect('.gift-product-category', 'Categories')
247
        initMultiselect('.gift-product-category', 'Categories')
248
        initMultiselect('.paymentMethod', 'Payment method')
248
        initMultiselect('.paymentMethod', 'Payment method')
249
        initMultiselect('.partnerInfo', 'Partner')
249
        initMultiselect('.partnerInfo', 'Partner')
250
    })
250
    })
-
 
251
 
-
 
252
    // Function to toggle CSV based on partner selection
-
 
253
    function toggleCsvOnPartnerChange(row) {
-
 
254
        const partnerSelect = row.find('.partnerInfo');
-
 
255
        const csvInput = row.find('.fofo-store-file');
-
 
256
 
-
 
257
        if (partnerSelect.val() && partnerSelect.val().length > 0) {
-
 
258
            csvInput.prop('disabled', true).val('');
-
 
259
        } else {
-
 
260
            csvInput.prop('disabled', false);
-
 
261
        }
-
 
262
    }
-
 
263
 
-
 
264
    // On partner dropdown change
-
 
265
    $(document).on('change', '.partnerInfo', function () {
-
 
266
        const row = $(this).closest('tr.gift-row');
-
 
267
        toggleCsvOnPartnerChange(row);
-
 
268
    });
-
 
269
 
-
 
270
    // Run check on modal open (for pre-filled values)
-
 
271
    $('#editOfferModal').on('shown.bs.modal', function () {
-
 
272
        $(this).find('tr.gift-row').each(function () {
-
 
273
            toggleCsvOnPartnerChange($(this));
-
 
274
        });
-
 
275
    });
-
 
276
 
251
</script>
277
</script>
252
278