fix: offer the questionnaire after every placement, the bus part to escorts
This commit is contained in:
1 parent
9fedc5b5d3
commit
2f4f9800dd
30 files changed
+311
-77
No files matched your search
@@ -33,7 +33,7 @@ class IndexController extends AbstractController
|
||||
$filterDto = $this->filterHandler->getFilterSettings();
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
$this->responseRepository->getListQuery(QuestionnaireCatalog::TEAMER_ESCORT, $filterDto),
|
||||
$this->responseRepository->getListQuery(QuestionnaireCatalog::TEAMER_ASSIGNMENT, $filterDto),
|
||||
$request->query->getInt('page', 1),
|
||||
$request->query->getInt('limit', 50),
|
||||
[
|
||||
@@ -43,7 +43,7 @@ class IndexController extends AbstractController
|
||||
);
|
||||
|
||||
return $this->render('administrative/questionnaire/index.html.twig', [
|
||||
'definition' => $this->catalog->get(QuestionnaireCatalog::TEAMER_ESCORT),
|
||||
'definition' => $this->catalog->get(QuestionnaireCatalog::TEAMER_ASSIGNMENT),
|
||||
'pagination' => $pagination,
|
||||
'filterDto' => $filterDto,
|
||||
]);
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Controller\Administrative\Questionnaire;
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\Assignment;
|
||||
use App\Enum\QuestionnaireFlag;
|
||||
use App\Form\QuestionnaireType;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -14,9 +15,10 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The teamer questionnaire as a teamer gets it, for trying out on any assignment - with or without
|
||||
* bus escort, before or after the trip, placed or not. Nothing is saved: "Absenden" shows the
|
||||
* answers as they would be stored, "Entwurf speichern" just keeps them in the form.
|
||||
* The teamer questionnaire as a teamer gets it, for trying out on any assignment - before or after
|
||||
* the trip, placed or not. It shows the assignment's own variant, with or without the bus
|
||||
* sections; ?bus_escort=1 or 0 tries the other one. Nothing is saved: "Absenden" shows the answers
|
||||
* as they would be stored, "Entwurf speichern" just keeps them in the form.
|
||||
*/
|
||||
class TestController extends AbstractController
|
||||
{
|
||||
@@ -34,7 +36,13 @@ class TestController extends AbstractController
|
||||
Assignment $assignment,
|
||||
Request $request,
|
||||
): Response {
|
||||
$definition = $this->catalog->get(QuestionnaireCatalog::TEAMER_ESCORT);
|
||||
$busEscort = $request->query->has('bus_escort')
|
||||
? $request->query->getBoolean('bus_escort')
|
||||
: $assignment->hasBusEscort();
|
||||
$definition = $this->catalog
|
||||
->get(QuestionnaireCatalog::TEAMER_ASSIGNMENT)
|
||||
->forFlags($busEscort ? [QuestionnaireFlag::BUS_ESCORT] : [])
|
||||
;
|
||||
|
||||
$form = $this->createForm(QuestionnaireType::class, [], ['definition' => $definition]);
|
||||
$form->handleRequest($request);
|
||||
@@ -56,6 +64,7 @@ class TestController extends AbstractController
|
||||
'form' => $form,
|
||||
'submitted' => $submitted,
|
||||
'draft' => $draft,
|
||||
'busEscort' => $busEscort,
|
||||
'returnUrl' => $this->getReturnUrl($request, 'app_administrative_assignment_detail', ['uuid' => $assignment->getUuid()]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class DetailController extends AbstractController
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
Disposition $disposition,
|
||||
): Response {
|
||||
$response = $this->responseRepository->findOneByDisposition(QuestionnaireCatalog::TEAMER_ESCORT, $disposition);
|
||||
$response = $this->responseRepository->findOneByDisposition(QuestionnaireCatalog::TEAMER_ASSIGNMENT, $disposition);
|
||||
|
||||
if (true !== $response?->isSubmitted()) {
|
||||
return $this->redirectToRoute('app_teamer_questionnaire_edit', ['uuid' => $disposition->getUuid()]);
|
||||
|
||||
@@ -18,8 +18,9 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The teamer's questionnaire after a bus escort, saved as a draft until it is submitted. A
|
||||
* submitted one is final and only shown read-only (DetailController).
|
||||
* The teamer's questionnaire after a placement - with the bus sections if it was a bus escort -
|
||||
* saved as a draft until it is submitted. A submitted one is final and only shown read-only
|
||||
* (DetailController).
|
||||
*/
|
||||
class EditController extends AbstractController
|
||||
{
|
||||
@@ -39,13 +40,16 @@ class EditController extends AbstractController
|
||||
Disposition $disposition,
|
||||
Request $request,
|
||||
): Response {
|
||||
$response = $this->responseRepository->findOneByDisposition(QuestionnaireCatalog::TEAMER_ESCORT, $disposition);
|
||||
$response = $this->responseRepository->findOneByDisposition(QuestionnaireCatalog::TEAMER_ASSIGNMENT, $disposition);
|
||||
|
||||
if (true === $response?->isSubmitted()) {
|
||||
return $this->redirectToRoute('app_teamer_questionnaire_detail', ['uuid' => $disposition->getUuid()]);
|
||||
}
|
||||
|
||||
$definition = $this->catalog->get(QuestionnaireCatalog::TEAMER_ESCORT);
|
||||
$definition = $this->catalog
|
||||
->get(QuestionnaireCatalog::TEAMER_ASSIGNMENT)
|
||||
->forFlags(DispositionContext::flags($disposition->getAssignment()))
|
||||
;
|
||||
|
||||
$form = $this->createForm(QuestionnaireType::class, $response?->getAnswers() ?? [], [
|
||||
'definition' => $definition,
|
||||
|
||||
Reference in new issue
Block a user