diff --git a/docs/crm.html b/docs/crm.html index 087be7b..b281248 100644 --- a/docs/crm.html +++ b/docs/crm.html @@ -305,6 +305,11 @@ function renderMainPanel(){ const p=document.getElementById("mainPanel");if(!p)return; const crm=state.crm||{pipeline:"lead",deal_amount:0,source:""}; if(mainTab==="deal"){ + const deal=crm.deal_amount||0; + const pays=crm.payments||[]; const paid=pays.reduce((s,x)=>s+(x.amount||0),0); const left=Math.max(0,deal-paid); + const doneArr=CLIENT_STAGES.map(s=>stageIsDone(s.key)); + const firstUndone=doneArr.findIndex(d=>!d); + const doneCnt=doneArr.filter(Boolean).length; p.innerHTML=`
Статус воронки
@@ -312,7 +317,36 @@ function renderMainPanel(){
Источник
-
👁 Открыть кабинет
`; +
👁 Открыть кабинет
+
+
+
📍 Прогресс проекта${doneCnt}/5 этапов
+ ${CLIENT_STAGES.map((s,i)=>{ + const done=doneArr[i], cur=!done&&i===firstUndone; + const brd=done?'#047857':cur?'#10B981':'#E5E7EB'; + const tag=done?'✓ готово':cur?'● в работе':'ожидает'; + return `
+ ${s.icon} +
${s.name}
${esc(s.desc)}
+ ${tag} +
`; + }).join('')} +
+
+
+
💰 Финансы
+
Смета${deal>0?money(deal):'—'}
+
Получено${money(paid)}
+
Остаток${money(left)}
+
+
+
Контакт
+ +
Заметка
+ +
+
+
`; renderPayments(); } else if(mainTab==="pricing"){p.innerHTML=`
`;renderPricing();} @@ -598,7 +632,10 @@ function addTask(){const t=document.getElementById("newTask").value.trim();if(!t function toggleTask(i){state.tasks[i].done=!state.tasks[i].done;saveTasks();renderClient();} function delTask(i){state.tasks.splice(i,1);saveTasks();renderClient();} async function saveCrm(){ - const crm={pipeline:document.getElementById("cpPipe").value,deal_amount:+document.getElementById("cpDeal").value||0,source:document.getElementById("cpSrc").value}; + const g=id=>document.getElementById(id); + const crm={pipeline:g("cpPipe").value,deal_amount:+g("cpDeal").value||0,source:g("cpSrc").value}; + if(g("cpContact"))crm.contact=g("cpContact").value; + if(g("cpNote"))crm.note=g("cpNote").value; state.crm={...state.crm,...crm}; await fetch(`${API}/api/project/crm`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:current,...crm})}); await loadProjects();