ui: add clear BOM button with server-side reset
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -294,6 +294,9 @@
|
|||||||
<div class="mt-3 flex items-center justify-between text-sm text-gray-600">
|
<div class="mt-3 flex items-center justify-between text-sm text-gray-600">
|
||||||
<div id="bom-stats"></div>
|
<div id="bom-stats"></div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
|
<button onclick="clearBOM()" class="px-3 py-1 bg-gray-100 text-gray-600 rounded hover:bg-gray-200 border border-gray-300">
|
||||||
|
Очистить
|
||||||
|
</button>
|
||||||
<button onclick="saveBOM()" class="px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700">
|
<button onclick="saveBOM()" class="px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700">
|
||||||
Сохранить BOM
|
Сохранить BOM
|
||||||
</button>
|
</button>
|
||||||
@@ -2823,6 +2826,20 @@ function debouncedResolveBOM() {
|
|||||||
_resolveBOMTimer = setTimeout(() => resolveBOM(), 500);
|
_resolveBOMTimer = setTimeout(() => resolveBOM(), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function clearBOM() {
|
||||||
|
if (bomRows.length && !confirm('Очистить BOM? Данные будут удалены с сервера.')) return;
|
||||||
|
bomRows = [];
|
||||||
|
document.getElementById('bom-table-container').classList.add('hidden');
|
||||||
|
document.getElementById('bom-paste-area').textContent = 'Нажмите сюда и вставьте из Excel (Ctrl+V)...';
|
||||||
|
if (configUUID) {
|
||||||
|
await fetch(`/api/configs/${configUUID}/vendor-spec`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {'Content-Type': 'application/json'},
|
||||||
|
body: JSON.stringify({vendor_spec: []})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function saveBOM() {
|
async function saveBOM() {
|
||||||
if (!configUUID || !bomRows.length) return;
|
if (!configUUID || !bomRows.length) return;
|
||||||
const spec = bomRows.map(r => ({
|
const spec = bomRows.map(r => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user