feat: add double-click on item row to add to cart
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3dc04ed092
commit
43ccb8a2da
|
|
@ -759,6 +759,23 @@ class SelectionDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Двойной клик по строке — добавить в корзину
|
||||||
|
$grid.find('tbody tr').on('dblclick', function(e) {
|
||||||
|
if ($(e.target).closest('.btn-add-to-cart, .row-qty-input, .stock-indicator, .item-open-link').length) return;
|
||||||
|
const item_index = parseInt($(this).data('item-index'));
|
||||||
|
const item = me.items_data[item_index];
|
||||||
|
if (!item) return;
|
||||||
|
const qty_val = parseFloat(($(this).find('.row-qty-input').val() || '').replace(',', '.')) || 1;
|
||||||
|
me.add_to_cart(item, qty_val);
|
||||||
|
|
||||||
|
// Визуальная обратная связь
|
||||||
|
const $btn = $(this).find('.btn-add-to-cart');
|
||||||
|
$btn.addClass('btn-success').removeClass('btn-primary');
|
||||||
|
setTimeout(() => {
|
||||||
|
$btn.addClass('btn-primary').removeClass('btn-success');
|
||||||
|
}, 600);
|
||||||
|
});
|
||||||
|
|
||||||
// Фильтрация ввода для qty-инпутов грида
|
// Фильтрация ввода для qty-инпутов грида
|
||||||
$grid.find('tbody tr').each(function() {
|
$grid.find('tbody tr').each(function() {
|
||||||
const item_index = parseInt($(this).data('item-index'));
|
const item_index = parseInt($(this).data('item-index'));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue