mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fixes for page 'mes parcours'
This commit is contained in:
parent
125dd4d980
commit
1a04d903fc
@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
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;
|
||||||
@ -22,9 +23,12 @@ class UserAccompanyingPeriodController extends AbstractController
|
|||||||
|
|
||||||
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
private AccompanyingPeriodRepository $accompanyingPeriodRepository;
|
||||||
|
|
||||||
public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository)
|
private PaginatorFactory $paginatorFactory;
|
||||||
|
|
||||||
|
public function __construct(AccompanyingPeriodRepository $accompanyingPeriodRepository, PaginatorFactory $paginatorFactory)
|
||||||
{
|
{
|
||||||
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
$this->accompanyingPeriodRepository = $accompanyingPeriodRepository;
|
||||||
|
$this->paginatorFactory = $paginatorFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,12 +36,15 @@ class UserAccompanyingPeriodController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function listAction(Request $request)
|
public function listAction(Request $request)
|
||||||
{
|
{
|
||||||
$accompanyingPeriods = [];
|
$total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser()]);
|
||||||
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $this->getUser()]);
|
$pagination = $this->paginatorFactory->create($total);
|
||||||
|
$accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $this->getUser()],
|
||||||
|
['openingDate' => 'DESC'], $pagination->getItemsPerPage(), $pagination->getCurrentPageFirstItemNumber());
|
||||||
|
|
||||||
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,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,6 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
*/
|
*/
|
||||||
public $authorizationChecker;
|
public $authorizationChecker;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var CountNotificationTask
|
|
||||||
*/
|
|
||||||
public $counter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var TokenStorageInterface
|
|
||||||
*/
|
|
||||||
public $tokenStorage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var TranslatorInterface
|
* @var TranslatorInterface
|
||||||
@ -63,4 +54,4 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
{
|
{
|
||||||
return ['user'];
|
return ['user'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository
|
|||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function countBy(array $criteria): int
|
||||||
|
{
|
||||||
|
return $this->repository->count($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
public function findOneBy(array $criteria): ?AccompanyingPeriod
|
public function findOneBy(array $criteria): ?AccompanyingPeriod
|
||||||
{
|
{
|
||||||
return $this->findOneBy($criteria);
|
return $this->findOneBy($criteria);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %}
|
{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %}
|
||||||
|
|
||||||
{% block title %}{{ 'Accompanying period list'|trans }}{% endblock title %}
|
{% block title %}{{ 'My accompanying periods'|trans }}{% endblock title %}
|
||||||
|
|
||||||
{% macro recordAction(period) %}
|
{% macro recordAction(period) %}
|
||||||
<li>
|
<li>
|
||||||
@ -14,12 +14,17 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h1>{{ 'Accompanying period list'|trans }}</h1>
|
<div class="col-md-10">
|
||||||
|
<h1>{{ 'My accompanying periods'|trans }}</h1>
|
||||||
|
|
||||||
|
<div class="flex-table accompanyingcourse-list">
|
||||||
|
{% for period in accompanyingPeriods %}
|
||||||
|
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{ chill_pagination(pagination) }}
|
||||||
|
|
||||||
<div class="flex-table accompanyingcourse-list">
|
|
||||||
{% for period in accompanyingPeriods %}
|
|
||||||
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user