v12: удалён дубликат openEdit, фикс входа

This commit is contained in:
Dauren777 2026-06-04 12:10:27 +00:00
parent b9bdf6aef3
commit 0116112a3e

View File

@ -513,59 +513,6 @@ function openEdit(id,monthIdx){
document.getElementById('editModalOverlay').classList.add('open')
}
// File list for current month
let filesHtml=''
if(curFiles.length){
filesHtml=`<div style="font-weight:600;margin:12px 0 6px;font-size:13px">Загруженные файлы за ${M(editMonthIdx)} (${curFiles.length} шт.)</div>`
curFiles.forEach((f,i)=>{filesHtml+=`<div class="file-row"><span class="file-info"><span class="file-name" onclick="downloadFile(${e.id},'${curMonth}',${i})">📄 ${f.name}</span><span class="file-desc">${f.desc||''}</span></span><span class="file-meta">${(f.size/1024).toFixed(0)} КБ · ${f.date}</span><button class="file-del" onclick="removeFile(${e.id},'${curMonth}',${i})">×</button></div>`})
}else{filesHtml=`<p style="font-size:13px;color:var(--gray-500);margin:12px 0 6px">Нет файлов за ${M(editMonthIdx)}</p>`}
document.getElementById('editModalContent').innerHTML=`
<button class="close" onclick="closeEditModal()">&times;</button>
<span class="badge blue">Раздел ${['I','II','III','IV','V'][e.sec]}</span>
<h3 style="margin:8px 0">${e.t}</h3>
<div class="meta-row">
<div class="fld">Дивизион<strong>${branches[e.b]}</strong></div>
<div class="fld">Ответственный<strong>${e.r}</strong></div>
<div class="fld">Срок<strong>${e.due}</strong></div>
<div class="fld">Факт<strong>${e.done}</strong></div>
</div>
<div class="field"><label>Статус</label><select id="editStatus" onchange="autoProgress()"><option value="wait" ${e.s==='wait'?'selected':''}>В процессе</option><option value="warn" ${e.s==='warn'?'selected':''}>На контроле</option><option value="late" ${e.s==='late'?'selected':''}>Просрочено</option><option value="done" ${e.s==='done'?'selected':''}>Исполнено</option></select></div>
<div class="field"><label>Прогресс (%)</label><input type="range" id="editProgress" min="0" max="100" value="${e.p}" oninput="document.getElementById('pVal').textContent=this.value+'%'" style="width:100%"><span id="pVal" style="font-weight:700">${e.p}%</span></div>
<div class="field"><label>Комментарий</label><textarea id="editComment" placeholder="Комментарий к статусу...">${savedEdits.comment||''}</textarea></div>
${subHtml}
<div style="border-top:1px solid var(--gray-200);padding-top:16px;margin-top:12px">
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:12px">
<span style="font-weight:600;font-size:14px">📎 Подтверждающие материалы</span>
<span style="font-size:12px;color:var(--gray-500)">Всего файлов: ${totalFiles}</span>
</div>
<div class="month-tabs">${months.map((m,i)=>`<span class="month-tab${i===editMonthIdx?' active':''}" onclick="openEdit(${e.id},${i})">${M(i)}</span>`).join('')}</div>
${filesHtml}
<div class="upload-row">
<input type="text" id="fileDesc" placeholder="Описание (акт, протокол, фото...)" style="flex:2">
<input type="file" id="editFileInput" multiple>
<button class="btn btn-sm" onclick="uploadFiles(${e.id},'${curMonth}')">Загрузить</button>
</div>
<p style="font-size:11px;color:var(--gray-500);margin-top:6px">Формы завершения: ${e.dname}</p>
</div>
<div class="ai-block"><h4>🤖 Вывод ИИ-агента</h4>${e.ai}</div>
<div style="font-weight:600;margin:8px 0 4px;font-size:14px">История:</div>
<div>${e.h.map(h=>`<div class="history-item"><div class="dot"></div>${h}</div>`).join('')}</div>
<div style="margin-top:20px;display:flex;gap:12px">
<button class="btn" onclick="saveEdit(${e.id})">Сохранить</button>
<button class="btn btn-outline" onclick="closeEditModal()">Отмена</button>
</div>`
document.getElementById('editModalOverlay').classList.add('open')
}
function uploadFiles(eventId, monthKey){
const fi=document.getElementById('editFileInput')
const desc=document.getElementById('fileDesc').value.trim()