Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.

Commit 6c59a6f

Browse files
committed
Front: Display todolist on homepage
1 parent a15ac5d commit 6c59a6f

File tree

2 files changed

+38
-13
lines changed

2 files changed

+38
-13
lines changed

src/Controller/DossierController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace App\Controller;
33

4-
use App\Entity\Dossier;
54
use App\Entity\Enum\DossierStatusEnum;
6-
use App\Repository\DossierRepository;
5+
use App\Entity\Main\Dossier;
6+
use App\Repository\Main\DossierRepository;
7+
use App\Repository\Second\TodolistRepository;
78
use Knp\Component\Pager\PaginatorInterface;
89
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
910
use Symfony\Component\HttpFoundation\{Request, Response};
@@ -16,13 +17,15 @@ public function __construct(private DossierRepository $dossierRepository)
1617
}
1718

1819
#[Route('/', name: 'dossierList', methods: [Request::METHOD_GET])]
19-
public function dossierList(Request $request, PaginatorInterface $paginator): Response
20+
public function dossierList(Request $request, PaginatorInterface $paginator, TodolistRepository $todolistRepository): Response
2021
{
2122
$query = $this->dossierRepository->findByStatus(DossierStatusEnum::ACTIVE);
2223
$dossierList = $paginator->paginate($query, $request->query->getInt('page', 1), 6);
24+
$todolist = $todolistRepository->findBy([], ['lastUpdate' => 'DESC'], 5);
2325

2426
return $this->render('dossierList.html.twig', [
2527
'dossierList' => $dossierList,
28+
'todolist' => $todolist,
2629
]);
2730
}
2831

templates/dossierList.html.twig

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,39 @@
22
{% set title = 'Dossier active List' %}
33

44
{% block body %}
5-
{% for dossier in dossierList %}
6-
<div>
7-
<p>
8-
Title: {{ dossier.title }}, client: {{ dossier.client.name }}.<br>
9-
Date: {{ dossier.createdDate|date('d/m/Y') }}<br>
10-
<a href="{{ path('dossierItem', {'id': dossier.id}) }}">Consult dossier</a>
11-
</p>
5+
<div class="container">
6+
<div class="row">
7+
<div class="col">
8+
{% for dossier in dossierList %}
9+
<p>
10+
Title: {{ dossier.title }}, client: {{ dossier.client.name }}.<br>
11+
Date: {{ dossier.createdDate|date('d/m/Y') }}<br>
12+
<a href="{{ path('dossierItem', {'id': dossier.id}) }}">Consult dossier</a>
13+
</p>
14+
{% else %}
15+
<p>No dossiers.</p>
16+
{% endfor %}
17+
</div>
18+
<div class="col list-group">
19+
<h3>Last Todolist</h3>
20+
<p><em>Stored in another database.</em></p>
21+
22+
{% for todo in todolist %}
23+
<label class="list-group-item d-flex gap-3">
24+
<input class="form-check-input flex-shrink-0" type="checkbox" value="" checked="" style="font-size: 1.375em;">
25+
<span class="pt-1 form-checked-content">
26+
<strong>Title: {{ todo.title }}</strong>
27+
<small class="d-block text-body-secondary">{{ todo.description }}</small>
28+
</span>
29+
</label>
30+
{% else %}
31+
<p>No list.</p>
32+
{% endfor %}
33+
34+
</div>
1235
</div>
13-
{% else %}
14-
<p>No dossiers.</p>
15-
{% endfor %}
36+
</div>
37+
1638

1739
<div class="navigation">
1840
{{ knp_pagination_render(dossierList) }}

0 commit comments

Comments
 (0)