query($sql)->fetchAll(PDO::FETCH_ASSOC); // Tri par statut $active = array_filter($holidays, fn($h) => in_array($h['status'], ['draft', 'planned', 'booked'])); $history = array_filter($holidays, fn($h) => in_array($h['status'], ['passed', 'archived'])); ?>

Mes Vacances ✈️

Aucun voyage en cours. Planifions quelque chose !

Historique

prepare("SELECT * FROM pf_holidays_items WHERE holiday_id = ?"); $stmt->execute([$h['id']]); $items = $stmt->fetchAll(PDO::FETCH_ASSOC); $json = htmlspecialchars(json_encode(['main' => $h, 'items' => $items]), ENT_QUOTES, 'UTF-8'); $dateDisplay = htmlspecialchars($h['period_hint'] ?? ''); if (empty($dateDisplay) && $h['start_date']) { $dateDisplay = date('d/m/Y', strtotime($h['start_date'])); if ($h['end_date']) $dateDisplay .= ' → ' . date('d/m/Y', strtotime($h['end_date'])); } $statusClass = match($h['status']) { 'booked' => 'bg-green-100 text-green-800', 'planned' => 'bg-blue-100 text-blue-800', 'passed' => 'bg-gray-100 text-gray-600', default => 'bg-yellow-50 text-yellow-800' }; // --- Calcul des métriques financières --- $cost = (float)$h['total_cost']; $paid = (float)$h['total_paid']; $saved = (float)$h['total_saved']; $leftToPay = max(0, $cost - $paid); // Calculs pour la barre de progression bicolore $pctPaid = $cost > 0 ? min(100, ($paid / $cost) * 100) : 0; $pctSaved = $cost > 0 ? min(100 - $pctPaid, ($saved / $cost) * 100) : 0; echo "

".htmlspecialchars($h['title'])."

".strtoupper($h['status'])."
👁️
🗓️ ".($dateDisplay ?: 'Dates à définir')."
Budget Total ".number_format($cost, 0, ',', ' ')." €
✓ Payé : ".number_format($paid, 0, ',', ' ')." €
💼 Financé : ".number_format($saved, 0, ',', ' ')." €
⏳ Reste à payer : ".number_format($leftToPay, 0, ',', ' ')." €
"; } ?>