fix: количество исчезало при вводе в мультиселект-таблицах конфигуратора
Партиальный DOM-патч в updateMultiQuantity() писал сумму в ячейку «Кол-во» (td:nth-child(5)) вместо «Стоимость» (td:nth-child(6)), затирая input с количеством. Заодно ужесточили поиск строки: вместо нестрогого querySelector по подстроке onchange-атрибута — точный поиск по data-lot-name.
This commit is contained in:
@@ -1597,7 +1597,7 @@ function renderMultiSelectTab(components) {
|
|||||||
const total = getDisplayPrice(item) * item.quantity;
|
const total = getDisplayPrice(item) * item.quantity;
|
||||||
|
|
||||||
html += `
|
html += `
|
||||||
<tr class="hover:bg-gray-50">
|
<tr class="hover:bg-gray-50" data-lot-name="${escapeHtml(item.lot_name)}">
|
||||||
<td class="px-2 py-2 text-center">${qualityDotHtml(comp?.price_quality)}</td>
|
<td class="px-2 py-2 text-center">${qualityDotHtml(comp?.price_quality)}</td>
|
||||||
<td class="px-3 py-2 min-w-48">
|
<td class="px-3 py-2 min-w-48">
|
||||||
<div class="autocomplete-wrapper relative">
|
<div class="autocomplete-wrapper relative">
|
||||||
@@ -1708,7 +1708,7 @@ function renderMultiSelectTabWithSections(sections) {
|
|||||||
const total = getDisplayPrice(item) * item.quantity;
|
const total = getDisplayPrice(item) * item.quantity;
|
||||||
|
|
||||||
html += `
|
html += `
|
||||||
<tr class="hover:bg-gray-50">
|
<tr class="hover:bg-gray-50" data-lot-name="${escapeHtml(item.lot_name)}">
|
||||||
<td class="px-2 py-2 text-center">${qualityDotHtml(comp?.price_quality)}</td>
|
<td class="px-2 py-2 text-center">${qualityDotHtml(comp?.price_quality)}</td>
|
||||||
<td class="px-3 py-2 min-w-48">
|
<td class="px-3 py-2 min-w-48">
|
||||||
<div class="autocomplete-wrapper relative">
|
<div class="autocomplete-wrapper relative">
|
||||||
@@ -2229,9 +2229,9 @@ function updateMultiQuantity(lotName, value) {
|
|||||||
updateCartUI();
|
updateCartUI();
|
||||||
triggerAutoSave();
|
triggerAutoSave();
|
||||||
// Update total in the row
|
// Update total in the row
|
||||||
const row = document.querySelector(`input[onchange*="${lotName}"]`)?.closest('tr');
|
const row = document.querySelector(`tr[data-lot-name="${CSS.escape(lotName)}"]`);
|
||||||
if (row) {
|
if (row) {
|
||||||
const totalCell = row.querySelector('td:nth-child(5)');
|
const totalCell = row.querySelector('td:nth-child(6)');
|
||||||
if (totalCell) {
|
if (totalCell) {
|
||||||
totalCell.textContent = formatMoney(getDisplayPrice(item) * item.quantity);
|
totalCell.textContent = formatMoney(getDisplayPrice(item) * item.quantity);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user