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,43 @@
<?php
namespace App\Controller\Administrative\Questionnaire;
use App\Config\QuestionnaireCatalog;
use App\Controller\Traits\ReturnUrlTrait;
use App\Entity\QuestionnaireResponse;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
/**
* One submitted questionnaire: what the disposition knew when it was submitted, then the answers,
* rendered with the definition version they were given under.
*/
class DetailController extends AbstractController
{
use ReturnUrlTrait;
public function __construct(
private readonly QuestionnaireCatalog $catalog,
) {
}
#[Route('/administrative/questionnaire/{uuid}', name: 'app_administrative_questionnaire_detail')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(QuestionnaireResponse $response, Request $request): Response
{
// a draft is still the teamer's
if (false === $response->isSubmitted()) {
throw new NotFoundHttpException();
}
return $this->render('administrative/questionnaire/detail.html.twig', [
'definition' => $this->catalog->get($response->getQuestionnaire(), $response->getVersion()),
'response' => $response,
'returnUrl' => $this->getReturnUrl($request, 'app_administrative_questionnaire_index'),
]);
}
}