mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-11 02:09:50 +00:00
Merge branch '111-list-my-acc-period-incomplete' into 'master'
fix list of "my accompanying periods" Closes #111 See merge request Chill-Projet/chill-bundles!557
This commit is contained in:
commit
eb41293c96
6
.changes/unreleased/Fixed-20230606-143955.yaml
Normal file
6
.changes/unreleased/Fixed-20230606-143955.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: 'List of "my accompanying periods": separate the active and closed periods in
|
||||||
|
two different lists, and show the inactive_long and inactive_short periods'
|
||||||
|
time: 2023-06-06T14:39:55.68417576+02:00
|
||||||
|
custom:
|
||||||
|
Issue: "111"
|
@ -12,9 +12,11 @@ declare(strict_types=1);
|
|||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
class UserAccompanyingPeriodController extends AbstractController
|
class UserAccompanyingPeriodController extends AbstractController
|
||||||
@ -32,12 +34,24 @@ class UserAccompanyingPeriodController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user")
|
* @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user")
|
||||||
*/
|
*/
|
||||||
public function listAction(Request $request)
|
public function listAction(Request $request): Response
|
||||||
{
|
{
|
||||||
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => ['CONFIRMED', 'CLOSED']]);
|
$active = $request->query->getBoolean('active', true);
|
||||||
|
$steps = match ($active) {
|
||||||
|
true => [
|
||||||
|
AccompanyingPeriod::STEP_CONFIRMED,
|
||||||
|
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG,
|
||||||
|
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT,
|
||||||
|
],
|
||||||
|
false => [
|
||||||
|
AccompanyingPeriod::STEP_CLOSED,
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => $steps]);
|
||||||
$pagination = $this->paginatorFactory->create($total);
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(
|
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(
|
||||||
['user' => $this->getUser(), 'step' => ['CONFIRMED', 'CLOSED']],
|
['user' => $this->getUser(), 'step' => $steps],
|
||||||
['openingDate' => 'DESC'],
|
['openingDate' => 'DESC'],
|
||||||
$pagination->getItemsPerPage(),
|
$pagination->getItemsPerPage(),
|
||||||
$pagination->getCurrentPageFirstItemNumber()
|
$pagination->getCurrentPageFirstItemNumber()
|
||||||
@ -46,13 +60,14 @@ class UserAccompanyingPeriodController extends AbstractController
|
|||||||
return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [
|
||||||
'accompanyingPeriods' => $accompanyingPeriods,
|
'accompanyingPeriods' => $accompanyingPeriods,
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
|
'active' => $active,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{_locale}/person/accompanying-periods/my/drafts", name="chill_person_accompanying_period_draft_user")
|
* @Route("/{_locale}/person/accompanying-periods/my/drafts", name="chill_person_accompanying_period_draft_user")
|
||||||
*/
|
*/
|
||||||
public function listDraftsAction(Request $request)
|
public function listDraftsAction(): Response
|
||||||
{
|
{
|
||||||
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']);
|
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']);
|
||||||
$pagination = $this->paginatorFactory->create($total);
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
|
@ -17,6 +17,15 @@
|
|||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<h1>{{ 'My accompanying periods'|trans }}</h1>
|
<h1>{{ 'My accompanying periods'|trans }}</h1>
|
||||||
|
|
||||||
|
<ul class="nav nav-pills justify-content-center">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link {% if active == true %}active{% endif %}" aria-current="page" href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': true}) }}">{{ ['Confirmed'|trans, 'course.inactive_short'|trans, 'course.inactive_long'|trans]|join(', ') }}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item ">
|
||||||
|
<a class="nav-link {% if active == false %}active{% endif %}" href="{{ chill_path_forward_return_path('chill_person_accompanying_period_user', {'active': false}) }}">{{ 'course.closed'|trans }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<p>{{ 'Number of periods'|trans }}: <span class="badge rounded-pill bg-primary">{{ pagination.totalItems }}</span></p>
|
<p>{{ 'Number of periods'|trans }}: <span class="badge rounded-pill bg-primary">{{ pagination.totalItems }}</span></p>
|
||||||
|
|
||||||
<div class="flex-table accompanyingcourse-list">
|
<div class="flex-table accompanyingcourse-list">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user