feat: list and show submitted questionnaires to the office

This commit is contained in:
fromme committed 2026-10-27 17:02:51 +01:00
1 parent 890e04f8a6
commit a35f91ac63
15 files changed
+715 -46

No files matched your search

@@ -0,0 +1,51 @@
<?php
namespace App\Controller\Administrative\Questionnaire;
use App\Config\QuestionnaireCatalog;
use App\Repository\QuestionnaireResponseRepository;
use App\Service\Common\QuestionnaireResponseFilterHandler;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
/**
* The submitted teamer questionnaires. Only administrative users read them: they rate the house
* manager among others, so house managers are deliberately not let in.
*/
class IndexController extends AbstractController
{
public function __construct(
private readonly QuestionnaireResponseFilterHandler $filterHandler,
private readonly QuestionnaireResponseRepository $responseRepository,
private readonly QuestionnaireCatalog $catalog,
private readonly PaginatorInterface $paginator,
) {
}
#[Route('/administrative/questionnaire', name: 'app_administrative_questionnaire_index')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Request $request): Response
{
$filterDto = $this->filterHandler->getFilterSettings();
$pagination = $this->paginator->paginate(
$this->responseRepository->getListQuery(QuestionnaireCatalog::TEAMER_ESCORT, $filterDto),
$request->query->getInt('page', 1),
$request->query->getInt('limit', 50),
[
'defaultSortFieldName' => 'response.submittedAt',
'defaultSortDirection' => 'desc',
]
);
return $this->render('administrative/questionnaire/index.html.twig', [
'definition' => $this->catalog->get(QuestionnaireCatalog::TEAMER_ESCORT),
'pagination' => $pagination,
'filterDto' => $filterDto,
]);
}
}