feat: График — диалог «Добавить встречу» с формой и сохранением

This commit is contained in:
wasrusgen 2026-05-29 14:54:10 +03:00
parent a76c0b37b9
commit 3ffade8412

View File

@ -1390,7 +1390,7 @@ function _renderShiftDetail(mday){
)
+'</div>';
});
timelineHtml += '<button onclick="_toast(\'+ Встреча запланирована\',\'#15803D\')" style="margin-left:-40px;margin-top:4px;font-size:12px;font-weight:700;color:var(--accent);background:transparent;border:1.5px dashed var(--accent);border-radius:10px;padding:8px 16px;cursor:pointer;width:100%">+ Добавить встречу</button>';
timelineHtml += '<button onclick="_addMeetingModal('+mday+')" style="margin-left:-40px;margin-top:4px;font-size:12px;font-weight:700;color:var(--accent);background:transparent;border:1.5px dashed var(--accent);border-radius:10px;padding:8px 16px;cursor:pointer;width:100%">+ Добавить встречу</button>';
timelineHtml += '</div>';
}
@ -4168,6 +4168,49 @@ function navBar() {
}
function _nav(id){window._currentScreen=id;document.getElementById('screen').innerHTML=renderScreen(id);document.getElementById('nav').innerHTML=navBar();}
// ── Диалог «Добавить встречу» ─────────────────────────────────────────────────
function _addMeetingModal(mday){
var old=document.getElementById('meetingModal'); if(old) old.remove();
var overlay=document.createElement('div');
overlay.id='meetingModal';
overlay.style.cssText='position:absolute;inset:0;background:rgba(0,0,0,.45);backdrop-filter:blur(3px);z-index:999;display:flex;align-items:flex-end';
var typeOpts=['Замер на объекте','Первичная консультация','Согласование проекта','Встреча с технологом','Приёмка заказа','Прочее']
.map(function(t){return '<option>'+t+'</option>';}).join('');
overlay.innerHTML=
'<div style="width:100%;background:var(--bg);border-radius:24px 24px 0 0;padding:24px 20px 36px;box-shadow:0 -8px 32px rgba(0,0,0,.2)">'
+'<div style="width:40px;height:4px;background:rgba(0,0,0,.15);border-radius:2px;margin:0 auto 20px"></div>'
+'<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:20px">'
+'<h3 style="font-size:17px;font-weight:700;color:var(--ink);margin:0">Новая встреча</h3>'
+'<button onclick="document.getElementById(\'meetingModal\').remove()" style="border:none;background:rgba(0,0,0,.07);border-radius:50%;width:28px;height:28px;font-size:16px;cursor:pointer;color:var(--muted);line-height:1">×</button>'
+'</div>'
+'<div style="font-size:11px;font-weight:700;color:var(--muted);margin-bottom:6px">КЛИЕНТ</div>'
+'<input id="mtgClient" type="text" placeholder="Имя клиента" style="width:100%;box-sizing:border-box;border:1.5px solid rgba(0,0,0,.1);border-radius:12px;padding:11px 14px;font-size:14px;color:var(--ink);background:var(--card);outline:none;margin-bottom:14px;font-family:inherit">'
+'<div style="font-size:11px;font-weight:700;color:var(--muted);margin-bottom:6px">ТИП ВСТРЕЧИ</div>'
+'<select id="mtgType" style="width:100%;box-sizing:border-box;border:1.5px solid rgba(0,0,0,.1);border-radius:12px;padding:11px 14px;font-size:14px;color:var(--ink);background:var(--card);outline:none;margin-bottom:14px;font-family:inherit">'+typeOpts+'</select>'
+'<div style="font-size:11px;font-weight:700;color:var(--muted);margin-bottom:6px">ВРЕМЯ</div>'
+'<input id="mtgTime" type="time" value="12:00" style="width:100%;box-sizing:border-box;border:1.5px solid rgba(0,0,0,.1);border-radius:12px;padding:11px 14px;font-size:14px;color:var(--ink);background:var(--card);outline:none;margin-bottom:22px;font-family:inherit">'
+'<button onclick="_saveMeeting('+mday+')" style="width:100%;background:var(--accent);color:#fff;border:none;border-radius:13px;padding:14px;font-size:15px;font-weight:700;cursor:pointer;margin-bottom:10px">Сохранить</button>'
+'<button onclick="document.getElementById(\'meetingModal\').remove()" style="width:100%;background:transparent;color:var(--muted);border:none;border-radius:13px;padding:10px;font-size:14px;font-weight:600;cursor:pointer">Отмена</button>'
+'</div>';
overlay.addEventListener('click',function(e){ if(e.target===overlay) overlay.remove(); });
document.getElementById('phoneFrame').appendChild(overlay);
setTimeout(function(){ var f=document.getElementById('mtgClient'); if(f) f.focus(); },100);
}
function _saveMeeting(mday){
var client=(document.getElementById('mtgClient').value||'').trim();
var type=document.getElementById('mtgType').value;
var time=document.getElementById('mtgTime').value||'12:00';
if(!client){ var inp=document.getElementById('mtgClient'); inp.style.border='1.5px solid #EF4444'; inp.placeholder='Введите имя клиента'; return; }
var colors={'Замер на объекте':'#3B82F6','Первичная консультация':'#0D9488','Согласование проекта':'#10B981','Встреча с технологом':'#F59E0B','Приёмка заказа':'#8B5CF6','Прочее':'#64748B'};
var wi=mday-19;
if(wi>=0&&wi<=6){ _APPTS[wi].push({time:time,client:client,type:type,order:null,color:colors[type]||'#64748B'}); }
document.getElementById('meetingModal').remove();
window._schedMday=mday;
document.getElementById('screen').innerHTML=renderScreen('manager_schedule');
_toast('Встреча добавлена ✓','#15803D');
}
// ── Toast ─────────────────────────────────────────────────────────────────────
function _toast(msg,color){
var t=document.createElement('div');