Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
920b09dacc | ||
|
|
b5f1163e2d | ||
|
|
8271a69f45 | ||
|
|
f00351706e | ||
|
|
a5d97f1206 | ||
|
|
582e54ddc4 | ||
|
|
adee913568 | ||
|
|
396aa0bac6 | ||
|
|
77de1643f0 |
No files matched your search
@@ -2,7 +2,7 @@ import {Controller} from '@hotwired/stimulus'
|
||||
|
||||
export default class extends Controller {
|
||||
static classes = ['closed', 'open', 'iconOpen']
|
||||
static targets = ['content', 'icon', 'container']
|
||||
static targets = ['content', 'icon', 'container', 'trigger']
|
||||
static values = {
|
||||
open: {
|
||||
type: Boolean,
|
||||
@@ -43,6 +43,10 @@ export default class extends Controller {
|
||||
this.iconTarget.classList.toggle(iconClass, true === open)
|
||||
}
|
||||
|
||||
if (this.hasTriggerTarget) {
|
||||
this.triggerTarget.setAttribute('aria-expanded', String(open))
|
||||
}
|
||||
|
||||
// Toggle class on container element (or controller element) if specified
|
||||
if (this.hasOpenClass) {
|
||||
const container = this.hasContainerTarget ? this.containerTarget : this.element
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<symbol id="icon-download" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3" /></symbol>
|
||||
<symbol id="icon-sort" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" /></symbol>
|
||||
<symbol id="icon-arrow-left" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 12h-15m0 0l6.75 6.75M4.5 12l6.75-6.75" /></symbol>
|
||||
<symbol id="icon-chevron-down" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /></symbol>
|
||||
<symbol id="icon-arrow-right" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12h15m0 0l-6.75-6.75M19.5 12l-6.75 6.75" /></symbol>
|
||||
<symbol id="icon-document" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" /></symbol>
|
||||
<symbol id="icon-filter" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z" /></symbol>
|
||||
|
||||
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
@@ -0,0 +1,7 @@
|
||||
@layer utilities {
|
||||
/* Reserve the scrollbar gutter so content does not shift width when a
|
||||
scrollbar appears (e.g. when a collapsible section is opened). */
|
||||
.scroll-stable {
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,5 @@
|
||||
@import "tailwindcss/components";
|
||||
@import "_components.css";
|
||||
|
||||
@import "tailwindcss/utilities";
|
||||
@import "tailwindcss/utilities";
|
||||
@import "_utilities.css";
|
||||
Generated
+21
-21
@@ -2193,16 +2193,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem-bundle",
|
||||
"version": "3.7.0",
|
||||
"version": "3.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem-bundle.git",
|
||||
"reference": "5eb41be38fc3759f74c9e458a6a5f0ef5f49284a"
|
||||
"reference": "9cccb6862c9fcd16e6d8a0fbd62254abb8017c99"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem-bundle/zipball/5eb41be38fc3759f74c9e458a6a5f0ef5f49284a",
|
||||
"reference": "5eb41be38fc3759f74c9e458a6a5f0ef5f49284a",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem-bundle/zipball/9cccb6862c9fcd16e6d8a0fbd62254abb8017c99",
|
||||
"reference": "9cccb6862c9fcd16e6d8a0fbd62254abb8017c99",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2257,9 +2257,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/thephpleague/flysystem-bundle/issues",
|
||||
"source": "https://github.com/thephpleague/flysystem-bundle/tree/3.7.0"
|
||||
"source": "https://github.com/thephpleague/flysystem-bundle/tree/3.7.1"
|
||||
},
|
||||
"time": "2026-03-28T22:14:56+00:00"
|
||||
"time": "2026-08-10T15:55:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem-local",
|
||||
@@ -11728,20 +11728,20 @@
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.13.4",
|
||||
"version": "1.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
|
||||
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
|
||||
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
"php": "^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.6.8",
|
||||
@@ -11776,15 +11776,15 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/myclabs/DeepCopy/issues",
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
|
||||
"source": "https://github.com/myclabs/DeepCopy/tree/1.14.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
|
||||
"type": "tidelift"
|
||||
"url": "https://github.com/mnapoli",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-08-01T08:46:24+00:00"
|
||||
"time": "2026-08-11T10:17:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
@@ -13118,16 +13118,16 @@
|
||||
},
|
||||
{
|
||||
"name": "rector/rector",
|
||||
"version": "2.6.1",
|
||||
"version": "2.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rectorphp/rector.git",
|
||||
"reference": "b8e68f058bca43e01a2e1caa51ef022d6551ed95"
|
||||
"reference": "03cd615cdd5648abb5f10ff3a684fdb976687190"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/b8e68f058bca43e01a2e1caa51ef022d6551ed95",
|
||||
"reference": "b8e68f058bca43e01a2e1caa51ef022d6551ed95",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/03cd615cdd5648abb5f10ff3a684fdb976687190",
|
||||
"reference": "03cd615cdd5648abb5f10ff3a684fdb976687190",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -13166,7 +13166,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/rectorphp/rector/issues",
|
||||
"source": "https://github.com/rectorphp/rector/tree/2.6.1"
|
||||
"source": "https://github.com/rectorphp/rector/tree/2.6.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -13174,7 +13174,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-08-03T17:30:34+00:00"
|
||||
"time": "2026-08-12T06:23:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
|
||||
@@ -17,9 +17,10 @@ security:
|
||||
roles: [ ROLE_MAILJET_WEBHOOK ]
|
||||
|
||||
role_hierarchy:
|
||||
ROLE_ADMIN:
|
||||
- ROLE_GROUPS_ADMIN
|
||||
ROLE_GROUPS_ADMIN:
|
||||
- ROLE_GROUPS_MANAGER
|
||||
-
|
||||
firewalls:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260817090000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Store the BusPro first and last name on the user';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// Left empty on purpose: the names are synced from BPN on the next login of each account.
|
||||
$this->addSql('ALTER TABLE user ADD first_name VARCHAR(100) DEFAULT NULL, ADD last_name VARCHAR(100) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE user DROP first_name, DROP last_name');
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,13 @@ class PersonalDataController extends AbstractController
|
||||
|
||||
// Update profile completeness flag on user entity
|
||||
$isComplete = $this->completenessChecker->isComplete($personalData);
|
||||
$user->setProfileComplete($isComplete);
|
||||
$user
|
||||
->setProfileComplete($isComplete)
|
||||
// Otherwise a rename here would stay invisible in the backend until the next
|
||||
// login, which is the only other place the name is synced from BPN.
|
||||
->setFirstName($personalData->firstName)
|
||||
->setLastName($personalData->name)
|
||||
;
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Deine persönlichen Daten wurden aktualisiert');
|
||||
|
||||
@@ -35,6 +35,14 @@ class SendAccessLinkController extends AbstractController
|
||||
throw $this->createAccessDeniedException('Invalid CSRF token.');
|
||||
}
|
||||
|
||||
// Older bookings can still be missing their contact data. Sending would be
|
||||
// silently skipped further down, so say so instead of reporting success.
|
||||
if (null === $booking->getEmail() || '' === trim($booking->getEmail())) {
|
||||
$this->addFlash('error', 'Für diese Buchung ist keine E-Mail-Adresse hinterlegt. Bitte ergänze sie, um den Zugangslink zu senden.');
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_admin_accommodationbooking_edit', ['id' => $booking->getId()]));
|
||||
}
|
||||
|
||||
$this->bookingService->sendCustomerConfirmationEmail($booking);
|
||||
|
||||
$this->addFlash('success', 'Der Zugangslink wurde dem Kunden per E-Mail zugestellt.');
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Controller\Groups;
|
||||
|
||||
use App\Entity\Groups\AccommodationBooking;
|
||||
use App\Form\Model\OfferAcceptDto;
|
||||
use App\Form\OfferAcceptConfirmationType;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Model\AccommodationBookingContext;
|
||||
@@ -97,13 +98,16 @@ class OfferController extends AbstractController
|
||||
return $this->redirectToOfferPage($request, $uuid);
|
||||
}
|
||||
|
||||
$confirmationForm = $this->createForm(OfferAcceptConfirmationType::class, null, [
|
||||
$dto = new OfferAcceptDto(remarks: $booking->getRemarks());
|
||||
$confirmationForm = $this->createForm(OfferAcceptConfirmationType::class, $dto, [
|
||||
'terms_url' => $this->termsUrlProvider->forAccommodation($booking->getAccommodation()),
|
||||
]);
|
||||
$confirmationForm->handleRequest($request);
|
||||
|
||||
if ($confirmationForm->isSubmitted() && $confirmationForm->isValid()) {
|
||||
$this->bookingService->acceptBooking($booking);
|
||||
// The textarea is prefilled, so the submitted value is the complete remark —
|
||||
// an emptied field arrives as null and must clear the stored one, not keep it.
|
||||
$this->bookingService->acceptBooking($booking, $dto->remarks ?? '');
|
||||
$this->addFlash('success', 'Deine Buchung ist bestätigt.');
|
||||
|
||||
return $this->redirectToOfferPage($request, $uuid);
|
||||
|
||||
@@ -109,9 +109,15 @@ class AccommodationBooking implements BlameableEntityInterface, TimestampableEnt
|
||||
#[Assert\NotBlank(groups: ['edit'])]
|
||||
private ?string $lastName = null;
|
||||
|
||||
/**
|
||||
* The `offer` group covers the one field a customer-facing booking cannot do without:
|
||||
* the access link and every notification are addressed to it. It is enforced on
|
||||
* creation as soon as the booking is not a draft, while `edit` additionally demands
|
||||
* the rest of the contact data.
|
||||
*/
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
#[Assert\NotBlank(groups: ['edit'])]
|
||||
#[Assert\Email(groups: ['edit'])]
|
||||
#[Assert\NotBlank(groups: ['edit', 'offer'])]
|
||||
#[Assert\Email(groups: ['edit', 'offer'])]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(length: 50, nullable: true)]
|
||||
|
||||
@@ -27,6 +27,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
#[ORM\Column(type: 'integer', nullable: true)]
|
||||
private ?int $addressId = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 100, nullable: true)]
|
||||
private ?string $firstName = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 100, nullable: true)]
|
||||
private ?string $lastName = null;
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
@@ -91,6 +97,46 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFirstName(): ?string
|
||||
{
|
||||
return $this->firstName;
|
||||
}
|
||||
|
||||
public function setFirstName(?string $firstName): static
|
||||
{
|
||||
$this->firstName = $firstName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastName(): ?string
|
||||
{
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
public function setLastName(?string $lastName): static
|
||||
{
|
||||
$this->lastName = $lastName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFullName(): ?string
|
||||
{
|
||||
$fullName = trim(sprintf('%s %s', $this->firstName, $this->lastName));
|
||||
|
||||
return '' !== $fullName ? $fullName : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name to identify this account by in the UI. BusPro only fills the name in on login, so
|
||||
* accounts that have not signed in since the columns were added fall back to their e-mail.
|
||||
*/
|
||||
public function getDisplayName(): string
|
||||
{
|
||||
return $this->getFullName() ?? (string) $this->email;
|
||||
}
|
||||
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return base64_decode($this->password);
|
||||
|
||||
@@ -4,9 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\EventListener;
|
||||
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use App\Security\DefaultRouteResolver;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
@@ -19,12 +22,17 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
* anonymous users, or "Access denied" for authenticated users. Clears target
|
||||
* path for authenticated denials to prevent redirect loops. OAuth2 routes are
|
||||
* logged but allowed to pass through without modification.
|
||||
*
|
||||
* Authenticated users are redirected to their default route, where the flash
|
||||
* message is shown. Anonymous users keep falling through to the firewall entry
|
||||
* point, which sends them to the login form and preserves the target path.
|
||||
*/
|
||||
class AccessDeniedListener implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly Security $security,
|
||||
private readonly LoggerInterface $authLogger,
|
||||
private readonly DefaultRouteResolver $defaultRouteResolver,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -58,16 +66,33 @@ class AccessDeniedListener implements EventSubscriberInterface
|
||||
/** @var Session $session */
|
||||
$session = $request->getSession();
|
||||
|
||||
if (null === $this->security->getUser()) {
|
||||
$session->getFlashBag()->add('info', 'Bitte melde dich an.');
|
||||
} else {
|
||||
$session->getFlashBag()->add('error', 'Zugriff verweigert');
|
||||
// Unset potentially set target path to avoid access denied errors
|
||||
$session->remove('_security.main.target_path');
|
||||
}
|
||||
|
||||
$this->authLogger->warning('Access denied', [
|
||||
'uri' => $request->getRequestUri(),
|
||||
]);
|
||||
|
||||
if (null === $this->security->getUser()) {
|
||||
$session->getFlashBag()->add('info', 'Bitte melde dich an.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$session->getFlashBag()->add('error', 'Zugriff verweigert');
|
||||
// Unset potentially set target path to avoid access denied errors
|
||||
$session->remove('_security.main.target_path');
|
||||
|
||||
$url = $this->defaultRouteResolver->resolveUrl();
|
||||
|
||||
// The default route denied access itself, redirecting there would loop
|
||||
if ($url === $request->getPathInfo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$event->setResponse(
|
||||
$request->headers->has('HX-Request')
|
||||
? new HxRedirectResponse($url)
|
||||
: new RedirectResponse($url)
|
||||
);
|
||||
// HxRedirectResponse carries a 200; without this the kernel turns it into a 500
|
||||
$event->allowCustomResponseCode();
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ final readonly class AccommodationBookingFilterOptionsProvider
|
||||
$managers[(int) $manager->getId()] = $manager;
|
||||
}
|
||||
|
||||
uasort($managers, static fn (User $a, User $b) => strcasecmp((string) $a->getEmail(), (string) $b->getEmail()));
|
||||
uasort($managers, static fn (User $a, User $b) => strcasecmp($a->getDisplayName(), $b->getDisplayName()));
|
||||
|
||||
return array_values($managers);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class AccommodationBookingFilterType extends AbstractListFilterType
|
||||
'label' => 'Betreuer:in',
|
||||
'class' => User::class,
|
||||
'choices' => $options['managers'],
|
||||
'choice_label' => 'email',
|
||||
'choice_label' => 'displayName',
|
||||
'placeholder' => 'alle',
|
||||
'required' => false,
|
||||
]];
|
||||
|
||||
@@ -10,9 +10,11 @@ use App\Enum\Groups\AccommodationBookingStatus;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
@@ -57,6 +59,13 @@ class AccommodationBookingCreateType extends AbstractType
|
||||
],
|
||||
'choice_label' => fn (AccommodationBookingStatus $status) => $status->label(),
|
||||
])
|
||||
// Not marked required in HTML: a draft may be saved without it, and the
|
||||
// validation group below enforces it for everything else.
|
||||
->add('email', EmailType::class, [
|
||||
'label' => 'E-Mail',
|
||||
'required' => false,
|
||||
'help' => 'Für ein Angebot erforderlich — der Zugangslink und alle Benachrichtigungen gehen an diese Adresse.',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
@@ -64,6 +73,15 @@ class AccommodationBookingCreateType extends AbstractType
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => AccommodationBooking::class,
|
||||
// A draft is a scratch record, but anything the customer can be pointed at
|
||||
// needs a reachable address — see the `offer` group on the entity. The rest of
|
||||
// the contact data is collected on the edit page, which validates `edit`.
|
||||
'validation_groups' => static function (FormInterface $form): array {
|
||||
/** @var AccommodationBooking $booking */
|
||||
$booking = $form->getData();
|
||||
|
||||
return $booking->isDraft() ? ['Default'] : ['Default', 'offer'];
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class AccommodationBookingType extends AbstractType
|
||||
'class' => User::class,
|
||||
'required' => false,
|
||||
'choices' => $options['assignable_managers'],
|
||||
'choice_label' => 'email',
|
||||
'choice_label' => 'displayName',
|
||||
'placeholder' => 'keine Zuordnung',
|
||||
'label' => 'Bearbeiter:in',
|
||||
]);
|
||||
|
||||
@@ -81,7 +81,7 @@ class AccommodationBookingFilterDto extends AbstractListFilterDto
|
||||
} elseif (null !== $this->managedBy) {
|
||||
$chips[] = new ListFilterChip(
|
||||
'Betreuer:in',
|
||||
(string) $this->managedBy->getEmail(),
|
||||
$this->managedBy->getDisplayName(),
|
||||
$this->managedByLocked ? [] : ['managedBy'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Carries what the offer acceptance modal submits: the AGB confirmation and an
|
||||
* optional remark. `remarks` is prefilled from the booking, so whatever comes back
|
||||
* is the full value the customer wants stored — an emptied textarea means "clear it".
|
||||
*/
|
||||
class OfferAcceptDto
|
||||
{
|
||||
public function __construct(
|
||||
#[Assert\IsTrue(message: 'Bitte akzeptiere die AGB, um die Buchung abzuschließen.')]
|
||||
public bool $termsAccepted = false,
|
||||
#[Assert\Length(max: 2000, maxMessage: 'Die Anmerkungen dürfen maximal {{ limit }} Zeichen lang sein.')]
|
||||
public ?string $remarks = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Form\Model\OfferAcceptDto;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\IsTrue;
|
||||
|
||||
/**
|
||||
* @extends AbstractType<null>
|
||||
* @extends AbstractType<OfferAcceptDto>
|
||||
*/
|
||||
class OfferAcceptConfirmationType extends AbstractType
|
||||
{
|
||||
@@ -22,19 +23,28 @@ class OfferAcceptConfirmationType extends AbstractType
|
||||
htmlspecialchars($options['terms_url'], ENT_QUOTES, 'UTF-8')
|
||||
);
|
||||
|
||||
$builder->add('termsAccepted', CheckboxType::class, [
|
||||
'label' => sprintf('Ich habe die %s gelesen und bin damit einverstanden, dass eine kostenpflichtige Buchung zustande kommt.', $termsLink),
|
||||
'label_html' => true,
|
||||
'mapped' => false,
|
||||
'required' => true,
|
||||
'constraints' => [
|
||||
new IsTrue(message: 'Bitte akzeptiere die AGB, um die Buchung abzuschließen.'),
|
||||
],
|
||||
]);
|
||||
$builder
|
||||
->add('remarks', TextareaType::class, [
|
||||
'label' => 'Anmerkungen (optional)',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'rows' => 4,
|
||||
'maxlength' => 2000,
|
||||
],
|
||||
])
|
||||
->add('termsAccepted', CheckboxType::class, [
|
||||
'label' => sprintf('Ich habe die %s gelesen und bin damit einverstanden, dass eine kostenpflichtige Buchung zustande kommt.', $termsLink),
|
||||
'label_html' => true,
|
||||
'required' => true,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => OfferAcceptDto::class,
|
||||
]);
|
||||
$resolver->setRequired('terms_url');
|
||||
$resolver->setAllowedTypes('terms_url', 'string');
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ class UserRepository extends ServiceEntityRepository
|
||||
|
||||
$this->applySearchTerm($qb, $filter->searchTerm(), [
|
||||
'user.email',
|
||||
'user.firstName',
|
||||
'user.lastName',
|
||||
'user.addressId',
|
||||
'user.personId',
|
||||
]);
|
||||
|
||||
@@ -53,6 +53,7 @@ class BpnAuthenticator extends AbstractLoginFormAuthenticator implements Authent
|
||||
private readonly Crypt $crypt,
|
||||
private readonly ProfileCompletenessChecker $completenessChecker,
|
||||
private readonly LoggerInterface $authLogger,
|
||||
private readonly DefaultRouteResolver $defaultRouteResolver,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -119,6 +120,8 @@ class BpnAuthenticator extends AbstractLoginFormAuthenticator implements Authent
|
||||
->setPassword($encryptedPassword)
|
||||
->setPersonId($personalData->personId)
|
||||
->setAddressId($personalData->addressId)
|
||||
->setFirstName($personalData->firstName)
|
||||
->setLastName($personalData->name)
|
||||
->setLastLoginAt(new \DateTimeImmutable())
|
||||
->setProfileComplete($this->completenessChecker->isComplete($personalData))
|
||||
;
|
||||
@@ -172,7 +175,7 @@ class BpnAuthenticator extends AbstractLoginFormAuthenticator implements Authent
|
||||
]);
|
||||
|
||||
$targetPath = $this->getTargetPath($request->getSession(), $firewallName)
|
||||
?? $this->urlGenerator->generate('app_account');
|
||||
?? $this->defaultRouteResolver->resolveUrl();
|
||||
|
||||
// When redirecting to admin from an HTMX request, force a full page navigation
|
||||
// to avoid layout issues between frontend (hx-boost) and EasyAdmin
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Security;
|
||||
|
||||
use App\Security\Voter\AdministrativeAccessVoter;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
/**
|
||||
* Resolves the route a user belongs to when no specific destination is known.
|
||||
*
|
||||
* Used after login (when no target path was stored) and when access to a page is
|
||||
* denied, so users land somewhere they are actually allowed to be instead of on an
|
||||
* error page.
|
||||
*/
|
||||
class DefaultRouteResolver
|
||||
{
|
||||
public function __construct(
|
||||
private readonly AuthorizationCheckerInterface $authorizationChecker,
|
||||
private readonly UrlGeneratorInterface $urlGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
public function resolveRoute(): string
|
||||
{
|
||||
if ($this->authorizationChecker->isGranted(AdministrativeAccessVoter::ADMINISTRATIVE_ACCESS)) {
|
||||
return 'app_admin_dashboard';
|
||||
}
|
||||
|
||||
return 'app_account';
|
||||
}
|
||||
|
||||
public function resolveUrl(): string
|
||||
{
|
||||
return $this->urlGenerator->generate($this->resolveRoute());
|
||||
}
|
||||
}
|
||||
@@ -387,14 +387,28 @@ class AccommodationBookingService
|
||||
/**
|
||||
* All accommodation mail is sent from the group desk address so customer replies
|
||||
* land there rather than in the general inbox.
|
||||
*
|
||||
* A booking can legitimately have no email yet (drafts, and offers created without
|
||||
* contact data), so a missing recipient is logged and skipped rather than thrown:
|
||||
* the caller's own work — accepting an offer, for instance — is already done and
|
||||
* must not fail over an undeliverable notification.
|
||||
*/
|
||||
private function sendBookingEmail(
|
||||
AccommodationBooking $booking,
|
||||
string $to,
|
||||
?string $to,
|
||||
string $subject,
|
||||
string $template,
|
||||
string $errorMessage,
|
||||
): void {
|
||||
if (null === $to || '' === trim($to)) {
|
||||
$this->logger->warning($errorMessage, [
|
||||
'booking_id' => $booking->getId(),
|
||||
'error' => 'No recipient email address on the booking.',
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->mailer->createAndSendEmail(
|
||||
[
|
||||
@@ -486,13 +500,21 @@ class AccommodationBookingService
|
||||
* only the status moves to Bestätigt, so an offer-originated booking remains
|
||||
* distinguishable from a direct one.
|
||||
* Idempotent — a no-op (including no emails) if the offer is not open any more.
|
||||
*
|
||||
* @param ?string $remarks null leaves the stored remark untouched, a string replaces it,
|
||||
* an empty string clears it
|
||||
*/
|
||||
public function acceptBooking(AccommodationBooking $booking): void
|
||||
public function acceptBooking(AccommodationBooking $booking, ?string $remarks = null): void
|
||||
{
|
||||
if (!$booking->isInquiry() || !$booking->isOpen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null !== $remarks) {
|
||||
$trimmed = trim($remarks);
|
||||
$booking->setRemarks('' === $trimmed ? null : $trimmed);
|
||||
}
|
||||
|
||||
$booking->setStatus(AccommodationBookingStatus::Accepted);
|
||||
$booking->setAcceptedAt(new \DateTimeImmutable());
|
||||
$this->entityManager->flush();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{#
|
||||
Collapsible section with a heading trigger and a chevron.
|
||||
|
||||
heading string visible heading text (required)
|
||||
id string unique per page; wires aria-controls (required)
|
||||
open bool initial state (default false)
|
||||
headingLevel int aria-level of the heading (default 2)
|
||||
contentClass string classes on the body wrapper (default 'rte-content')
|
||||
storageKey string persist open state in sessionStorage (default '')
|
||||
#}
|
||||
<div {{ stimulus_controller('toggle',
|
||||
{ 'open': open|default(false), 'storageKey': storageKey|default('') },
|
||||
{ 'closed': 'hidden', 'iconOpen': 'rotate-180' }) }}>
|
||||
<button type="button"
|
||||
class="flex items-center justify-between w-full text-left"
|
||||
data-action="toggle#toggle"
|
||||
data-toggle-target="trigger"
|
||||
aria-expanded="{{ open|default(false) ? 'true' : 'false' }}"
|
||||
aria-controls="{{ id }}-content">
|
||||
<span class="block text-2xl md:text-3xl font-bold mb-2"
|
||||
role="heading"
|
||||
aria-level="{{ headingLevel|default(2) }}">
|
||||
{{ heading }}
|
||||
</span>
|
||||
<span class="shrink-0 transition-transform" data-toggle-target="icon">
|
||||
{{ icon('chevron-down', 'w-5 h-5') }}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div id="{{ id }}-content"
|
||||
class="{{ contentClass|default('rte-content') }}"
|
||||
data-toggle-target="content">
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends 'layout.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
{% include '_partials/_flashes.html.twig' %}
|
||||
<div class="px-4 lg:px-8 py-8 lg:py-16">
|
||||
<h1 class="text-white uppercase pb-4">
|
||||
Mein<br>Account
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</td>
|
||||
<td>
|
||||
{% if booking.managedBy is not null %}
|
||||
{{ booking.managedBy.email }}
|
||||
{{ booking.managedBy.displayName }}
|
||||
{% else %}
|
||||
keine Zuordnung
|
||||
{% endif %}
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
<div class="lg:col-span-2">
|
||||
{{ form_row(form.status) }}
|
||||
</div>
|
||||
<div class="lg:col-span-2">
|
||||
{{ form_row(form.email) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end pt-8">
|
||||
<button type="submit" class="button button--primary button--small">
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{{ knp_pagination_sortable(pagination, 'Name', 'user.lastName') }}
|
||||
</th>
|
||||
<th>
|
||||
{{ knp_pagination_sortable(pagination, 'E-Mail', 'user.email') }}
|
||||
</th>
|
||||
@@ -37,6 +40,9 @@
|
||||
<tbody>
|
||||
{% for user in pagination %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ user.fullName | default('-') }}
|
||||
</td>
|
||||
<td>
|
||||
{{ user.email }}
|
||||
</td>
|
||||
@@ -65,7 +71,7 @@
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<td colspan="8">
|
||||
{{ filter.isActive ? 'Keine Treffer für diesen Filter.' : 'Keine Daten...' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
|
||||
{# Content - toggleable on mobile, always visible on desktop #}
|
||||
<div class="hidden lg:block flex-1 min-h-0 bg-white shadow-lg lg:shadow-none overflow-y-auto px-4 lg:px-8 py-8"
|
||||
<div class="hidden lg:block flex-1 min-h-0 bg-white shadow-lg lg:shadow-none overflow-y-auto scroll-stable px-4 lg:px-8 py-8"
|
||||
data-toggle-target="content">
|
||||
{% include 'booking/_summary_travel_info.html.twig' with {
|
||||
'bookingDto': bookingDto,
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<div class="hidden lg:block shrink-0">
|
||||
{% include 'booking/_pagination.html.twig' with { 'current_step': 1 } %}
|
||||
</div>
|
||||
<div class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
<h2 class="pb-4">
|
||||
Unterkunft
|
||||
</h2>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<div class="hidden lg:block shrink-0">
|
||||
{% include 'booking/_pagination.html.twig' with { 'current_step': 2 } %}
|
||||
</div>
|
||||
<div class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
<h2 class="pb-4">
|
||||
Teilnehmer:innen
|
||||
</h2>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="hidden lg:block shrink-0">
|
||||
{% include 'booking/_pagination.html.twig' with { 'current_step': 2 } %}
|
||||
</div>
|
||||
<div id="main-content" class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div id="main-content" class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
{# Flash messages - must be inside main-content for HTMX swap to display them #}
|
||||
{% include '_partials/_flashes.html.twig' %}
|
||||
{% include 'booking/_participant_form.html.twig' with {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="hidden lg:block shrink-0">
|
||||
{% include 'booking/_pagination.html.twig' with { 'current_step': 3 } %}
|
||||
</div>
|
||||
<div class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
<h2 class="pb-4">
|
||||
Zahlungsart
|
||||
</h2>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<span class="block uppercase font-semibold">Buchungsübersicht</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
{% include 'booking/_summary_travel_info.html.twig' with {
|
||||
'bookingDto': bookingCreateContext.bookingDto,
|
||||
'summaryData': bookingCreateContext.summaryData,
|
||||
@@ -42,7 +42,7 @@
|
||||
<div class="hidden lg:block shrink-0">
|
||||
{% include 'booking/_pagination.html.twig' with { 'current_step': 4 } %}
|
||||
</div>
|
||||
<div class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
<h2 class="pb-4">
|
||||
Bitte bestätige deine Buchung
|
||||
</h2>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
|
||||
{# Scrollable content #}
|
||||
<div class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
{% block participant_cards %}
|
||||
<h2 class="pb-4">Teilnehmer:innen</h2>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="hidden lg:flex shrink-0 px-4 lg:px-8 h-16 items-center shadow-md relative z-10 bg-white">
|
||||
<h1 class="text-xl font-semibold uppercase">Buchung bearbeiten</h1>
|
||||
</div>
|
||||
<div id="main-content" class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div id="main-content" class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
{# Flash messages - must be inside main-content for HTMX swap to display them #}
|
||||
{% include '_partials/_flashes.html.twig' %}
|
||||
{% include 'booking/_participant_form.html.twig' with {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
|
||||
{# Scrollable content area #}
|
||||
<div class="flex-1 overflow-y-auto p-4 lg:p-8 bg-primary-bg">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable p-4 lg:p-8 bg-primary-bg">
|
||||
{% include '_partials/_flashes.html.twig' %}
|
||||
|
||||
<div class="space-y-8 pb-8">
|
||||
|
||||
@@ -1,29 +1,50 @@
|
||||
{% extends 'email/layout.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% set info_url = 'https://www.ep-reisen.de/reisen-fuer-gruppen/infos-zusatzleistungen/reiseinfos/ablauf-und-fristen-eurer-buchung/ablauf-und-fristen-eurer-buchung-fuer-sommeraufenthalte/' %}
|
||||
|
||||
{% if accessLink %}
|
||||
<h1>{{ booking.accepted ? 'Deine Buchung ist bestätigt' : 'Dein Angebot ist bereit' }}</h1>
|
||||
<h1>
|
||||
{{ booking.accepted ? 'Deine Buchung ist bestätigt' : 'Dein Angebot ist bereit' }}
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
Hallo {{ booking.firstName }},
|
||||
{% if not booking.accepted %}
|
||||
vielen Dank für deine Anfrage! Wir haben sie geprüft — dein Angebot wartet auf dich.
|
||||
{% else %}
|
||||
vielen Dank! Deine Buchung ist bei uns eingegangen und bestätigt.
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
{% if not booking.accepted %}
|
||||
<p>
|
||||
vielen Dank! Hiermit bestätigen wir den Eingang deiner Buchung.
|
||||
</p>
|
||||
<p>
|
||||
Wir übergeben die Buchung nun für die Detailabstimmung an die Kollegen und Kolleginnen in der
|
||||
Gruppenabwicklung. Sie werden sich rechtzeitig bei Euch melden und alle weiteren Details mit euch
|
||||
besprechen. Keine Sorge, sollte es sich ein wenig verzögern, der Termin ist fest für euch reserviert und
|
||||
geblockt! Wie es danach für euch weitergeht, könnt ihr euch <a href="{{ info_url }}" class="underline">hier schon einmal anschauen</a>.
|
||||
</p>
|
||||
{% else %}
|
||||
<p>
|
||||
vielen Dank für deine Anfrage! Wir melden uns so schnell wie möglich bei dir mit deinem persönlichen
|
||||
Angebot.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
<a href="{{ accessLink }}" class="button">
|
||||
{{ booking.accepted ? 'Buchung ansehen' : 'Angebot ansehen & bestätigen' }}
|
||||
</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<h1>Deine Anfrage ist bei uns eingegangen</h1>
|
||||
<h1>
|
||||
Deine Anfrage ist bei uns eingegangen
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
Hallo {{ booking.firstName }}, vielen Dank für deine Anfrage! Wir melden uns so schnell wie möglich
|
||||
bei dir mit deinem persönlichen Angebot.
|
||||
Hallo {{ booking.firstName }},
|
||||
</p>
|
||||
<p>
|
||||
vielen Dank für deine Anfrage! Wir melden uns so schnell wie möglich bei dir mit deinem persönlichen
|
||||
Angebot.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
@@ -43,5 +64,13 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="small">Bei Fragen antworte einfach auf diese E-Mail.</p>
|
||||
<p>
|
||||
Bei Fragen antworte einfach auf diese E-Mail.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Viele Grüße aus Köln
|
||||
<br>
|
||||
Dein Team von E&P Reisen
|
||||
</p>
|
||||
{% endblock %}
|
||||
@@ -24,4 +24,9 @@
|
||||
<td>{{ booking.dateTo|date('d.m.Y') }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% if booking.remarks %}
|
||||
<h2>Anmerkungen</h2>
|
||||
<p>{{ booking.remarks|nl2br }}</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -1,10 +1,24 @@
|
||||
{% extends 'email/layout.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Deine Buchung ist bestätigt</h1>
|
||||
{% set info_url = 'https://www.ep-reisen.de/reisen-fuer-gruppen/infos-zusatzleistungen/reiseinfos/ablauf-und-fristen-eurer-buchung/ablauf-und-fristen-eurer-buchung-fuer-sommeraufenthalte/' %}
|
||||
|
||||
<h1>
|
||||
Deine Buchung ist bestätigt
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
Hallo {{ booking.firstName }}, vielen Dank! Deine Buchung ist jetzt verbindlich bestätigt.
|
||||
Hallo {{ booking.firstName }},
|
||||
</p>
|
||||
|
||||
<p>
|
||||
vielen Dank! Hiermit bestätigen wir den Eingang deiner Buchung.
|
||||
</p>
|
||||
<p>
|
||||
Wir übergeben die Buchung nun für die Detailabstimmung an die Kollegen und Kolleginnen in der
|
||||
Gruppenabwicklung. Sie werden sich rechtzeitig bei Euch melden und alle weiteren Details mit euch besprechen.
|
||||
Keine Sorge, sollte es sich ein wenig verzögern, der Termin ist fest für euch reserviert und geblockt! Wie es
|
||||
danach für euch weitergeht, könnt ihr euch <a href="{{ info_url }}" class="underline">hier schon einmal anschauen</a>.
|
||||
</p>
|
||||
|
||||
{% if accessLink %}
|
||||
@@ -13,7 +27,10 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<h2>Unterkunft</h2>
|
||||
<h2>
|
||||
Unterkunft
|
||||
</h2>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><strong>Name</strong></td>
|
||||
@@ -29,5 +46,21 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="small">Bei Fragen antworte einfach auf diese E-Mail.</p>
|
||||
{% if booking.remarks %}
|
||||
<h2>
|
||||
Anmerkungen
|
||||
</h2>
|
||||
|
||||
<p>{{ booking.remarks|nl2br }}</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
Bei Fragen antworte einfach auf diese E-Mail.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Viele Grüße aus Köln
|
||||
<br>
|
||||
Dein Team von E&P Reisen
|
||||
</p>
|
||||
{% endblock %}
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
{% block content %}
|
||||
{% from '_partials/_validation_errors.html.twig' import validation_alert %}
|
||||
{{ validation_alert(confirmationForm, 'Bitte akzeptiere die AGB, um die Buchung abzuschließen.', false) }}
|
||||
{# Generic title: both fields can fail, and each renders its own message inline. #}
|
||||
{{ validation_alert(confirmationForm, null, false) }}
|
||||
|
||||
<p class="mb-6">
|
||||
Möchtest du dieses Angebot jetzt verbindlich buchen?
|
||||
@@ -17,6 +18,7 @@
|
||||
'hx-swap': 'outerHTML',
|
||||
}
|
||||
}) }}
|
||||
{{ form_row(confirmationForm.remarks) }}
|
||||
{{ form_row(confirmationForm.termsAccepted) }}
|
||||
|
||||
<div class="mt-6 flex flex-col space-y-4 md:flex-row md:space-y-0 justify-between">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
|
||||
{# Content #}
|
||||
<div class="hidden lg:block flex-1 min-h-0 bg-white shadow-lg lg:shadow-none overflow-y-auto px-4 lg:px-8 py-8"
|
||||
<div class="hidden lg:block flex-1 min-h-0 bg-white shadow-lg lg:shadow-none overflow-y-auto scroll-stable px-4 lg:px-8 py-8"
|
||||
data-toggle-target="content">
|
||||
|
||||
{# Accommodation info #}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
|
||||
{# Content #}
|
||||
<div class="hidden lg:block flex-1 min-h-0 bg-white shadow-lg lg:shadow-none overflow-y-auto px-4 lg:px-8 py-8"
|
||||
<div class="hidden lg:block flex-1 min-h-0 bg-white shadow-lg lg:shadow-none overflow-y-auto scroll-stable px-4 lg:px-8 py-8"
|
||||
data-toggle-target="content">
|
||||
|
||||
{# Accommodation info #}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
|
||||
{# Main area #}
|
||||
<div class="flex-1 order-2 lg:order-1 lg:col-span-3 bg-white flex flex-col gap-y-8 min-h-0 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 order-2 lg:order-1 lg:col-span-3 bg-white flex flex-col gap-y-8 min-h-0 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
{% include '_partials/_flashes.html.twig' %}
|
||||
|
||||
<hgroup>
|
||||
@@ -97,23 +97,11 @@
|
||||
|
||||
{# hotel description #}
|
||||
{% if ctx.hotelCmsData is not null %}
|
||||
<div {{ stimulus_controller('toggle', { 'open': false }, { 'closed': 'hidden', 'iconOpen': 'rotate-180' }) }}>
|
||||
<button type="button"
|
||||
class="flex items-center justify-between w-full text-left"
|
||||
data-action="toggle#toggle">
|
||||
<h2>
|
||||
Die Unterkunft
|
||||
</h2>
|
||||
<svg class="w-5 h-5 shrink-0 transition-transform"
|
||||
data-toggle-target="icon"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 256 256">
|
||||
<rect width="256" height="256" fill="none"></rect>
|
||||
<polyline points="208 96 128 176 48 96" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></polyline>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="rte-content" data-toggle-target="content">
|
||||
{% embed '_partials/_collapsible.html.twig' with {
|
||||
heading: 'Die Unterkunft',
|
||||
id: 'accommodation',
|
||||
} %}
|
||||
{% block body %}
|
||||
{% set icons = ctx.hotelCmsData.icons %}
|
||||
{% set iconMap = {
|
||||
bedsCount: { icon: 'bed', label: 'Anzahl Betten' },
|
||||
@@ -165,15 +153,8 @@
|
||||
</h2>
|
||||
{{ ctx.hotelCmsData.roomTypes | raw }}
|
||||
{% endif %}
|
||||
|
||||
{% if ctx.hotelCmsData.additionalInformation|striptags|trim is not empty %}
|
||||
<h2>
|
||||
Weitere Infos
|
||||
</h2>
|
||||
{{ ctx.hotelCmsData.additionalInformation | raw }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
{{ macros.imageGallery(ctx.hotelCmsData.images.resized.l, ctx.hotelCmsData.images.resized.m, ctx.accommodation.name) }}
|
||||
{% endif %}
|
||||
@@ -181,23 +162,12 @@
|
||||
{# region description #}
|
||||
{% if ctx.hotelCmsData is not null and ctx.hotelCmsData.region is not null %}
|
||||
{% set region = ctx.hotelCmsData.region %}
|
||||
<div {{ stimulus_controller('toggle', { 'open': false }, { 'closed': 'hidden', 'iconOpen': 'rotate-180' }) }}>
|
||||
<button type="button"
|
||||
class="flex items-center justify-between w-full text-left"
|
||||
data-action="toggle#toggle">
|
||||
<h2>
|
||||
Die Region {{ region.name }}
|
||||
</h2>
|
||||
<svg class="w-5 h-5 shrink-0 transition-transform"
|
||||
data-toggle-target="icon"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 256 256">
|
||||
<rect width="256" height="256" fill="none"></rect>
|
||||
<polyline points="208 96 128 176 48 96" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"></polyline>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="rte-content" data-toggle-target="content">
|
||||
{% embed '_partials/_collapsible.html.twig' with {
|
||||
heading: 'Die Region ' ~ region.name,
|
||||
id: 'region',
|
||||
region: region,
|
||||
} %}
|
||||
{% block body %}
|
||||
{% if region.altitude or region.length or region.lifts %}
|
||||
<ul class="flex flex-wrap gap-x-6 text-sm not-prose">
|
||||
{% if region.altitude %}
|
||||
@@ -218,9 +188,6 @@
|
||||
{% endif %}
|
||||
{{ region.description | default('') | raw }}
|
||||
|
||||
<h2>
|
||||
Skigebiet
|
||||
</h2>
|
||||
{{ region.skiArea | default('') | raw }}
|
||||
{{ region.skiAreaExtended | default('') | raw }}
|
||||
|
||||
@@ -228,8 +195,8 @@
|
||||
<h2>Aktuelles aus der Region</h2>
|
||||
{{ region.news | raw }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
{% if region.regionMaps is not null and region.regionMaps | length > 0 %}
|
||||
{% set regionMapImages = region.regionMaps | map(url => {url: url}) %}
|
||||
@@ -238,6 +205,19 @@
|
||||
|
||||
{{ macros.imageGallery(region.images.resized.l ?? [], region.images.resized.m ?? [], region.name) }}
|
||||
{% endif %}
|
||||
|
||||
{# additional information #}
|
||||
{% if ctx.hotelCmsData is not null and ctx.hotelCmsData.additionalInformation|striptags|trim is not empty %}
|
||||
{% embed '_partials/_collapsible.html.twig' with {
|
||||
heading: 'Zusatzinformationen',
|
||||
id: 'additional-information',
|
||||
} %}
|
||||
{% block body %}
|
||||
{{ ctx.hotelCmsData.additionalInformation | raw }}
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{% include 'groups/booking/_pagination.html.twig' with { 'current_step': 1 } %}
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
|
||||
<h2 class="pb-2">
|
||||
Gewünschter Zeitraum
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
{# The scroll container itself must survive the htmx refresh — only its contents
|
||||
are swapped, so assets/loading.js can restore the scroll position. #}
|
||||
<div id="booking-form"
|
||||
class="flex-1 overflow-y-auto px-4 lg:px-8 py-8"
|
||||
class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8"
|
||||
hx-post="{{ path('app_groups_booking_step_2_refresh') }}"
|
||||
hx-trigger="change delay:300ms"
|
||||
hx-target="#booking-form"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{% include 'groups/booking/_pagination.html.twig' with { 'current_step': 3 } %}
|
||||
</div>
|
||||
|
||||
<div id="booking-form" class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div id="booking-form" class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
<h2 class="pb-4">
|
||||
Persönliche Daten
|
||||
</h2>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{% include 'groups/booking/_pagination.html.twig' with { 'current_step': 4 } %}
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
|
||||
<div class="flex-1 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
|
||||
<h2 class="pb-4">
|
||||
Bitte bestätige deine Angaben
|
||||
</h2>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{% extends 'base_admin.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% set main_menu = is_granted('ROLE_ADMIN') ? 'admin_main' : 'groups_main' %}
|
||||
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 lg:grid lg:grid-cols-4 gap-8 py-8">
|
||||
<div class="lg:col-span-4 flex items-center justify-between pb-4 lg:pb-0">
|
||||
<a href="{{ path(app.user ? 'app_admin_dashboard' : 'app_security_login') }}">
|
||||
<a href="{{ path(app.user ? 'app_admin_dashboard' : 'app_login') }}">
|
||||
<img class="h-8 w-auto" src="{{ asset('build/images/logo_ep.svg') }}" alt="My E&P Admin">
|
||||
</a>
|
||||
{% if app.user %}
|
||||
@@ -18,7 +19,9 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="hidden lg:block sticky top-0 h-screen">
|
||||
{{ knp_menu_render(knp_menu_get('admin_main')) }}
|
||||
{% if app.user %}
|
||||
{{ knp_menu_render(knp_menu_get(main_menu)) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="lg:col-span-3">
|
||||
{% block content %}{% endblock %}
|
||||
@@ -37,10 +40,8 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="w-full h-full p-8 pt-0 overflow-y-scroll">
|
||||
{% if is_granted('ROLE_ADMIN') %}
|
||||
{{ knp_menu_render(knp_menu_get('admin_main')) }}
|
||||
{% elseif is_granted('ROLE_GROUPS_MANAGER') %}
|
||||
{{ knp_menu_render(knp_menu_get('groups_main')) }}
|
||||
{% if app.user %}
|
||||
{{ knp_menu_render(knp_menu_get(main_menu)) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Controller\Groups\OfferController;
|
||||
use App\Entity\Groups\Accommodation;
|
||||
use App\Entity\Groups\AccommodationBooking;
|
||||
use App\Enum\Groups\AccommodationBookingStatus;
|
||||
use App\Form\Model\OfferAcceptDto;
|
||||
use App\Repository\Groups\AccommodationBookingRepository;
|
||||
use App\Service\AccommodationBookingBreakdownCalculator;
|
||||
use App\Service\AccommodationBookingLinkSigner;
|
||||
@@ -208,6 +209,7 @@ class OfferControllerTest extends TestCase
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
$booking->setRemarks("Bitte Zimmer im EG\nDanke!");
|
||||
|
||||
$bookingRepository = $this->createMock(AccommodationBookingRepository::class);
|
||||
$bookingRepository->method('findOneBy')->with(['uuid' => $booking->getUuid()])->willReturn($booking);
|
||||
@@ -233,12 +235,17 @@ class OfferControllerTest extends TestCase
|
||||
self::assertSame('groups/booking/_offer_accept_confirmation_modal.html.twig', $controller->renderedView);
|
||||
self::assertSame($booking, $controller->renderedParameters['booking']);
|
||||
self::assertSame($confirmationForm, $controller->renderedParameters['confirmationForm']);
|
||||
|
||||
self::assertInstanceOf(OfferAcceptDto::class, $controller->formData);
|
||||
self::assertSame("Bitte Zimmer im EG\nDanke!", $controller->formData->remarks, 'the stored remark is prefilled into the modal');
|
||||
self::assertFalse($controller->formData->termsAccepted);
|
||||
}
|
||||
|
||||
public function testConfirmPostValidAcceptsBookingAndRedirects(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
$booking->setRemarks('Bitte Zimmer im EG');
|
||||
|
||||
$bookingRepository = $this->createMock(AccommodationBookingRepository::class);
|
||||
$bookingRepository->method('findOneBy')->willReturn($booking);
|
||||
@@ -247,7 +254,7 @@ class OfferControllerTest extends TestCase
|
||||
$linkSigner->method('isSessionAuthorized')->willReturn(true);
|
||||
|
||||
$bookingService = $this->createMock(AccommodationBookingService::class);
|
||||
$bookingService->expects(self::once())->method('acceptBooking')->with($booking);
|
||||
$bookingService->expects(self::once())->method('acceptBooking')->with($booking, 'Bitte Zimmer im EG');
|
||||
|
||||
$confirmationForm = $this->createMock(FormInterface::class);
|
||||
$confirmationForm->method('handleRequest')->willReturnSelf();
|
||||
@@ -282,7 +289,8 @@ class OfferControllerTest extends TestCase
|
||||
$linkSigner->method('isSessionAuthorized')->willReturn(true);
|
||||
|
||||
$bookingService = $this->createMock(AccommodationBookingService::class);
|
||||
$bookingService->expects(self::once())->method('acceptBooking')->with($booking);
|
||||
// No remark on the booking and none submitted: the empty string clears rather than keeps.
|
||||
$bookingService->expects(self::once())->method('acceptBooking')->with($booking, '');
|
||||
|
||||
$confirmationForm = $this->createMock(FormInterface::class);
|
||||
$confirmationForm->method('handleRequest')->willReturnSelf();
|
||||
@@ -412,6 +420,8 @@ final class TestableOfferController extends OfferController
|
||||
/** @var array<string, mixed> */
|
||||
public array $renderedParameters = [];
|
||||
|
||||
public mixed $formData = null;
|
||||
|
||||
public function __construct(
|
||||
AccommodationBookingRepository $bookingRepository,
|
||||
AccommodationBookingLinkSigner $linkSigner,
|
||||
@@ -430,6 +440,8 @@ final class TestableOfferController extends OfferController
|
||||
|
||||
protected function createForm(string $type, mixed $data = null, array $options = []): FormInterface
|
||||
{
|
||||
$this->formData = $data;
|
||||
|
||||
return $this->confirmationForm ?? throw new \LogicException('No confirmation form mock configured for this test.');
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\EventListener;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\EventListener\AccessDeniedListener;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use App\Security\DefaultRouteResolver;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
class AccessDeniedListenerTest extends TestCase
|
||||
{
|
||||
public function testAuthenticatedUserIsRedirectedToTheirDefaultRoute(): void
|
||||
{
|
||||
$request = $this->request('/admin/user');
|
||||
$event = $this->dispatch($request, new User('[email protected]'));
|
||||
|
||||
$response = $event->getResponse();
|
||||
self::assertInstanceOf(RedirectResponse::class, $response);
|
||||
self::assertSame('/admin/dashboard', $response->getTargetUrl());
|
||||
self::assertSame(['Zugriff verweigert'], $this->session($request)->getFlashBag()->get('error'));
|
||||
}
|
||||
|
||||
public function testTargetPathIsClearedToAvoidBeingSentBackToTheDeniedPage(): void
|
||||
{
|
||||
$request = $this->request('/admin/user');
|
||||
$this->session($request)->set('_security.main.target_path', '/admin/user');
|
||||
|
||||
$this->dispatch($request, new User('[email protected]'));
|
||||
|
||||
self::assertFalse($this->session($request)->has('_security.main.target_path'));
|
||||
}
|
||||
|
||||
public function testHtmxRequestsGetAFullPageRedirect(): void
|
||||
{
|
||||
$request = $this->request('/admin/user', ['HTTP_HX-Request' => 'true']);
|
||||
$event = $this->dispatch($request, new User('[email protected]'));
|
||||
|
||||
$response = $event->getResponse();
|
||||
self::assertInstanceOf(HxRedirectResponse::class, $response);
|
||||
self::assertSame('/admin/dashboard', $response->headers->get('HX-Redirect'));
|
||||
// Without this the kernel replaces the 200 of an HxRedirectResponse with a 500
|
||||
self::assertTrue($event->isAllowingCustomResponseCode());
|
||||
}
|
||||
|
||||
public function testDenialOnTheDefaultRouteItselfDoesNotRedirect(): void
|
||||
{
|
||||
$request = $this->request('/admin/dashboard');
|
||||
$event = $this->dispatch($request, new User('[email protected]'));
|
||||
|
||||
self::assertFalse($event->hasResponse());
|
||||
}
|
||||
|
||||
public function testAnonymousUsersFallThroughToTheEntryPoint(): void
|
||||
{
|
||||
$request = $this->request('/admin/user');
|
||||
$event = $this->dispatch($request, null);
|
||||
|
||||
self::assertFalse($event->hasResponse());
|
||||
self::assertSame(['Bitte melde dich an.'], $this->session($request)->getFlashBag()->get('info'));
|
||||
}
|
||||
|
||||
public function testOauth2RoutesAreLeftUntouched(): void
|
||||
{
|
||||
$request = $this->request('/authorize');
|
||||
$request->attributes->set('_route', 'oauth2_authorize');
|
||||
|
||||
$event = $this->dispatch($request, new User('[email protected]'));
|
||||
|
||||
self::assertFalse($event->hasResponse());
|
||||
self::assertSame([], $this->session($request)->getFlashBag()->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $server
|
||||
*/
|
||||
private function request(string $uri, array $server = []): Request
|
||||
{
|
||||
$request = Request::create($uri, server: $server);
|
||||
$request->setSession(new Session(new MockArraySessionStorage()));
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
private function session(Request $request): Session
|
||||
{
|
||||
/** @var Session $session */
|
||||
$session = $request->getSession();
|
||||
|
||||
return $session;
|
||||
}
|
||||
|
||||
private function dispatch(Request $request, ?UserInterface $user): ExceptionEvent
|
||||
{
|
||||
$security = $this->createMock(Security::class);
|
||||
$security->method('getUser')->willReturn($user);
|
||||
|
||||
$resolver = $this->createMock(DefaultRouteResolver::class);
|
||||
$resolver->method('resolveUrl')->willReturn('/admin/dashboard');
|
||||
|
||||
$listener = new AccessDeniedListener(
|
||||
$security,
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$resolver,
|
||||
);
|
||||
|
||||
$event = new ExceptionEvent(
|
||||
$this->createMock(HttpKernelInterface::class),
|
||||
$request,
|
||||
HttpKernelInterface::MAIN_REQUEST,
|
||||
new AccessDeniedException(),
|
||||
);
|
||||
|
||||
$listener->onKernelException($event);
|
||||
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Form\Admin\Groups;
|
||||
|
||||
use App\Entity\Groups\AccommodationBooking;
|
||||
use App\Enum\Groups\AccommodationBookingStatus;
|
||||
use App\Form\Admin\Groups\AccommodationBookingCreateType;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints\Email;
|
||||
use Symfony\Component\Validator\Constraints\EmailValidator;
|
||||
use Symfony\Component\Validator\ConstraintValidatorFactory;
|
||||
use Symfony\Component\Validator\Validation;
|
||||
|
||||
class AccommodationBookingCreateTypeTest extends TestCase
|
||||
{
|
||||
public function testDraftsAreValidatedWithoutTheOfferGroup(): void
|
||||
{
|
||||
self::assertSame(['Default'], $this->resolveValidationGroups(AccommodationBookingStatus::Draft));
|
||||
}
|
||||
|
||||
public function testOffersAddTheOfferGroup(): void
|
||||
{
|
||||
self::assertSame(['Default', 'offer'], $this->resolveValidationGroups(AccommodationBookingStatus::Open));
|
||||
}
|
||||
|
||||
public function testDraftCanBeCreatedWithoutAnEmail(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Draft);
|
||||
|
||||
$violations = $this->validate($booking, $this->resolveValidationGroups(AccommodationBookingStatus::Draft));
|
||||
|
||||
self::assertCount(0, $violations);
|
||||
}
|
||||
|
||||
public function testOfferCannotBeCreatedWithoutAnEmail(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
|
||||
$violations = $this->validate($booking, $this->resolveValidationGroups(AccommodationBookingStatus::Open));
|
||||
|
||||
$properties = array_map(static fn ($violation) => $violation->getPropertyPath(), iterator_to_array($violations));
|
||||
|
||||
self::assertSame(['email'], $properties, 'only the address is enforced here — the rest of the contact data belongs to the edit form');
|
||||
}
|
||||
|
||||
public function testOfferRejectsAMalformedEmail(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
$booking->setEmail('not-an-address');
|
||||
|
||||
$violations = $this->validate($booking, $this->resolveValidationGroups(AccommodationBookingStatus::Open));
|
||||
|
||||
self::assertCount(1, $violations);
|
||||
self::assertSame('email', $violations[0]->getPropertyPath());
|
||||
}
|
||||
|
||||
public function testOfferWithAnEmailIsValid(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
$booking->setEmail('[email protected]');
|
||||
|
||||
$violations = $this->validate($booking, $this->resolveValidationGroups(AccommodationBookingStatus::Open));
|
||||
|
||||
self::assertCount(0, $violations);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function resolveValidationGroups(AccommodationBookingStatus $status): array
|
||||
{
|
||||
$resolver = new OptionsResolver();
|
||||
(new AccommodationBookingCreateType())->configureOptions($resolver);
|
||||
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus($status);
|
||||
|
||||
$form = $this->createMock(FormInterface::class);
|
||||
$form->method('getData')->willReturn($booking);
|
||||
|
||||
return ($resolver->resolve()['validation_groups'])($form);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $groups
|
||||
*/
|
||||
private function validate(AccommodationBooking $booking, array $groups): \Symfony\Component\Validator\ConstraintViolationListInterface
|
||||
{
|
||||
// The app configures email_validation_mode: html5 globally (config/packages/validator.yaml);
|
||||
// the standalone builder would otherwise fall back to the deprecated "loose" mode.
|
||||
$validatorFactory = new ConstraintValidatorFactory([
|
||||
EmailValidator::class => new EmailValidator(Email::VALIDATION_MODE_HTML5),
|
||||
]);
|
||||
|
||||
return Validation::createValidatorBuilder()
|
||||
->enableAttributeMapping()
|
||||
->setConstraintValidatorFactory($validatorFactory)
|
||||
->getValidator()
|
||||
->validate($booking, null, $groups);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Form\Model;
|
||||
|
||||
use App\Form\Model\OfferAcceptDto;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Validator\Validation;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class OfferAcceptDtoTest extends TestCase
|
||||
{
|
||||
public function testAcceptedTermsWithoutRemarksIsValid(): void
|
||||
{
|
||||
$violations = $this->validator()->validate(new OfferAcceptDto(termsAccepted: true));
|
||||
|
||||
self::assertCount(0, $violations);
|
||||
}
|
||||
|
||||
public function testUncheckedTermsAreRejected(): void
|
||||
{
|
||||
$violations = $this->validator()->validate(new OfferAcceptDto(remarks: 'Bitte Zimmer im EG'));
|
||||
|
||||
self::assertCount(1, $violations);
|
||||
self::assertSame('termsAccepted', $violations[0]->getPropertyPath());
|
||||
self::assertSame('Bitte akzeptiere die AGB, um die Buchung abzuschließen.', $violations[0]->getMessage());
|
||||
}
|
||||
|
||||
public function testRemarksAreCappedAt2000Characters(): void
|
||||
{
|
||||
$dto = new OfferAcceptDto(termsAccepted: true, remarks: str_repeat('a', 2001));
|
||||
|
||||
$violations = $this->validator()->validate($dto);
|
||||
|
||||
self::assertCount(1, $violations);
|
||||
self::assertSame('remarks', $violations[0]->getPropertyPath());
|
||||
self::assertSame('Die Anmerkungen dürfen maximal 2000 Zeichen lang sein.', $violations[0]->getMessage());
|
||||
}
|
||||
|
||||
public function testRemarksAtTheLimitAreAccepted(): void
|
||||
{
|
||||
$dto = new OfferAcceptDto(termsAccepted: true, remarks: str_repeat('a', 2000));
|
||||
|
||||
self::assertCount(0, $this->validator()->validate($dto));
|
||||
}
|
||||
|
||||
private function validator(): ValidatorInterface
|
||||
{
|
||||
return Validation::createValidatorBuilder()
|
||||
->enableAttributeMapping()
|
||||
->getValidator();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ use App\BusProNet\Model\PersonalData;
|
||||
use App\Entity\User;
|
||||
use App\Security\BpnAuthenticator;
|
||||
use App\Security\Crypt;
|
||||
use App\Security\DefaultRouteResolver;
|
||||
use App\Security\Role;
|
||||
use App\Service\ProfileCompletenessChecker;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@@ -143,6 +144,7 @@ class BpnAuthenticatorTest extends TestCase
|
||||
$crypt,
|
||||
$completenessChecker,
|
||||
$this->createMock(LoggerInterface::class),
|
||||
$this->createMock(DefaultRouteResolver::class),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Security;
|
||||
|
||||
use App\Security\DefaultRouteResolver;
|
||||
use App\Security\Voter\AdministrativeAccessVoter;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
|
||||
class DefaultRouteResolverTest extends TestCase
|
||||
{
|
||||
public function testStaffLandsInTheAdminArea(): void
|
||||
{
|
||||
self::assertSame('app_admin_dashboard', $this->resolver(true)->resolveRoute());
|
||||
}
|
||||
|
||||
public function testEverybodyElseLandsOnTheirAccount(): void
|
||||
{
|
||||
self::assertSame('app_account', $this->resolver(false)->resolveRoute());
|
||||
}
|
||||
|
||||
public function testUrlIsGeneratedForTheResolvedRoute(): void
|
||||
{
|
||||
self::assertSame('/admin/dashboard', $this->resolver(true)->resolveUrl());
|
||||
}
|
||||
|
||||
private function resolver(bool $hasAdministrativeAccess): DefaultRouteResolver
|
||||
{
|
||||
$authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class);
|
||||
$authorizationChecker
|
||||
->method('isGranted')
|
||||
->with(AdministrativeAccessVoter::ADMINISTRATIVE_ACCESS)
|
||||
->willReturn($hasAdministrativeAccess)
|
||||
;
|
||||
|
||||
$urlGenerator = $this->createMock(UrlGeneratorInterface::class);
|
||||
$urlGenerator
|
||||
->method('generate')
|
||||
->willReturnCallback(static fn (string $route): string => match ($route) {
|
||||
'app_admin_dashboard' => '/admin/dashboard',
|
||||
'app_account' => '/account',
|
||||
default => self::fail(sprintf('Unexpected route "%s"', $route)),
|
||||
})
|
||||
;
|
||||
|
||||
return new DefaultRouteResolver($authorizationChecker, $urlGenerator);
|
||||
}
|
||||
}
|
||||
@@ -294,6 +294,89 @@ class AccommodationBookingServiceTest extends TestCase
|
||||
self::assertNotNull($booking->getAcceptedAt());
|
||||
}
|
||||
|
||||
public function testAcceptBookingStoresTrimmedRemarks(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
$booking->setEmail('[email protected]');
|
||||
$booking->setRemarks('vom Telefonat');
|
||||
|
||||
$service = $this->createServiceWithAccommodation(mailer: $this->createMock(Mailer::class));
|
||||
|
||||
$service->acceptBooking($booking, " Bitte Zimmer im EG\nund Frühstück um 8 \n");
|
||||
|
||||
self::assertSame("Bitte Zimmer im EG\nund Frühstück um 8", $booking->getRemarks(), 'inner line breaks survive, outer whitespace does not');
|
||||
}
|
||||
|
||||
public function testAcceptBookingClearsRemarksForEmptySubmission(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
$booking->setEmail('[email protected]');
|
||||
$booking->setRemarks('vom Telefonat');
|
||||
|
||||
$service = $this->createServiceWithAccommodation(mailer: $this->createMock(Mailer::class));
|
||||
|
||||
$service->acceptBooking($booking, ' ');
|
||||
|
||||
self::assertNull($booking->getRemarks(), 'an emptied textarea clears the stored remark');
|
||||
}
|
||||
|
||||
public function testAcceptBookingLeavesRemarksUntouchedWithoutSubmission(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
$booking->setEmail('[email protected]');
|
||||
$booking->setRemarks('vom Telefonat');
|
||||
|
||||
$service = $this->createServiceWithAccommodation(mailer: $this->createMock(Mailer::class));
|
||||
|
||||
$service->acceptBooking($booking);
|
||||
|
||||
self::assertSame('vom Telefonat', $booking->getRemarks(), 'the API path must not wipe the remark');
|
||||
}
|
||||
|
||||
public function testAcceptBookingDoesNotStoreRemarksWhenOfferIsNotOpen(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Accepted);
|
||||
$booking->setRemarks('vom Telefonat');
|
||||
|
||||
$service = $this->createServiceWithAccommodation(mailer: $this->createMock(Mailer::class));
|
||||
|
||||
$service->acceptBooking($booking, 'zu spät');
|
||||
|
||||
self::assertSame('vom Telefonat', $booking->getRemarks());
|
||||
}
|
||||
|
||||
public function testAcceptBookingSkipsTheCustomerEmailWhenNoAddressIsStored(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setStatus(AccommodationBookingStatus::Open);
|
||||
|
||||
// Only the office notification goes out — the customer copy has no recipient.
|
||||
$mailer = $this->createMock(Mailer::class);
|
||||
$mailer
|
||||
->expects(self::once())
|
||||
->method('createAndSendEmail')
|
||||
->with(
|
||||
self::anything(),
|
||||
self::callback(static fn (array $options) => '[email protected]' === $options['to']),
|
||||
);
|
||||
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
$logger
|
||||
->expects(self::once())
|
||||
->method('warning')
|
||||
->with('Failed to send offer accepted customer email', self::anything());
|
||||
|
||||
$service = $this->createServiceWithAccommodation(mailer: $mailer, logger: $logger);
|
||||
|
||||
$service->acceptBooking($booking);
|
||||
|
||||
self::assertSame(AccommodationBookingStatus::Accepted, $booking->getStatus(), 'the acceptance itself must not fail');
|
||||
}
|
||||
|
||||
public function testAcceptBookingIsIdempotentAndSendsNoNotifications(): void
|
||||
{
|
||||
$entityManager = $this->createMock(EntityManagerInterface::class);
|
||||
|
||||
Reference in new issue
Block a user