diff --git a/planner.php b/planner.php index 57904e4..3e1b310 100644 --- a/planner.php +++ b/planner.php @@ -42,53 +42,7 @@ $dutchShortMonths = ['', 'jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', $formattedSelectedDate = $dutchFullDays[(int)date('N', $selectedTs)] . ' ' . date('j', $selectedTs) . ' ' . $dutchMonths[(int)date('n', $selectedTs)] . ' ' . date('Y', $selectedTs); $formattedWeekRange = date('j', $mondayTs) . ' ' . $dutchShortMonths[(int)date('n', $mondayTs)] . ' – ' . date('j', $sundayTs) . ' ' . $dutchShortMonths[(int)date('n', $sundayTs)] . ' ' . date('Y', $sundayTs); -<<<<<<< HEAD // 1. Haal integratiestatussen op -======= -// 1. Haal dagplanning op of maak aan voor $selectedDate -$stmtPlan = $db->prepare("SELECT * FROM daily_plans WHERE user_id = ? AND plan_date = ?"); -$stmtPlan->execute([$userId, $selectedDate]); -$dailyPlan = $stmtPlan->fetch(); - -if (!$dailyPlan) { - $defaultGoal = ($selectedDate === $today) ? 'Mijn belangrijkste doel van vandaag behalen' : 'Focusdoel voor deze dag bepalen'; - $stmtCreatePlan = $db->prepare(" - INSERT INTO daily_plans (user_id, plan_date, focus_goal) - VALUES (?, ?, ?) - "); - $stmtCreatePlan->execute([$userId, $selectedDate, $defaultGoal]); - $planId = (int)$db->lastInsertId(); - $dailyPlan = ['id' => $planId, 'plan_date' => $selectedDate, 'focus_goal' => $defaultGoal, 'notes' => '']; -} - -// 2. Haal taken op voor de geselecteerde dag -$stmtTasks = $db->prepare(" - SELECT * FROM tasks - WHERE user_id = ? AND (daily_plan_id = ? " . ($selectedDate === $today ? "OR daily_plan_id IS NULL" : "") . ") - ORDER BY is_completed ASC, priority ASC, time_block_start ASC, created_at DESC -"); -$stmtTasks->execute([$userId, $dailyPlan['id']]); -$tasks = $stmtTasks->fetchAll(); - -// 3. Haal weekstatistieken voor taken op (aantal per dag) -$stmtWeekTasks = $db->prepare(" - SELECT dp.plan_date, COUNT(t.id) as total_tasks, SUM(CASE WHEN t.is_completed = 1 THEN 1 ELSE 0 END) as completed_tasks - FROM daily_plans dp - LEFT JOIN tasks t ON t.daily_plan_id = dp.id AND t.user_id = ? - WHERE dp.user_id = ? AND dp.plan_date BETWEEN ? AND ? - GROUP BY dp.plan_date -"); -$stmtWeekTasks->execute([$userId, $userId, $weekStart, $weekEnd]); -$weekTaskStats = []; -foreach ($stmtWeekTasks->fetchAll() as $row) { - $weekTaskStats[$row['plan_date']] = [ - 'total' => (int)$row['total_tasks'], - 'completed' => (int)$row['completed_tasks'], - ]; -} - -// 4. Haal integratiestatussen op ->>>>>>> dd738e670b78819c11e329da93db1b472808f195 $stmtInt = $db->prepare("SELECT * FROM integrations WHERE user_id = ?"); $stmtInt->execute([$userId]); $userIntegrations = []; @@ -97,12 +51,9 @@ foreach ($stmtInt->fetchAll() as $row) { } $isOutlookConnected = !empty($userIntegrations['OUTLOOK']['access_token']) && empty($userIntegrations['OUTLOOK']['is_demo_mode']); -<<<<<<< HEAD $outlookIntegrationSettings = json_decode($userIntegrations['OUTLOOK']['settings'] ?? '{}', true) ?: []; $syncIntervalSeconds = isset($outlookIntegrationSettings['sync_interval_seconds']) ? (int)$outlookIntegrationSettings['sync_interval_seconds'] : 30; -======= ->>>>>>> dd738e670b78819c11e329da93db1b472808f195 $weekOutlookEvents = []; $isLiveOutlook = false; @@ -110,12 +61,9 @@ if ($isOutlookConnected) { // Haal afspraken op voor het volledige datumbereik van de week $weekOutlookEvents = microsoft_fetch_events_range($userId, $weekStart, $weekEnd); $isLiveOutlook = true; -<<<<<<< HEAD // Synchroniseer / reconcilieer Fociz taken direct met actuele Outlook data microsoft_reconcile_tasks_with_outlook($userId, $weekStart, $weekEnd, $weekOutlookEvents); -======= ->>>>>>> dd738e670b78819c11e329da93db1b472808f195 } else { // Demo data indien Microsoft Outlook nog niet gekoppeld is $weekOutlookEvents = [ @@ -152,7 +100,6 @@ if ($isOutlookConnected) { ]; } -<<<<<<< HEAD // 2. Haal dagplanning op of maak aan voor $selectedDate $stmtPlan = $db->prepare("SELECT * FROM daily_plans WHERE user_id = ? AND plan_date = ?"); $stmtPlan->execute([$userId, $selectedDate]); @@ -195,8 +142,6 @@ foreach ($stmtWeekTasks->fetchAll() as $row) { ]; } -======= ->>>>>>> dd738e670b78819c11e329da93db1b472808f195 // Groepeer Outlook afspraken per datum $outlookEventsByDate = []; foreach ($weekOutlookEvents as $evt) { @@ -249,7 +194,6 @@ foreach ($dayOutlookEvents as $evt) { $displayedOutlookEvents[] = $evt; } -<<<<<<< HEAD // Bereken initiële status-hash voor achtergrondsynchronisatie $dayEventsForHash = []; foreach ($displayedOutlookEvents as $e) { @@ -274,8 +218,6 @@ $initialSyncHash = md5(json_encode([ 'tasks' => $tasksForHash ])); -======= ->>>>>>> dd738e670b78819c11e329da93db1b472808f195 // 6. Tijdlijn uren & Werkdag Standaarden (Release v1.4) $workdayStartStr = $workdaySettings['workday_start'] ?? '08:30'; $workdayEndStr = $workdaySettings['workday_end'] ?? '17:30'; @@ -338,20 +280,12 @@ for ($h = $startHour; $h <= $endHour; $h++) {
-<<<<<<< HEAD
Outlook 365 Live
@@ -571,24 +505,16 @@ for ($h = $startHour; $h <= $endHour; $h++) {
-<<<<<<< HEAD
->>>>>>> dd738e670b78819c11e329da93db1b472808f195
-<<<<<<< HEAD
@@ -629,22 +555,6 @@ for ($h = $startHour; $h <= $endHour; $h++) {
-======= - - -
-
- - ->>>>>>> dd738e670b78819c11e329da93db1b472808f195
@@ -703,11 +613,7 @@ for ($h = $startHour; $h <= $endHour; $h++) { -<<<<<<< HEAD -======= - ->>>>>>> dd738e670b78819c11e329da93db1b472808f195 @@ -733,16 +639,11 @@ for ($h = $startHour; $h <= $endHour; $h++) { -<<<<<<< HEAD -<<<<<<< HEAD @@ -975,7 +873,6 @@ for ($h = $startHour; $h <= $endHour; $h++) { -<<<<<<< HEAD -======= ->>>>>>> dd738e670b78819c11e329da93db1b472808f195