From f5d1c466c570be1cca1ade0d9a623f89793a174b Mon Sep 17 00:00:00 2001 From: wasrusgen Date: Sat, 30 May 2026 14:01:00 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20screen=20mockup=20generator=20=E2=80=94?= =?UTF-8?q?=20Elena=20designs=20UI=20previews=20per=20module=20with=20clie?= =?UTF-8?q?nt=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/crm.html | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/crm.html b/docs/crm.html index 647974c..c7a3311 100644 --- a/docs/crm.html +++ b/docs/crm.html @@ -242,6 +242,29 @@ function exportSpecPDF(){ w.document.close(); } +async function designScreen(module,idx){ + const box=document.getElementById(`screen-${idx}`);box.innerHTML='
Елена рисует экран...
'; + try{const r=await fetch(`${API}/api/design-screen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:current,module})});const d=await r.json(); + if(d.error){box.innerHTML=`
Ошибка: ${d.error}
`;return} + box.innerHTML=renderScreen(d.screen); + }catch(e){box.innerHTML=`
${e.message}
`} +} +function renderScreen(s){ + const frame=inner=>`
${esc(s.title)}
${inner}
`; + const acts=`
${(s.actions||[]).map((a,i)=>`${esc(a)}`).join("")}
`; + let inner=""; + if(s.type==="list"){ + inner=`${(s.columns||[]).map(c=>``).join("")}${(s.rows||[]).map(r=>`${r.map(c=>``).join("")}`).join("")}
${esc(c)}
${esc(c)}
`+acts; + }else if(s.type==="kanban"){ + inner=`
${(s.columns||[]).map(c=>`
${esc(c)}
${(s.rows&&s.rows[0]&&s.rows[0][0])||'Карточка'}
`).join("")}
`+acts; + }else if(s.type==="dashboard"){ + inner=`
${(s.kpis||[]).map(k=>`
${esc(k.value)}
${esc(k.label)}
`).join("")}
`+acts; + }else{ // form/card + inner=`
${(s.fields||[]).map(f=>`
${esc(f.label)}
${f.kind==='select'?'▾ выбрать':f.kind==='status'?'● статус':f.kind==='money'?'0 ₽':f.kind==='date'?'дд.мм.гггг':'значение'}
`).join("")}
`+acts; + } + return frame(inner); +} + const TABS=[{id:"interview",name:"Интервью",icon:"💬"},{id:"methods",name:"Методологии",icon:"🎯"},{id:"canvas",name:"Стратегия",icon:"📊"},{id:"idef0",name:"Функции",icon:"🔧"},{id:"spec",name:"ТЗ",icon:"📋"}]; function approved(s){return state.approvals&&state.approvals[s]} async function approve(s){await fetch(`${API}/api/project/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:current,stage:s,approved:true})});state.approvals=state.approvals||{};state.approvals[s]=1;renderClient();} @@ -263,7 +286,7 @@ async function rerun(stage){const [ep,key]=BUILD[stage];const btn=document.getEl function renderCanvas(c){const B=(k,cls,l)=>{const b=c[k];return `
${l}${b.completeness}%
`};return `
${B("key_partners","kp","Партнёры")}${B("key_activities","ka","Активности")}${B("value_propositions","vp","Ценность")}${B("customer_relationships","cr","Отношения")}${B("customer_segments","cs","Сегменты")}${B("key_resources","kr","Ресурсы")}${B("channels","ch","Каналы")}${B("cost_structure","co","Издержки")}${B("revenue_streams","rev","Доходы")}
Вывод: ${esc(c.insight)}
`;} function renderIdef(m){const box=(fn,ct,ins,outs,me,id,pct)=>{const C=(ct&&ct.length)?ct.map(c=>`${esc(c.name)}`).join(""):`нет управления`;const I=(ins||[]).map(a=>`${esc(a.name)}`).join("")||'';const O=(outs||[]).map(a=>`${esc(a.name)}${a.target==='НИКУДА'?' ⊘':''}`).join("")||'';const M=(me||[]).map(x=>`${esc(x.name)}`).join("")||'';return `
${C}
${I}
${id?`${id}`:''}${esc(fn)}${pct!=null?`${pct}%`:''}
${O}
${M}
`};let h=`
Паттерн: ${esc(m.business_pattern)}
`;if(m.context)h+=`
A-0 Контекст
`+box(m.context.function,m.context.controls,m.context.inputs,m.context.outputs,m.context.mechanisms,"A0");h+=`
Декомпозиция · ${m.activities.length}
`;m.activities.forEach(a=>h+=box(a.function,a.controls,a.inputs,a.outputs,a.mechanisms,a.node_id,a.completeness));if(m.arrow_issues&&m.arrow_issues.length){h+=`
Разрывы · ${m.arrow_issues.length}
`;m.arrow_issues.forEach(g=>{const col=g.severity==='critical'?'#DC2626':g.severity==='high'?'#92400E':'#1E40AF';h+=`
${esc(g.node_id)} · ${g.type}
${esc(g.title)}
${esc(g.description)}
`})}return h;} -function renderSpec(s){let h=`
AОбзор
${esc(s.overview)}
AРоли (${s.roles.length})
`;s.roles.forEach(r=>h+=`
${esc(r.name)} — ${esc(r.does)}
Доступ: ${esc(r.access)}
`);h+=`
BМодули (${s.modules.length})
`;s.modules.forEach(m=>h+=`
${esc(m.source_node)}${esc(m.name)}
${esc(m.purpose)}
${m.screens.map(x=>`${esc(x)}`).join("")}
📥 ${esc(m.inputs_data)} · 📤 ${esc(m.outputs_data)}
${m.rules.length?`
${m.rules.map(r=>`
${esc(r)}
`).join("")}
`:''}
`);h+=`
CДанные (${s.entities.length} таблиц)
`;s.entities.forEach(e=>h+=`
◆ ${esc(e.name)}
${e.fields.map(f=>`
${esc(f.field)} ${esc(f.type)}
`).join("")}
${e.relations.length?`
🔗 ${e.relations.map(esc).join(" · ")}
`:''}
${esc(e.example)}
`);if(s.open_questions&&s.open_questions.length){h+=`
Уточнить перед разработкой${s.open_questions.map(q=>`
${esc(q)}
`).join("")}
`}return h;} +function renderSpec(s){let h=`
AОбзор
${esc(s.overview)}
AРоли (${s.roles.length})
`;s.roles.forEach(r=>h+=`
${esc(r.name)} — ${esc(r.does)}
Доступ: ${esc(r.access)}
`);h+=`
BМодули (${s.modules.length})
`;s.modules.forEach((m,mi)=>h+=`
${esc(m.source_node)}${esc(m.name)}
${esc(m.purpose)}
${m.screens.map(x=>`${esc(x)}`).join("")}
📥 ${esc(m.inputs_data)} · 📤 ${esc(m.outputs_data)}
${m.rules.length?`
${m.rules.map(r=>`
${esc(r)}
`).join("")}
`:''}
`);h+=`
CДанные (${s.entities.length} таблиц)
`;s.entities.forEach(e=>h+=`
◆ ${esc(e.name)}
${e.fields.map(f=>`
${esc(f.field)} ${esc(f.type)}
`).join("")}
${e.relations.length?`
🔗 ${e.relations.map(esc).join(" · ")}
`:''}
${esc(e.example)}
`);if(s.open_questions&&s.open_questions.length){h+=`
Уточнить перед разработкой${s.open_questions.map(q=>`
${esc(q)}
`).join("")}
`}return h;} loadProjects().then(render);