màj avec 14 février à latapie

This commit is contained in:
Pierre Martin
2026-01-27 00:40:41 +01:00
parent a3324155bd
commit 482a35adf4
3 changed files with 34 additions and 18 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
start: start:
pnpm dlx serve src php -S localhost:8000 -t src
# Require a password. Not versioned. See Bitwarden. # Require a password. Not versioned. See Bitwarden.
deploy: deploy:
+30 -13
View File
@@ -7,14 +7,16 @@
/** /**
* Charge les distributions depuis le fichier de configuration * Charge les distributions depuis le fichier de configuration
*/ */
function chargerDistributions(): array { function chargerDistributions(): array
{
return require __DIR__ . '/distributions.php'; return require __DIR__ . '/distributions.php';
} }
/** /**
* Trouve la prochaine distribution * Trouve la prochaine distribution
*/ */
function trouverProchaineDistribution(array $distributions): ?array { function trouverProchaineDistribution(array $distributions): ?array
{
$maintenant = new DateTime(); $maintenant = new DateTime();
foreach ($distributions as $distrib) { foreach ($distributions as $distrib) {
@@ -30,7 +32,8 @@ function trouverProchaineDistribution(array $distributions): ?array {
/** /**
* Vérifie si une distribution est passée * Vérifie si une distribution est passée
*/ */
function estPassee(array $distribution): bool { function estPassee(array $distribution): bool
{
$maintenant = new DateTime(); $maintenant = new DateTime();
$date = new DateTime($distribution['date']); $date = new DateTime($distribution['date']);
return $date < $maintenant; return $date < $maintenant;
@@ -39,7 +42,8 @@ function estPassee(array $distribution): bool {
/** /**
* Formate une date de distribution * Formate une date de distribution
*/ */
function formaterDate(string $date): string { function formaterDate(string $date): string
{
$dateObj = new DateTime($date); $dateObj = new DateTime($date);
$formatter = new IntlDateFormatter( $formatter = new IntlDateFormatter(
'fr_FR', 'fr_FR',
@@ -62,7 +66,7 @@ function formaterDate(string $date): string {
7 => 'Dimanche' 7 => 'Dimanche'
]; ];
return $joursTraduction[$jourSemaine] . ' ' . $dateObj->format('d') . ' ' . return $joursTraduction[$jourSemaine] . ' ' . $dateObj->format('d') . ' ' .
ucfirst($formatter->format($dateObj)); ucfirst($formatter->format($dateObj));
} }
return ucfirst($dateFormatee); return ucfirst($dateFormatee);
@@ -71,7 +75,8 @@ function formaterDate(string $date): string {
/** /**
* Formate une date courte (pour le calendrier) * Formate une date courte (pour le calendrier)
*/ */
function formaterDateCourte(string $date): string { function formaterDateCourte(string $date): string
{
$dateObj = new DateTime($date); $dateObj = new DateTime($date);
$formatter = new IntlDateFormatter( $formatter = new IntlDateFormatter(
'fr_FR', 'fr_FR',
@@ -94,7 +99,7 @@ function formaterDateCourte(string $date): string {
7 => 'Dimanche' 7 => 'Dimanche'
]; ];
return '<strong>' . $joursTraduction[$jourSemaine] . '</strong> ' . return '<strong>' . $joursTraduction[$jourSemaine] . '</strong> ' .
$formatter->format($dateObj); $formatter->format($dateObj);
} }
return $formatter->format($dateObj); return $formatter->format($dateObj);
@@ -103,7 +108,8 @@ function formaterDateCourte(string $date): string {
/** /**
* Formate une date complète avec jour de la semaine * Formate une date complète avec jour de la semaine
*/ */
function formaterDateComplete(DateTime $date): string { function formaterDateComplete(DateTime $date): string
{
$formatter = new IntlDateFormatter( $formatter = new IntlDateFormatter(
'fr_FR', 'fr_FR',
IntlDateFormatter::FULL, IntlDateFormatter::FULL,
@@ -119,7 +125,8 @@ function formaterDateComplete(DateTime $date): string {
/** /**
* Formate une date pour le calendrier * Formate une date pour le calendrier
*/ */
function formaterDateCalendrier(DateTime $date): string { function formaterDateCalendrier(DateTime $date): string
{
$formatter = new IntlDateFormatter( $formatter = new IntlDateFormatter(
'fr_FR', 'fr_FR',
IntlDateFormatter::LONG, IntlDateFormatter::LONG,
@@ -135,7 +142,8 @@ function formaterDateCalendrier(DateTime $date): string {
/** /**
* Retourne l'info du lieu de distribution * Retourne l'info du lieu de distribution
*/ */
function getLieuInfo(string $lieu): array { function getLieuInfo(?string $lieu): array
{
$lieux = [ $lieux = [
'grange' => [ 'grange' => [
'nom' => 'La Grange', 'nom' => 'La Grange',
@@ -148,6 +156,12 @@ function getLieuInfo(string $lieu): array {
'adresse' => '28 rue Guillaume Berdeil', 'adresse' => '28 rue Guillaume Berdeil',
'url' => 'https://www.openstreetmap.org/?mlat=43.516927&mlon=1.319663#map=19/43.516927/1.319663', 'url' => 'https://www.openstreetmap.org/?mlat=43.516927&mlon=1.319663#map=19/43.516927/1.319663',
'description' => 'au Secours Populaire de Frouzins 28 rue Guillaume Berdeil' 'description' => 'au Secours Populaire de Frouzins 28 rue Guillaume Berdeil'
],
'latapie' => [
'nom' => 'Salle des fêtes Jean Latapie',
'adresse' => 'Chemin des Mailheaux',
'url' => 'https://www.openstreetmap.org/way/123574995',
'description' => 'à la Salle des fêtes Jean Latapie Chemin des Mailheaux'
] ]
]; ];
@@ -157,7 +171,8 @@ function getLieuInfo(string $lieu): array {
/** /**
* Classe CSS pour le type de distribution * Classe CSS pour le type de distribution
*/ */
function getClasseDistribution(array $distribution, bool $estProchaine): string { function getClasseDistribution(array $distribution, bool $estProchaine): string
{
if ($estProchaine) { if ($estProchaine) {
return 'bg-green-500'; return 'bg-green-500';
} }
@@ -176,7 +191,8 @@ function getClasseDistribution(array $distribution, bool $estProchaine): string
/** /**
* Classe CSS pour le texte * Classe CSS pour le texte
*/ */
function getClasseTexte(array $distribution, bool $estProchaine): string { function getClasseTexte(array $distribution, bool $estProchaine): string
{
if ($estProchaine) { if ($estProchaine) {
return 'text-white'; return 'text-white';
} }
@@ -195,7 +211,8 @@ function getClasseTexte(array $distribution, bool $estProchaine): string {
/** /**
* Label du statut * Label du statut
*/ */
function getLabelStatut(array $distribution, bool $estProchaine): ?string { function getLabelStatut(array $distribution, bool $estProchaine): ?string
{
if ($estProchaine) { if ($estProchaine) {
return 'Prochaine'; return 'Prochaine';
} }
+3 -4
View File
@@ -59,10 +59,9 @@ return [
], ],
[ [
'date' => '2026-02-14', 'date' => '2026-02-14',
'lieu' => null, 'lieu' => 'latapie',
'type' => 'annulee', 'type' => 'special',
'label' => 'Pas de distribution', 'label' => '🍷 Salon des vins et producteurs locaux 🍷'
'raison' => 'Salon des vins et producteurs locaux'
], ],
[ [
'date' => '2026-02-28', 'date' => '2026-02-28',