diff --git a/mockup.html b/mockup.html index dcc43b7..04bef9e 100644 --- a/mockup.html +++ b/mockup.html @@ -1726,6 +1726,7 @@ body{font-family:var(--font-ui);background:var(--surf);color:var(--ink);line-hei 📋 Шаблоны ✍️ Составить документ ✅ Мои документы + 📝 Карта дела 🖊️ Реквизиты 💳 Баланс и оплата ↩ Выйти (в начало) @@ -2267,6 +2268,24 @@ body{font-family:var(--font-ui);background:var(--surf);color:var(--ink);line-hei + +
+
Кабинет
+
+

📝 Карта дела

+ +
+
+
Здесь собрано всё что важно знать по делу: принятые решения, зафиксированные риски, обещания по документам. Это приложение к делу — не сам документ.
+
+
+ +
+ Начните работу с Еленой — карта дела заполнится автоматически. +
+
+
+
Кабинет

Реквизиты

@@ -4694,8 +4713,10 @@ function _showGeneratedDoc(data) { '
' + '
' + '' + - '' + - '' + + '' + + '' + + '' + + '' + '
' + '
'; @@ -4717,6 +4738,74 @@ function _printDoc() { w.document.close(); } +function _sendDocToCounterparty() { + var textEl = document.getElementById('tpl-doc-text'); + if (!textEl) return; + + var text = textEl.textContent || textEl.innerText || ''; + var postalData = typeof _postalData !== 'undefined' ? _postalData : null; + var toEmail = (postalData && postalData.counterEmail) || ''; + var toName = (postalData && postalData.counterparty) || 'Контрагенту'; + + // Закрываем модал документа + var modal = document.getElementById('tpl-result'); + if (modal) modal.remove(); + + // Показываем модал отправки + var sendModal = document.createElement('div'); + sendModal.id = 'send-doc-modal'; + sendModal.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:1000;display:flex;align-items:flex-end;justify-content:center'; + sendModal.innerHTML = + '
' + + '
📨 Отправить контрагенту
' + + '
Документ будет отправлен по email или вы скопируете ссылку
' + + '
' + + '' + + '' + + '
' + + '
' + + '' + + '' + + '' + + '
' + + '
' + + '💡 После отправки зафиксируем факт в карте дела — дата, получатель.' + + '
' + + '
'; + document.body.appendChild(sendModal); + setTimeout(function(){ var e = document.getElementById('send-email'); if (e && !e.value) e.focus(); }, 200); +} + +function _doSendEmail() { + var email = (document.getElementById('send-email') || {}).value || ''; + var subject = (document.getElementById('send-subject') || {}).value || 'Документ'; + var textEl = document.getElementById('tpl-doc-text'); + var body = textEl ? (textEl.textContent || '') : ''; + + // Открываем mailto (браузер откроет почтовый клиент) + var mailtoLink = 'mailto:' + encodeURIComponent(email) + + '?subject=' + encodeURIComponent(subject) + + '&body=' + encodeURIComponent(body.slice(0, 2000) + (body.length > 2000 ? '\n\n...(полный текст скопируйте из приложения)' : '')); + + window.location.href = mailtoLink; + + // Фиксируем в карте дела + _addCaseNote('decision', + 'Документ отправлен: ' + subject + (email ? ' → ' + email : ''), + { email: email, date: new Date().toISOString() }); + + document.getElementById('send-doc-modal').remove(); + toast('✅ Открываю почтовый клиент. Факт отправки зафиксирован в карте дела.'); +} + +function _copyAndClose() { + _copyDoc(); + var m = document.getElementById('send-doc-modal'); + if (m) m.remove(); + _addCaseNote('decision', 'Текст документа скопирован для отправки контрагенту', {}); + toast('📋 Текст скопирован. Вставьте в письмо контрагенту.'); +} + function _copyDoc() { var text = document.getElementById('tpl-doc-text'); if (!text) return; @@ -7376,6 +7465,7 @@ function tab(name){ if(name==='sroki' && typeof renderDeadlines==='function') renderDeadlines(); if(name==='shab' && typeof renderContextTemplates==='function') renderContextTemplates(); if(name==='requisites' && typeof _loadRequisites==='function') _loadRequisites(); + if(name==='casemap' && typeof renderCaseMap==='function') renderCaseMap(); if(name==='docs') { var contracts = typeof _getContracts === 'function' ? _getContracts() : []; if (contracts.length && typeof renderDocChecklist === 'function') renderDocChecklist(contracts[0].type); @@ -7689,6 +7779,132 @@ function _compressAsync(showToast) { .catch(function(){}); } +// ── КАРТА ДЕЛА ─────────────────────────────────────────────────────────────── + +var _CASE_NOTES_KEY = 'zashita_case_notes'; + +// Добавить заметку в карту дела +function _addCaseNote(type, text, meta) { + try { + var notes = JSON.parse(localStorage.getItem(_CASE_NOTES_KEY) || '[]'); + notes.push({ + id: Date.now(), + ts: new Date().toISOString(), + type: type, // 'risk' | 'missing_doc' | 'promise' | 'decision' | 'refusal' | 'acknowledged' + text: text, + meta: meta || {} + }); + localStorage.setItem(_CASE_NOTES_KEY, JSON.stringify(notes)); + } catch(e){} +} + +function _getCaseNotes() { + try { return JSON.parse(localStorage.getItem(_CASE_NOTES_KEY) || '[]'); } + catch(e) { return []; } +} + +function renderCaseMap() { + var el = document.getElementById('casemap-content'); + if (!el) return; + + var notes = _getCaseNotes(); + var dossier = _getDossier() || {}; + + if (!notes.length && !dossier.facts && !dossier.decisions && !dossier.open) { + el.innerHTML = '
Начните работу с Еленой — карта дела заполнится автоматически.
'; + return; + } + + var today = new Date().toLocaleDateString('ru-RU', {day:'2-digit', month:'long', year:'numeric'}); + var html = '
Сформировано: ' + today + '
'; + + // Секция: Принятые решения (из досье) + if (dossier.decisions && dossier.decisions.length) { + html += _cmSection('✅ Принятые решения', '#16a34a', dossier.decisions.map(function(d){ + return {text: d, icon: '✅'}; + })); + } + + // Секция: Зафиксированные риски + var risks = notes.filter(function(n){ return n.type === 'risk' || n.type === 'acknowledged'; }); + if (risks.length) { + html += _cmSection('⚠️ Принятые риски (клиент ознакомлен)', '#d97706', risks.map(function(n){ + return {text: n.text, icon: n.type === 'acknowledged' ? '👁' : '⚠️', date: n.ts}; + })); + } + + // Секция: Отсутствующие документы + var missing = notes.filter(function(n){ return n.type === 'missing_doc'; }); + if (missing.length) { + html += _cmSection('📁 Документы отсутствуют', '#dc2626', missing.map(function(n){ + return {text: n.text, icon: '❌', sub: n.meta.reason || '', date: n.ts}; + })); + } + + // Секция: Обещания загрузить + var promises = notes.filter(function(n){ return n.type === 'promise'; }); + if (promises.length) { + html += _cmSection('🕐 Обещано загрузить позже', '#2563eb', promises.map(function(n){ + return {text: n.text, icon: '📋', date: n.ts}; + })); + } + + // Секция: Отказы контрагента + var refusals = notes.filter(function(n){ return n.type === 'refusal'; }); + if (refusals.length) { + html += _cmSection('🚫 Отказы контрагента', '#7c3aed', refusals.map(function(n){ + return {text: n.text, icon: '🚫', date: n.ts}; + })); + } + + // Секция: Открытые вопросы + if (dossier.open && dossier.open.length) { + html += _cmSection('❓ Открытые вопросы', '#6b7280', dossier.open.map(function(d){ + return {text: d, icon: '❓'}; + })); + } + + // Подпись + html += '
' + + 'Карта дела сформирована сервисом ЗАЩИТА (@wasrusgen1) · i@wasrusgen.ru · ' + today + + '
'; + + el.innerHTML = html; +} + +function _cmSection(title, color, items) { + if (!items || !items.length) return ''; + var html = '
' + + '
' + title + '
' + + '
'; + items.forEach(function(item) { + var dateStr = item.date ? ' ' + + new Date(item.date).toLocaleDateString('ru-RU') + '' : ''; + html += '
' + + '' + item.icon + '' + + '' + item.text + '' + dateStr + + (item.sub ? '
' + item.sub + '
' : '') + + '
'; + }); + return html + '
'; +} + +function _exportCaseMap() { + var el = document.getElementById('casemap-content'); + if (!el) return; + var w = window.open('', '_blank'); + w.document.write('Карта дела — ЗАЩИТА' + + '' + + '

📝 Карта дела

' + el.innerHTML + + '