Large refactor
This commit is contained in:
@@ -241,7 +241,7 @@ $jsonMessages = json_encode($messages, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_Q
|
||||
</div>
|
||||
|
||||
<!-- MODAL 1: E-mail Inplannen in Fociz Dagplanning -->
|
||||
<div id="planMailModal" class="fixed inset-0 z-50 bg-slate-950/60 backdrop-blur-sm hidden items-center justify-center p-4">
|
||||
<div id="planMailModal" onclick="if(event.target === this) closePlanMailModal()" class="fixed inset-0 z-50 bg-slate-950/60 backdrop-blur-sm hidden items-center justify-center p-4 overflow-y-auto">
|
||||
<div class="bg-white dark:bg-[#111624] border border-slate-200 dark:border-slate-800 rounded-3xl max-w-lg w-full p-6 sm:p-7 shadow-2xl space-y-5 animate-in fade-in zoom-in-95 duration-150">
|
||||
<div class="flex items-center justify-between pb-3 border-b border-slate-100 dark:border-slate-800">
|
||||
<div class="flex items-center space-x-2.5">
|
||||
@@ -253,7 +253,7 @@ $jsonMessages = json_encode($messages, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_Q
|
||||
<p class="text-[11px] text-slate-400">Plaats dit actiepunt direct op jouw Fociz tijdlijn</p>
|
||||
</div>
|
||||
</div>
|
||||
<button onclick="closePlanMailModal()" class="text-slate-400 hover:text-slate-600 p-1.5 rounded-lg transition cursor-pointer">
|
||||
<button onclick="closePlanMailModal()" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 p-1.5 rounded-lg transition cursor-pointer">
|
||||
<i data-lucide="x" class="w-4 h-4"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -268,21 +268,46 @@ $jsonMessages = json_encode($messages, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_Q
|
||||
<input type="text" id="planMailSubject" required class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3.5 py-2 text-xs text-slate-900 dark:text-white font-semibold focus:outline-none focus:ring-1 focus:ring-indigo-500">
|
||||
</div>
|
||||
|
||||
<!-- Datum & Slimme "Plan in open blok" knop -->
|
||||
<div class="space-y-2 pt-1 border-t border-slate-100 dark:border-slate-800">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-xs font-bold text-slate-700 dark:text-slate-300">Datum & Tijdblok</span>
|
||||
<button type="button" onclick="planInNextOpenBlockMail()" id="btnMailPlanOpenBlock" class="inline-flex items-center space-x-1.5 px-3 py-1.5 rounded-xl bg-gradient-to-r from-indigo-600 to-sky-600 hover:from-indigo-500 hover:to-sky-500 text-white text-xs font-bold transition shadow-xs cursor-pointer active:scale-95" title="Vind automatisch het eerstvolgende vrije kwartierblok binnen werktijden">
|
||||
<i data-lucide="sparkles" class="w-3.5 h-3.5"></i>
|
||||
<span>Plan in open blok</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Open blok banner -->
|
||||
<div id="mailPlanOpenBlockNotice" class="hidden p-2.5 rounded-xl bg-emerald-50 dark:bg-emerald-500/10 border border-emerald-200 dark:border-emerald-500/20 text-emerald-800 dark:text-emerald-300 text-[11px] flex items-center justify-between">
|
||||
<div class="flex items-center space-x-1.5 min-w-0 flex-1 mr-2">
|
||||
<i data-lucide="check-circle" class="w-3.5 h-3.5 text-emerald-600 dark:text-emerald-400 flex-shrink-0"></i>
|
||||
<span id="mailPlanOpenBlockNoticeText" class="truncate font-semibold"></span>
|
||||
</div>
|
||||
<button type="button" onclick="document.getElementById('mailPlanOpenBlockNotice').classList.add('hidden')" class="p-0.5 text-emerald-600 dark:text-emerald-400 hover:text-emerald-800 rounded cursor-pointer">
|
||||
<i data-lucide="x" class="w-3 h-3"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-700 dark:text-slate-300 mb-1">Datum</label>
|
||||
<input type="date" id="planMailDate" value="<?= date('Y-m-d') ?>" required class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3 py-2 text-xs text-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-indigo-500">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-700 dark:text-slate-300 mb-1">Starttijd (optioneel)</label>
|
||||
<input type="text" id="planMailStartTime" placeholder="bijv. 10:30" class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3 py-2 text-xs font-mono text-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-indigo-500">
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<label class="block text-xs font-semibold text-slate-700 dark:text-slate-300">Starttijd (optioneel)</label>
|
||||
<span id="planMailEndTimeBadge" class="text-[10px] text-indigo-600 dark:text-indigo-400 font-mono font-semibold"></span>
|
||||
</div>
|
||||
<input type="text" id="planMailStartTime" oninput="updatePlanMailEndTimeBadge()" placeholder="bijv. 10:30" class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3 py-2 text-xs font-mono text-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-indigo-500">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-700 dark:text-slate-300 mb-1">Tijdsduur</label>
|
||||
<select id="planMailDuration" class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3 py-2 text-xs text-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-indigo-500">
|
||||
<select id="planMailDuration" onchange="updatePlanMailEndTimeBadge()" class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3 py-2 text-xs text-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-indigo-500 cursor-pointer">
|
||||
<option value="15">15 minuten</option>
|
||||
<option value="30" selected>30 minuten</option>
|
||||
<option value="45">45 minuten</option>
|
||||
@@ -292,7 +317,7 @@ $jsonMessages = json_encode($messages, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_Q
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-700 dark:text-slate-300 mb-1">Prioriteit</label>
|
||||
<select id="planMailPriority" class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3 py-2 text-xs text-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-indigo-500">
|
||||
<select id="planMailPriority" class="w-full bg-slate-50 dark:bg-[#0c0f17] border border-slate-300 dark:border-slate-700 rounded-xl px-3 py-2 text-xs text-slate-900 dark:text-white focus:outline-none focus:ring-1 focus:ring-indigo-500 cursor-pointer">
|
||||
<option value="P1">P1 - Urgent / Brandend</option>
|
||||
<option value="P2" selected>P2 - Belangrijk</option>
|
||||
<option value="P3">P3 - Regulier</option>
|
||||
@@ -313,8 +338,54 @@ $jsonMessages = json_encode($messages, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_Q
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal: Waarschuwing Buiten Werktijden (Mail) -->
|
||||
<div id="outsideWorkhoursModalMail" onclick="if(event.target === this) closeOutsideWorkhoursModalMail('CANCEL')" class="fixed inset-0 z-50 bg-slate-950/70 backdrop-blur-sm hidden items-center justify-center p-4">
|
||||
<div class="bg-white dark:bg-[#111624] border border-amber-500/30 rounded-2xl w-full max-w-md shadow-2xl p-6 space-y-4">
|
||||
<div class="flex items-start space-x-3">
|
||||
<div class="w-10 h-10 rounded-2xl bg-amber-500/10 border border-amber-500/20 text-amber-500 flex items-center justify-center flex-shrink-0">
|
||||
<i data-lucide="alert-triangle" class="w-5 h-5"></i>
|
||||
</div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<h3 class="text-base font-bold text-slate-900 dark:text-white leading-tight">
|
||||
Let op! Je plant buiten werktijden
|
||||
</h3>
|
||||
<p class="text-xs text-slate-500 dark:text-slate-400 mt-1">
|
||||
Het ingeplande tijdblok valt buiten de gezette werktijden.
|
||||
</p>
|
||||
</div>
|
||||
<button type="button" onclick="closeOutsideWorkhoursModalMail('CANCEL')" class="p-1 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 rounded-lg transition cursor-pointer flex-shrink-0">
|
||||
<i data-lucide="x" class="w-4 h-4"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800/40 rounded-xl p-3.5 text-xs text-amber-800 dark:text-amber-300 space-y-1.5">
|
||||
<div class="flex items-center justify-between text-[11px] font-semibold text-amber-900 dark:text-amber-200">
|
||||
<span>Gekozen tijdblok:</span>
|
||||
<span id="outsideWorkhoursSelectedSlotMail" class="font-mono font-bold"></span>
|
||||
</div>
|
||||
<div class="flex items-center justify-between text-[11px] text-amber-700 dark:text-amber-400">
|
||||
<span>Gezette werktijden:</span>
|
||||
<span id="outsideWorkhoursBoundsMail" class="font-mono font-semibold">08:30 – 17:00</span>
|
||||
</div>
|
||||
<p class="text-[11px] text-amber-700/80 dark:text-amber-400/80 pt-1 border-t border-amber-200/60 dark:border-amber-800/30">
|
||||
Kies <strong>Nee</strong> om het item automatisch in te plannen in het eerstvolgende open blok op de volgende werkdag, of kies <strong>Ja</strong> om toch nu buiten werktijd te plannen.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center space-x-2.5 pt-2">
|
||||
<button type="button" id="btnOutsideWorkhoursNoMail" onclick="closeOutsideWorkhoursModalMail('NEE')" class="flex-1 px-4 py-2.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white font-bold text-xs transition shadow-xs flex items-center justify-center space-x-1.5 cursor-pointer">
|
||||
<i data-lucide="calendar-arrow-up" class="w-4 h-4"></i>
|
||||
<span>Nee (Volgende werkdag)</span>
|
||||
</button>
|
||||
<button type="button" id="btnOutsideWorkhoursYesMail" onclick="closeOutsideWorkhoursModalMail('JA')" class="px-4 py-2.5 rounded-xl bg-slate-100 hover:bg-slate-200 dark:bg-slate-800 dark:hover:bg-slate-700 text-slate-700 dark:text-slate-200 font-semibold text-xs transition cursor-pointer">
|
||||
<span>Ja, toch inplannen</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL 2: E-mail Beantwoorden -->
|
||||
<div id="replyModal" class="fixed inset-0 z-50 bg-slate-950/60 backdrop-blur-sm hidden items-center justify-center p-4">
|
||||
<div id="replyModal" onclick="if(event.target === this) closeReplyModal()" class="fixed inset-0 z-50 bg-slate-950/60 backdrop-blur-sm hidden items-center justify-center p-4">
|
||||
<div class="bg-white dark:bg-[#111624] border border-slate-200 dark:border-slate-800 rounded-3xl max-w-lg w-full p-6 sm:p-7 shadow-2xl space-y-5 animate-in fade-in zoom-in-95 duration-150">
|
||||
<div class="flex items-center justify-between pb-3 border-b border-slate-100 dark:border-slate-800">
|
||||
<div class="flex items-center space-x-2.5">
|
||||
@@ -360,7 +431,7 @@ $jsonMessages = json_encode($messages, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_Q
|
||||
</div>
|
||||
|
||||
<!-- MODAL 3: E-mail Doorsturen -->
|
||||
<div id="forwardModal" class="fixed inset-0 z-50 bg-slate-950/60 backdrop-blur-sm hidden items-center justify-center p-4">
|
||||
<div id="forwardModal" onclick="if(event.target === this) closeForwardModal()" class="fixed inset-0 z-50 bg-slate-950/60 backdrop-blur-sm hidden items-center justify-center p-4">
|
||||
<div class="bg-white dark:bg-[#111624] border border-slate-200 dark:border-slate-800 rounded-3xl max-w-lg w-full p-6 sm:p-7 shadow-2xl space-y-5 animate-in fade-in zoom-in-95 duration-150">
|
||||
<div class="flex items-center justify-between pb-3 border-b border-slate-100 dark:border-slate-800">
|
||||
<div class="flex items-center space-x-2.5">
|
||||
@@ -671,7 +742,97 @@ function closeMobileDetail() {
|
||||
document.getElementById('noMailSelectedState').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// Modal open/close helpers
|
||||
// Modal open/close helpers & Open blok inplannen
|
||||
let _outsideWorkhoursPendingMail = null;
|
||||
|
||||
function updatePlanMailEndTimeBadge() {
|
||||
const startInput = document.getElementById('planMailStartTime');
|
||||
const durationInput = document.getElementById('planMailDuration');
|
||||
const badge = document.getElementById('planMailEndTimeBadge');
|
||||
if (!startInput || !durationInput || !badge) return;
|
||||
|
||||
const startVal = (startInput.value || '').trim();
|
||||
const duration = parseInt(durationInput.value || '30', 10);
|
||||
if (!startVal || !startVal.includes(':') || isNaN(duration)) {
|
||||
badge.innerText = '';
|
||||
return;
|
||||
}
|
||||
|
||||
const [hStr, mStr] = startVal.split(':');
|
||||
const totalMinutes = (parseInt(hStr, 10) * 60 + parseInt(mStr, 10)) + duration;
|
||||
const endH = Math.floor((totalMinutes / 60) % 24);
|
||||
const endM = totalMinutes % 60;
|
||||
const endStr = `${String(endH).padStart(2, '0')}:${String(endM).padStart(2, '0')}`;
|
||||
badge.innerText = `(tot ${endStr})`;
|
||||
}
|
||||
|
||||
async function planInNextOpenBlockMail(startFromNextWorkday = false) {
|
||||
const durationInput = document.getElementById('planMailDuration');
|
||||
const duration = parseInt(durationInput?.value || '30', 10);
|
||||
const btn = document.getElementById('btnMailPlanOpenBlock');
|
||||
const origHtml = btn ? btn.innerHTML : '';
|
||||
|
||||
if (btn) {
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = `<i data-lucide="loader-2" class="w-3.5 h-3.5 animate-spin"></i><span>Zoeken...</span>`;
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
}
|
||||
|
||||
try {
|
||||
let url = `/api/planner.php?action=find_next_free_slot&duration=${duration}`;
|
||||
if (startFromNextWorkday) {
|
||||
url += '&start_from_next_workday=1';
|
||||
}
|
||||
const resp = await fetch(url);
|
||||
const data = await resp.json();
|
||||
|
||||
if (data.success && data.slot) {
|
||||
const slot = data.slot;
|
||||
const dateInput = document.getElementById('planMailDate');
|
||||
const startInput = document.getElementById('planMailStartTime');
|
||||
if (dateInput) dateInput.value = slot.date;
|
||||
if (startInput) startInput.value = slot.start;
|
||||
|
||||
updatePlanMailEndTimeBadge();
|
||||
|
||||
const notice = document.getElementById('mailPlanOpenBlockNotice');
|
||||
const noticeText = document.getElementById('mailPlanOpenBlockNoticeText');
|
||||
if (notice && noticeText) {
|
||||
const formattedDate = new Date(slot.date + 'T00:00:00').toLocaleDateString('nl-NL', { weekday: 'short', day: 'numeric', month: 'short' });
|
||||
noticeText.innerText = `Vrij blok gevonden: ${formattedDate} om ${slot.start} – ${slot.end} (${duration} min)`;
|
||||
notice.classList.remove('hidden');
|
||||
}
|
||||
} else {
|
||||
alert(data.error || 'Geen beschikbaar tijdblok gevonden binnen de komende 14 dagen.');
|
||||
}
|
||||
} catch (err) {
|
||||
alert('Netwerkfout bij zoeken van open blok: ' + err.message);
|
||||
} finally {
|
||||
if (btn) {
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = origHtml;
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function closeOutsideWorkhoursModalMail(choice) {
|
||||
const modal = document.getElementById('outsideWorkhoursModalMail');
|
||||
if (modal) modal.classList.add('hidden');
|
||||
|
||||
if (choice === 'JA') {
|
||||
if (_outsideWorkhoursPendingMail) {
|
||||
_outsideWorkhoursPendingMail.bypassWorkhours = true;
|
||||
submitPlanEmail(null, _outsideWorkhoursPendingMail);
|
||||
}
|
||||
} else if (choice === 'NEE') {
|
||||
_outsideWorkhoursPendingMail = null;
|
||||
planInNextOpenBlockMail(true);
|
||||
} else {
|
||||
_outsideWorkhoursPendingMail = null;
|
||||
}
|
||||
}
|
||||
|
||||
function openPlanMailModal() {
|
||||
if (!selectedMessage) return;
|
||||
document.getElementById('planMailId').value = selectedMessage.id;
|
||||
@@ -679,9 +840,15 @@ function openPlanMailModal() {
|
||||
document.getElementById('planMailWebLink').value = selectedMessage.web_link || '';
|
||||
document.getElementById('planMailSender').value = selectedMessage.from_name || '';
|
||||
|
||||
const notice = document.getElementById('mailPlanOpenBlockNotice');
|
||||
if (notice) notice.classList.add('hidden');
|
||||
|
||||
updatePlanMailEndTimeBadge();
|
||||
|
||||
const modal = document.getElementById('planMailModal');
|
||||
modal.classList.remove('hidden');
|
||||
modal.classList.add('flex');
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
}
|
||||
|
||||
function closePlanMailModal() {
|
||||
@@ -690,26 +857,72 @@ function closePlanMailModal() {
|
||||
modal.classList.remove('flex');
|
||||
}
|
||||
|
||||
async function submitPlanEmail(e) {
|
||||
e.preventDefault();
|
||||
async function submitPlanEmail(e, options = {}) {
|
||||
if (e) e.preventDefault();
|
||||
|
||||
const messageId = document.getElementById('planMailId').value;
|
||||
const subject = document.getElementById('planMailSubject').value;
|
||||
const planDate = document.getElementById('planMailDate').value;
|
||||
const timeBlockStart = (document.getElementById('planMailStartTime')?.value || '').trim();
|
||||
const durationMinutes = parseInt(document.getElementById('planMailDuration').value, 10);
|
||||
const priority = document.getElementById('planMailPriority').value;
|
||||
const webLink = document.getElementById('planMailWebLink').value;
|
||||
const sender = document.getElementById('planMailSender').value;
|
||||
|
||||
// Controleer of de geplande tijd buiten de gezette werktijden valt (standaard 08:30 - 17:00)
|
||||
if (!options.bypassWorkhours && timeBlockStart && timeBlockStart.includes(':')) {
|
||||
const [shStr, smStr] = timeBlockStart.split(':');
|
||||
const startMin = parseInt(shStr, 10) * 60 + parseInt(smStr, 10);
|
||||
const endMin = startMin + durationMinutes;
|
||||
|
||||
const workStartMin = 8 * 60 + 30; // 08:30
|
||||
const workEndMin = 17 * 60; // 17:00
|
||||
|
||||
if (startMin < workStartMin || endMin > workEndMin) {
|
||||
_outsideWorkhoursPendingMail = { messageId, subject, planDate, timeBlockStart, durationMinutes, priority, webLink, sender };
|
||||
|
||||
const endH = Math.floor((endMin / 60) % 24);
|
||||
const endM = endMin % 60;
|
||||
const endStr = `${String(endH).padStart(2, '0')}:${String(endM).padStart(2, '0')}`;
|
||||
|
||||
const slotEl = document.getElementById('outsideWorkhoursSelectedSlotMail');
|
||||
if (slotEl) slotEl.innerText = `${timeBlockStart} – ${endStr} (${durationMinutes} min)`;
|
||||
|
||||
const outsideModal = document.getElementById('outsideWorkhoursModalMail');
|
||||
if (outsideModal) {
|
||||
outsideModal.classList.remove('hidden');
|
||||
outsideModal.classList.add('flex');
|
||||
setTimeout(() => {
|
||||
const btnNo = document.getElementById('btnOutsideWorkhoursNoMail');
|
||||
if (btnNo) btnNo.focus();
|
||||
}, 50);
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const btn = document.getElementById('planMailSubmitBtn');
|
||||
const origHtml = btn.innerHTML;
|
||||
btn.innerHTML = `<i data-lucide="loader-2" class="w-3.5 h-3.5 animate-spin"></i><span>Inplannen...</span>`;
|
||||
btn.disabled = true;
|
||||
const origHtml = btn ? btn.innerHTML : '';
|
||||
if (btn) {
|
||||
btn.innerHTML = `<i data-lucide="loader-2" class="w-3.5 h-3.5 animate-spin"></i><span>Inplannen...</span>`;
|
||||
btn.disabled = true;
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/mail.php?action=plan_email', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({
|
||||
message_id: document.getElementById('planMailId').value,
|
||||
subject: document.getElementById('planMailSubject').value,
|
||||
plan_date: document.getElementById('planMailDate').value,
|
||||
time_block_start: document.getElementById('planMailStartTime').value,
|
||||
duration_minutes: parseInt(document.getElementById('planMailDuration').value, 10),
|
||||
priority: document.getElementById('planMailPriority').value,
|
||||
web_link: document.getElementById('planMailWebLink').value,
|
||||
sender: document.getElementById('planMailSender').value
|
||||
message_id: messageId,
|
||||
subject: subject,
|
||||
plan_date: planDate,
|
||||
time_block_start: timeBlockStart,
|
||||
duration_minutes: durationMinutes,
|
||||
priority: priority,
|
||||
web_link: webLink,
|
||||
sender: sender
|
||||
})
|
||||
});
|
||||
const data = await res.json();
|
||||
@@ -722,9 +935,11 @@ async function submitPlanEmail(e) {
|
||||
} catch(err) {
|
||||
alert('Netwerkfout: ' + err.message);
|
||||
} finally {
|
||||
btn.innerHTML = origHtml;
|
||||
btn.disabled = false;
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
if (btn) {
|
||||
btn.innerHTML = origHtml;
|
||||
btn.disabled = false;
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -858,6 +1073,27 @@ function escapeHtml(str) {
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
// Toetsenbordnavigatie voor alle modals (Escape & Enter)
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
const outsideModal = document.getElementById('outsideWorkhoursModalMail');
|
||||
if (outsideModal && !outsideModal.classList.contains('hidden')) {
|
||||
closeOutsideWorkhoursModalMail('CANCEL');
|
||||
return;
|
||||
}
|
||||
closePlanMailModal();
|
||||
closeReplyModal();
|
||||
closeForwardModal();
|
||||
} else if (e.key === 'Enter') {
|
||||
const outsideModal = document.getElementById('outsideWorkhoursModalMail');
|
||||
if (outsideModal && !outsideModal.classList.contains('hidden')) {
|
||||
e.preventDefault();
|
||||
closeOutsideWorkhoursModalMail('NEE');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
applyMailSearch();
|
||||
if (allMessages && allMessages.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user