feat: persist and sort by viewed by admins status of teamers

This commit is contained in:
Björn Fromme
2024-06-23 17:28:15 +02:00
parent 8d8d6dacd3
commit b58bd9f34f
5 changed files with 72 additions and 7 deletions
@@ -25,20 +25,17 @@ class IndexController extends AbstractController
public function index(Request $request): Response
{
$filterDto = $this->filterHandler->getFilterSettings();
$requestedSorting = $request->query->get('sort');
$query = $this
->teamerRepository
->getListQuery($filterDto)
->getListQuery($filterDto, $requestedSorting)
;
$pagination = $this->paginator->paginate(
$query,
$request->query->getInt('page', 1),
10,
[
'defaultSortFieldName' => 'teamer.lastName',
'defaultSortDirection' => 'asc',
]
10
);
return $this->render('administrative/teamer/index.html.twig', [
@@ -4,6 +4,7 @@ namespace App\Controller\Administrative\Teamer;
use App\Controller\Traits\ReturnUrlTrait;
use App\Entity\Teamer;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -14,10 +15,19 @@ class ProfileController extends AbstractController
{
use ReturnUrlTrait;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
#[Route('/administrative/teamer/profile/{uuid}', name: 'app_administrative_teamer_profile')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Teamer $teamer, Request $request): Response
{
if (false === $teamer->isViewed()) {
$teamer->setViewed(true);
$this->entityManager->flush();
}
$returnUrl = $this->getReturnUrl($request, 'app_administrative_teamer_index');
return $this->render('administrative/teamer/profile.html.twig', [