From f99fae5a28c637f74f1d5a92bd739882c75525fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Fri, 19 Jun 2026 10:27:10 +0400 Subject: [PATCH] =?UTF-8?q?radio=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D1=8B=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=B0=20=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=B4=D0=BE=D0=B3=D0=BE=D0=B2=D0=BE=D1=80=D0=B0=20+?= =?UTF-8?q?=20api=20set=5Finitial=20(v1.0.57)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.cfm | 25 +++++++++++++++++++++++++ index.cfm | 44 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/api.cfm b/api.cfm index 610ff18..c9320b9 100644 --- a/api.cfm +++ b/api.cfm @@ -117,6 +117,31 @@ #preserveSingleQuotes(body.sql)# + + + + + + + + SELECT contract_id FROM supplements WHERE id= + + + + + + + UPDATE supplements SET type='additional' + WHERE contract_id= + + + UPDATE supplements SET type='initial' + WHERE id= + + + + + diff --git a/index.cfm b/index.cfm index 6135e47..73dc218 100644 --- a/index.cfm +++ b/index.cfm @@ -61,7 +61,7 @@
Nubes - Сверка договоров — LLM v1.0.56 — Lucee + Сверка договоров — LLM v1.0.57 — Lucee
@@ -76,7 +76,7 @@
- +
ИмяИзменёнРазмерСтатус
ИмяИзменёнРазмерСтатусБазовый
@@ -164,15 +164,20 @@ function formatDate(ts) { function renderTable() { if (fileQueue.length === 0) { - fileTable.innerHTML = 'Нет файлов — выберите .docx / .pdf / .zip'; + fileTable.innerHTML = 'Нет файлов — выберите .docx / .pdf / .zip'; parseBtn.disabled = true; } else { fileTable.innerHTML = fileQueue.map(function(f, i) { + var radio = ''; + if (f.supp_id) { + radio = ''; + } return '' + '' + f.name + '' + '' + formatDate(f.lastModified) + '' + '' + formatSize(f.size) + '' + '' + (f.status || '') + '' + + '' + radio + '' + '' + '' + ''; @@ -219,6 +224,8 @@ fileInput.addEventListener('change', async function() { renderTable(); } + await refreshSupps(); + fileInput.value = ''; fileInput.disabled = false; parseBtn.disabled = (contractId === null); @@ -304,6 +311,9 @@ parseBtn.addEventListener('click', async function() { renderTable(); } + // Обновить информацию о supplement_id/type для radio + await refreshSupps(); + parseBtn.innerHTML = ' ✓ Готово'; var llmBtn = document.getElementById('llmBtn'); llmBtn.style.display = 'flex'; @@ -311,6 +321,34 @@ parseBtn.addEventListener('click', async function() { lucide.createIcons(); }); +// ── Обновить supplement_id/type для radio ────────────────── +async function refreshSupps() { + if (!contractId) return; + try { + var resp = await fetch('/api.cfm?action=query&sql=' + encodeURIComponent("SELECT s.id, s.type, s.document_id FROM supplements s WHERE s.contract_id='" + contractId + "'")); + var data = await resp.json(); + if (data.OK && data.ROWS) { + data.ROWS.forEach(function(r) { + var supp = {}; + data.COLUMNS.forEach(function(c, ci) { supp[c] = r[ci]; }); + for (var i = 0; i < fileQueue.length; i++) { + if (fileQueue[i].doc_id === supp.document_id) { + fileQueue[i].supp_id = supp.id; + fileQueue[i].supp_type = supp.type; + } + } + }); + renderTable(); + } + } catch(e) {} +} + +function setInitial(suppId) { + fetch('/api.cfm?action=set_initial&supplement_id=' + suppId) + .then(function() { refreshSupps(); }); +} +window.setInitial = setInitial; + // ── LLM: Сравнить ──────────────────────────────────────────── document.getElementById('llmBtn').addEventListener('click', async function() { if (!contractId) return;