@@ -479,6 +527,31 @@ function renderClient(){
renderMainPanel();
}
function setMainTab(t){mainTab=t;editPayIdx=-1;renderMainPanel();document.querySelectorAll('.mtab').forEach((b,i)=>b.classList.toggle('active',MAINTABS[i].id===mainTab));}
+function renderDocsTab(){
+ const docs=state.documents||[];
+ let h=`
+
+
📎
Загрузить документ клиента
+
PDF · Word · Excel · txt — перетащите или нажмите. Елена учтёт в анализе.
`;
+ if(!docs.length)h+=`
Документов пока нет
`;
+ else h+=docs.map(d=>{const u=`${API}/api/doc?token=${encodeURIComponent(current)}&name=${encodeURIComponent(d.filename)}`;return `
`}).join('');
+ return h;
+}
+async function opUpload(files){
+ for(const f of files){
+ toast("Загружаю "+f.name+"…");
+ try{
+ const b64=await new Promise((res,rej)=>{const r=new FileReader();r.onload=()=>res(r.result);r.onerror=rej;r.readAsDataURL(f)});
+ const r=await fetch(`${API}/api/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:current,filename:f.name,content:b64})});
+ const d=await r.json();
+ if(d.error){toast("Ошибка: "+d.error,"err");continue;}
+ state.documents=state.documents||[];state.documents.push({filename:d.filename,size:d.size});
+ toast("«"+f.name+"» загружен","ok");
+ }catch(e){toast("Ошибка: "+e.message,"err");}
+ }
+ renderClient();
+}
+function opDropFiles(e){e.preventDefault();e.currentTarget.style.background="#fff";opUpload(e.dataTransfer.files);}
const DEV_STAGE={canvas:"📊 Стратегия",idef0:"🔧 Функции",spec:"📋 ТЗ",documents:"📁 Документы",methods:"🎯 Методологии",interview:"💬 Интервью"};
function renderDeviations(){
const dev=state.deviations||[];
@@ -549,8 +622,8 @@ function renderMainPanel(){
Контакт
-
Заметка
-
+
Заметка ${micBtn('cpNote',26)}
+