-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 169 - Add future and past event lists * 169 - Load past events * 169 - New event list design * 169 - link easier to click on * 169: small ui improvements * 169: fix column gap * 169: clean css and style draft events list * 169: fix router and other PR fix * 169: some improvements - rename toast test page - fix deprecated code in `event_edit` - add extra gap below birthdays - fix formatting of past events - remove dead code in `RenderEvents` - fix `event_list` CSS - improve typings in `FactoryDependency` --------- Co-authored-by: Atmos4 <[email protected]>
- Loading branch information
1 parent
ed30fc1
commit 1de78ea
Showing
11 changed files
with
253 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
function render_events_article(EventDto $event) | ||
{ | ||
$diff = date_create('now')->diff($event->deadline->add(new DateInterval("PT23H59M59S"))); | ||
$limit_class = $tooltip_content = ""; | ||
if ($diff->invert) { | ||
$limit_class = "passed"; | ||
$tooltip_content = "data-tooltip='Deadline dépassée'"; | ||
} elseif ($diff->days < 7) { | ||
$limit_class = "warning"; | ||
$tooltip_content = "data-tooltip=\"" | ||
. ($diff->days == 0 ? | ||
$diff->format("Plus que %h heures!") : | ||
$diff->format("Dans %d jour" . ($diff->days == 1 ? "" : "s"))) | ||
. "\""; | ||
} ?> | ||
|
||
<article class="event-article" hx-trigger="click,keyup[key=='Enter'||key==' ']" onkeydown="console.log(event.key)" | ||
hx-get="/evenements/<?= $event->id ?>" hx-target="body" hx-push-url="true" tabindex=0> | ||
<div class="grid"> | ||
<div class="icon"> | ||
<?php if ($event->open): | ||
if ($event->registered == true): ?> | ||
<ins><i class="fas fa-check fa-xl" title="Inscrit !"></i></ins> | ||
<?php elseif ($event->registered === false): ?> | ||
<del><i class="fas fa-xmark fa-xl" title="Pas inscrit"></i></del> | ||
<?php else: ?> | ||
<i class="fas fa-question fa-xl" title="Pas encore inscrit"></i> | ||
<?php endif; else: ?> | ||
<i class="fas fa-file" title="Brouillon"></i> | ||
<?php endif ?> | ||
</div> | ||
|
||
<div class="title"> | ||
<b> | ||
<?= $event->name ?> | ||
</b> | ||
</div> | ||
<div class="dates"> | ||
<span> | ||
<?= format_date($event->start) ?> | ||
</span> | ||
<i class="fas fa-arrow-right"></i> | ||
<span> | ||
<?= format_date($event->end) ?> | ||
</span> | ||
</div> | ||
<div class="event-limit <?= $limit_class ?>"> | ||
<i title="Deadline" class="fas fa-clock"></i><span <?= $tooltip_content ?> data-placement='left'> | ||
<?= format_date($event->deadline) ?> | ||
</span> | ||
</div> | ||
</div> | ||
</article> | ||
<?php | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
include_once __DIR__ . "/RenderEvents.php"; | ||
|
||
restrict_access(); | ||
$can_edit = check_auth(Access::$ADD_EVENTS); | ||
|
||
formatter("d MMM"); | ||
$user = User::getCurrent(); | ||
$future_events = Event::listAllFutureOpen($user->id); | ||
if ($can_edit) | ||
$draft_events = Event::listDrafts(); | ||
|
||
// Get the current date | ||
$current_date_month = date('m'); | ||
$current_date_day = date('d'); | ||
|
||
// Query the database to get a list of users whose birthday matches the current date | ||
$birthday_users = em()->createQueryBuilder() | ||
->select("u") | ||
->from(User::class, "u") | ||
->where("MONTH(u.birthdate) = :month AND DAY(u.birthdate) = :day") | ||
->setParameter("month", $current_date_month) | ||
->setParameter("day", $current_date_day) | ||
->getQuery()->getResult(); | ||
|
||
page("Événements")->css("event_list.css")->heading(false); | ||
|
||
$vowels = array("a", "e", "i", "o", "u"); ?> | ||
|
||
<?php if ($birthday_users): ?> | ||
<div class="birthday-wrapper"> | ||
<?php foreach ($birthday_users as $birthday_user): ?> | ||
<div class="birthday"> | ||
🎂 C'est l'anniversaire | ||
<?= ((in_array(strtolower(substr($birthday_user->first_name, 0, 1)), $vowels)) ? "d'" : "de ") | ||
. "$birthday_user->first_name $birthday_user->last_name 🎉" ?> | ||
</div> | ||
<?php endforeach ?> | ||
</div> | ||
<?php endif ?> | ||
|
||
<h2 class="center">Événements</h2> | ||
|
||
|
||
<?php if ($can_edit): ?> | ||
<nav id="page-actions"> | ||
<a href="/evenements/nouveau"><i class="fas fa-plus"></i> Ajouter un | ||
événement</a> | ||
</nav> | ||
<?php endif ?> | ||
|
||
<?php if (!count($future_events) && !($can_edit && count($draft_events))): ?> | ||
<p class="center">Pas d'événement pour le moment 😴</p> | ||
<?php return; | ||
endif ?> | ||
|
||
<?php // Draft events | ||
if ($can_edit && count($draft_events)): ?> | ||
|
||
<h6>Événements en attente</h6> | ||
<?php | ||
foreach ($draft_events as $draft_event) { | ||
render_events_article($draft_event); | ||
} ?> | ||
<h6>Événements publiés</h6> | ||
<?php endif ?> | ||
|
||
<?php if (count($future_events)): ?> | ||
<?php foreach ($future_events as $event): ?> | ||
<?= render_events_article($event); ?> | ||
<?php endforeach ?> | ||
|
||
<div id="loadEvents"> | ||
<button class="outline secondary" hx-get="/evenements/passes" hx-swap="outerHTML" hx-target="this">Charger | ||
les | ||
événements | ||
passés</button> | ||
</div> | ||
<?php endif ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
include_once __DIR__ . "/RenderEvents.php"; | ||
|
||
restrict_access(); | ||
formatter("d MMM"); | ||
$user = User::getCurrent(); | ||
$past_events = Event::listAllPastOpen($user->id); | ||
|
||
if (count($past_events)) { | ||
foreach ($past_events as $event) { | ||
render_events_article($event); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.