diff --git a/deploy/app.js b/deploy/app.js new file mode 100644 index 0000000..a494b90 --- /dev/null +++ b/deploy/app.js @@ -0,0 +1,644 @@ +// Contracts App — весь JS на VM (contracts.kube5s.ru) +// Lucee: только домен + index.cfm-скелет +var VM_API = 'https://contracts.kube5s.ru'; +var UPLOAD_URL = VM_API + '/upload'; +var CONVERT_URL = VM_API + '/convert-doc'; +var UNZIP_URL = VM_API + '/unzip-upload'; +var UNZIP_URL = 'https://contracts.kube5s.ru/unzip-upload'; +var SITE_URL = ''; // same origin for api calls + +var fileInput = document.getElementById('fileInput'); +var fileTable = document.getElementById('fileTable'); +var fileQueue = []; +var contractId = null; + +function formatSize(bytes) { + if (!bytes || bytes === 0) return '—'; + if (bytes < 1024) return bytes + ' B'; + if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB'; + return (bytes / 1048576).toFixed(1) + ' MB'; +} + +function formatDate(ts) { + if (!ts) return '—'; + var d = new Date(ts); + return d.toLocaleDateString('ru-RU') + ' ' + d.toLocaleTimeString('ru-RU', {hour:'2-digit',minute:'2-digit'}); +} + +function renderTable() { + if (fileQueue.length === 0) { + fileTable.innerHTML = '
| Действие | Услуга | Цена | Кол-во | Сумма | Дата |
|---|---|---|---|---|---|
| ' + action + ' | ' + name + ' | ' + price + ' | ' + qty + ' | ' + sum + ' | ' + ds + ' |
' + textify + ''; + + // Правая: статистика + textify + rightHtml += '
' + d.ERRORS.join('\n') + '';
+ }
+ }
+ rightHtml += '' + textify + ''; + if (f.supp_id) { + rightHtml += '