Add Outlook synchronization features: implement real-time sync check, save sync preferences, and reconcile tasks with Outlook events

This commit is contained in:
2026-09-09 15:31:12 +02:00
parent 1df22d97f9
commit 7a5d14f181
4 changed files with 589 additions and 48 deletions
+43
View File
@@ -48,6 +48,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
exit;
}
// 2b. Outlook synchronisatievoorkeuren opslaan
elseif ($action === 'save_outlook_settings') {
$syncInterval = (int)($_POST['sync_interval_seconds'] ?? 30);
$stmtExisting = $db->prepare("SELECT settings FROM integrations WHERE user_id = ? AND provider = 'OUTLOOK'");
$stmtExisting->execute([$userId]);
$existing = $stmtExisting->fetch();
$settings = json_decode($existing['settings'] ?? '{}', true) ?: [];
$settings['sync_interval_seconds'] = $syncInterval;
$stmtUp = $db->prepare("UPDATE integrations SET settings = ? WHERE user_id = ? AND provider = 'OUTLOOK'");
$stmtUp->execute([json_encode($settings), $userId]);
$message = "Uw Microsoft Outlook synchronisatievoorkeur is succesvol opgeslagen.";
$messageType = 'success';
}
// 3. Jira Opslaan & Testen
elseif ($action === 'save_jira') {
$companyDomain = jira_get_company_domain();
@@ -462,6 +479,32 @@ require_once __DIR__ . '/includes/header.php';
</div>
</div>
<form method="POST" class="mt-4 p-4 rounded-xl bg-slate-50/70 dark:bg-slate-900/60 border border-slate-200/80 dark:border-slate-800 flex flex-col sm:flex-row sm:items-center justify-between gap-4">
<input type="hidden" name="action" value="save_outlook_settings">
<div class="space-y-1">
<label for="sync_interval_seconds" class="text-xs font-bold text-slate-900 dark:text-white flex items-center space-x-1.5">
<i data-lucide="refresh-cw" class="w-3.5 h-3.5 text-sky-500"></i>
<span>Automatische Agenda Synchronisatie</span>
</label>
<p class="text-[11px] text-slate-500 dark:text-slate-400 leading-relaxed">
Bepaalt hoe vaak het dagplanningscherm in de achtergrond controleert op gewijzigde of verwijderde Outlook afspraken.
</p>
</div>
<div class="flex items-center space-x-2">
<?php $currentInterval = (int)($outlookSettings['sync_interval_seconds'] ?? 30); ?>
<select id="sync_interval_seconds" name="sync_interval_seconds" class="px-3 py-2 rounded-xl border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-800 text-slate-900 dark:text-white text-xs focus:ring-2 focus:ring-sky-500 focus:outline-hidden">
<option value="15" <?= $currentInterval === 15 ? 'selected' : '' ?>>Elke 15 seconden (Real-time)</option>
<option value="30" <?= $currentInterval === 30 ? 'selected' : '' ?>>Elke 30 seconden (Aanbevolen)</option>
<option value="60" <?= $currentInterval === 60 ? 'selected' : '' ?>>Elke 60 seconden (1 minuut)</option>
<option value="120" <?= $currentInterval === 120 ? 'selected' : '' ?>>Elke 2 minuten</option>
<option value="0" <?= $currentInterval === 0 ? 'selected' : '' ?>>Handmatig (en bij vensterfocus)</option>
</select>
<button type="submit" class="px-4 py-2 rounded-xl bg-sky-600 hover:bg-sky-500 text-white font-semibold text-xs transition shadow-2xs whitespace-nowrap cursor-pointer">
Opslaan
</button>
</div>
</form>
<div class="mt-4 p-3.5 rounded-xl bg-teal-50 dark:bg-teal-500/10 border border-teal-200 dark:border-teal-500/20 text-teal-800 dark:text-teal-300 text-xs flex items-center justify-between">
<div class="flex items-center space-x-2">
<i data-lucide="check-circle" class="w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"></i>