màj avec 14 février à latapie
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
start:
|
||||
pnpm dlx serve src
|
||||
php -S localhost:8000 -t src
|
||||
|
||||
# Require a password. Not versioned. See Bitwarden.
|
||||
deploy:
|
||||
|
||||
+30
-13
@@ -7,14 +7,16 @@
|
||||
/**
|
||||
* Charge les distributions depuis le fichier de configuration
|
||||
*/
|
||||
function chargerDistributions(): array {
|
||||
function chargerDistributions(): array
|
||||
{
|
||||
return require __DIR__ . '/distributions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Trouve la prochaine distribution
|
||||
*/
|
||||
function trouverProchaineDistribution(array $distributions): ?array {
|
||||
function trouverProchaineDistribution(array $distributions): ?array
|
||||
{
|
||||
$maintenant = new DateTime();
|
||||
|
||||
foreach ($distributions as $distrib) {
|
||||
@@ -30,7 +32,8 @@ function trouverProchaineDistribution(array $distributions): ?array {
|
||||
/**
|
||||
* Vérifie si une distribution est passée
|
||||
*/
|
||||
function estPassee(array $distribution): bool {
|
||||
function estPassee(array $distribution): bool
|
||||
{
|
||||
$maintenant = new DateTime();
|
||||
$date = new DateTime($distribution['date']);
|
||||
return $date < $maintenant;
|
||||
@@ -39,7 +42,8 @@ function estPassee(array $distribution): bool {
|
||||
/**
|
||||
* Formate une date de distribution
|
||||
*/
|
||||
function formaterDate(string $date): string {
|
||||
function formaterDate(string $date): string
|
||||
{
|
||||
$dateObj = new DateTime($date);
|
||||
$formatter = new IntlDateFormatter(
|
||||
'fr_FR',
|
||||
@@ -62,7 +66,7 @@ function formaterDate(string $date): string {
|
||||
7 => 'Dimanche'
|
||||
];
|
||||
return $joursTraduction[$jourSemaine] . ' ' . $dateObj->format('d') . ' ' .
|
||||
ucfirst($formatter->format($dateObj));
|
||||
ucfirst($formatter->format($dateObj));
|
||||
}
|
||||
|
||||
return ucfirst($dateFormatee);
|
||||
@@ -71,7 +75,8 @@ function formaterDate(string $date): string {
|
||||
/**
|
||||
* Formate une date courte (pour le calendrier)
|
||||
*/
|
||||
function formaterDateCourte(string $date): string {
|
||||
function formaterDateCourte(string $date): string
|
||||
{
|
||||
$dateObj = new DateTime($date);
|
||||
$formatter = new IntlDateFormatter(
|
||||
'fr_FR',
|
||||
@@ -94,7 +99,7 @@ function formaterDateCourte(string $date): string {
|
||||
7 => 'Dimanche'
|
||||
];
|
||||
return '<strong>' . $joursTraduction[$jourSemaine] . '</strong> ' .
|
||||
$formatter->format($dateObj);
|
||||
$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
|
||||
*/
|
||||
function formaterDateComplete(DateTime $date): string {
|
||||
function formaterDateComplete(DateTime $date): string
|
||||
{
|
||||
$formatter = new IntlDateFormatter(
|
||||
'fr_FR',
|
||||
IntlDateFormatter::FULL,
|
||||
@@ -119,7 +125,8 @@ function formaterDateComplete(DateTime $date): string {
|
||||
/**
|
||||
* Formate une date pour le calendrier
|
||||
*/
|
||||
function formaterDateCalendrier(DateTime $date): string {
|
||||
function formaterDateCalendrier(DateTime $date): string
|
||||
{
|
||||
$formatter = new IntlDateFormatter(
|
||||
'fr_FR',
|
||||
IntlDateFormatter::LONG,
|
||||
@@ -135,7 +142,8 @@ function formaterDateCalendrier(DateTime $date): string {
|
||||
/**
|
||||
* Retourne l'info du lieu de distribution
|
||||
*/
|
||||
function getLieuInfo(string $lieu): array {
|
||||
function getLieuInfo(?string $lieu): array
|
||||
{
|
||||
$lieux = [
|
||||
'grange' => [
|
||||
'nom' => 'La Grange',
|
||||
@@ -148,6 +156,12 @@ function getLieuInfo(string $lieu): array {
|
||||
'adresse' => '28 rue Guillaume Berdeil',
|
||||
'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'
|
||||
],
|
||||
'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
|
||||
*/
|
||||
function getClasseDistribution(array $distribution, bool $estProchaine): string {
|
||||
function getClasseDistribution(array $distribution, bool $estProchaine): string
|
||||
{
|
||||
if ($estProchaine) {
|
||||
return 'bg-green-500';
|
||||
}
|
||||
@@ -176,7 +191,8 @@ function getClasseDistribution(array $distribution, bool $estProchaine): string
|
||||
/**
|
||||
* Classe CSS pour le texte
|
||||
*/
|
||||
function getClasseTexte(array $distribution, bool $estProchaine): string {
|
||||
function getClasseTexte(array $distribution, bool $estProchaine): string
|
||||
{
|
||||
if ($estProchaine) {
|
||||
return 'text-white';
|
||||
}
|
||||
@@ -195,7 +211,8 @@ function getClasseTexte(array $distribution, bool $estProchaine): string {
|
||||
/**
|
||||
* Label du statut
|
||||
*/
|
||||
function getLabelStatut(array $distribution, bool $estProchaine): ?string {
|
||||
function getLabelStatut(array $distribution, bool $estProchaine): ?string
|
||||
{
|
||||
if ($estProchaine) {
|
||||
return 'Prochaine';
|
||||
}
|
||||
|
||||
@@ -59,10 +59,9 @@ return [
|
||||
],
|
||||
[
|
||||
'date' => '2026-02-14',
|
||||
'lieu' => null,
|
||||
'type' => 'annulee',
|
||||
'label' => 'Pas de distribution',
|
||||
'raison' => 'Salon des vins et producteurs locaux'
|
||||
'lieu' => 'latapie',
|
||||
'type' => 'special',
|
||||
'label' => '🍷 Salon des vins et producteurs locaux 🍷'
|
||||
],
|
||||
[
|
||||
'date' => '2026-02-28',
|
||||
|
||||
Reference in New Issue
Block a user