Skip to content

Commit

Permalink
171 - Add activity view
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu414 committed Mar 27, 2024
1 parent f76a545 commit 1e88d3d
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 70 deletions.
95 changes: 95 additions & 0 deletions app/pages/events/activity_view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php
restrict_access();

$activity = em()->find(Activity::class, get_route_param("activity_id"));

if ($activity->type == ActivityType::RACE) {
$icon = "fa fa-stopwatch";
} elseif ($activity->type == ActivityType::TRAINING) {
$icon = "fa fa-dumbbell";
} else {
$icon = "fa fa-bowl-food";
}

page($activity->name)->css("event_view.css");
?>

<nav id="page-actions">
<?php $link = $activity->event ? "/evenements/{$activity->event->id}" : "/evenements" ?>
<a href="<?= $link ?>" class="secondary"><i class="fas fa-caret-left"></i> Retour</a>

</nav>

<article>
<header class="center">
<?php if ($activity->type == ActivityType::RACE) {
$type = "Course";
} elseif ($activity->type == ActivityType::TRAINING) {
$type = "Entrainement";
} else {
$type = "Autre";
} ?>

<div style="margin-bottom: 1rem;"><i class="fas <?= $icon ?> fa-2xl"></i></div>
<p>
<kbd>
<?= $type ?>
</kbd>
</p>
<div class="row">
<div>
<?php include app_path() . "/components/start_icon.php" ?>
<span>
<?= "Date : " . format_date($activity->date) ?>
</span>
</div>
</div>

<div class="row">
<?php
$activity_entry = $activity->entries[0] ?? null;
if ($activity->event->open): ?>
<?php if ($activity_entry): ?>
<?php if ($activity_entry->present): ?>
<ins><i class="fas fa-check fa-lg"></i></ins>
<?php else: ?>
<del><i class="fas fa-xmarkf fa-lg"></i></del>
<?php endif; ?>
<?php else: ?>
<i class="fas fa-question fa-lg"></i>
<?php endif; ?>
<?php else: ?>
<del>Pas encore publié</del>
<?php endif ?>
</div>
</header>

<?php if ($activity->event->open): ?>
<blockquote>
<h6>Inscription</h6>
<div class="grid">
<ul class="fa-ul">
<?php if ($activity_entry?->present): ?>
<li><span class="fa-li"><i class="fa fa-check"></i></span><ins>Je participe</ins></li>
<?php else: ?>
<li><span class="fa-li"><i class="fa fa-xmark"></i></span><del>
<?= $activity_entry ? "Je ne participe pas" : "Pas inscrit" ?>
</del></li>
<?php endif; ?>
</ul>
<?php if ($activity_entry?->category): ?>
<ul class="fa-ul">
<li><span class="fa-li"><abbr title="Catégorie"><i class="fa fa-person-running"></i></abbr></span>
<?= $activity_entry->category?->name ?>
</li>
</ul>
<?php endif ?>
</div>
<?php if ($activity_entry?->comment): ?>
<div>
<cite>Remarque : </cite>
<?= $activity_entry->comment ?>
</div>
<?php endif; ?>
</blockquote>
<?php endif ?>
2 changes: 1 addition & 1 deletion app/pages/events/entry_list/entry_list_tab_activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$activityEntries = ActivityService::getActivityEntries($activityId);
?>
<?php if (!$activityEntries): ?>
<p style="padding: 1rem" class="center">Pas d'inscrits sur cette course</p>
<p style="padding: 1rem" class="center">Pas d'inscrits sur cette activité</p>
<?php return;
endif ?>
<figure>
Expand Down
140 changes: 73 additions & 67 deletions app/pages/events/event_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,20 @@
</div>
</div>


<div class="row">
<b>
<?php if ($event->open): ?>
<?php if ($entry?->present): ?>
<ins><i class="fas fa-check"></i>
<span>Je participe</span></ins>
<?php if ($event->open): ?>
<?php if ($entry): ?>
<?php if ($entry->present): ?>
<ins><i class="fas fa-check fa-lg"></i></ins>
<?php else: ?>
<del><i class="fas fa-xmark"></i>
<span>
<?= $entry ? "Je ne participe pas" : "Pas inscrit" ?>
</span></del>
<del><i class="fas fa-xmarkf fa-lg"></i></del>
<?php endif; ?>
<?php else: ?>
<del>Pas encore publié</del>
<?php endif ?>
</b>
<i class="fas fa-question fa-lg"></i>
<?php endif; ?>
<?php else: ?>
<del>Pas encore publié</del>
<?php endif ?>
</div>

<?php if ($event->bulletin_url): ?>
Expand All @@ -110,22 +107,37 @@
<?php endif ?>
</header>

<?php if ($entry && $entry->present): ?>
<div class="grid">
<p>
<?= ConditionalIcon($entry->transport, "Transport avec le club") ?>
</p>
<p>
<?= ConditionalIcon($entry->accomodation, "Hébergement avec le club") ?>
<?php if ($event->open): ?>
<blockquote>
<h6>Inscription</h6>
<p class="row">
<?php if ($entry?->present): ?>
<ins><i class="fas fa-check"></i>
<span>Je participe</span></ins>
<?php else: ?>
<del><i class="fas fa-xmark"></i>
<span>
<?= $entry ? "Je ne participe pas" : "Pas inscrit" ?>
</span></del>
<?php endif; ?>
</p>
</div>
<?php endif ?>
<?php if ($entry && $entry->present): ?>
<div class="grid">
<p>
<?= ConditionalIcon($entry->transport, "Transport avec le club") ?>
</p>
<p>
<?= ConditionalIcon($entry->accomodation, "Hébergement avec le club") ?>
</p>
</div>
<?php endif ?>

