update dashboard

This commit is contained in:
Simon Vieille 2022-04-25 11:22:33 +02:00
parent 35408e7e16
commit 1619cadf64
Signed by: deblan
GPG key ID: 579388D585F70417
7 changed files with 140 additions and 3 deletions

View file

@ -7,7 +7,7 @@
</tr>
</thead>
<tr>
<td v-for="item in week" v-bind:class="{'bg-light': !item.currentMonth}">
<td v-for="item, key in week" v-bind:class="{'bg-dash': !item.currentMonth, 'bg-light': item.currentMonth && [5, 6].indexOf(key) > -1}">
<div v-for="event in item.events" class="mb-3">
<details>
<summary>
@ -40,10 +40,20 @@
<style scoped>
td {
height: calc((100vh - 190px) / 8);
height: 40px;
width: calc(100% / 7);
}
.bg-dash {
background: repeating-linear-gradient(
45deg,
#f2f5f8,
#e9ecef 10px,
#e5e8eb 10px,
#dddfe2 20px
);
}
.btn-xs {
font-size: 12px;
padding: 3px 4px;

View file

@ -0,0 +1,42 @@
<?php
namespace App\Controller;
use App\Core\Controller\Dashboard\DashboardAdminController as BaseController;
use App\Repository\ConferenceRepositoryQuery;
use App\Repository\DebriefingRepositoryQuery;
use App\Repository\InterventionRepositoryQuery;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/admin")
*/
class DashboardAdminController extends BaseController
{
protected DebriefingRepositoryQuery $debriefingQuery;
protected ConferenceRepositoryQuery $conferenceQuery;
protected InterventionRepositoryQuery $interventionQuery;
public function __construct(
DebriefingRepositoryQuery $debriefingQuery,
ConferenceRepositoryQuery $conferenceQuery,
InterventionRepositoryQuery $interventionQuery
) {
$this->debriefingQuery = $debriefingQuery;
$this->conferenceQuery = $conferenceQuery;
$this->interventionQuery = $interventionQuery;
}
/**
* @Route("/", name="admin_custom_dashboard_index")
*/
public function index(): Response
{
return $this->render('@Core/dashboard/index.html.twig', [
'conferences' => $this->conferenceQuery->create()->latest()->find(),
'debriefings' => $this->debriefingQuery->create()->latest()->find(),
'interventions' => $this->interventionQuery->create()->latest()->find(),
]);
}
}

View file

@ -34,4 +34,12 @@ class ConferenceRepositoryQuery extends RepositoryQuery
return $this->withThemeType($value);
}
}
public function latest(int $max = 5)
{
return $this
->addOrderBy('.date', 'DESC')
->setMaxResults($max)
;
}
}

View file

@ -12,4 +12,12 @@ class DebriefingRepositoryQuery extends RepositoryQuery
{
parent::__construct($repository, 'd', $paginator);
}
public function latest(int $max = 5)
{
return $this
->addOrderBy('.date', 'DESC')
->setMaxResults($max)
;
}
}

View file

@ -22,4 +22,12 @@ class InterventionRepositoryQuery extends RepositoryQuery
;
}
}
public function latest(int $max = 5)
{
return $this
->addOrderBy('.date', 'DESC')
->setMaxResults($max)
;
}
}

View file

@ -15,7 +15,7 @@
route: path('admin_establishment_index'),
icon: 'fa fa-building'
}) }}
{{ include('@Core/admin/module/_menu_item.html.twig', {
id: 'theme_type',
label: 'Types de thématiques',

View file

@ -7,5 +7,66 @@
<div id="calendar"></div>
</div>
</div>
<div class="col-md-4">
<div class="p-3">
<div class="list-group">
<div class="list-group-item list-group-item-info">
<span class="fa fa-users"></span>
Dernières interventions
</div>
{% for entity in interventions %}
<a href="{{ safe_path('admin_intervention_show', {entity: entity.id}) }}" class="list-group-item list-group-item-action">
{% for item in entity.speakers %}
<span class="btn btn-sm btn-{{ item.color }} mr-2">{{ item.name }}</span>
{% endfor %}
{% for item in entity.establishments %}
<span class="btn btn-sm btn-light border mr-2">{{ item.name }}</span>
{% endfor %}
<span class="float-right btn btn-sm btn-primary">
{{ entity.date|date('d/m/Y') }}
</span>
</a>
{% endfor %}
</div>
</div>
</div>
<div class="col-md-4">
<div class="p-3">
<div class="list-group">
<div class="list-group-item list-group-item-info">
<span class="fa fa-users"></span>
Dernières conférences
</div>
{% for entity in conferences %}
<a href="{{ safe_path('admin_conference_show', {entity: entity.id}) }}" class="list-group-item list-group-item-action">
{{ entity.label }}
</a>
{% endfor %}
</div>
</div>
</div>
<div class="col-md-4">
<div class="p-3">
<div class="list-group">
<div class="list-group-item list-group-item-info">
<span class="fa fa-list-alt"></span>
Derniers comptes-rendus
</div>
{% for entity in debriefings %}
<a href="{{ safe_path('admin_debriefing_show', {entity: entity.id}) }}" class="list-group-item list-group-item-action">
{{ entity.topic }}
</a>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}