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

@@ -4,14 +4,9 @@ declare(strict_types=1);
namespace App\Tests\Repository;
use App\Config\QuestionnaireCatalog;
use App\Entity\Application;
use App\Entity\Assignment;
use App\Entity\Destination;
use App\Entity\Disposition;
use App\Entity\QuestionnaireResponse;
use App\Entity\Teamer;
use App\Model\Questionnaire\Definition;
use App\Repository\DispositionRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -27,6 +22,8 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
*/
class DispositionRepositoryQuestionnaireTest extends KernelTestCase
{
use QuestionnaireFixturesTrait;
private const string GO_LIVE = '2026-01-01';
private EntityManagerInterface $entityManager;
@@ -138,45 +135,4 @@ class DispositionRepositoryQuestionnaireTest extends KernelTestCase
return $this->repository->findPendingQuestionnaireByTeamer($this->teamer, new \DateTimeImmutable(self::GO_LIVE));
}
private function escort(string $dateTo = 'yesterday', ?Teamer $teamer = null): Disposition
{
$destination = (new Destination())
->setProduct('Davos Klosters - Schwendi')
->setHotel('Schwendi')
->setHotelCode('DKI')
->setHotelBusProId(1)
->setDateFrom(new \DateTimeImmutable($dateTo.' -7 days'))
->setDateTo(new \DateTimeImmutable($dateTo))
->setPickups([['busProId' => 4711, 'city' => 'Stuttgart', 'street' => 'Busbahnhof', 'time' => '21:30']])
;
$assignment = (new Assignment())
->setDestination($destination)
->setPickup(4711)
->setStatus(Assignment::STATUS_STAFFED)
;
$disposition = (new Disposition(new Application($assignment, $teamer ?? $this->teamer)))
->setStatus(Disposition::STATUS_ENDED)
;
$this->entityManager->persist($destination);
$this->entityManager->persist($assignment);
$this->entityManager->persist($disposition);
return $disposition;
}
private function respond(Disposition $disposition, bool $submit, string $questionnaire = QuestionnaireCatalog::TEAMER_ESCORT): void
{
$definition = new Definition($questionnaire, 1, 'Beispiel', null, []);
$response = QuestionnaireResponse::forDisposition($definition, $disposition);
if ($submit) {
$response->submit($definition, [], [], new \DateTimeImmutable());
} else {
$response->saveDraft([], []);
}
$this->entityManager->persist($response);
}
}