<?php if ($entry && $entry->comment): ?>
<blockquote>
<?= $entry->comment ?>
<?php if ($entry && $entry->comment): ?>
<cite>Remarque : </cite>
<?= $entry->comment ?>
<?php endif; ?>
</blockquote>
<?php endif; ?>
<?php endif ?>

<?php if (count($event->activities)): ?>
<h3>Activités :
Expand All @@ -149,52 +161,46 @@
</b>
</summary>
<h6>Description</h6>
<div class="row">
<div class="col-sm-12 col-md-6">
<ul class="fa-ul">
<li><span class="fa-li"><i class="fa fa-calendar"></i></span>
<?= format_date($activity->date) ?>
</li>
</ul>
<?php if ($can_edit): ?>
<a role="button" class="outline secondary"
href='/evenements/<?= $event->id ?>/activite/<?= $activity->id ?>'>
<i class="fa fa-pen"></i>
Modifier</a>
<?php endif ?>
</div>
<div class="col-sm-12 col-md-6">
<ul class="fa-ul">
<li><span class="fa-li"><i class="fa fa-location-dot"></i></span>
<?= $activity->place ?>
</li>
</ul>
</div>
<div class="grid">
<ul class="fa-ul">
<li><span class="fa-li"><i class="fa fa-calendar"></i></span>
<?= format_date($activity->date) ?>
</li>
</ul>
<ul class="fa-ul">
<li><span class="fa-li"><i class="fa fa-location-dot"></i></span>
<?= $activity->place ?>
</li>
</ul>

</div>
<a role="button" class="outline secondary" href='/evenements/<?= $event->id ?>/activite/<?= $activity->id ?>'>
<i class="fa fa-circle-info"></i>
Détails</a>
<?php if ($can_edit): ?>
<a role="button" class="outline secondary"
href='/evenements/<?= $event->id ?>/activite/<?= $activity->id ?>/modifier'>
<i class="fa fa-pen"></i>
Modifier</a>
<?php endif ?>
<blockquote>
<h6>Inscription</h6>
<div class="row">

<div class="col-sm-12 col-md-6">
<div class="grid">
<ul class="fa-ul">
<?php if ($activity_entry?->present): ?>
<li><span class="fa-li"><i class="fa fa-check"></i></span><ins>Je participe</ins></li>
<?php else: ?>
<li><span class="fa-li"><i class="fa fa-xmark"></i></span><del>
<?= $activity_entry ? "Je ne participe pas" : "Pas inscrit" ?>
</del></li>
<?php endif; ?>
</ul>
<?php if ($activity_entry?->category): ?>
<ul class="fa-ul">
<?php if ($activity_entry?->present): ?>
<li><span class="fa-li"><i class="fa fa-check"></i></span><ins>Je participe</ins></li>
<?php else: ?>
<li><span class="fa-li"><i class="fa fa-xmark"></i></span><del>
<?= $activity_entry ? "Je ne participe pas" : "Pas inscrit" ?>
</del></li>
<?php endif; ?>
<li><span class="fa-li"><abbr title="Catégorie"><i class="fa fa-person-running"></i></abbr></span>
<?= $activity_entry->category?->name ?>
</li>
</ul>
</div>
<?php if ($activity_entry?->category): ?>
<div class="col-sm-12 col-md-6">
<ul class="fa-ul">
<li><span class="fa-li"><abbr title="Catégorie"><i
class="fa fa-person-running"></i></abbr></span>
<?= $activity_entry->category?->name ?>
</li>
</ul>
</div>
<?php endif ?>
</div>
<?php if ($activity_entry?->comment): ?>
Expand Down
7 changes: 5 additions & 2 deletions routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
Router::add('/evenements/passes', 'pages/events/event_list/past_events');
Router::add('/evenements/nouveau', 'pages/events/event_edit');
Router::add('/evenements/$event_id/modifier', 'pages/events/event_edit');
Router::add('/evenements/$event_id/ajouter-activite', 'pages/events/activity_edit');
Router::add('/evenements/$event_id/activite/$activity_id', 'pages/events/activity_edit');
Router::add('/evenements/$event_id', 'pages/events/event_view');
Router::add('/evenements/$event_id/inscription', 'pages/events/event_register');
Router::add('/evenements/$event_id/publier', 'pages/events/event_publish');
Expand All @@ -49,6 +47,11 @@
Router::add('/evenements/$event_id/participants/tabs', 'pages/events/entry_list/entry_list_tabs');
// Router::add('/download', 'uploads/download_file');

// Activities
Router::add('/evenements/$event_id/activite/$activity_id/modifier', 'pages/events/activity_edit');
Router::add('/evenements/$event_id/ajouter-activite', 'pages/events/activity_edit');
Router::add('/evenements/$event_id/activite/$activity_id', 'pages/events/activity_view');

// Settings
Router::add('/mon-profil', 'pages/settings/settings');
// Settings/users
Expand Down

0 comments on commit 1e88d3d

Please sign in to comment.