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

Planifier le voyage


🚗 Transport

🏨 Hébergement

🎫 Activité


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' }; // --- NOUVEAU : Calcul de la progression --- $cost = (float)$h['total_cost']; $funded = (float)$h['total_funded']; $leftToPay = max(0, $cost - $funded); // Pourcentage pour la barre de progression (max 100%) $percent = $cost > 0 ? min(100, round(($funded / $cost) * 100)) : 0; // Couleur de la barre : Rouge si < 50%, Jaune si < 100%, Vert si tout est payé $barColor = $percent === 100 ? '#10b981' : ($percent > 50 ? '#f59e0b' : '#ef4444'); echo "

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

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