Remove partnumbers column from all pricelist views (data mixed across sources)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-03-13 14:24:15 +03:00
parent 61d7e493bd
commit f0e6bba7e9

View File

@@ -59,7 +59,6 @@
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Категория</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Описание</th>
<th id="th-qty" class="hidden px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase">Доступно</th>
<th id="th-partnumbers" class="hidden px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Partnumbers</th>
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase">Цена, $</th>
<th id="th-settings" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Настройки</th>
</tr>
@@ -160,13 +159,12 @@
}
function itemsColspan() {
return isWarehouseSource() ? 5 : 4;
return isStockSource() ? 4 : 5;
}
function toggleWarehouseColumns() {
const stock = isStockSource();
document.getElementById('th-qty').classList.toggle('hidden', true);
document.getElementById('th-partnumbers').classList.toggle('hidden', !isWarehouseSource());
document.getElementById('th-settings').classList.toggle('hidden', stock);
}
@@ -249,27 +247,6 @@
const description = item.lot_description || '-';
const truncatedDesc = description.length > descMax ? description.substring(0, descMax) + '...' : description;
// Partnumbers cell (stock sources only)
let pnHtml = '—';
if (stock) {
const qtys = item.partnumber_qtys || {};
const allPNs = Array.isArray(item.partnumbers) ? item.partnumbers : [];
const withQty = allPNs.filter(pn => qtys[pn] > 0);
const list = withQty.length > 0 ? withQty : allPNs;
if (list.length === 0) {
pnHtml = '—';
} else {
const shown = list.slice(0, 4);
const rest = list.length - shown.length;
const formatPN = pn => {
const q = qtys[pn];
const qStr = (q > 0) ? ` <span class="text-gray-400">(${formatQty(q)} шт.)</span>` : '';
return `<div><span class="font-mono text-xs">${escapeHtml(pn)}</span>${qStr}</div>`;
};
pnHtml = shown.map(formatPN).join('');
if (rest > 0) pnHtml += `<div class="text-gray-400 text-xs">+${rest} ещё</div>`;
}
}
// Price cell — add spread badge for competitor
@@ -287,7 +264,6 @@
<span class="px-2 py-1 text-xs bg-gray-100 rounded">${escapeHtml(item.category || '-')}</span>
</td>
<td class="${p} text-sm text-gray-500" title="${escapeHtml(description)}">${escapeHtml(truncatedDesc)}</td>
${isWarehouseSource() ? `<td class="${p} text-sm text-gray-600">${pnHtml}</td>` : ''}
<td class="${p} whitespace-nowrap text-right font-mono">${priceHtml}</td>
${!stock ? `<td class="${p} whitespace-nowrap text-sm"><span class="text-xs bg-gray-100 px-2 py-1 rounded">${formatPriceSettings(item)}</span></td>` : ''}
</tr>