Fix brainstorm delete and plan button
This commit is contained in:
+37
-14
@@ -1444,8 +1444,12 @@ for ($h = $startHour; $h <= $endHour; $h++) {
|
||||
<div class="flex items-center space-x-1 flex-shrink-0">
|
||||
<?php $isMailPlanned = !empty($plannedExternalIds[$mail['id']]); ?>
|
||||
<button
|
||||
onclick="openPlanEmailDirect('<?= htmlspecialchars(addslashes($mail['id'])) ?>', '<?= htmlspecialchars(addslashes($mail['subject'])) ?>', '<?= htmlspecialchars(addslashes($mail['sender_name'])) ?>', '<?= htmlspecialchars(addslashes($mail['web_link'] ?? '')) ?>', '<?= htmlspecialchars(addslashes($mail['body_preview'] ?? '')) ?>')"
|
||||
data-mail-id="<?= htmlspecialchars($mail['id']) ?>"
|
||||
onclick="handleEmailPlanClick(this, event)"
|
||||
data-mail-id="<?= htmlspecialchars($mail['id'] ?? '', ENT_QUOTES) ?>"
|
||||
data-mail-subject="<?= htmlspecialchars($mail['subject'] ?? '', ENT_QUOTES) ?>"
|
||||
data-mail-sender="<?= htmlspecialchars($mail['sender_name'] ?? 'Outlook Mail', ENT_QUOTES) ?>"
|
||||
data-mail-link="<?= htmlspecialchars($mail['web_link'] ?? '', ENT_QUOTES) ?>"
|
||||
data-mail-preview="<?= htmlspecialchars(mb_substr($mail['body_preview'] ?? '', 0, 300), ENT_QUOTES) ?>"
|
||||
class="plan-btn-mail flex items-center space-x-1 text-[11px] <?= $isMailPlanned ? 'font-bold text-white bg-emerald-600 hover:bg-emerald-500 border border-emerald-600 shadow-xs' : 'font-semibold text-indigo-600 dark:text-indigo-400 hover:text-indigo-700 dark:hover:text-indigo-300 bg-indigo-50 dark:bg-indigo-500/10 hover:bg-indigo-100 dark:hover:bg-indigo-500/20 border border-indigo-200 dark:border-indigo-500/20' ?> px-2.5 py-1 rounded-lg transition cursor-pointer"
|
||||
title="<?= $isMailPlanned ? 'Deze e-mail is al ingepland als dagtaak (klik om opnieuw/anders in te plannen)' : 'Plan deze e-mail direct in als dagtaak' ?>"
|
||||
>
|
||||
@@ -2858,9 +2862,18 @@ document.addEventListener('click', function(e) {
|
||||
}
|
||||
});
|
||||
|
||||
// --- Globale Planner Status & Naadloos AJAX Datumbeheer ---
|
||||
let activePlannerDate = '<?= $selectedDate ?>';
|
||||
let weekStartDate = '<?= $weekStart ?>';
|
||||
let weekEndDate = '<?= $weekEnd ?>';
|
||||
let currentSyncHash = '<?= $initialSyncHash ?? '' ?>';
|
||||
let isDateSwitching = false;
|
||||
const FOCIZ_WORKDAY_START = '<?= $workdayStartStr ?>';
|
||||
const FOCIZ_WORKDAY_END = '<?= $workdayEndStr ?>';
|
||||
|
||||
// --- Fociz Widget Beheer & Configuratielogica (v2.0) ---
|
||||
let focizWidgets = <?= json_encode(array_values($userWidgetLayout), JSON_UNESCAPED_UNICODE) ?>;
|
||||
const defaultWidgetLayout = <?= json_encode(array_values($availableWidgets), JSON_UNESCAPED_UNICODE) ?>;
|
||||
let focizWidgets = <?= json_encode(array_values($userWidgetLayout), JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?>;
|
||||
const defaultWidgetLayout = <?= json_encode(array_values($availableWidgets), JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?>;
|
||||
|
||||
// --- AI Dagbriefing (laden bij pagina-open, alleen voor vandaag) ---
|
||||
<?php if ($isTodaySelected): ?>
|
||||
@@ -3132,7 +3145,7 @@ function showWidgetToast(htmlMessage, type = 'success', duration = 3500) {
|
||||
}
|
||||
|
||||
// --- Agenda Dagen Blokkeren & Rechtermuisklik Context Menu ---
|
||||
const CAL_BLOCK_REASONS = <?= json_encode(array_values(array_filter($calendarBlockReasons, fn($r) => !empty($r['is_active'])))) ?>;
|
||||
const CAL_BLOCK_REASONS = <?= json_encode(array_values(array_filter($calendarBlockReasons, fn($r) => !empty($r['is_active']))), JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?>;
|
||||
const CAL_BLOCK_DEFAULT_TITLES = {};
|
||||
if (Array.isArray(CAL_BLOCK_REASONS)) {
|
||||
CAL_BLOCK_REASONS.forEach(r => {
|
||||
@@ -5017,6 +5030,9 @@ function openJiraPlanModal(issueKey, fallbackData = null) {
|
||||
if (descChevron) descChevron.classList.remove('rotate-180');
|
||||
if (descLabel) descLabel.textContent = 'Inhoud van het item bekijken';
|
||||
|
||||
// Target datum: actieve planner datum of vandaag
|
||||
const targetDate = (typeof activePlannerDate !== 'undefined' && activePlannerDate) ? activePlannerDate : new Date().toISOString().slice(0, 10);
|
||||
|
||||
// Controleer of dit ticket al is ingepland
|
||||
const existingTask = (typeof plannedExternalTasksMap !== 'undefined' && plannedExternalTasksMap[issue.key]) ? plannedExternalTasksMap[issue.key] : null;
|
||||
const isAlreadyPlanned = Boolean(existingTask);
|
||||
@@ -5448,6 +5464,22 @@ function toggleEmailPlanPreview() {
|
||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||
}
|
||||
|
||||
function handleEmailPlanClick(btn, event = null) {
|
||||
if (event) {
|
||||
try {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
} catch (_) {}
|
||||
}
|
||||
if (!btn) return;
|
||||
const mailId = btn.getAttribute('data-mail-id') || '';
|
||||
const subject = btn.getAttribute('data-mail-subject') || '';
|
||||
const sender = btn.getAttribute('data-mail-sender') || 'Outlook Mail';
|
||||
const link = btn.getAttribute('data-mail-link') || '';
|
||||
const preview = btn.getAttribute('data-mail-preview') || '';
|
||||
openPlanEmailDirect(mailId, subject, sender, link, preview);
|
||||
}
|
||||
|
||||
function openPlanEmailDirect(mailId, subject, sender, webLink, bodyPreview = '') {
|
||||
_emailPlanCurrentData = { mailId, subject, sender, webLink, bodyPreview };
|
||||
|
||||
@@ -5836,15 +5868,6 @@ function resetTimer() {}
|
||||
function saveTimerStateBeforeReload() {}
|
||||
function restoreTimerStateIfAny() {}
|
||||
|
||||
// --- Globale Planner Status & Naadloos AJAX Datumbeheer ---
|
||||
let activePlannerDate = '<?= $selectedDate ?>';
|
||||
let weekStartDate = '<?= $weekStart ?>';
|
||||
let weekEndDate = '<?= $weekEnd ?>';
|
||||
let currentSyncHash = '<?= $initialSyncHash ?? '' ?>';
|
||||
let isDateSwitching = false;
|
||||
const FOCIZ_WORKDAY_START = '<?= $workdayStartStr ?>';
|
||||
const FOCIZ_WORKDAY_END = '<?= $workdayEndStr ?>';
|
||||
|
||||
/**
|
||||
* Controleert of een gepland tijdstip buiten de gezette werktijden of in het weekend valt
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user