Compare commits

25 Commits
Author SHA1 Message Date
fromme 46934e278c fix: log authorization denials on the auth channel 2026-11-13 16:21:04 +01:00
fromme aebfc2ca9b feat: back-channel logout to client apps 2026-11-13 16:20:22 +01:00
fromme 3247df1171 feat: link ephub from account dashboard for eligible users 2026-11-13 15:48:54 +01:00
fromme 6cfaaf1ba9 feat: adopt ep-design 1.5.0 in admin 2026-11-13 15:14:05 +01:00
fromme fd3d88209c feat: adopt ep-design 1.4.0 in admin 2026-11-13 14:48:37 +01:00
fromme 21b00e3bd6 fix: adopt ep-design 1.3.1 menu click action 2026-11-13 13:47:29 +01:00
fromme e517163c9a feat: adopt ep-design 1.3.0 in admin 2026-11-13 12:42:00 +01:00
fromme df564c30ae feat: align admin dashboard cards with epteam 2026-11-13 12:03:39 +01:00
fromme 558e45fe5f feat: restyle admin views in corporate design 2026-11-13 11:51:46 +01:00
fromme c660bd68de feat: adopt E&P corporate design in admin 2026-11-13 11:51:46 +01:00
fromme 55378b2bbc feat: stop booking flow when BusPro is unreachable 2026-11-11 19:51:52 +01:00
fromme ac23baf625 feat: lock pooled rooms once the pool is used up 2026-11-11 17:16:42 +01:00
fromme a1645784fe fix: reword shared contingent hint 2026-11-11 17:12:55 +01:00
fromme 3d94505e8d feat: cap rooms sharing a contingent per booking 2026-11-11 16:35:49 +01:00
fromme 5942ecf340 docs: document pooled room contingents 2026-11-11 16:35:49 +01:00
fromme 0b0286787b feat: offer rooms on request by Anf code suffix 2026-11-11 11:35:38 +01:00
fromme 2936d8947a docs: update initial booking status comment 2026-11-10 17:32:38 +01:00
fromme 0ff312c0c0 feat: add bookable flag to product export rooms 2026-11-10 17:32:38 +01:00
fromme 2b27b9809d feat: offer only free rooms in booking step 1 2026-11-10 17:32:38 +01:00
fromme 980e378a7b feat: disable mailjet open and click tracking 2026-11-10 17:25:16 +01:00
fromme 77960fe81f chore: update project dependencies 2026-11-09 18:15:36 +01:00
fromme 9ce42de4c1 refactor: drop edit-mode room assignment code 2026-11-09 18:01:25 +01:00
fromme d50995a21c fix: pass BusPro room assignments through on edit 2026-11-09 18:00:47 +01:00
fromme 897a1ac7f9 fix: show booked room count in edit summary 2026-11-09 18:00:47 +01:00
fromme 2705401393 feat: add bus-only travel mailing lists 2026-11-09 15:53:53 +01:00
136 changed files with 3911 additions and 1321 deletions

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { Controller } from '@hotwired/stimulus'
/*
* The navigation (sidebar or header tabs) as a drawer on small screens: a modal <dialog> (target
* "dialog"), so focus stays inside and Escape closes it. A click on the dimmed page beside it closes it
* too, and so does widening the window until the navigation shows (lg).
*/
export default class extends Controller {
static targets = ['dialog']
connect () {
this.wide = window.matchMedia('(min-width: 64rem)')
this.onWide = (event) => event.matches && this.close()
this.wide.addEventListener('change', this.onWide)
}
disconnect () {
this.wide.removeEventListener('change', this.onWide)
}
open () {
this.dialogTarget.showModal()
}
close () {
this.dialogTarget.close()
}
// a click on the dialog element itself, not on its content, is a click on the backdrop
closeOnBackdrop (event) {
if (event.target === this.dialogTarget) {
this.close()
}
}
}
+89
View File
@@ -0,0 +1,89 @@
import { Controller } from '@hotwired/stimulus'
/*
* A small menu behind a "⋯" button: the button (menu#toggle) opens the panel (target "panel") below
* itself. The panel is positioned fixed, so a scrolling container can't cut it off. Escape, a click
* outside or a click on one of its items closes it; arrow keys move between the items. Scrolling or
* resizing closes it too: a fixed panel would stay put while its row moves away (a table swiped
* sideways on a phone).
*/
export default class extends Controller {
static targets = ['button', 'panel']
connect () {
this.onOutside = (event) => {
if (!this.element.contains(event.target)) {
this.close()
}
}
this.onKey = (event) => this.key(event)
this.onScroll = (event) => {
if (!this.panelTarget.contains(event.target)) {
this.close()
}
}
this.onResize = () => this.close()
}
disconnect () {
this.close()
}
toggle (event) {
event.stopPropagation()
this.panelTarget.hidden ? this.open() : this.close()
}
open () {
const box = this.buttonTarget.getBoundingClientRect()
const panel = this.panelTarget
panel.hidden = false
// below the button, aligned to its right edge, and inside the window
const left = Math.max(8, Math.min(box.right - panel.offsetWidth, window.innerWidth - panel.offsetWidth - 8))
const below = box.bottom + 4 + panel.offsetHeight <= window.innerHeight
panel.style.left = `${left}px`
panel.style.top = `${below ? box.bottom + 4 : box.top - panel.offsetHeight - 4}px`
this.buttonTarget.setAttribute('aria-expanded', 'true')
document.addEventListener('click', this.onOutside, true)
document.addEventListener('keydown', this.onKey)
// capture: scroll events don't bubble, and the scrolling box may be any ancestor
document.addEventListener('scroll', this.onScroll, true)
window.addEventListener('resize', this.onResize)
this.items()[0]?.focus({ preventScroll: true })
}
close () {
if (this.panelTarget.hidden) {
return
}
this.panelTarget.hidden = true
this.buttonTarget.setAttribute('aria-expanded', 'false')
document.removeEventListener('click', this.onOutside, true)
document.removeEventListener('keydown', this.onKey)
document.removeEventListener('scroll', this.onScroll, true)
window.removeEventListener('resize', this.onResize)
}
// an item was chosen: it does its own work (htmx, link), the menu only closes
choose () {
this.close()
}
key (event) {
const items = this.items()
const index = items.indexOf(document.activeElement)
if (event.key === 'Escape') {
event.stopPropagation()
this.close()
this.buttonTarget.focus()
} else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
event.preventDefault()
const next = (index + (event.key === 'ArrowDown' ? 1 : -1) + items.length) % items.length
items[next]?.focus()
}
}
items () {
return [...this.panelTarget.querySelectorAll('a, button:not([disabled])')]
}
}
@@ -1,16 +0,0 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static outlets = [ 'mobilenav' ]
static classes = [ 'closed' ]
trigger({ params: { mode } }) {
this.mobilenavOutlet.toggle(mode)
}
toggle(mode) {
// Add animation classes only now to avoid fouc
this.element.classList.add('transition-transform', 'duration-300')
this.element.classList.toggle(this.closedClass, 'close' === mode)
}
}
@@ -1,30 +0,0 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static classes = ['closed', 'iconClosed', 'iconExpanded']
static targets = ['submenu', 'button', 'icon']
static values = { expanded: Boolean }
toggleSubmenu() {
this.expandedValue = !this.expandedValue
}
expandedValueChanged(expanded) {
this.submenuTarget.classList.toggle(this.closedClass, false === expanded)
if (false === this.hasButtonTarget) {
return
}
this.buttonTarget.setAttribute('aria-expanded', expanded)
if (false === this.hasIconTarget) {
return
}
if (true === expanded) {
this.iconTarget.classList.add(...this.iconExpandedClasses)
this.iconTarget.classList.remove(...this.iconClosedClasses)
} else {
this.iconTarget.classList.add(...this.iconClosedClasses)
this.iconTarget.classList.remove(...this.iconExpandedClasses)
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 500 153" xmlns="http://www.w3.org/2000/svg"><g fill="#0084d4"><path d="m332.922 85.597c4.527 0 7.819 3.292 7.819 7.819 0 4.115-2.675 6.79-5.762 7.613l6.791 11.934h-3.704l-6.379-11.523h-7.613v11.523h-3.292v-27.366zm-8.642 12.963h8.642c2.469 0 4.527-2.058 4.527-5.144 0-3.293-2.264-5.144-5.35-5.144h-7.819z" fill-rule="nonzero"/><path d="m374.28 85.597v2.88h-15.432v9.877h13.374v2.881h-13.374v9.053h15.843v2.675h-19.135v-27.366z" fill-rule="nonzero"/><path d="m389.095 85.597h3.292v27.366h-3.292z"/><path d="m406.79 111.317.823-2.675c1.029.411 4.733 1.852 8.436 1.852 4.527 0 6.791-1.852 6.791-4.527 0-3.498-3.498-4.321-6.996-5.35-4.321-1.234-8.848-2.675-8.848-8.024 0-4.939 3.704-7.408 9.259-7.408 3.292 0 6.79 1.029 8.642 1.852l-.823 2.675s-4.115-1.646-7.613-1.646c-3.704 0-6.173 1.852-6.173 4.527 0 3.292 3.704 4.321 6.996 5.349 4.321 1.235 8.848 2.675 8.848 8.025 0 5.144-4.116 7.407-9.671 7.407-4.321 0-8.025-1.234-9.671-2.057z" fill-rule="nonzero"/><path d="m458.848 85.597v2.88h-15.432v9.877h13.374v2.881h-13.374v9.053h15.843v2.675h-19.136v-27.366z" fill-rule="nonzero"/><path d="m476.955 85.597 8.642 12.963 5.967 9.259-.206-9.259v-12.963h3.292v27.366h-3.498l-8.642-13.375-5.761-9.053.206 9.259v13.169h-3.292v-27.366z" fill-rule="nonzero"/><path d="m339.712 123.663v2.88h-15.432v9.877h13.374v2.88h-13.374v9.054h15.843v2.881h-19.135v-27.572z" fill-rule="nonzero"/><path d="m352.263 123.663 8.231 23.251 8.23-23.251h3.498l-9.876 27.366h-3.704l-9.877-27.366z" fill-rule="nonzero"/><path d="m401.44 123.663v2.88h-15.432v9.877h13.375v2.88h-13.375v9.054h15.844v2.881h-19.136v-27.572z" fill-rule="nonzero"/><path d="m416.872 123.663 8.642 12.963 5.967 9.259-.205-9.259v-12.963h3.292v27.366h-3.498l-8.642-13.375-5.761-9.053.205 9.259v13.169h-3.292v-27.366z" fill-rule="nonzero"/><path d="m466.872 123.457v3.086h-9.259v24.486h-3.292v-24.692h-9.259v-2.88z" fill-rule="nonzero"/><path d="m475.309 149.177.823-2.675c1.028.412 4.732 1.852 8.436 1.852 4.527 0 6.79-1.852 6.79-4.527 0-3.498-3.498-4.321-6.996-5.35-4.321-1.234-8.848-2.675-8.848-8.024 0-4.939 3.704-7.408 9.26-7.408 3.292 0 6.79 1.029 8.642 1.852l-.823 2.675s-4.116-1.646-7.614-1.646c-3.703 0-6.172 1.852-6.172 4.527 0 3.292 3.703 4.321 6.995 5.349 4.321 1.235 8.848 2.675 8.848 8.025 0 5.144-4.115 7.408-9.671 7.408-4.115 0-8.024-1.235-9.67-2.058z" fill-rule="nonzero"/><path d="m367.695 1.852v10.905h-33.333v17.078h28.395v11.112h-28.395v15.637h33.951v10.906h-47.12v-65.638z" fill-rule="nonzero"/><path d="m418.93 16.255c0 5.556-3.292 11.729-10.7 16.255l11.317 13.169s2.264-4.115 2.264-9.465h9.876c-.206 10.082-4.938 17.901-4.938 17.901l12.14 13.992h-14.609l-4.938-5.761c-4.527 3.909-10.494 6.173-17.284 6.173-12.346 0-23.457-7.202-23.457-20.782 0-8.848 5.761-14.404 11.728-18.519-3.292-4.321-5.761-7.202-5.761-12.963 0-11.317 9.465-15.638 16.872-15.638 7.408 0 17.49 4.321 17.49 15.638zm-28.189 31.276c0 6.173 4.526 10.082 11.728 10.082 3.704 0 6.996-1.029 9.671-3.292l-14.403-16.667c-4.116 2.264-6.996 5.35-6.996 9.877zm5.967-30.659c0 3.293 2.057 5.144 4.321 7.614 3.704-1.646 6.378-4.527 6.378-7.819 0-3.91-2.674-5.35-5.349-5.35-3.498 0-5.35 2.263-5.35 5.555z" fill-rule="nonzero"/><path d="m479.424 1.852c11.111 0 20.164 9.259 20.164 20.988 0 12.551-9.053 21.399-19.958 21.399h-15.844v23.456h-13.169v-65.843zm-15.638 31.276h13.169c6.173 0 9.671-4.527 9.671-10.288 0-7.202-5.556-9.877-10.7-9.877h-12.14z" fill-rule="nonzero"/><path d="m220.165.617c-74.898 11.317-167.902 39.301-167.902 78.601 0 36.42 86.009 27.161 86.009 27.161s-137.86 45.884-137.86-14.404c0-68.312 173.868-91.358 219.753-91.358z" fill-rule="nonzero"/></g><path d="m34.979 151.235c74.898-11.112 167.902-39.301 167.902-78.601 0-36.42-86.009-27.161-86.009-27.161s137.861-45.885 137.861 14.404c0 68.518-173.869 91.358-219.754 91.358z" fill="#f8c62f" fill-rule="nonzero"/><path d="m124.897 70.576-26.337 8.231 25.103 1.646-.823-4.939z" fill="#0084d4" fill-rule="nonzero"/><path d="m156.173 72.428-18.93 5.967-7.202 19.959-3.498-23.251 8.231-22.017 3.498 16.256z" fill="#f8c62f" fill-rule="nonzero"/></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

+64
View File
@@ -0,0 +1,64 @@
/* Admin-only additions to ep-design.css, built on its tokens */
@layer base {
.htmx-indicator {
@apply invisible;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
@apply visible;
}
/* checked boxes and radios in the brand colour (@tailwindcss/forms fills them with currentColor) */
[type="checkbox"],
[type="radio"] {
@apply text-brand;
}
/* thin scrollbars without a track for inner scrolling areas, as in app.css */
body * {
scrollbar-width: thin;
scrollbar-color: var(--color-line) transparent;
}
}
@layer components {
.badge {
@apply inline-flex items-center px-1.5 py-0.5 text-xs font-bold whitespace-nowrap;
}
.tippy-box {
@apply bg-brand;
}
.tippy-box[data-placement^='top'] > .tippy-arrow::before {
border-top-color: var(--color-brand);
}
.tippy-box[data-placement^='bottom'] > .tippy-arrow::before {
border-bottom-color: var(--color-brand);
}
.tippy-box[data-placement^='left'] > .tippy-arrow::before {
border-left-color: var(--color-brand);
}
.tippy-box[data-placement^='right'] > .tippy-arrow::before {
border-right-color: var(--color-brand);
}
}
/* a list in a card, scrolling sideways when it is wider than the content column */
@layer components {
.data-table-wrapper {
@apply mb-8 overflow-x-auto border border-line bg-white;
}
.data-table-wrapper__inner {
@apply min-w-full align-middle;
}
.data-table tbody tr {
@apply hover:bg-brand-light/50;
}
}
-10
View File
@@ -1,10 +0,0 @@
@import "./components/autocomplete.css";
@import "./components/badge.css";
@import "./components/button.css";
@import "./components/datatable.css";
@import "./components/datepicker.css";
@import "./components/forms.css";
@import "./components/pagination.css";
@import "./components/toast.css";
@import "./components/tooltip.css";
@import "./components/typography.css";
+11 -3
View File
@@ -1,4 +1,12 @@
/* The admin in the E&P corporate design; shares nothing with app.css, so the frontend stays as it is */
@import "tailwindcss" source(none);
@import "./_theme.css";
@import "./_base.css" layer(base);
@import "./_components_admin.css" layer(components);
@import "toastify-js/src/toastify.css" layer(base);
@import "tippy.js/dist/tippy.css" layer(base);
@import "./ep-design.css";
@import "./_admin.css";
@source "../../templates";
@source "../../src";
@source "../../assets";
@plugin "@tailwindcss/forms";
+377
View File
@@ -0,0 +1,377 @@
/*
* E&P corporate design for the internal Symfony tools, taken from the E&P apps template (Gitea EP/apps,
* frontend/app/globals.css, frontend/components/): Lato, deep blue as the brand colour, magenta only
* for the one main action of a page, square shapes, light blue page.
* Status colours (green, red, amber) always come with text, never alone.
*
* Import after Tailwind: @import "tailwindcss"; @import "./ep-design.css"; @plugin "@tailwindcss/forms";
* The toast styles expect toastify-js, imported into the base layer before this file:
* @import "toastify-js/src/toastify.css" layer(base); unlayered (or through its own <link>), its
* colours and gradient beat these layered styles whatever their specificity.
*/
/*
* Lato (OFL) ships with the app, so browsers load nothing from Google: 400 (and italic), 700, 900. No 600:
* font-semibold renders as 700, like font-bold; font-black is 900. The weights are not remapped.
*/
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("../fonts/lato-400.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("../fonts/lato-400-italic.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("../fonts/lato-700.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("../fonts/lato-900.woff2") format("woff2");
}
@theme {
--font-sans: "Lato", ui-sans-serif, system-ui, sans-serif;
/* square everywhere; rounded-full stays round. Plain `rounded` reads --radius. */
--radius: 0px;
--radius-xs: 0px;
--radius-sm: 0px;
--radius-md: 0px;
--radius-lg: 0px;
--radius-xl: 0px;
--radius-2xl: 0px;
--radius-3xl: 0px;
--radius-4xl: 0px;
--color-brand: #18527b; /* E&P deep blue, 8.5:1 on white */
--color-brand-dark: #103c5b;
--color-brand-mid: #165883;
--color-brand-bright: #009fff; /* underlines and focus, never text */
--color-brand-light: #e3eef8;
--color-page: #ebf3fa; /* page background */
--color-line: #d8e3ed; /* borders */
--color-ink: #27272a; /* text */
--color-muted: #52525b; /* secondary text, 7.7:1 on white */
--color-accent: #c4097c; /* magenta of the main action */
--color-accent-from: #960167;
--color-accent-to: #fa1a8c;
}
/*
* Tailwind 3 defaults that Tailwind 4 changed: borders were a light gray instead of currentColor,
* and buttons had a pointer cursor.
*/
@layer base {
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-line, currentcolor);
}
button:not(:disabled),
[role="button"]:not(:disabled) {
cursor: pointer;
}
/* text size of every E&P app: 14px; text-base (16px) and up only for headings */
body {
font-size: var(--text-sm);
line-height: var(--text-sm--line-height);
}
/* modals: centred (Preflight resets the browser's margin: auto), the page behind dimmed and blurred */
dialog:modal {
margin: auto;
max-height: 85vh;
}
dialog::backdrop {
background: rgb(39 39 42 / 0.35);
backdrop-filter: blur(3px);
}
/* visible keyboard focus everywhere (WCAG 2.4.7) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
outline: 3px solid var(--color-brand-bright);
outline-offset: 2px;
}
}
/*
* Components as in the apps template (frontend/components/ui.ts, Field.tsx, Alert.tsx). Magenta
* only for the one main action of a page.
*/
@layer components {
.btn,
.btn-primary,
.btn-secondary {
@apply inline-flex items-center justify-center gap-2 px-4 py-2.5 text-xs font-bold uppercase tracking-wide no-underline transition-colors disabled:cursor-not-allowed;
}
.btn-primary {
@apply text-white;
background-image: linear-gradient(120deg, var(--color-accent-from), #9e036a 40%, var(--color-accent-to));
}
.btn-primary:hover {
background-image: linear-gradient(120deg, #7d0156, #8a035d 40%, #e3107c);
}
.btn-primary:disabled {
background-image: none;
background-color: #64748b;
}
.btn-secondary {
@apply border border-brand bg-white text-brand hover:bg-brand hover:text-white;
}
/* small actions in toolbars and on cards, next to the one main action */
.btn-tool {
@apply inline-flex items-center gap-1 rounded border border-line bg-white px-2 py-1 text-sm text-ink hover:border-brand hover:text-brand disabled:cursor-default disabled:border-line disabled:text-gray-400;
}
/* the "⋯" behind which the actions of a card or row wait (menu_controller.js); finger-sized on touch screens */
.btn-more {
@apply inline-flex h-6 w-6 pointer-coarse:h-10 pointer-coarse:w-10 shrink-0 items-center justify-center rounded text-muted hover:bg-page hover:text-brand aria-expanded:bg-page aria-expanded:text-brand;
}
.menu-panel {
@apply fixed z-40 min-w-48 border border-line bg-white py-1 text-sm shadow-lg;
}
.menu-item {
@apply block w-full px-3 py-1.5 pointer-coarse:py-3 text-left text-ink no-underline hover:bg-page hover:text-brand focus:bg-page;
}
.menu-item-danger {
@apply block w-full px-3 py-1.5 pointer-coarse:py-3 text-left text-red-800 hover:bg-page hover:text-red-900 focus:bg-page;
}
.input {
@apply block w-full border border-slate-500 bg-white px-3 py-2 text-sm text-slate-900 placeholder:text-slate-500 focus:border-brand-bright aria-[invalid=true]:border-red-700 aria-[invalid=true]:ring-1 aria-[invalid=true]:ring-red-700 disabled:bg-slate-100 disabled:text-slate-600;
}
.field-label {
@apply block text-xs font-bold uppercase tracking-wide text-slate-700;
}
/* white box on the light blue page */
.card {
@apply border border-line bg-white;
}
.section-title {
@apply text-base font-bold uppercase tracking-wide text-brand;
}
/* a row of tabs; the base line is an inset shadow, so a row that scrolls sideways doesn't scroll vertically too */
.tabs {
@apply flex overflow-x-auto shadow-[inset_0_-1px_0_var(--color-line)];
}
.tab {
@apply shrink-0 whitespace-nowrap border-b-4 border-transparent px-3 py-2 text-sm text-ink no-underline hover:text-brand;
}
.tab[aria-current],
.tab[aria-selected="true"] {
@apply border-brand-bright font-bold text-brand;
}
/* the main views as tabs in the header (_partials/_header.html.twig), for apps with few views */
.header-tab {
@apply flex items-center whitespace-nowrap border-b-4 border-transparent px-3 text-ink no-underline hover:text-brand;
}
.header-tab[aria-current] {
@apply border-brand-bright font-bold text-brand;
}
/*
* Sidebar navigation for apps with many views (_partials/_sidebar_menu.html.twig): on the light
* blue page, the current item is a white box.
*/
.sidebar-heading {
@apply px-2 pt-5 pb-1 text-[11px] font-bold uppercase tracking-wide text-muted;
}
.sidebar-link {
@apply flex w-full items-center gap-x-3 p-2 text-left text-sm leading-6 font-bold text-ink no-underline hover:bg-white/60 hover:text-brand;
}
.sidebar-sublink {
@apply block py-2 pr-2 pl-10 text-sm leading-6 text-ink no-underline hover:bg-white/60 hover:text-brand;
}
:is(.sidebar-link, .sidebar-sublink)[aria-current],
.sidebar-link--ancestor {
@apply bg-white text-brand;
}
.sidebar-group > summary {
@apply list-none;
}
.sidebar-group > summary::-webkit-details-marker {
display: none;
}
/* chevron of a group that opens in place */
.sidebar-group > summary::after {
@apply ml-auto size-2 shrink-0 rotate-45 border-r-2 border-b-2 border-current opacity-60 transition-transform content-[''];
}
.sidebar-group[open] > summary::after {
@apply -rotate-135;
}
/* the navigation (sidebar or header tabs) as a drawer from the left on small screens (drawer_controller.js) */
dialog.drawer {
@apply m-0 h-dvh max-h-none w-80 max-w-[calc(100vw-4rem)] bg-page p-0;
}
/*
* a modal dialog doesn't stop the page behind it from scrolling: on touch screens the page took the
* gesture first, and a long navigation in the drawer only scrolled once the page was at its end.
* Only for the drawer: locking for every dialog:modal would hide the page's scrollbar under a
* desktop modal and shift the layout sideways.
*/
html:has(dialog.drawer:modal) {
@apply overflow-hidden;
}
/* lists in a card: the outer cells line up with the card's padding */
.data-table {
@apply w-full;
}
.data-table thead tr {
@apply border-b-2 border-brand text-left text-[11px] font-bold uppercase tracking-wide text-brand;
}
.data-table th {
@apply px-2 py-2;
}
.data-table td {
@apply px-2 py-1.5;
}
.data-table :is(th, td):first-child {
@apply pl-5;
}
.data-table :is(th, td):last-child {
@apply pr-5;
}
.data-table tbody tr {
@apply border-b last:border-b-0;
}
/*
* Lists of entries in a card, as on a dashboard (components/dashboard/): one line per entry, the
* whole line is the link or button, its parts separated by a dot, the text cut off with "…".
*/
.entry-list {
@apply divide-y divide-line;
}
.entry-list > li {
@apply py-2 first:pt-0 last:pb-0;
}
/* a work queue that would otherwise grow the card without limit; keep it rare, it scrolls awkwardly on phones */
.entry-list--scroll {
@apply max-h-64 overflow-y-auto pr-3;
}
.entry-link {
@apply flex w-full min-w-0 items-center gap-1.5 text-left text-ink no-underline;
}
:is(a, button).entry-link {
@apply hover:text-brand;
}
.entry-link > * {
@apply shrink-0;
}
/* the text after the icon: one line, cut off as a whole with "…" */
.entry-text {
@apply min-w-0 shrink truncate;
}
/* icons and dots inside the text flow with it (Tailwind's preflight makes svg a block) */
.entry-text :is(svg, img) {
@apply inline-block align-middle;
}
.entry-dot {
@apply text-muted;
}
/* notices (_partials/_alert.html.twig): light, with a coloured bar on the left */
.notice {
@apply border-l-4 px-4 py-2;
}
/* toasts (toast_controller.js) in the colours of the notices */
.toastify {
@apply max-w-sm rounded-none border-l-4 bg-none px-4 py-3 text-sm shadow-lg;
}
.toastify--success {
@apply border-emerald-700 bg-emerald-50 text-emerald-950;
}
.toastify--error {
@apply border-red-700 bg-red-50 text-red-950;
}
.toastify--warning {
@apply border-amber-600 bg-amber-50 text-amber-950;
}
.toastify--info {
@apply border-brand bg-brand-light text-ink;
}
.toastify .toast-close {
@apply ml-3 text-current opacity-60 hover:opacity-100;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
Generated
+510 -246
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1,3 +1,3 @@
knp_menu:
twig:
template: _partials/_menu.html.twig
template: admin/_partials/_sidebar_menu.html.twig
+3
View File
@@ -426,6 +426,9 @@ services:
App\BpnConnect\TravelsClient:
parent: App\BpnConnect\AbstractApiClient
App\BpnConnect\RoomsClient:
parent: App\BpnConnect\AbstractApiClient
App\ClickUp\ApiClient:
arguments:
$apiToken: '%env(default::CLICKUP_API_TOKEN)%'
+9
View File
@@ -268,6 +268,14 @@ page-consistency rule as `GET /api/exports/travels` above; only the rows differ.
`Buchungsstop` rooms and services, rooms without a price and boarding points with id `0` are all emitted. Which of
them a website shows, and how, is the client's rule, not this endpoint's.
**Which rooms can be booked.** Each room carries `bookable`, the one derived field: `true` exactly when the
booking flow offers the room for a new booking. That is status `Frei` with `available` above 0. A room on request
(`Anfrage`) is not bookable even with rooms left, because booking it would only produce an inquiry, unless its
`code` ends in `Anf` (case-sensitive, e.g. `6erSDAnf`): the office sells such a room on request on purpose, it is
`bookable`, and booking it makes the whole booking an inquiry. No room with `available` 0 or `null` is bookable. Show a room that is not bookable as sold out and do not count it towards places
or the "ab" price. Read `bookable` rather than deriving it from `status` and `available`, so a change to the rule
reaches you without a client change.
At current volumes the export is ~420 rows and ~3.8 MB of JSON (a row is 4–24 kB), so the default `perPage=500`
returns it in one page.
@@ -313,6 +321,7 @@ returns it in one page.
"price": 229,
"available": 24,
"status": "Frei",
"bookable": true,
"boardCode": "Lt. Auss.",
"boardBusProId": 2
}
+27 -3
View File
@@ -181,15 +181,37 @@ JOIN dbo.PartnerPreis pp ON pp.IDPartnerPreisKategorie_FS=pk.IDPartnerPreisKateg
WHERE pk.IDAdresse_FS=@HotelAddressId AND pk.IDArtPartnerPreisCode_FS=@PriceCode
AND pk.IDArtVerpflegung_FS=@BoardId AND pk.EK_VK='VK'
AND pp.IDPartnerSaisonTafel_FS=@SaisonTafelId AND pp.Naechte=@Nights;
-- room availability (flat, reproducible)
-- room allotment (remaining = allotment − bookings, computed by BusPro; see below)
SELECT IDZimmer_FS,Anzahl,BuchungsStatus FROM dbo.PartnerKontingent
WHERE IDAdresse_FS=@HotelAddressId AND IDZimmer_FS=@ZimmerartId
AND TerminVon<=@Abreise AND TerminBis>=@Anreise;
```
- V: `EK_VK` = `EK` purchase / `VK` sale. **Always filter `VK`** for customer prices.
- V: `PartnerKontingent.Anzahl` IS the available room count. Gate with `BuchungsStatus`
(`''` bookable, `S` stop, `A` on request).
- V 2026-11-11: `PartnerKontingent.Anzahl` is the room **allotment**, not what is left
(hotel 163113, room type 2366: `Anzahl=6` while the export reported `verfuegbar="1"`).
BusPro computes the remaining count; read it from the export, not from this table. Gate with
`BuchungsStatus` (`''` bookable, `S` stop, `A` on request).
- V 2026-11-11: **pooled room contingents.** `PartnerZimmer.IDPartnerZimmer_FS_KontiAus`
points at the `PartnerZimmer` (same hotel) whose contingent a room type uses; `0` = own.
Used for selling one room at several occupancies ("Unterbelegung"): at hotel 163113 room
types 2367–2369 (7/6/5 pax) point at `PartnerZimmer` 8709 (2366, 8 pax). Only the parent
has `PartnerKontingent` rows; the export reports the parent's remaining count on every room
of the pool. The link is per hotel × room type (the same `Zimmerart` ids recur at other
hotels), and room codes do not reveal it. `Zimmerart.Teilzimmer`/`TeilzimmerAus` were 0 for
all four rooms and are not this link.
```sql
-- room type → room type owning its contingent, one hotel
SELECT pz.IDZimmerart_FS, COALESCE(m.IDZimmerart_FS, pz.IDZimmerart_FS) AS PoolZimmerart
FROM dbo.PartnerZimmer pz
LEFT JOIN dbo.PartnerZimmer m ON m.IDPartnerZimmer = pz.IDPartnerZimmer_FS_KontiAus
WHERE pz.IDAdresse_FS = @HotelAddressId;
```
- V 2026-11-11: BusPro's booking check does not sum a booking's rooms per pool. One booking with two room
types of one pool is accepted against a remaining count of 1 and drives it to −1
(2026-11-11, travel 1591, rooms 2366 + 2367).
- A: `PartnerZimmer.PreisJeZimmer` flags per-room vs per-person. Observed booking
responses returned the room price **per person** — check the flag before multiplying.
- Service availability is a different, harder problem — see A10.
@@ -326,6 +348,8 @@ guides · `Kalkulation*`/`VorplanungRaster*` costing and pre-planning.
- `BuchungTNZuschlag` holds the departure surcharge. → `ArtZuschlag` has no such entry (A7).
- `sys.objects.create_date` shows when a table was added. → Every object reported the same
date: that of the last DB restore. Use `modify_date` after the restore instead.
- `PartnerKontingent.Anzahl` is the remaining room count. → Hotel 163113, room type 2366:
`Anzahl=6` against export `verfuegbar="1"` on the same day (A6). It is the allotment.
# A12. Maintenance
+10 -6
View File
@@ -261,15 +261,18 @@ WHERE pk.IDAdresse_FS = @HotelAddressId
> customer price. `PartnerZimmer.PreisJeZimmer` flags per-room vs. per-person pricing.
```sql
-- availability (XML 'verfuegbar') — VALIDATED: = PartnerKontingent.Anzahl for the
-- (hotel, room-type, date-span). IDZimmer_FS = the XML idbuspro_zimmer (a Zimmerart).
-- Sample: IDAdresse_FS=224923, IDZimmer_FS=1413, 2026-12-11 → Anzahl=25 = XML verfuegbar.
-- allotment behind XML 'verfuegbar' for the (hotel, room-type, date-span).
-- IDZimmer_FS = the XML idbuspro_zimmer (a Zimmerart). Anzahl is the allotment, NOT what is
-- left: 2026-11-11, hotel 163113 / 2366 → Anzahl=6 against XML verfuegbar=1. The earlier
-- sample 224923 / 1413 / 2026-12-11 (Anzahl=25 = verfuegbar) presumably had no bookings yet.
SELECT IDZimmer_FS, Anzahl, BuchungsStatus FROM dbo.PartnerKontingent
WHERE IDAdresse_FS = @HotelAddressId
AND IDZimmer_FS = @ZimmerartId -- the room type (XML idbuspro_zimmer)
AND TerminVon <= @Abreise AND TerminBis >= @Anreise;
```
> `verfuegbar` is a **flat column** (`PartnerKontingent.Anzahl`) — reproducible by SQL.
> `verfuegbar` is **computed** by BusPro: allotment minus bookings (see
> `live-api-queries.md`), and for a pooled room type the parent's figure
> (`PartnerZimmer.IDPartnerZimmer_FS_KontiAus`, `buspro-database-reference.md` A6).
> Gate it with `BuchungsStatus` (`''` bookable, `S` stop, `A` on-request).
> `<abpreis>` (the headline "from" price) is still **computed** (cheapest valid room +
> mandatory services) — recompute in the proxy from the per-room prices above.
@@ -298,8 +301,9 @@ ORDER BY gs.Position, sg.Position;
4. ~~**Partner room pricing**~~ — ✅ fully validated end-to-end: room `1413` (MBZ) →
code `38` → category `9478` → season `15420` × `Naechte=2` × `VK` × schema `1` =
**`269,00`**. (XML `abpreis 289,00` = room + mandatory services = computed.)
5. ~~**`verfuegbar`**~~ — ✅ flat: `PartnerKontingent.Anzahl` for `(IDAdresse_FS, IDZimmer_FS,
date-span)`; `1413 / 2026-12-11 → 25`. `<abpreis>` remains computed (recompute in proxy).
5. **`verfuegbar`** — computed, not flat (corrected 2026-11-11): `PartnerKontingent.Anzahl`
is the allotment; `1413 / 2026-12-11 → 25` presumably matched because nothing was booked
yet. `<abpreis>` remains computed (recompute in proxy).
6. ~~**Minimum-services filter**~~ — ✅ defined: "included services" =
(A2a) `Leistung`s with sales price `0.00` (schema 1) **+** (A2b) selection items from
the hardcoded "Leistungen" `Selektionsgruppenstamm` ids, merged into one plain list.
+8 -3
View File
@@ -79,9 +79,14 @@ Trip rules (`App\Chatbot\TripCatalog`):
("NEU Sportclub Lederer Wochenenden und Kurztrips", "Vacanceole Résidence L'Edelweiss"), so a hotel is
shown under its TYPO3 title, and under BusPro's name only when TYPO3 has no hotel for its code.
`query` searches both. Trips have no name in BusPro's export, only a code; their names are TYPO3's.
- A room is bookable unless its status is `Buchungsstop`. The baby row (room code `Baby`) is not a room.
`available` counts rooms, so the places of a date at a hotel are `Σ available × maxPax` over its
bookable rooms. The tools never output room counts, only `frei` or `auf Anfrage`.
- A room is listed unless its status is `Buchungsstop`. The baby row (room code `Baby`) is not a room.
A listed room is bookable when the booking flow offers it (the export's `bookable`): `Frei` with rooms
left is `frei`; `Anfrage` with rooms left and a room code ending in `Anf` (sold on request on purpose,
booking it produces an inquiry) is `auf Anfrage`. Any other room, including any other one on request, is
sold out, as the website shows it. A date at a hotel is as available as its best room; dates with only
sold-out rooms stay in `search_trips`, marked `ausgebucht`. `available` counts rooms, so the places of a
date at a hotel are `Σ available × maxPax` over its bookable rooms, and the "ab" price is the cheapest
bookable room's. The tools never output room counts, only `frei`, `auf Anfrage` or `ausgebucht`.
- `search_trips` only offers products that TYPO3 lists in its own website search (`searchable`) and does
not mark as unbookable. Closed group trips and staff trainings are `searchable: false`. `get_trip` still
answers when someone names their code.
+34
View File
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20261109074654 extends AbstractMigration
{
public function getDescription(): string
{
return 'Allows a bus-only travel mailing list next to the full one: adds bus_leg and the list name, which replaces travel_code as the unique key.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE travel_mailing_list ADD bus_leg VARCHAR(20) DEFAULT NULL, ADD name VARCHAR(64) DEFAULT NULL');
// Every existing list holds all participants and is named by its travel code alone.
$this->addSql('UPDATE travel_mailing_list SET name = travel_code');
$this->addSql('ALTER TABLE travel_mailing_list MODIFY name VARCHAR(64) NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_68DC6E285E237E06 ON travel_mailing_list (name)');
$this->addSql('ALTER TABLE travel_mailing_list DROP INDEX UNIQ_68DC6E28BC4DD335, ADD INDEX IDX_68DC6E28BC4DD335 (travel_code)');
}
public function down(Schema $schema): void
{
// Fails while a travel has two lists; delete the bus-only one first.
$this->addSql('ALTER TABLE travel_mailing_list DROP INDEX IDX_68DC6E28BC4DD335, ADD UNIQUE INDEX UNIQ_68DC6E28BC4DD335 (travel_code)');
$this->addSql('DROP INDEX UNIQ_68DC6E285E237E06 ON travel_mailing_list');
$this->addSql('ALTER TABLE travel_mailing_list DROP bus_leg, DROP name');
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20261113151744 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds the back-channel logout URL and secret to OAuth2 clients.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE oauth2_client ADD logout_url VARCHAR(255) DEFAULT NULL, ADD logout_secret VARCHAR(128) DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE oauth2_client DROP logout_url, DROP logout_secret');
}
}
@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\BpnConnect\Model;
use App\Enum\BusLeg;
readonly class TravelMailingResponse
{
/**
@@ -12,6 +14,7 @@ readonly class TravelMailingResponse
public function __construct(
public string $travelCode,
public array $data,
public ?BusLeg $busLeg = null,
) {
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace App\BpnConnect;
class RoomsClient extends AbstractApiClient
{
private const string CONTINGENT_POOLS_PATH = '/api/v1/rooms/contingent-pools';
/**
* Which room type's contingent each room type of a hotel draws on.
*
* The office sells one room at several occupancies by pointing the extra room types at the
* first one's contingent (`PartnerZimmer.IDPartnerZimmer_FS_KontiAus`). A room type with its
* own contingent maps to itself.
*
* @param int $hotelId the hotel's BusPro address id (the export's `<hotel idbuspro>`)
*
* @return array<int, int> room type id => room type id owning its contingent
*/
public function getContingentPools(int $hotelId): array
{
$payload = $this->request(self::CONTINGENT_POOLS_PATH, ['hotelId' => $hotelId]);
$pools = [];
foreach ($payload['data'] ?? [] as $item) {
$pools[(int) $item['room_type_id']] = (int) $item['pool_room_type_id'];
}
return $pools;
}
}
+24 -4
View File
@@ -4,8 +4,10 @@ declare(strict_types=1);
namespace App\BpnConnect;
use App\BpnConnect\Exception\BpnConnectException;
use App\BpnConnect\Model\TravelMailingRecipient;
use App\BpnConnect\Model\TravelMailingResponse;
use App\Enum\BusLeg;
class TravelsClient extends AbstractApiClient
{
@@ -14,13 +16,31 @@ class TravelsClient extends AbstractApiClient
/**
* An unknown travel code yields an empty list, not an error: bpn-connect cannot tell it
* apart from a travel without confirmed participants.
*
* @param ?BusLeg $busLeg only participants who booked this bus leg, plus their bookings' applicants
*/
public function getMailingRecipients(string $travelCode): TravelMailingResponse
public function getMailingRecipients(string $travelCode, ?BusLeg $busLeg = null): TravelMailingResponse
{
$payload = $this->request(self::MAILING_PATH, [
'travelCode' => $travelCode,
$query = ['travelCode' => $travelCode];
if (null !== $busLeg) {
$query['busLeg'] = $busLeg->value;
}
$payload = $this->request(self::MAILING_PATH, $query);
// A bpn-connect that predates the filter ignores the parameter and returns everyone, which
// must not end up on a list meant for bus passengers only.
$appliedBusLeg = $payload['meta']['bus_leg'] ?? null;
if ($appliedBusLeg !== $busLeg?->value) {
$this->logger->error('BpnConnect ignored the travel mailing bus filter', [
'travel_code' => $travelCode,
'requested_bus_leg' => $busLeg?->value,
'applied_bus_leg' => $appliedBusLeg,
]);
throw new BpnConnectException('BpnConnect did not apply the requested bus leg filter.');
}
$recipients = array_map(
static fn (array $item) => new TravelMailingRecipient(
email: $item['email'],
@@ -30,6 +50,6 @@ class TravelsClient extends AbstractApiClient
$payload['data'] ?? [],
);
return new TravelMailingResponse($payload['meta']['travel_code'] ?? $travelCode, $recipients);
return new TravelMailingResponse($payload['meta']['travel_code'] ?? $travelCode, $recipients, $busLeg);
}
}
@@ -153,7 +153,6 @@ class BookingDataProcessor
$roomSelection->price = $room->price;
$roomSelection->quantity = $bookingRoom->totalCount; // Actual quantity from booking XML (anzahl)
$roomSelection->capacity = $room->minPax ?? 1;
$roomSelection->maxQuantity = $bookingRoom->totalCount + ($room->available ?? 0);
$dto->roomSelections[] = $roomSelection;
}
}
@@ -341,6 +340,7 @@ class BookingDataProcessor
$this->serviceProcessor->processParticipantServices($participant, $bookingData, $travelData);
}
$this->serviceProcessor->removeCanceledParticipantsFromRooms($bookingData);
$this->serviceProcessor->removeUnusedServices($bookingData);
$this->personalDataSynchronizer->updateParticipantPersonalData(
$formData->participants,
@@ -14,8 +14,9 @@ use Psr\Log\LoggerInterface;
* Processes participant service selections for booking updates.
*
* Handles the assignment and mapping of services (additional, transportation,
* pickup, room, insurance) from participant DTOs to the booking model during
* the update request workflow.
* pickup, insurance) from participant DTOs to the booking model during the
* update request workflow. Rooms are not taken from the DTOs: they cannot be
* changed in edit mode, so the booking's own room assignments are sent back.
*/
class ParticipantServiceProcessor
{
@@ -28,7 +29,7 @@ class ParticipantServiceProcessor
* Resets all existing participant-to-service mappings to start with a clean slate.
*
* This ensures that service assignments are rebuilt from scratch based on current form selections.
* Includes resetting room mappings to allow room reassignments during edit.
* Room mappings are left alone, see removeCanceledParticipantsFromRooms().
*
* @param Booking $bookingData The booking data object containing services to reset
*/
@@ -39,7 +40,6 @@ class ParticipantServiceProcessor
...$bookingData->transportationServices,
...$bookingData->pickups,
...$bookingData->dropOffs,
...$bookingData->rooms,
...$bookingData->insurances,
];
@@ -52,7 +52,7 @@ class ParticipantServiceProcessor
* Processes all services for a single participant.
*
* This orchestrator method handles the complete service assignment workflow for one participant,
* including additional services, transportation services, pickup locations, and room assignments.
* including additional services, transportation services, pickup locations, and insurance.
*
* @param ParticipantDto $participant The participant data from the form
* @param Booking $bookingData The booking data object to update
@@ -68,7 +68,6 @@ class ParticipantServiceProcessor
$this->processTransportationServices($participant, $bookingData, $travelData);
$this->processPickupLocations($participant, $bookingData);
$this->processDropOffLocations($participant, $bookingData);
$this->processRoomAssignment($participant, $bookingData);
$this->processInsurance($participant, $bookingData, $travelData);
}
@@ -271,27 +270,23 @@ class ParticipantServiceProcessor
}
/**
* Processes room assignment for a participant.
* Removes canceled participants from the booking's room assignments.
*
* Maps the participant to their assigned room. Allows room reassignment during
* booking edits while maintaining the constraint that participants can only be
* assigned to room types that have already been booked.
* Room assignments cannot be changed in edit mode, so they are sent back as BusPro reports
* them on the booking reloaded at submit, together with its anzahl. Rebuilding them from the
* session would undo any reassignment made in BusPro while the edit was open, and send a
* zuordnung that no longer matches anzahl. Canceled participants are left out, as for every
* other service.
*
* @param ParticipantDto $participant The participant data from the form
* @param Booking $bookingData The booking data object to update
*/
private function processRoomAssignment(ParticipantDto $participant, Booking $bookingData): void
public function removeCanceledParticipantsFromRooms(Booking $bookingData): void
{
if (null === $participant->assignedRoomId) {
return;
}
// Find the room in the existing booking by ID
foreach ($bookingData->rooms as $room) {
if ($room->id === $participant->assignedRoomId) {
$room->mapping[] = $participant->index;
break;
}
$room->mapping = array_values(array_filter(
$room->mapping,
fn (int $index) => 'S' !== ($bookingData->participantsStatus[$index] ?? null)
));
}
}
+32
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\BusProNet\Model;
use App\BusProNet\Constants;
use Symfony\Component\Serializer\Attribute\Context;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
@@ -20,6 +21,37 @@ class Room
public const SELECTION_TYPE_BY_PAX = 'by_pax';
public const SELECTION_TYPE_BY_ROOM = 'by_room';
/**
* Room code suffix by which the office marks a room as deliberately sold on request.
*/
public const ON_REQUEST_CODE_SUFFIX = 'Anf';
/**
* Whether a room with this status, availability and code is offered for new bookings.
*
* 'Frei' rooms with rooms left. A room on request ('Anfrage') would turn the booking into
* an inquiry, so it is treated as sold out, unless isOnRequestByCode() says the office
* sells it that way on purpose. Static and taking the raw values so the product export
* and the chatbot, which hold rooms as arrays, apply the same rule.
*/
public static function isBookableState(?string $status, ?int $available, ?string $code): bool
{
if (($available ?? 0) <= 0) {
return false;
}
return Constants::STATUS_AVAILABLE === $status
|| (Constants::STATUS_ON_REQUEST === $status && self::isOnRequestByCode($code));
}
/**
* Whether the room code carries the on-request suffix (case-sensitive, e.g. `6erSDAnf`).
*/
public static function isOnRequestByCode(?string $code): bool
{
return null !== $code && str_ends_with($code, self::ON_REQUEST_CODE_SUFFIX);
}
#[Groups(['api:list', 'api:single', 'snapshot'])]
public ?int $id = null;
+4 -39
View File
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace App\BusProNet\Model;
use App\BusProNet\Constants;
use App\BusProNet\Traits\SortByPriceTrait;
use Symfony\Component\Serializer\Attribute\Context;
use Symfony\Component\Serializer\Attribute\Groups;
@@ -278,10 +277,10 @@ class Travel
}
/**
* Retrieves all bookable rooms (both regular and inquiry).
* Retrieves all bookable rooms.
*
* Returns rooms that have availability greater than zero and a bookable status
* (either 'Frei' for regular booking or 'Anfrage' for inquiry booking).
* Returns the rooms Room::isBookableState() accepts: status 'Frei' with rooms left, or rooms
* the office sells on request on purpose, which turn the booking into an inquiry.
*
* @return array<int, Room> The filtered array of bookable rooms, indexed by room ID
*/
@@ -289,7 +288,7 @@ class Travel
{
$result = [];
foreach ($this->rooms as $room) {
if ($room->available > 0 && $this->isBookableRoomStatus($room->status)) {
if (Room::isBookableState($room->status, $room->available, $room->code)) {
$result[$room->id] = $room;
}
}
@@ -307,40 +306,6 @@ class Travel
return [] !== $this->getAvailableRooms();
}
/**
* Checks if all bookable rooms require inquiry booking.
*
* Returns true if there are bookable rooms but none with 'Frei' status.
* This indicates the booking must be submitted as an inquiry.
*
* @return bool True if only inquiry rooms are available
*/
public function requiresInquiryBooking(): bool
{
$bookableRooms = $this->getAvailableRooms();
if ([] === $bookableRooms) {
return false;
}
foreach ($bookableRooms as $room) {
if (Constants::STATUS_AVAILABLE === $room->status) {
return false;
}
}
return true;
}
/**
* Checks if a room status allows booking.
*/
private function isBookableRoomStatus(?string $status): bool
{
return Constants::STATUS_AVAILABLE === $status
|| Constants::STATUS_ON_REQUEST === $status;
}
/**
* Retrieves a room by its ID.
*
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\BusProNet\XmlParser;
use App\BusProNet\Constants;
use App\BusProNet\Model\Room;
use Symfony\Component\DomCrawler\Crawler;
/**
@@ -61,7 +62,8 @@ class ProductExportParser extends AbstractParser
* The hotel's rooms, without the PDGS pseudo room.
*
* `available` is a count of rooms, not persons. Occupancy is read case-insensitively:
* the travel export writes `MinPax`/`MaxPax`.
* the travel export writes `MinPax`/`MaxPax`. `bookable` is the one derived field: whether
* the booking flow offers the room, so a consumer need not re-derive that rule.
*
* @return list<array<string, mixed>>
*/
@@ -76,6 +78,9 @@ class ProductExportParser extends AbstractParser
return;
}
$available = $this->getIntAttrOrNullValue($room, 'verfuegbar');
$status = $this->getAttrOrNullValue($room, 'status');
$rooms[] = [
'busProId' => $this->getIntAttrOrNullValue($room, 'idbuspro_zimmer'),
'code' => $code,
@@ -85,8 +90,9 @@ class ProductExportParser extends AbstractParser
'maxPax' => $this->getIntAttrOrNullValue($room, 'maxpax'),
'nights' => $this->getIntAttrOrNullValue($room, 'naechte'),
'price' => $this->stringToFloat($this->getAttrOrNullValue($room, 'preis')),
'available' => $this->getIntAttrOrNullValue($room, 'verfuegbar'),
'status' => $this->getAttrOrNullValue($room, 'status'),
'available' => $available,
'status' => $status,
'bookable' => Room::isBookableState($status, $available, $code),
'boardCode' => $this->getAttrOrNullValue($room, 'vpcode'),
'boardBusProId' => $this->getIntAttrOrNullValue($room, 'idbuspro_vp'),
];
+3 -5
View File
@@ -40,8 +40,6 @@ class TripCatalog
/** The feed's only language for now; trips are joined in it. */
public const LANGUAGE = 'de';
private const STATUS_FREE = 'Frei';
private const DATES_WITH_PICKUPS = 3;
private const BODY_LIMIT = 20000;
private const HOTEL_BODY_LIMIT = 8000;
@@ -571,7 +569,7 @@ class TripCatalog
*/
private function matches(array $row, TravelDateFacts $facts, ?HotelType $hotelType, TripCriteria $criteria): bool
{
if (!$facts->isBookable()) {
if (!$facts->isListed()) {
return false;
}
@@ -696,7 +694,7 @@ class TripCatalog
'board' => $room['boardCode'] ?? null,
'nights' => $room['nights'] ?? null,
'price' => $room['price'] ?? null,
'availability' => self::STATUS_FREE === ($room['status'] ?? null) ? TravelDateFacts::AVAILABILITY_FREE : TravelDateFacts::AVAILABILITY_ON_REQUEST,
'availability' => TravelDateFacts::roomAvailability($room),
], static fn (mixed $value): bool => null !== $value);
}
@@ -712,7 +710,7 @@ class TripCatalog
'hotel' => $this->hotelName($catalog, $hotel, $row),
'hotelCode' => $row['hotel']['code'],
'rooms' => $rooms,
'bookable' => [] !== $rooms,
'bookable' => [] !== array_diff(array_column($rooms, 'availability'), [TravelDateFacts::AVAILABILITY_SOLD_OUT]),
];
}
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Command;
use App\Entity\TravelMailingList;
use App\Exception\NewsletterProviderException;
use App\Repository\TravelMailingListRepository;
use App\Service\TravelMailingListManager;
@@ -39,20 +40,29 @@ class CleanupTravelMailingListsCommand extends Command
return Command::SUCCESS;
}
// A travel's lists are deleted together (see TravelMailingListManager::delete()), including
// one that is not due yet because the travel's start date moved after it was created.
$travelCodes = array_unique(array_map(static fn (TravelMailingList $mailingList) => $mailingList->getTravelCode(), $mailingLists));
$failed = 0;
foreach ($mailingLists as $mailingList) {
$deletedLists = 0;
foreach ($travelCodes as $travelCode) {
$travelLists = $this->travelMailingListRepository->findByTravelCode($travelCode);
$listIds = implode(', ', array_map(static fn (TravelMailingList $mailingList) => $mailingList->getMailjetListId(), $travelLists));
try {
$deletedContacts = $this->travelMailingListManager->delete($mailingList);
$io->writeln(sprintf('Deleted %s (list %d) and %d orphaned contact(s).', $mailingList->getTravelCode(), $mailingList->getMailjetListId(), $deletedContacts));
$deletedContacts = $this->travelMailingListManager->delete($travelLists);
$deletedLists += count($travelLists);
$io->writeln(sprintf('Deleted %s (lists %s) and %d orphaned contact(s).', $travelCode, $listIds, $deletedContacts));
} catch (NewsletterProviderException $exception) {
// The row stays, so the next run picks the list up again.
// The rows of lists not yet deleted stay, so the next run picks them up again.
++$failed;
$this->logger->error('Delete travel mailing list failed', [
'travel_code' => $mailingList->getTravelCode(),
'mailjet_list_id' => $mailingList->getMailjetListId(),
$this->logger->error('Delete travel mailing lists failed', [
'travel_code' => $travelCode,
'mailjet_list_ids' => $listIds,
'error' => $exception->getMessage(),
]);
$io->error(sprintf('%s (list %d): %s', $mailingList->getTravelCode(), $mailingList->getMailjetListId(), $exception->getMessage()));
$io->error(sprintf('%s (lists %s): %s', $travelCode, $listIds, $exception->getMessage()));
}
}
@@ -60,7 +70,7 @@ class CleanupTravelMailingListsCommand extends Command
return Command::FAILURE;
}
$io->success(sprintf('Deleted %d travel mailing list(s).', count($mailingLists)));
$io->success(sprintf('Deleted %d travel mailing list(s).', $deletedLists));
return Command::SUCCESS;
}
@@ -7,7 +7,9 @@ namespace App\Controller\Admin\TravelMailing;
use App\BpnConnect\Exception\BpnConnectException;
use App\BpnConnect\TravelsClient;
use App\BusProNet\Utility\DateCodeUtility;
use App\Entity\TravelMailingList;
use App\Exception\NewsletterProviderException;
use App\Form\Model\TravelMailingLookupDto;
use App\Repository\TravelMailingListRepository;
use App\Service\TravelDataProvider;
use App\Service\TravelMailingListManager;
@@ -39,11 +41,19 @@ class CreateListController extends AbstractController
throw $this->createAccessDeniedException('Invalid CSRF token.');
}
$travelCode = (new DateCodeUtility())->sanitize($request->request->getString('travelCode'));
$returnUrl = $this->generateUrl('app_admin_travelmailing', ['travelCode' => $travelCode]);
$lookup = new TravelMailingLookupDto();
$lookup->travelCode = (new DateCodeUtility())->sanitize($request->request->getString('travelCode'));
$lookup->busOnly = $request->request->getBoolean('busOnly');
$travelCode = $lookup->travelCode;
$busLeg = $lookup->getBusLeg();
$returnUrl = $this->generateUrl('app_admin_travelmailing', array_filter([
'travelCode' => $travelCode,
'busOnly' => $lookup->busOnly ? 1 : null,
]));
if (null !== $this->travelMailingListRepository->findOneByTravelCode($travelCode)) {
$this->addFlash('error', sprintf('Für %s gibt es bereits eine Mailjet-Liste.', $travelCode));
$name = TravelMailingList::nameFor($travelCode, $busLeg);
if (null !== $this->travelMailingListRepository->findOneByName($name)) {
$this->addFlash('error', sprintf('Die Mailjet-Liste %s gibt es bereits.', $name));
return $this->redirect($returnUrl);
}
@@ -57,7 +67,7 @@ class CreateListController extends AbstractController
// Fetched again rather than posted from the page, so the list holds what BusPro reports now.
try {
$recipients = $this->travelsClient->getMailingRecipients($travelCode)->data;
$recipients = $this->travelsClient->getMailingRecipients($travelCode, $busLeg)->data;
} catch (BpnConnectException) {
$this->addFlash('error', 'Die Teilnehmerliste konnte nicht von BusPro abgerufen werden. Bitte später erneut versuchen.');
@@ -71,7 +81,7 @@ class CreateListController extends AbstractController
}
try {
$mailingList = $this->travelMailingListManager->create($travelCode, $recipients, $travelStartsAt);
$mailingList = $this->travelMailingListManager->create($travelCode, $recipients, $busLeg, $travelStartsAt);
} catch (NewsletterProviderException $exception) {
$this->adminLogger->error('Create travel mailing list failed', [
'travel_code' => $travelCode,
@@ -85,9 +95,10 @@ class CreateListController extends AbstractController
$this->adminLogger->info('Create travel mailing list', [
'travel_code' => $travelCode,
'mailjet_list_id' => $mailingList->getMailjetListId(),
'bus_leg' => $busLeg?->value,
'recipients' => count($recipients),
]);
$this->addFlash('success', sprintf('Die Mailjet-Liste %s wurde mit %d Empfängern angelegt.', $travelCode, count($recipients)));
$this->addFlash('success', sprintf('Die Mailjet-Liste %s wurde mit %d Empfängern angelegt.', $mailingList->getName(), count($recipients)));
return $this->redirect($returnUrl);
}
@@ -7,6 +7,7 @@ namespace App\Controller\Admin\TravelMailing;
use App\BpnConnect\Exception\BpnConnectException;
use App\BpnConnect\TravelsClient;
use App\BusProNet\Utility\DateCodeUtility;
use App\Entity\TravelMailingList;
use App\Form\Admin\TravelMailingLookupType;
use App\Form\Model\TravelMailingLookupDto;
use App\Repository\TravelMailingListRepository;
@@ -39,7 +40,9 @@ class IndexController extends AbstractController
$result = null;
$travelLabel = null;
$travelStartsAt = null;
$mailingLists = [];
$mailingList = null;
$listName = null;
$failed = false;
if ($form->isSubmitted() && $form->isValid()) {
// The local index matches codes exactly, so "lpjmp-281126" has to become "LPJMP281126"
@@ -47,10 +50,17 @@ class IndexController extends AbstractController
$travelCode = (new DateCodeUtility())->sanitize((string) $lookup->travelCode);
try {
$result = $this->travelsClient->getMailingRecipients($travelCode);
$result = $this->travelsClient->getMailingRecipients($travelCode, $lookup->getBusLeg());
$travelLabel = $this->travelDataProvider->mapDateCodeToLabel($travelCode);
$travelStartsAt = $this->travelDataProvider->mapDateCodeToStartDate($travelCode);
$mailingList = $this->travelMailingListRepository->findOneByTravelCode($travelCode);
$mailingLists = $this->travelMailingListRepository->findByTravelCode($travelCode);
// The list matching the current filter, if one exists, replaces the create button.
$listName = TravelMailingList::nameFor($travelCode, $lookup->getBusLeg());
foreach ($mailingLists as $existing) {
if ($listName === $existing->getName()) {
$mailingList = $existing;
}
}
} catch (BpnConnectException) {
// The client has already logged the cause; the page only needs to say it failed.
$failed = true;
@@ -62,7 +72,9 @@ class IndexController extends AbstractController
'result' => $result,
'travel_label' => $travelLabel,
'travel_starts_at' => $travelStartsAt,
'mailing_lists' => $mailingLists,
'mailing_list' => $mailingList,
'list_name' => $listName,
'failed' => $failed,
]);
}
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Controller\Booking\Create;
use App\BusProNet\XmlLoader\AgencyLoader;
use App\Exception\BookingBackendUnavailableException;
use App\Exception\HotelNotFoundException;
use App\Exception\HotelNotInTravelException;
use App\Exception\NoRoomsAvailableException;
@@ -119,6 +120,10 @@ class IndexController extends AbstractController
} catch (TravelNotFoundException|HotelNotFoundException|HotelNotInTravelException|NoRoomsAvailableException $e) {
$this->addFlash('error', $e->getMessage());
return $this->htmxRedirect($request, $this->generateUrl('app_booking_create_error'));
} catch (BookingBackendUnavailableException) {
$this->addFlash('error', 'Unser Buchungssystem ist gerade nicht erreichbar. Bitte versuche es in ein paar Minuten erneut.');
return $this->htmxRedirect($request, $this->generateUrl('app_booking_create_error'));
}
}
@@ -13,7 +13,6 @@ use App\Htmx\HxTrait;
use App\Service\BookingConfigurator;
use App\Service\BookingCreateContextFactory;
use App\Service\BookingSessionManager;
use App\Service\RoomPricingCalculator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
@@ -66,7 +65,6 @@ class Step1Controller extends AbstractBookingCreateController
$bookingCreateDto->resetParticipantAssignments();
}
// Check if room selection forces inquiry mode
$this->bookingService->updateBookingStatusFromRoomSelection($bookingCreateDto);
$bookingCreateDto->currentStep = 2;
@@ -78,10 +76,7 @@ class Step1Controller extends AbstractBookingCreateController
return $this->redirectToRoute('app_booking_create_step_2');
}
$context = $this->createContextFactory->create(
$bookingCreateDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
$context = $this->createContextFactory->createForRoomSelection($bookingCreateDto);
return $this->render('booking/create/step_1.html.twig', [
'bookingCreateContext' => $context,
@@ -108,10 +103,7 @@ class Step1Controller extends AbstractBookingCreateController
]);
$form->handleRequest($request);
$context = $this->createContextFactory->create(
$bookingCreateDto,
RoomPricingCalculator::PRICING_MODE_SELECTION
);
$context = $this->createContextFactory->createForRoomSelection($bookingCreateDto);
// The DTO is now updated with the latest selection.
// We can now render the blocks with the fresh data.
@@ -6,6 +6,7 @@ namespace App\Controller\Booking\Create;
use App\BusProNet\Model\Travel;
use App\Entity\User;
use App\Exception\BookingBackendUnavailableException;
use App\Exception\BookingSessionNotFoundException;
use App\Exception\HotelNotInTravelException;
use App\Exception\TravelNotFoundException;
@@ -67,8 +68,19 @@ class Step2Controller extends AbstractBookingCreateController
return $redirect;
}
// Enrich with fresh availability data
$this->travelDataService->enrichWithFreshAvailabilities($bookingCreateDto->travel);
// Enrich with fresh availability data. Opening the step is the last moment before the customer
// types in participant data, so an unreachable BusPro stops them here rather than at the inquiry
// in step 3. Submitting the step stays lenient: the data is entered by then, and step 3 says so.
try {
$this->travelDataService->enrichWithFreshAvailabilities(
$bookingCreateDto->travel,
requireReachable: false === $request->isMethod(Request::METHOD_POST),
);
} catch (BookingBackendUnavailableException) {
$this->addFlash('error', 'Unser Buchungssystem ist gerade nicht erreichbar. Deine Zimmerauswahl bleibt gespeichert, bitte versuche es in ein paar Minuten erneut.');
return $this->redirectToRoute('app_booking_create_step_1');
}
// Resync the room selections with the refreshed travel before any participant count is derived
// from them, and send the customer back to step 1 when a room they picked is gone.
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Controller\Booking\Create;
use App\BusProNet\Client\BookingClient;
use App\BusProNet\Exception\ApiClientException;
use App\BusProNet\Exception\TimeoutException;
use App\BusProNet\Model\BookingResponse;
use App\BusProNet\Model\Notification;
@@ -183,7 +184,17 @@ class Step3Controller extends AbstractBookingCreateController
'exception' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
],
'Die Anfrage hat zu lange gedauert. Bitte versuche es erneut oder wende dich an den Kundenservice.',
'Die Anfrage hat zu lange gedauert. Deine Angaben bleiben gespeichert, bitte versuche es in ein paar Minuten erneut oder wende dich an den Kundenservice.',
);
} catch (ApiClientException $e) {
$this->handleApiError(
$this->logger,
'Booking inquiry failed to reach BusPro',
[
'exception' => $e->getMessage(),
'trace' => $e->getTraceAsString(),
],
'Unser Buchungssystem ist gerade nicht erreichbar. Deine Angaben bleiben gespeichert, bitte versuche es in ein paar Minuten erneut.',
);
} catch (\Exception $e) {
$this->handleApiError(
+8
View File
@@ -55,6 +55,14 @@ class Mailer
->context($context)
;
// Mailjet tracks per its account settings unless a message says otherwise: an open pixel
// and links rewritten through its redirect domain. These headers only work over SMTP - the
// Send API refuses them - and Symfony's SMTP transport passes them through untouched.
$email->getHeaders()
->addTextHeader('X-Mailjet-TrackOpen', '0')
->addTextHeader('X-Mailjet-TrackClick', '0')
;
foreach ($config['attachments'] as $attachment) {
/* @var EmailAttachmentInterface $attachment */
$attachment->attachTo($email);
+39
View File
@@ -50,6 +50,21 @@ class OAuth2Client extends AbstractClient
#[ORM\Column(type: 'json')]
private array $requiredRoles = [];
/**
* Where BackchannelLogoutListener tells this client that an account logged out of
* MyE&P. Null for a client that has no back channel, which is then simply not told.
*/
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $logoutUrl = null;
/**
* The bearer token sent with the back-channel logout call. Stored readable, unlike the
* client secret, because MyE&P is the side that sends it rather than the side that
* checks it.
*/
#[ORM\Column(type: 'string', length: 128, nullable: true)]
private ?string $logoutSecret = null;
/**
* @return list<string>
*/
@@ -67,4 +82,28 @@ class OAuth2Client extends AbstractClient
return $this;
}
public function getLogoutUrl(): ?string
{
return $this->logoutUrl;
}
public function setLogoutUrl(?string $logoutUrl): self
{
$this->logoutUrl = $logoutUrl;
return $this;
}
public function getLogoutSecret(): ?string
{
return $this->logoutSecret;
}
public function setLogoutSecret(?string $logoutSecret): self
{
$this->logoutSecret = $logoutSecret;
return $this;
}
}
+34 -2
View File
@@ -4,41 +4,63 @@ declare(strict_types=1);
namespace App\Entity;
use App\Enum\BusLeg;
use App\Repository\TravelMailingListRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* A Mailjet contact list created for one travel's participants. The row exists so the list can
* be deleted again once the travel is past; the list itself is never updated after creation.
*
* A travel can have two lists, one for all participants and one for bus passengers only, told
* apart by their name.
*/
#[ORM\Entity(repositoryClass: TravelMailingListRepository::class)]
#[ORM\Index(columns: ['travel_code'])]
class TravelMailingList
{
private const string BUS_ONLY_SUFFIX = ' nur Bus';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 32, unique: true)]
#[ORM\Column(type: 'string', length: 32)]
private string $travelCode;
/** The Mailjet list name. */
#[ORM\Column(type: 'string', length: 64, unique: true)]
private string $name;
#[ORM\Column(type: 'integer')]
private int $mailjetListId;
/** The bus leg its participants were filtered by; null when it holds all participants. */
#[ORM\Column(length: 20, nullable: true, enumType: BusLeg::class)]
private ?BusLeg $busLeg;
#[ORM\Column(type: 'datetime_immutable')]
private \DateTimeImmutable $deleteAfter;
#[ORM\Column(type: 'datetime_immutable')]
private \DateTimeImmutable $createdAt;
public function __construct(string $travelCode, int $mailjetListId, \DateTimeImmutable $deleteAfter)
public function __construct(string $travelCode, int $mailjetListId, ?BusLeg $busLeg, \DateTimeImmutable $deleteAfter)
{
$this->travelCode = $travelCode;
$this->name = self::nameFor($travelCode, $busLeg);
$this->mailjetListId = $mailjetListId;
$this->busLeg = $busLeg;
$this->deleteAfter = $deleteAfter;
$this->createdAt = new \DateTimeImmutable();
}
public static function nameFor(string $travelCode, ?BusLeg $busLeg): string
{
return null !== $busLeg ? $travelCode.self::BUS_ONLY_SUFFIX : $travelCode;
}
public function getId(): ?int
{
return $this->id;
@@ -49,11 +71,21 @@ class TravelMailingList
return $this->travelCode;
}
public function getName(): string
{
return $this->name;
}
public function getMailjetListId(): int
{
return $this->mailjetListId;
}
public function getBusLeg(): ?BusLeg
{
return $this->busLeg;
}
public function getDeleteAfter(): \DateTimeImmutable
{
return $this->deleteAfter;
+27
View File
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Enum;
/**
* Which bus leg a travel participant must have booked to be selected, as bpn-connect's travel
* mailing endpoint takes it (`busLeg`).
*/
enum BusLeg: string
{
case Outbound = 'outbound';
case Inbound = 'inbound';
case Any = 'any';
case Both = 'both';
public function label(): string
{
return match ($this) {
self::Outbound => 'Busreisende (Hinfahrt)',
self::Inbound => 'Busreisende (Rückfahrt)',
self::Any => 'Busreisende (Hin- oder Rückfahrt)',
self::Both => 'Busreisende (Hin- und Rückfahrt)',
};
}
}
@@ -39,7 +39,7 @@ class AuthorizationCodeListener
private readonly UrlGeneratorInterface $urlGenerator,
private readonly RequestStack $requestStack,
private readonly Security $security,
private readonly LoggerInterface $authenticationLogger,
private readonly LoggerInterface $authLogger,
private readonly Environment $twig,
) {
}
@@ -62,7 +62,7 @@ class AuthorizationCodeListener
Response::HTTP_TEMPORARY_REDIRECT
);
$event->setResponse($response);
$this->authenticationLogger->info('Authorization request without session');
$this->authLogger->info('Authorization request without session');
return;
}
@@ -126,7 +126,7 @@ class AuthorizationCodeListener
array $required,
string $reason,
): void {
$this->authenticationLogger->info('Authorization request denied', [
$this->authLogger->info('Authorization request denied', [
'client' => $client,
'user_id' => $user->getId(),
'required_roles' => $required,
@@ -0,0 +1,103 @@
<?php
declare(strict_types=1);
namespace App\EventListener;
use App\Entity\OAuth2Client;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\Security\Http\Event\LogoutEvent;
use Symfony\Contracts\HttpClient\Exception\ExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* Tells every client application with a back channel that an account logged out of MyE&P,
* so the application can end that account's sessions as well.
*
* Each client gets a form-encoded POST of the account's `sub` — the uuid, exactly as
* /api/userinfo exports it — authorized with the client's own logout secret. The call is
* best effort: a client that is down, slow or misconfigured is logged and skipped, because
* a failed call must never keep the user signed in to MyE&P.
*
* Only an explicit logout gets here. A session that merely expires dispatches nothing, so
* the client applications are not told about it.
*
* Runs before SessionLogoutListener (priority 0), which invalidates the session the
* `_oauth2` flag is read from.
*/
#[AsEventListener(event: LogoutEvent::class, priority: 64)]
class BackchannelLogoutListener
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly HttpClientInterface $httpClient,
private readonly LoggerInterface $authLogger,
) {
}
public function __invoke(LogoutEvent $event): void
{
$user = $event->getToken()?->getUser();
if (false === $user instanceof User) {
return;
}
// AuthorizationCodeListener logs the user out of MyE&P straight after authorizing an
// application that sent them here to sign in. Telling the applications about that
// logout would sign the user out of the very application they just signed in to.
if ($event->getRequest()->hasSession() && true === $event->getRequest()->getSession()->get('_oauth2', false)) {
return;
}
// a handful of rows, so filtered here rather than in a query
$clients = array_filter(
$this->entityManager->getRepository(OAuth2Client::class)->findAll(),
static fn (OAuth2Client $client): bool => null !== $client->getLogoutUrl(),
);
// Requests first, responses second: HttpClient sends concurrently, so a slow client
// costs its own timeout once rather than adding it to every other client's.
$responses = [];
foreach ($clients as $client) {
try {
$responses[] = [$client, $this->httpClient->request('POST', (string) $client->getLogoutUrl(), [
'auth_bearer' => (string) $client->getLogoutSecret(),
'body' => ['sub' => $user->getUuid()],
'timeout' => 3,
])];
} catch (ExceptionInterface $e) {
// a malformed URL is refused before anything is sent
$this->warn($client, $user, ['error' => $e->getMessage()]);
}
}
foreach ($responses as [$client, $response]) {
try {
$status = $response->getStatusCode();
} catch (ExceptionInterface $e) {
$this->warn($client, $user, ['error' => $e->getMessage()]);
continue;
}
if (200 !== $status) {
$this->warn($client, $user, ['status' => $status]);
}
}
}
/**
* @param array<string, mixed> $context
*/
private function warn(OAuth2Client $client, User $user, array $context): void
{
$this->authLogger->warning('Back-channel logout failed', [
'client' => $client->getName(),
'user_id' => $user->getId(),
] + $context);
}
}
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace App\Exception;
/**
* Thrown when BusPro cannot be reached at a point where the booking flow must not continue without it.
*
* The flow can render most steps from XML export and snapshot data, but the inquiry in step 3 and the
* booking itself always need BusPro. Failing before the customer types in participant data is kinder
* than failing after.
*/
class BookingBackendUnavailableException extends \RuntimeException
{
}
+6 -1
View File
@@ -6,13 +6,14 @@ namespace App\Form\Admin;
use App\Form\Model\TravelMailingLookupDto;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Submits as GET with an empty block prefix, so a lookup is the plain URL `?travelCode=…`
* and can be bookmarked or shared.
* (plus `&busOnly=1`) and can be bookmarked or shared.
*
* @extends AbstractType<TravelMailingLookupDto>
*/
@@ -26,6 +27,10 @@ class TravelMailingLookupType extends AbstractType
'placeholder' => 'z. B. LPJMP281126',
],
]);
$builder->add('busOnly', CheckboxType::class, [
'label' => 'nur '.TravelMailingLookupDto::BUS_LEG->label(),
'required' => false,
]);
}
public function configureOptions(OptionsResolver $resolver): void
+35
View File
@@ -3,14 +3,22 @@
namespace App\Form;
use App\Form\Model\BookingDto;
use App\Service\RoomContingentPoolResolver;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
/** @extends AbstractType<BookingDto> */
class BookingCreateStep1Type extends AbstractType
{
public function __construct(
private readonly RoomContingentPoolResolver $poolResolver,
) {
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
@@ -28,6 +36,33 @@ class BookingCreateStep1Type extends AbstractType
;
}
/**
* Caps the step buttons of rooms sharing a contingent at what the other rooms leave of it.
*
* Runs on every render, including the htmx refresh after each change, so selecting one room
* of a pool locks the others once the pool is used up. Only the view changes: the choices
* keep the room's own count, and RoomSelectionValidator stays the check on submit.
*/
public function finishView(FormView $view, FormInterface $form, array $options): void
{
$bookingDto = $form->getData();
$selectionViews = $view['roomSelections'];
foreach ($this->poolResolver->findSharedPools($bookingDto->travel) as $pool) {
$remaining = max(0, $pool->getAvailable() - $pool->getSelectedQuantity($bookingDto->roomSelections));
foreach (array_keys($pool->rooms) as $roomId) {
if (!isset($selectionViews[$roomId]) || !isset($selectionViews[$roomId]['quantity'])) {
continue;
}
$quantityView = $selectionViews[$roomId]['quantity'];
$quantity = $bookingDto->roomSelections[$roomId]->quantity ?? 0;
$quantityView->vars['max_value'] = min($quantityView->vars['max_value'], $quantity + $remaining);
}
}
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
+4
View File
@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Form\Model;
use App\Model\RoomContingentPool;
/**
* Bundles the data needed to render the booking create flow.
*/
@@ -12,6 +14,7 @@ class BookingCreateContext
/**
* @param array<int, ParticipantCardDataDto>|null $cardsData
* @param array<int, float>|null $participantPrices
* @param array<int, RoomContingentPool> $roomContingentPools shared pools by member room id, step 1 only
*/
public function __construct(
public readonly BookingDto $bookingDto,
@@ -21,6 +24,7 @@ class BookingCreateContext
public readonly bool $isSubmitted = false,
public readonly ?array $participantPrices = null,
public readonly bool $familyInsuranceUpgradeAvailable = false,
public readonly array $roomContingentPools = [],
) {
}
}
+2 -2
View File
@@ -60,8 +60,8 @@ class BookingDto
/**
* Booking status the travel itself calls for when the booking starts, before any room is
* selected and before the create-flow status rules run. Step 1 falls back to it whenever
* no on-request room is selected, so the status can move back from 'A'.
* selected and before the create-flow status rules run. Step 1 falls back to it, so an 'A'
* from the Step 3 BusPro fallback is cleared when the rooms change.
*
* Null in sessions started before it was introduced.
*/
+13
View File
@@ -4,10 +4,23 @@ declare(strict_types=1);
namespace App\Form\Model;
use App\Enum\BusLeg;
use Symfony\Component\Validator\Constraints as Assert;
class TravelMailingLookupDto
{
/**
* The leg "bus passengers only" stands for: whoever takes the bus out, whatever their return.
*/
public const BusLeg BUS_LEG = BusLeg::Outbound;
#[Assert\NotBlank(message: 'Bitte einen Reisecode angeben.')]
public ?string $travelCode = null;
public bool $busOnly = false;
public function getBusLeg(): ?BusLeg
{
return $this->busOnly ? self::BUS_LEG : null;
}
}
-2
View File
@@ -2,7 +2,6 @@
namespace App\Form;
use App\BusProNet\Constants;
use App\Form\Model\RoomSelectionDto;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
@@ -45,7 +44,6 @@ class RoomSelectType extends AbstractType
$view->vars['label_room'] = $data->label;
$view->vars['label_price_amount'] = null;
$view->vars['is_inquiry'] = Constants::STATUS_ON_REQUEST === $data->status;
if (null !== $data->price) {
$view->vars['label_price_amount'] = (float) $data->price;
@@ -48,6 +48,17 @@ class ParticipantAssignedRoomFieldHandler extends AbstractParticipantFieldHandle
return 'assignedRoomId';
}
/**
* Skips edit mode, where room assignments cannot be changed.
*
* The field is static text there, so a submitted value can only come from a replayed or
* hand-crafted POST. The edit request sends the booking's own assignments anyway.
*/
public function shouldProcess(array $submittedData, string $mode, int $participantIndex): bool
{
return BookingDto::MODE_EDIT !== $mode && parent::shouldProcess($submittedData, $mode, $participantIndex);
}
/**
* Processes the assignedRoomId field for a specific participant.
*
@@ -65,7 +76,7 @@ class ParticipantAssignedRoomFieldHandler extends AbstractParticipantFieldHandle
* 6. Updates the participant's assignedRoomId property
*
* @param array<string, mixed> $submittedData The submitted participant form data
* @param BookingDto $bookingDto The booking DTO to update (create or edit)
* @param BookingDto $bookingDto The booking DTO to update
* @param int $participantIndex The index of the participant being processed
*/
public function processField(array $submittedData, BookingDto $bookingDto, int $participantIndex): void
@@ -122,15 +133,8 @@ class ParticipantAssignedRoomFieldHandler extends AbstractParticipantFieldHandle
return false;
}
// Calculate total capacity for this room type
// In edit mode, use maxQuantity which includes available rooms beyond the booked count.
// In create mode, use quantity which is the user's room selection from step 1.
if (BookingDto::MODE_EDIT === $bookingDto->getMode()) {
$effectiveQuantity = $roomSelection->maxQuantity;
} else {
$effectiveQuantity = $roomSelection->quantity ?? 0;
}
$totalCapacity = $effectiveQuantity * $roomSelection->capacity;
// Calculate total capacity for this room type from the step 1 selection
$totalCapacity = ($roomSelection->quantity ?? 0) * $roomSelection->capacity;
// Count current occupancy (excluding current participant)
$occupancy = 0;
@@ -182,12 +186,7 @@ class ParticipantAssignedRoomFieldHandler extends AbstractParticipantFieldHandle
return; // Shouldn't happen
}
if (BookingDto::MODE_EDIT === $bookingDto->getMode()) {
$effectiveQuantity = $roomSelection->maxQuantity;
} else {
$effectiveQuantity = $roomSelection->quantity ?? 0;
}
$totalCapacity = $effectiveQuantity * $roomSelection->capacity;
$totalCapacity = ($roomSelection->quantity ?? 0) * $roomSelection->capacity;
$currentOccupancy = count($participantsWithRoom);
$spacesNeeded = ($currentOccupancy + 1) - $totalCapacity;
@@ -8,7 +8,6 @@ use App\BusProNet\Constants;
use App\BusProNet\Model\Booking;
use App\BusProNet\Model\Insurance;
use App\BusProNet\Model\Pickup;
use App\BusProNet\Model\Room;
use App\BusProNet\Model\Service;
use App\BusProNet\Utility\DirectionMapper;
use App\Form\Model\BookingDto;
@@ -86,21 +85,18 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
*/
protected function registerFieldOptionProviders(): void
{
// Room assignment field provider (available for both create and edit workflows)
// Room assignment field provider (create only: edit mode renders the room as static text)
// Returns empty array when no room choices available
$this->fieldOptionProviders['assignedRoomId'] = function (BookingDto $bookingDto, int $participantIndex, array $options = []): array {
$choices = [];
if (BookingDto::MODE_CREATE === $bookingDto->getMode()) {
// Create context: use selected rooms from step 1, filtered by participant age
// Use selected rooms from step 1, filtered by participant age
$choices = $this->filterRoomsByParticipantAge(
$bookingDto->getSelectedRooms(),
$bookingDto,
$participantIndex
);
} elseif (BookingDto::MODE_EDIT === $bookingDto->getMode()) {
// Edit context: convert booked rooms to RoomSelectionDto for consistent handling
$choices = $this->convertBookedRoomsToSelectionDtos($bookingDto->booking->rooms);
}
if (true === empty($choices)) {
@@ -782,31 +778,6 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
});
}
/**
* Converts booked Room objects to RoomSelectionDto for consistent form handling.
*
* In edit mode, we need to convert Room entities to RoomSelectionDto objects
* so the form can use the same choice_value and choice_label configuration
* as create mode, enabling consistent price display in the template.
*
* @param Room[] $bookedRooms Rooms from existing booking
*
* @return RoomSelectionDto[] Array of room selection DTOs
*/
private function convertBookedRoomsToSelectionDtos(array $bookedRooms): array
{
$selections = [];
foreach ($bookedRooms as $room) {
$selection = new RoomSelectionDto();
$selection->id = $room->id;
$selection->label = $room->label;
$selection->price = $room->price;
$selections[] = $selection;
}
return $selections;
}
/**
* Filters rental services by selected skipass duration.
*
+13 -13
View File
@@ -103,32 +103,32 @@ class AdminMenuBuilder
],
]);
$this->addLogoutItem($menu);
$this->addAccountGroup($menu);
return $menu;
}
private function addLogoutItem(ItemInterface $menu): void
/**
* The account actions close the menu as one group without a route, so it opens in place in the
* sidebar and the drawer alike; sub-items carry no icons.
*/
private function addAccountGroup(ItemInterface $menu): void
{
$this->addDivider($menu);
$menu->addChild('MyE&P', [
$account = $menu->addChild('Mein Account', [
'extras' => [
'icon' => 'user',
],
]);
$account->addChild('MyE&P', [
'route' => 'app_account',
'linkAttributes' => [
'title' => 'zu MyE&P',
],
'extras' => [
'icon' => 'logout',
],
]);
$menu->addChild('Logout', [
$account->addChild('Abmelden', [
'route' => 'app_logout',
'linkAttributes' => [
'title' => 'Logout',
],
'extras' => [
'icon' => 'logout',
],
]);
}
+48 -12
View File
@@ -4,16 +4,21 @@ declare(strict_types=1);
namespace App\Model\Chatbot;
use App\BusProNet\Constants;
use App\BusProNet\Model\Room;
use App\Enum\RoomType;
/**
* What the website's travel search knows about one travel date at one hotel, derived from
* a product export row the way TYPO3's DateImportService derives it, with two deliberate
* differences: rooms in `Buchungsstop` are not bookable, and neither is the baby row.
* differences: rooms in `Buchungsstop` are not listed, and neither is the baby row. A listed
* room is bookable when Room::isBookableState() says so, as the booking flow offers it;
* the others are sold out, as the website shows them. A bookable room on request is reported
* as such, because booking it only produces an inquiry.
*
* - places: Σ available × maxPax over the bookable rooms (`available` counts rooms);
* - priceFrom ("ab" price): cheapest bookable room with places left, else cheapest bookable room;
* - minPax: the smallest group a bookable room takes;
* - priceFrom ("ab" price): cheapest bookable room, else cheapest listed room;
* - minPax: the smallest group a listed room takes;
* - inclusions from the selection groups (7 Skipass, 71 Verpflegung, 86 Programm, 87 Kurse,
* 89 Events) and the outbound bus service (a price of 0 means included).
*/
@@ -21,9 +26,12 @@ final readonly class TravelDateFacts
{
public const AVAILABILITY_FREE = 'frei';
public const AVAILABILITY_ON_REQUEST = 'auf Anfrage';
public const AVAILABILITY_SOLD_OUT = 'ausgebucht';
/** Best first: a date is as available as its best room. */
private const AVAILABILITY_RANK = [self::AVAILABILITY_FREE, self::AVAILABILITY_ON_REQUEST, self::AVAILABILITY_SOLD_OUT];
public const STATUS_BOOKING_STOP = 'Buchungsstop';
private const STATUS_FREE = 'Frei';
private const GROUP_SKIPASS = 7;
private const GROUP_BOARD = 71;
@@ -32,7 +40,7 @@ final readonly class TravelDateFacts
private const GROUP_EVENTS = 89;
/**
* @param list<RoomType> $roomTypes distinct, of the bookable rooms
* @param list<RoomType> $roomTypes distinct, of the listed rooms
* @param list<string> $boards included board labels
*/
private function __construct(
@@ -71,12 +79,13 @@ final readonly class TravelDateFacts
continue;
}
$available = (int) ($room['available'] ?? 0);
$places += $available * (int) ($room['maxPax'] ?? 0);
$roomAvailability = self::roomAvailability($room);
$bookable = self::AVAILABILITY_SOLD_OUT !== $roomAvailability;
if ($bookable) {
$places += (int) $room['available'] * (int) ($room['maxPax'] ?? 0);
}
$roomTypes[$type->value] = $type;
$availability = self::STATUS_FREE === ($room['status'] ?? null) || self::AVAILABILITY_FREE === $availability
? self::AVAILABILITY_FREE
: self::AVAILABILITY_ON_REQUEST;
$availability = null === $availability ? $roomAvailability : self::better($availability, $roomAvailability);
if (is_int($room['minPax'] ?? null) && (null === $minPax || $room['minPax'] < $minPax)) {
$minPax = $room['minPax'];
@@ -86,7 +95,7 @@ final readonly class TravelDateFacts
$price = (float) $room['price'];
$priceFrom = null === $priceFrom ? $price : min($priceFrom, $price);
if ($available > 0) {
if ($bookable) {
$priceFromWithPlaces = null === $priceFromWithPlaces ? $price : min($priceFromWithPlaces, $price);
}
}
@@ -131,11 +140,38 @@ final readonly class TravelDateFacts
);
}
public function isBookable(): bool
/**
* Whether the website search lists the date at all, sold out or not.
*/
public function isListed(): bool
{
return null !== $this->availability;
}
/**
* One of the AVAILABILITY_* constants.
*
* @param array<string, mixed> $room a room of a ProductExportBuilder row
*/
public static function roomAvailability(array $room): string
{
if (!Room::isBookableState($room['status'] ?? null, $room['available'] ?? null, $room['code'] ?? null)) {
return self::AVAILABILITY_SOLD_OUT;
}
return Constants::STATUS_ON_REQUEST === ($room['status'] ?? null)
? self::AVAILABILITY_ON_REQUEST
: self::AVAILABILITY_FREE;
}
/**
* The better of two AVAILABILITY_* values.
*/
private static function better(string $a, string $b): string
{
return array_search($a, self::AVAILABILITY_RANK, true) <= array_search($b, self::AVAILABILITY_RANK, true) ? $a : $b;
}
/**
* What the price includes, as the website lists it on a result.
*
+66
View File
@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace App\Model;
use App\BusProNet\Model\Room;
use App\Form\Model\RoomSelectionDto;
/**
* Offered rooms of one travel that draw on the same BusPro contingent.
*
* BusPro reports the pool's remaining count on every member, and checks each room of a booking
* against it separately, so a booking with two members can take more than is left. Only pools
* with more than one offered member exist as objects; every other room is its own pool and is
* already capped by its own count.
*/
final readonly class RoomContingentPool
{
/**
* @param array<int, Room> $rooms the offered members, indexed by room id
*/
public function __construct(
public array $rooms,
) {
}
/**
* Rooms left in the pool. The members should all report the same figure; the lowest is the
* safe reading if they ever disagree.
*/
public function getAvailable(): int
{
return min(array_map(static fn (Room $room): int => $room->available ?? 0, $this->rooms));
}
/**
* Rooms the given selections take from the pool.
*
* @param iterable<RoomSelectionDto> $roomSelections
*/
public function getSelectedQuantity(iterable $roomSelections): int
{
$quantity = 0;
foreach ($roomSelections as $roomSelection) {
if (null !== $roomSelection->id && $this->contains($roomSelection->id)) {
$quantity += $roomSelection->quantity ?? 0;
}
}
return $quantity;
}
public function contains(int $roomId): bool
{
return isset($this->rooms[$roomId]);
}
/**
* @return list<string>
*/
public function getLabels(): array
{
return array_values(array_map(static fn (Room $room): string => (string) $room->label, $this->rooms));
}
}
+10 -2
View File
@@ -18,9 +18,17 @@ class TravelMailingListRepository extends ServiceEntityRepository
parent::__construct($registry, TravelMailingList::class);
}
public function findOneByTravelCode(string $travelCode): ?TravelMailingList
public function findOneByName(string $name): ?TravelMailingList
{
return $this->findOneBy(['travelCode' => $travelCode]);
return $this->findOneBy(['name' => $name]);
}
/**
* @return list<TravelMailingList>
*/
public function findByTravelCode(string $travelCode): array
{
return $this->findBy(['travelCode' => $travelCode], ['id' => 'ASC']);
}
/**
+42 -22
View File
@@ -10,11 +10,13 @@ use App\BusProNet\Model\Service;
use App\BusProNet\Model\Travel;
use App\BusProNet\Service\BookingStatusRuleRegistry;
use App\BusProNet\XmlLoader\AgencyLoader;
use App\Exception\BookingBackendUnavailableException;
use App\Exception\NoRoomsAvailableException;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
use App\Form\Model\RoomSelectionDto;
use App\Form\Service\ServiceAgeEvaluator;
use App\Model\RoomContingentPool;
use App\Model\RoomSelectionAdjustment;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\Request;
@@ -28,6 +30,7 @@ class BookingConfigurator
private readonly ParticipantEligibilityChecker $participantEligibilityService,
private readonly BookingStatusRuleRegistry $bookingStatusRuleRegistry,
private readonly AgencyLoader $agencyLoader,
private readonly RoomContingentPoolResolver $poolResolver,
#[Autowire(param: 'default_booking_status')]
private readonly string $defaultBookingStatus,
) {
@@ -44,6 +47,11 @@ class BookingConfigurator
* - 'Frei': Regular booking with availability checks
* - 'Option': Create-flow override from specific rules
* - 'Anfrage': Inquiry booking, allows booking even with 0 availability
*
* The availability call doubles as the health check for the whole flow: if BusPro cannot be
* reached now, the inquiry in step 3 would fail after the customer typed in every participant.
*
* @throws BookingBackendUnavailableException When BusPro cannot be reached
*/
public function startFreshBooking(Request $request, int $dateId, int $hotelId, ?int $agencyId = null): BookingDto
{
@@ -54,7 +62,7 @@ class BookingConfigurator
// Fetch and patch availability data (includes allowedBookingStatus from API)
// Force refresh ensures fresh data at booking start, then populates cache for subsequent loads
$availabilities = $this->travelDataService->getAvailabilityData($dateId, cached: true, forceRefresh: true);
$availabilities = $this->travelDataService->getAvailabilityData($dateId, cached: true, forceRefresh: true, requireReachable: true);
if (null !== $availabilities) {
$this->travelDataService->patchAvailabilities($travelData, $availabilities);
}
@@ -102,16 +110,19 @@ class BookingConfigurator
* exists; one that only loses part of its contingent leaves a quantity nothing else re-checks
* before the booking is submitted; and one that becomes bookable again has no selection at all.
* Rebuilding the selections from the current rooms, with the chosen quantities carried over and
* capped at what is left, keeps both sides in step.
* capped at what is left, keeps both sides in step. Rooms sharing a contingent are capped
* together as well, in selection order, since BusPro reports the shared remainder on each.
*
* @return list<RoomSelectionAdjustment> The selections that had to give up quantity, in selection order
*/
public function reconcileRoomSelections(BookingDto $bookingDto): array
{
$availableRooms = $bookingDto->travel->getAvailableRooms();
$pools = $this->poolResolver->findSharedPools($bookingDto->travel);
$adjustments = [];
$quantitiesByRoomId = [];
$poolRemainders = [];
foreach ($bookingDto->roomSelections as $roomSelection) {
if (null === $roomSelection->id) {
@@ -121,6 +132,13 @@ class BookingConfigurator
$requestedQuantity = $roomSelection->quantity ?? 0;
$bookableQuantity = min($requestedQuantity, $availableRooms[$roomSelection->id]->available ?? 0);
$poolIndex = $this->findPoolIndex($pools, $roomSelection->id);
if (null !== $poolIndex) {
$poolRemainders[$poolIndex] ??= $pools[$poolIndex]->getAvailable();
$bookableQuantity = min($bookableQuantity, $poolRemainders[$poolIndex]);
$poolRemainders[$poolIndex] -= $bookableQuantity;
}
$quantitiesByRoomId[$roomSelection->id] = $bookableQuantity;
if (0 < $requestedQuantity && $bookableQuantity < $requestedQuantity) {
@@ -141,6 +159,20 @@ class BookingConfigurator
return $adjustments;
}
/**
* @param list<RoomContingentPool> $pools
*/
private function findPoolIndex(array $pools, int $roomId): ?int
{
foreach ($pools as $index => $pool) {
if ($pool->contains($roomId)) {
return $index;
}
}
return null;
}
/**
* Creates a room selection DTO from room data and quantities.
*
@@ -611,10 +643,6 @@ class BookingConfigurator
/**
* Determines the initial booking status based on travel configuration and API restrictions.
*
* This method implements a multi-stage check to determine the appropriate booking status:
* 1. Checks API restrictions via buchungstatusmoeglich attribute
* 2. Checks if only inquiry rooms are available (no Frei rooms with available > 0)
*
* When API provides allowed status restrictions, the method respects them by selecting
* the best available status in order of preference: configured default → 'F' → 'O' → 'A'.
*
@@ -627,13 +655,7 @@ class BookingConfigurator
*/
private function determineInitialBookingStatus(Travel $travelData): string
{
// Check 1: Only inquiry rooms available (all rooms with available > 0 have status 'Anfrage')
// This takes precedence as it's a business rule independent of API restrictions
if ($travelData->requiresInquiryBooking()) {
return Constants::BOOKING_STATUS_INQUIRY;
}
// Check 2: If API provided allowed status restrictions, respect them
// If API provided allowed status restrictions, respect them
if ([] !== $travelData->allowedBookingStatus) {
// Prefer configured default status if allowed
if ($travelData->isBookingStatusAllowed($this->defaultBookingStatus)) {
@@ -658,19 +680,19 @@ class BookingConfigurator
}
/**
* Updates booking status based on selected room requirements.
* Updates the booking status after the room selection in Step 1.
*
* If ANY selected room is only bookable on request, the whole booking becomes an inquiry.
* If any selected room is on request, which Step 1 offers only for rooms the office sells
* that way on purpose (Room::isBookableState()), the whole booking becomes an inquiry.
* Otherwise the status returns to what the travel called for when the booking started,
* and the create-flow rules run again, so a customer who swaps an on-request room for a
* free one in Step 1 is no longer submitted as an inquiry. An 'A' from the Step 3 BusPro
* fallback is cleared the same way; Step 3 validates again and re-applies it if needed.
* and the create-flow rules run again. An 'A' from the Step 3 BusPro fallback is cleared
* this way; Step 3 validates again with the new rooms and re-applies it if needed.
*
* @param BookingDto $bookingDto The booking DTO to update
*/
public function updateBookingStatusFromRoomSelection(BookingDto $bookingDto): void
{
if (true === $this->hasOnRequestRoomSelected($bookingDto)) {
if ($this->hasOnRequestRoomSelected($bookingDto)) {
$bookingDto->bookingStatus = Constants::BOOKING_STATUS_INQUIRY;
return;
@@ -689,9 +711,7 @@ class BookingConfigurator
{
foreach ($bookingDto->getSelectedRooms() as $roomSelection) {
$room = $bookingDto->travel->getRoomById($roomSelection->id);
if (null !== $room
&& Constants::STATUS_ON_REQUEST === $room->status
&& $room->available > 0) {
if (null !== $room && Constants::STATUS_ON_REQUEST === $room->status) {
return true;
}
}
@@ -20,6 +20,7 @@ class BookingCreateContextFactory
private readonly BookingSummaryAssembler $summaryDataService,
private readonly BookingPriceCalculator $priceCalculator,
private readonly FamilyInsuranceAvailabilityChecker $familyInsuranceService,
private readonly RoomContingentPoolResolver $poolResolver,
) {
}
@@ -37,6 +38,29 @@ class BookingCreateContextFactory
);
}
/**
* The step 1 context, which also tells which offered rooms share a contingent.
*/
public function createForRoomSelection(BookingDto $bookingDto): BookingCreateContext
{
$baseContext = $this->buildBaseContext($bookingDto, RoomPricingCalculator::PRICING_MODE_SELECTION);
$poolsByRoomId = [];
foreach ($this->poolResolver->findSharedPools($bookingDto->travel) as $pool) {
foreach (array_keys($pool->rooms) as $roomId) {
$poolsByRoomId[$roomId] = $pool;
}
}
return new BookingCreateContext(
bookingDto: $bookingDto,
summaryData: $baseContext['summaryData'],
groupedRooms: $baseContext['groupedRooms'],
familyInsuranceUpgradeAvailable: $baseContext['familyInsuranceUpgradeAvailable'],
roomContingentPools: $poolsByRoomId,
);
}
public function createWithParticipantCards(BookingDto $bookingDto, bool $isSubmitted): BookingCreateContext
{
$baseContext = $this->buildBaseContext($bookingDto, RoomPricingCalculator::PRICING_MODE_SELECTION);
+7 -14
View File
@@ -63,7 +63,7 @@ class BookingEditDraftMerger
// Room assignment
if (true === isset($data['roomAssignment']) && true === is_array($data['roomAssignment'])) {
$this->applyRoomAssignment($participant, $data['roomAssignment'], $travel);
$this->applyRoomAssignment($participant, $data['roomAssignment']);
}
// License plate
@@ -177,26 +177,19 @@ class BookingEditDraftMerger
}
/**
* Applies the drafted room assignment to the participant.
* Applies the drafted room remarks to the participant.
*
* The room id uses the same merge strategy as single-select services: it is only
* applied when it resolves to a room of the current travel. A draft may therefore move
* a participant to another room, but never unassign one. Edit mode renders the room as
* static text and never submits assignedRoomId, so a null in the draft is only ever an
* artefact of a snapshot taken before BusPro reported the assignment - replaying it
* would drop the participant's room, both in the UI and in the outbound zuordnung.
* The drafted assignedRoomId is ignored. Edit mode renders the room as static text and
* never submits it, so the draft only holds what BusPro reported when it was saved, and
* replaying it would undo a reassignment the office made since. The room always comes
* from the booking as loaded.
*
* remarksRoom keeps overwrite semantics: it is free text the user can deliberately clear.
*
* @param array<string, mixed> $data
*/
private function applyRoomAssignment(ParticipantDto $participant, array $data, Travel $travel): void
private function applyRoomAssignment(ParticipantDto $participant, array $data): void
{
$assignedRoomId = $data['assignedRoomId'] ?? null;
if (null !== $assignedRoomId && null !== $travel->getRoomById((int) $assignedRoomId)) {
$participant->assignedRoomId = (int) $assignedRoomId;
}
if (true === array_key_exists('remarksRoom', $data)) {
$participant->remarksRoom = $data['remarksRoom'];
}
@@ -0,0 +1,89 @@
<?php
declare(strict_types=1);
namespace App\Service;
use App\BpnConnect\Exception\BpnConnectException;
use App\BpnConnect\RoomsClient;
use App\BusProNet\Model\Travel;
use App\Model\RoomContingentPool;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
/**
* Groups a travel's offered rooms by the BusPro contingent they share.
*
* The link is hotel setup, not availability, so it is cached per hotel; the remaining count keeps
* coming from the travel data. When bpn-connect cannot answer, every room counts as its own pool,
* which is how bookings behaved before: bpn-connect and BusPro sit behind the same link, so a
* booking is unlikely to get through while bpn-connect is unreachable anyway.
*/
class RoomContingentPoolResolver
{
private const int CACHE_TTL_SECONDS = 3600;
public function __construct(
private readonly RoomsClient $roomsClient,
private readonly CacheInterface $cache,
#[Autowire(service: 'monolog.logger.bpn')]
private readonly LoggerInterface $logger,
) {
}
/**
* @return list<RoomContingentPool> pools with more than one offered room, in room order
*/
public function findSharedPools(Travel $travel): array
{
if (null === $travel->hotelId) {
return [];
}
$poolIds = $this->getPoolIds($travel->hotelId);
if ([] === $poolIds) {
return [];
}
$roomsByPool = [];
foreach ($travel->getAvailableRooms() as $roomId => $room) {
$roomsByPool[$poolIds[$roomId] ?? $roomId][$roomId] = $room;
}
$pools = [];
foreach ($roomsByPool as $rooms) {
if (1 < count($rooms)) {
$pools[] = new RoomContingentPool($rooms);
}
}
return $pools;
}
/**
* @return array<int, int> room type id => pool room type id, empty when unknown
*/
private function getPoolIds(int $hotelId): array
{
try {
return $this->cache->get(
sprintf('bpn_connect_room_contingent_pools_%d', $hotelId),
function (ItemInterface $item) use ($hotelId): array {
$item->expiresAfter(self::CACHE_TTL_SECONDS);
return $this->roomsClient->getContingentPools($hotelId);
}
);
} catch (BpnConnectException $e) {
// Thrown inside the callback, so nothing was cached and the next request asks again.
$this->logger->error('Room contingent pools unavailable, rooms are checked one by one', [
'hotel_id' => $hotelId,
'error' => $e->getMessage(),
]);
return [];
}
}
}
+3 -10
View File
@@ -147,12 +147,8 @@ class RoomPricingCalculator
}
}
// Count current participant assignments from the DTO (reflects live state
// including new assignments not yet in the booking entity)
$assignmentCounts = $bookingDto->getRoomAssignmentCounts();
// Build pricing array
foreach ($roomGroups as $roomId => $data) {
foreach ($roomGroups as $data) {
$room = $data['room'];
$participantCount = $data['participantCount'];
$totalPrice = $data['totalPrice'];
@@ -160,14 +156,11 @@ class RoomPricingCalculator
// Calculate average unit price (price per person)
$unitPrice = $participantCount > 0 ? $totalPrice / $participantCount : 0.0;
// Use live assignment count for quantity display so the sidebar reflects
// new room assignments that haven't been persisted to the booking entity yet
$quantity = $assignmentCounts[$roomId] ?? $room->totalCount;
$roomPricing[] = [
'roomId' => $room->id,
'label' => $room->label,
'quantity' => $quantity,
// Rooms, not occupants: room assignments cannot change in edit mode
'quantity' => $room->totalCount,
'participantCount' => $participantCount,
'unitPrice' => $unitPrice,
'totalPrice' => $totalPrice,
+36 -13
View File
@@ -11,6 +11,7 @@ use App\BusProNet\Model\Notification;
use App\BusProNet\Model\ServiceAvailabilityResponse;
use App\BusProNet\Model\Travel;
use App\BusProNet\XmlLoader\TravelLoader;
use App\Exception\BookingBackendUnavailableException;
use App\Exception\HotelNotInTravelException;
use App\Exception\TravelNotFoundException;
use Psr\Cache\InvalidArgumentException;
@@ -328,14 +329,25 @@ class TravelDataProvider
/**
* Gets availability data for a travel date.
*
* A failed connection is never cached, so the next call asks BusPro again instead of
* reusing the failure for the whole TTL.
*
* @param int $dateId The travel date ID for API call
* @param bool $cached Whether to use cached data (default: false)
* @param bool $forceRefresh Whether to invalidate cache before fetching (requires cached: true)
* @param bool $requireReachable Whether an unreachable BusPro throws instead of returning null
*
* @return ServiceAvailabilityResponse|null The availability data or null if not available or error occurred
*
* @throws BookingBackendUnavailableException When BusPro cannot be reached and $requireReachable is set
*/
public function getAvailabilityData(int $dateId, bool $cached = false, bool $forceRefresh = false): ?ServiceAvailabilityResponse
{
public function getAvailabilityData(
int $dateId,
bool $cached = false,
bool $forceRefresh = false,
bool $requireReachable = false,
): ?ServiceAvailabilityResponse {
try {
if ($cached) {
return $this->fetchCached(
sprintf('availability_%d', $dateId),
@@ -346,6 +358,18 @@ class TravelDataProvider
}
return $this->fetchAvailabilityData($dateId);
} catch (ApiClientException $e) {
$this->logger->error('Failed to fetch availability data from API', [
'dateId' => $dateId,
'error' => $e->getMessage(),
]);
if ($requireReachable) {
throw new BookingBackendUnavailableException(sprintf('BusPro is unreachable for travel date %d.', $dateId), 0, $e);
}
return null;
}
}
/**
@@ -368,10 +392,13 @@ class TravelDataProvider
*
* @param Travel $travel The travel object to enrich
* @param bool $cached Whether to use cached availability data (default: true)
* @param bool $requireReachable Whether an unreachable BusPro throws instead of leaving the travel as is
*
* @throws BookingBackendUnavailableException When BusPro cannot be reached and $requireReachable is set
*/
public function enrichWithFreshAvailabilities(Travel $travel, bool $cached = true): void
public function enrichWithFreshAvailabilities(Travel $travel, bool $cached = true, bool $requireReachable = false): void
{
$availabilities = $this->getAvailabilityData($travel->id, $cached);
$availabilities = $this->getAvailabilityData($travel->id, $cached, requireReachable: $requireReachable);
if (null !== $availabilities) {
$this->patchAvailabilities($travel, $availabilities);
@@ -573,9 +600,13 @@ class TravelDataProvider
}
}
/**
* Lets a connection failure propagate, so it escapes the cache callback without being stored.
*
* @throws ApiClientException
*/
private function fetchAvailabilityData(int $dateId): ?ServiceAvailabilityResponse
{
try {
$availabilities = $this->travelClient->getAvailabilities($dateId);
if ($availabilities instanceof Notification) {
@@ -593,14 +624,6 @@ class TravelDataProvider
]);
return $availabilities;
} catch (ApiClientException $e) {
$this->logger->error('Failed to fetch availability data from API', [
'dateId' => $dateId,
'error' => $e->getMessage(),
]);
return null;
}
}
/**
+37 -14
View File
@@ -6,14 +6,16 @@ namespace App\Service;
use App\BpnConnect\Model\TravelMailingRecipient;
use App\Entity\TravelMailingList;
use App\Enum\BusLeg;
use App\Exception\NewsletterProviderException;
use App\Mailjet\ApiClient;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
/**
* Creates one Mailjet contact list per travel and deletes it again 30 days after the travel
* started, together with every contact that is on no other Mailjet list.
* Creates Mailjet contact lists for a travel (all participants, bus passengers only) and deletes
* them again 30 days after the travel started, together with every contact that is on no other
* Mailjet list.
*/
class TravelMailingListManager
{
@@ -28,16 +30,17 @@ class TravelMailingListManager
/**
* @param TravelMailingRecipient[] $recipients
* @param ?BusLeg $busLeg the bus leg the recipients were filtered by, if any
*
* @throws NewsletterProviderException
*/
public function create(string $travelCode, array $recipients, \DateTimeImmutable $travelStartsAt): TravelMailingList
public function create(string $travelCode, array $recipients, ?BusLeg $busLeg, \DateTimeImmutable $travelStartsAt): TravelMailingList
{
$listId = $this->mailjet->createContactsList($travelCode);
$listId = $this->mailjet->createContactsList(TravelMailingList::nameFor($travelCode, $busLeg));
// Tracked before the contacts go in, so a list Mailjet already holds is never left without a row
// that the cleanup would find.
$mailingList = new TravelMailingList($travelCode, $listId, $travelStartsAt->modify(self::DELETE_AFTER));
$mailingList = new TravelMailingList($travelCode, $listId, $busLeg, $travelStartsAt->modify(self::DELETE_AFTER));
$this->entityManager->persist($mailingList);
$this->entityManager->flush();
@@ -51,8 +54,10 @@ class TravelMailingListManager
$this->logger->info('Created Mailjet travel mailing list', [
'travel_code' => $travelCode,
'name' => $mailingList->getName(),
'mailjet_list_id' => $listId,
'mailjet_job_id' => $jobId,
'bus_leg' => $busLeg?->value,
'recipients' => count($recipients),
]);
@@ -60,22 +65,32 @@ class TravelMailingListManager
}
/**
* Deletes the orphaned contacts first and the list last, so a run that fails halfway can be
* repeated: the list still names whoever is left.
* Deletes all lists of one travel together. Taken one at a time, a contact on both would
* never count as orphaned: Mailjet still reports a list for 60 days after its deletion.
*
* The orphaned contacts go first and the lists last, so a run that fails halfway can be
* repeated: the lists still name whoever is left.
*
* @param TravelMailingList[] $mailingLists
*
* @return int the number of contacts deleted
*
* @throws NewsletterProviderException
*/
public function delete(TravelMailingList $mailingList): int
public function delete(array $mailingLists): int
{
$listId = $mailingList->getMailjetListId();
$listIds = array_map(static fn (TravelMailingList $mailingList) => $mailingList->getMailjetListId(), $mailingLists);
$contactIds = [];
foreach ($listIds as $listId) {
array_push($contactIds, ...$this->mailjet->getListContactIds($listId));
}
$deletedContacts = 0;
foreach ($this->mailjet->getListContactIds($listId) as $contactId) {
foreach (array_unique($contactIds) as $contactId) {
// Anyone who is, or recently was, on another list is kept: their newsletter consent or
// another travel's mailing still needs the contact.
if ([$listId] !== array_values(array_unique($this->mailjet->getContactListIds($contactId)))) {
if ([] !== array_diff($this->mailjet->getContactListIds($contactId), $listIds)) {
continue;
}
@@ -83,16 +98,23 @@ class TravelMailingListManager
++$deletedContacts;
}
$this->mailjet->deleteContactsList($listId);
$this->logger->info('Deleted orphaned travel mailing contacts', [
'mailjet_list_ids' => $listIds,
'deleted_contacts' => $deletedContacts,
]);
foreach ($mailingLists as $mailingList) {
$this->mailjet->deleteContactsList($mailingList->getMailjetListId());
$this->entityManager->remove($mailingList);
$this->entityManager->flush();
$this->logger->info('Deleted Mailjet travel mailing list', [
'travel_code' => $mailingList->getTravelCode(),
'mailjet_list_id' => $listId,
'deleted_contacts' => $deletedContacts,
'name' => $mailingList->getName(),
'mailjet_list_id' => $mailingList->getMailjetListId(),
]);
}
return $deletedContacts;
}
@@ -129,6 +151,7 @@ class TravelMailingListManager
// The row stays, so the scheduled cleanup removes the list later.
$this->logger->error('Could not delete Mailjet travel mailing list after a failed import', [
'travel_code' => $mailingList->getTravelCode(),
'name' => $mailingList->getName(),
'mailjet_list_id' => $mailingList->getMailjetListId(),
'error' => $exception->getMessage(),
]);
+4 -2
View File
@@ -10,14 +10,16 @@ use Symfony\Component\Validator\Constraint;
* Validates room selection requirements for bookings.
*
* Applied as a class-level constraint on BookingDto to ensure valid room
* configurations: at least one room must be selected, and baby rooms
* cannot be booked without accompanying regular rooms.
* configurations: at least one room must be selected, baby rooms
* cannot be booked without accompanying regular rooms, and rooms that
* share a contingent cannot together exceed what is left of it.
*/
#[\Attribute]
class RoomSelection extends Constraint
{
public string $noRoomSelectedMessage = 'Bitte mindestens ein Zimmer/Bett auswählen';
public string $onlyBabyRoomsMessage = 'Baby-Zimmer können nur in Kombination mit regulären Zimmern gebucht werden.';
public string $sharedContingentExceededMessage = 'Diese Zimmer teilen sich ein Kontingent, von dem nur noch {{ available }} verfügbar ist: {{ rooms }}. Bitte reduziere deine Auswahl.';
public function getTargets(): array|string
{
@@ -6,6 +6,7 @@ namespace App\Validator\Constraints;
use App\BusProNet\Constants;
use App\Form\Model\BookingDto;
use App\Service\RoomContingentPoolResolver;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
@@ -13,11 +14,17 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
/**
* Validates room selection business rules for bookings.
*
* Enforces that at least one room is selected and that baby rooms (BABY code)
* are only booked in combination with regular rooms, not standalone.
* Enforces that at least one room is selected, that baby rooms (BABY code)
* are only booked in combination with regular rooms, not standalone, and that
* rooms sharing a contingent do not together take more than is left of it.
*/
class RoomSelectionValidator extends ConstraintValidator
{
public function __construct(
private readonly RoomContingentPoolResolver $poolResolver,
) {
}
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof RoomSelection) {
@@ -40,6 +47,24 @@ class RoomSelectionValidator extends ConstraintValidator
// Check that not only Baby rooms are selected
$this->assertNotOnlyBabyRooms($value, $constraint);
$this->assertSharedContingentsNotExceeded($value, $constraint);
}
/**
* BusPro reports a shared contingent's remaining count on every room drawing on it and accepts
* a booking that takes it from two of them, so the sum has to be checked here.
*/
private function assertSharedContingentsNotExceeded(BookingDto $bookingDto, RoomSelection $constraint): void
{
foreach ($this->poolResolver->findSharedPools($bookingDto->travel) as $pool) {
if ($pool->getSelectedQuantity($bookingDto->getSelectedRooms()) > $pool->getAvailable()) {
$this->context->buildViolation($constraint->sharedContingentExceededMessage)
->setParameter('{{ available }}', (string) $pool->getAvailable())
->setParameter('{{ rooms }}', implode(', ', $pool->getLabels()))
->addViolation();
}
}
}
private function assertNotOnlyBabyRooms(BookingDto $bookingDto, RoomSelection $constraint): void
+1 -1
View File
@@ -1,5 +1,5 @@
{% if app.session.flashBag.peek('error')|length > 0 %}
{% include '_partials/_toast.html.twig' with { level: 'warning', messages: app.flashes('error') } %}
{% include '_partials/_toast.html.twig' with { level: 'error', messages: app.flashes('error') } %}
{% endif %}
{% if app.session.flashBag.peek('success')|length > 0 %}
{% include '_partials/_toast.html.twig' with { level: 'success', messages: app.flashes('success') } %}
@@ -28,9 +28,10 @@
name="q"
value="{{ filter.q }}"
placeholder="{{ form.q.vars.attr.placeholder|default('Suchen…') }}"
class="block w-64 rounded-md border-0 py-1.5 pl-9 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-primary text-sm">
aria-label="Suchen"
class="input w-64 pl-9">
<div class="absolute inset-y-0 left-0 flex items-center pl-2.5 pointer-events-none">
{{ icon('search', 'w-4 h-4 text-gray-500') }}
{{ icon('search', 'w-4 h-4 text-muted') }}
</div>
</div>
</form>
@@ -39,13 +40,13 @@
hx-get="{{ path(modal_route, app.request.query.all) }}"
hx-target="body"
hx-swap="beforeend"
class="button button--secondary button--small inline-flex items-center gap-1.5">
class="btn-tool">
{{ icon('filter', 'w-4 h-4') }}
Filter{% if filter.activeCount > 0 %} ({{ filter.activeCount }}){% endif %}
</button>
{% if filter.isActive %}
<a href="{{ path(route) }}" class="text-sm text-gray-600 underline hover:text-gray-900">
<a href="{{ path(route) }}" class="text-sm text-brand underline hover:text-brand-dark">
zurücksetzen
</a>
{% endif %}
@@ -54,11 +55,11 @@
{% if chips|length > 0 %}
<div class="flex flex-wrap items-center gap-2 pt-3">
{% for chip in chips %}
<span class="inline-flex items-center gap-1.5 rounded-full bg-gray-100 border border-gray-300 pl-3 {{ chip.isRemovable ? 'pr-1' : 'pr-3' }} py-1 text-xs text-gray-700">
<span class="inline-flex items-center gap-1.5 rounded-full bg-brand-light border border-line pl-3 {{ chip.isRemovable ? 'pr-1' : 'pr-3' }} py-1 text-xs text-ink">
<span><span class="font-bold">{{ chip.label }}:</span> {{ chip.value }}</span>
{% if chip.isRemovable %}
<a href="{{ path(route, filter_query_without(chip.removeKeys)) }}"
class="inline-flex items-center justify-center w-4 h-4 rounded-full hover:bg-gray-300"
class="inline-flex items-center justify-center w-4 h-4 rounded-full hover:bg-white"
aria-label="Filter „{{ chip.label }}“ entfernen">
{{ icon('close', 'w-3 h-3') }}
</a>
-83
View File
@@ -1,83 +0,0 @@
{% extends 'knp_menu.html.twig' %}
{% block list %}
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
{% if item.level == 0 %}
<div class="min-h-full flex grow flex-col gap-y-5 lg:border-r border-gray-200 bg-white md:pr-6">
<nav class="flex flex-1 flex-col">
<ul role="list" class="space-y-1">
{{ block('children') }}
</ul>
</nav>
</div>
{% else %}
<ul class="{{ html_classes('mt-1 px-2', { 'hidden': not matcher.isCurrent(item) }) }}" {{ stimulus_target('sidebar-menu', 'submenu') }}>
{{ block('children') }}
</ul>
{% endif %}
{% endif %}
{% endblock %}
{% block item %}
{% if item.displayed %}
<li>
{%- if item.hasChildren and item.displayChildren %}
<div {{ stimulus_controller('sidebar-menu', {'expanded': matcher.isAncestor(item)}, {'closed': 'hidden', 'iconClosed': 'text-gray-400', 'iconExpanded': 'text-gray-500'}) }}>
{%- endif %}
{%- if item.uri is not empty %}
{{ block('linkElement') }}
{%- else %}
{{ block('spanElement') }}
{%- endif %}
{{ block('list') }}
{%- if item.hasChildren and item.displayChildren %}
</div>
{%- endif %}
</li>
{% endif %}
{% endblock %}
{% block linkElement %}
{% import _self as knp_menu %}
<a href="{{ item.uri }}"
class="{{ html_classes('', {
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold': item.level == 1,
'block rounded-md py-2 pr-2 pl-9 text-sm leading-6': item.level > 1,
'text-gray-700 hover:bg-gray-50': not (matcher.isCurrent(item) or matcher.isAncestor(item)),
'bg-gray-100 text-gray-900': matcher.isCurrent(item) or matcher.isAncestor(item),
}) }}"
{{ knp_menu.attributes(item.linkAttributes) }}>
{{ block('label') }}
</a>
{% endblock %}
{% block spanElement %}
{% import _self as knp_menu %}
{% if item.hasChildren %}
<button type="button"
{{ stimulus_action('sidebar-menu', 'toggleSubmenu') }}
{{ stimulus_target('sidebar-menu', 'button') }}
{{ knp_menu.attributes(item.linkAttributes) }}
class="{{ html_classes('hover:bg-gray-50 flex items-center w-full text-left rounded-md p-2 gap-x-3 text-sm leading-6 font-semibold text-gray-700', { 'bg-gray-50': matcher.isAncestor(item) }) }}"
aria-expanded="false">
{{ block('label') }}
</button>
{% elseif item.extras.divider is defined %}
<hr class="my-4 h-px bg-gray-200">
{% else %}
<div class="hover:bg-gray-50 group flex gap-x-3 rounded-md p-2 text-sm leading-5 font-semibold text-gray-700"
role="button">
{{ block('label') }}
</div>
{% endif %}
{% endblock %}
{% block label %}
{% if item.extras.icon is defined %}
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 ' ~ ((matcher.isCurrent(item) or matcher.isAncestor(item)) ? 'text-gray-600' : 'text-gray-400')) }}
<span class="flex-1">{{ item.label|raw }}</span>
{% else %}
{{ item.label|raw }}
{% endif %}
{% endblock %}
@@ -1,12 +1,13 @@
{% if pageCount > 0 %}
<div class="bg-gray-100 border border-gray-300 border-t-0 px-4 py-3 flex items-center justify-between sm:px-4">
<div class="border-t border-line px-5 py-3 flex items-center justify-between">
<div class="flex-1 flex items-center justify-between">
<div class="flex items-center space-x-4">
<div class="text-sm leading-5 text-gray-700">
<div class="text-sm leading-5 text-muted">
{{ 'paginator.info'|trans({ '{from}': firstItemNumber, '{to}': lastItemNumber, '{total}': totalCount })|raw }}
</div>
<select name="limit"
class="text-sm py-1 border-gray-300"
aria-label="Einträge pro Seite"
class="input w-auto py-1"
hx-get="{{ path(route, query|merge({(pageParameterName): 1})) }}"
hx-replace-url="{{ path(route, query|merge({(pageParameterName): 1})) }}"
hx-target="body">
@@ -19,43 +20,43 @@
<nav class="relative z-0 inline-flex">
{% if pageCount > 1 %}
{% if first is defined and current != first %}
<a href="{{ path(route, query|merge({(pageParameterName): first})) }}" class="relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white">
<a href="{{ path(route, query|merge({(pageParameterName): first})) }}" class="relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="m18.75 4.5-7.5 7.5 7.5 7.5m-6-15L5.25 12l7.5 7.5" />
</svg>
</a>
{% endif %}
{% if previous is defined %}
<a href="{{ path(route, query|merge({(pageParameterName): previous})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white" aria-label="Previous">
<a href="{{ path(route, query|merge({(pageParameterName): previous})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white" aria-label="Vorherige Seite">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5 8.25 12l7.5-7.5" />
</svg>
</a>
{% endif %}
{% if current > 3 %}
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-700">
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-line bg-white text-sm leading-5 text-muted">
...
</span>
{% endif %}
{% for page in pagesInRange %}
<a href="{{ path(route, query|merge({(pageParameterName): page})) }}" class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm leading-5 font-medium focus:z-10 hover:bg-secondary {% if page == current %}bg-primary text-white hover:text-white{% else %}bg-white text-gray-700 hover:text-white{% endif %}">
<a href="{{ path(route, query|merge({(pageParameterName): page})) }}" class="-ml-px relative inline-flex items-center px-4 py-2 border text-sm leading-5 focus:z-10 {% if page == current %}border-brand bg-brand font-bold text-white{% else %}border-line bg-white text-brand hover:bg-brand hover:text-white{% endif %}"{% if page == current %} aria-current="page"{% endif %}>
{{ page }}
</a>
{% endfor %}
{% if current < pageCount - 3 %}
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-700">
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-line bg-white text-sm leading-5 text-muted">
...
</span>
{% endif %}
{% if next is defined %}
<a href="{{ path(route, query|merge({(pageParameterName): next})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white" aria-label="Next">
<a href="{{ path(route, query|merge({(pageParameterName): next})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white" aria-label="Nächste Seite">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5" />
</svg>
</a>
{% endif %}
{% if last is defined and current != last %}
<a href="{{ path(route, query|merge({(pageParameterName): last})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white">
<a href="{{ path(route, query|merge({(pageParameterName): last})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="m5.25 4.5 7.5 7.5-7.5 7.5m6-15 7.5 7.5-7.5 7.5" />
</svg>
+8
View File
@@ -22,6 +22,14 @@
<span class="text-xl uppercase text-white group-hover:text-primary-light">Meine Daten</span>
</a>
</li>
{% if is_granted('ROLE_EMPLOYEE') %}
<li class="py-4">
<a href="https://platz.ep-reisen.de/auth/init" class="flex items-center space-x-2 group" hx-boost="false">
<svg class="w-8 h-8 text-white group-hover:text-primary-light" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-monitor preview-icon"><rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/></svg>
<span class="text-xl uppercase text-white group-hover:text-primary-light">Platz-Buchung</span>
</a>
</li>
{% endif %}
{% if is_granted(constant('App\\Security\\Voter\\AdministrativeAccessVoter::ADMINISTRATIVE_ACCESS')) %}
<li class="py-4">
<a href="{{ path('app_admin_dashboard') }}" class="flex items-center space-x-2 group" hx-boost="false">
+2 -2
View File
@@ -34,10 +34,10 @@
</div>
<div class="flex justify-between items-center pt-8">
<a href="{{ path(route) }}" class="text-sm text-gray-600 underline hover:text-gray-900">
<a href="{{ path(route) }}" class="text-sm text-brand underline hover:text-brand-dark">
auf Standard zurücksetzen
</a>
<button type="submit" class="button button--primary button--small">
<button type="submit" class="btn-primary">
anwenden
</button>
</div>
@@ -0,0 +1,12 @@
{#
A notice in the style of the apps template's Alert.tsx: `type` is success, error, warning or
info, `message` the text. Errors are announced at once (role="alert"), the others politely.
#}
{% set styles = {
success: ['border-emerald-700 bg-emerald-50 text-emerald-950', 'Erledigt'],
error: ['border-red-700 bg-red-50 text-red-950', 'Fehler'],
warning: ['border-amber-600 bg-amber-50 text-amber-950', 'Achtung'],
info: ['border-brand bg-brand-light text-ink', 'Hinweis'],
} %}
{% set style = styles[type ?? 'info'] %}
<div role="{{ type == 'error' ? 'alert' : 'status' }}" class="notice {{ style[0] }}"><span class="sr-only">{{ style[1] }}: </span>{{ message }}</div>
@@ -0,0 +1,23 @@
{#
E&P header as in the apps template: logo, app name behind a thin line, a deep blue bar below.
Embed it and fill its blocks:
- `header_nav`: the main views as `.header-tab` links, for apps with few views (layout_tabs)
- `header_end`: season, user menu, help link and, in the sidebar layout, the menu button
`app_name` and `home_path` come from the embedding template; `header_width` lines the header up with
a centred content column (layout_sidebar), without it the header runs full width (layout_tabs).
#}
<header class="shrink-0 print:hidden">
<div class="border-b border-line bg-white">
<div class="flex items-stretch gap-x-6 text-sm {{ header_width ?? 'px-4' }}">
<a href="{{ home_path }}" class="flex shrink-0 items-center gap-3 py-2">
<img src="{{ asset('build/images/ep-logo.svg') }}" alt="E&P Reisen & Events" width="157" height="48" class="h-9 w-auto">
<span class="pl-3 border-l border-line font-black uppercase tracking-wide text-brand">{{ app_name }}</span>
</a>
{% block header_nav %}{% endblock %}
<div class="ml-auto flex items-stretch gap-x-4">
{% block header_end %}{% endblock %}
</div>
</div>
</div>
<div class="h-2 bg-brand" aria-hidden="true"></div>
</header>
@@ -0,0 +1,63 @@
{#
KnpMenu template for the sidebar (layout_sidebar.html.twig). Items of the first level:
- a link (`.sidebar-link`); with children, they show below it while it or a child is current
- without a URI but with children: a group that opens in place (<details>), open while a child is current
- extras `heading` (a group heading) or `divider` (a line)
- extras `icon`: rendered with _partials/_icon.html.twig (`icon`, `class`), as myep's icon() does
#}
{% extends 'knp_menu.html.twig' %}
{% block list %}
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
{% if item.level == 0 %}
<ul class="space-y-1">
{{ block('children') }}
</ul>
{% elseif item.uri is empty or matcher.isCurrent(item) or matcher.isAncestor(item) %}
<ul class="mt-1 space-y-1">
{{ block('children') }}
</ul>
{% endif %}
{% endif %}
{% endblock %}
{% block item %}
{% if item.displayed and item.extras.heading is defined %}
<li class="sidebar-heading">{{ item.label }}</li>
{% elseif item.displayed and item.extras.divider is defined %}
<li><hr class="my-4 border-line"></li>
{% elseif item.displayed %}
<li>
{% if item.uri is empty and item.hasChildren and item.displayChildren %}
<details class="sidebar-group" {{ matcher.isAncestor(item) ? 'open' }}>
<summary class="sidebar-link {{ matcher.isAncestor(item) ? 'text-brand' }}">{{ block('label') }}</summary>
{{ block('list') }}
</details>
{% else %}
{{ block('linkElement') }}
{{ block('list') }}
{% endif %}
</li>
{% endif %}
{% endblock %}
{% block linkElement %}
{% import _self as knp_menu %}
{% set is_current = matcher.isCurrent(item) %}
<a href="{{ item.uri }}"
class="{{ item.level == 1 ? 'sidebar-link' : 'sidebar-sublink' }} {{ not is_current and item.level == 1 and matcher.isAncestor(item) ? 'sidebar-link--ancestor' }}"
{% if is_current %}aria-current="page"{% endif %}
{{ knp_menu.attributes(item.linkAttributes) }}>{{ block('label') }}</a>
{% endblock %}
{% block label -%}
{% if item.extras.icon is defined -%}
{{ include('_partials/_icon.html.twig', {
icon: item.extras.icon,
class: 'size-5 shrink-0 ' ~ (matcher.isCurrent(item) or matcher.isAncestor(item) ? 'text-brand' : 'text-muted'),
}) }}
<span class="flex-1">{{ item.label }}</span>
{%- else -%}
{{ item.label }}
{%- endif %}
{%- endblock %}
+40 -40
View File
@@ -39,28 +39,28 @@
{% endif %}
</div>
<div class="flex justify-between pt-8">
<a href="{{ path('app_admin_accommodation') }}" class="button button--secondary button--small">
<a href="{{ path('app_admin_accommodation') }}" class="btn-secondary">
zurück
</a>
<button type="submit" class="button button--primary button--small">
<button type="submit" class="btn-primary">
speichern
</button>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
<hr class="my-8">
<div class="mt-8">
<twig:calendar :accommodation="accommodation"/>
</div>
<hr class="my-8">
<section id="prices">
<h2 class="text-xl font-bold">
<h2 class="section-title pb-3">
Preise
</h2>
<div class="data-table-wrapper mb-4">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -135,17 +135,17 @@
{% endif %}
</td>
<td class="text-right">
<twig:dropdown>
<twig:dropdown:link url="{{ path('app_admin_accommodationprice_edit', { 'id': price.id }) }}">
<twig:menu>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_accommodationprice_edit', { 'id': price.id }) }}">
bearbeiten
</twig:dropdown:link>
<twig:dropdown:link url="{{ path('app_admin_accommodationprice_duplicate', { 'id': price.id }) }}">
</a>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_accommodationprice_duplicate', { 'id': price.id }) }}">
duplizieren
</twig:dropdown:link>
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodationprice_delete', { 'id': price.id }) }}" warning>
</a>
<button type="button" class="menu-item-danger" role="menuitem" hx-get="{{ path('app_admin_accommodationprice_delete', { 'id': price.id }) }}" hx-target="body" hx-swap="beforeend">
löschen
</twig:dropdown:hxbutton>
</twig:dropdown>
</button>
</twig:menu>
</td>
</tr>
{% else %}
@@ -160,7 +160,7 @@
</div>
</div>
<div class="flex justify-end">
<a href="{{ path('app_admin_accommodationprice_create', { 'id': accommodation.id }) }}" class="button button--primary button--small">
<a href="{{ path('app_admin_accommodationprice_create', { 'id': accommodation.id }) }}" class="btn-tool">
neu
</a>
</div>
@@ -169,11 +169,11 @@
<hr class="my-8">
<section id="board-services">
<h2 class="text-xl font-bold">
<h2 class="section-title pb-3">
Verpflegungsleistungen
</h2>
<div class="data-table-wrapper mb-4">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -202,17 +202,17 @@
{{ (service.price / 100) | format_currency(accommodation.currency) }}
</td>
<td class="text-right">
<twig:dropdown>
<twig:dropdown:link url="{{ path('app_admin_boardservice_edit', { 'id': service.id }) }}">
<twig:menu>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_boardservice_edit', { 'id': service.id }) }}">
bearbeiten
</twig:dropdown:link>
<twig:dropdown:link url="{{ path('app_admin_boardservice_duplicate', { 'id': service.id }) }}">
</a>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_boardservice_duplicate', { 'id': service.id }) }}">
duplizieren
</twig:dropdown:link>
<twig:dropdown:hxbutton url="{{ path('app_admin_boardservice_delete', { 'id': service.id }) }}" warning>
</a>
<button type="button" class="menu-item-danger" role="menuitem" hx-get="{{ path('app_admin_boardservice_delete', { 'id': service.id }) }}" hx-target="body" hx-swap="beforeend">
löschen
</twig:dropdown:hxbutton>
</twig:dropdown>
</button>
</twig:menu>
</td>
</tr>
{% else %}
@@ -227,7 +227,7 @@
</div>
</div>
<div class="flex justify-end">
<a href="{{ path('app_admin_boardservice_create', { 'id': accommodation.id }) }}" class="button button--primary button--small">
<a href="{{ path('app_admin_boardservice_create', { 'id': accommodation.id }) }}" class="btn-tool">
neu
</a>
</div>
@@ -238,14 +238,14 @@
<section id="additional-services" {{ stimulus_controller('sortable', {
url: path('app_admin_accommodation_additionalservices_order', { id: accommodation.id })
}) }}>
<h2 class="text-xl font-bold">
<h2 class="section-title pb-3">
Optionale Zusatzleistungen
</h2>
<p class="text-sm text-gray-500 mb-2">
<p class="text-sm text-muted mb-2">
Die Reihenfolge wird per Drag &amp; Drop festgelegt und gilt auch für das Buchungsformular.
</p>
<div class="data-table-wrapper mb-4">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -268,7 +268,7 @@
<tbody {{ stimulus_target('sortable', 'list') }}>
{% for service in additionalServices %}
<tr {{ stimulus_target('sortable', 'item') }} data-sortable-id="{{ service.id }}">
<td class="cursor-grab text-gray-400" {{ stimulus_target('sortable', 'handle') }}>
<td class="cursor-grab text-muted" {{ stimulus_target('sortable', 'handle') }}>
{{ icon('draggable', 'w-4 h-4') }}
</td>
<td>
@@ -284,17 +284,17 @@
{{ (service.price / 100) | format_currency(accommodation.currency) }}
</td>
<td class="text-right">
<twig:dropdown>
<twig:dropdown:link url="{{ path('app_admin_additionalservice_edit', { 'id': service.id }) }}">
<twig:menu>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_additionalservice_edit', { 'id': service.id }) }}">
bearbeiten
</twig:dropdown:link>
<twig:dropdown:link url="{{ path('app_admin_additionalservice_duplicate', { 'id': service.id }) }}">
</a>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_additionalservice_duplicate', { 'id': service.id }) }}">
duplizieren
</twig:dropdown:link>
<twig:dropdown:hxbutton url="{{ path('app_admin_additionalservice_delete', { 'id': service.id }) }}" warning>
</a>
<button type="button" class="menu-item-danger" role="menuitem" hx-get="{{ path('app_admin_additionalservice_delete', { 'id': service.id }) }}" hx-target="body" hx-swap="beforeend">
löschen
</twig:dropdown:hxbutton>
</twig:dropdown>
</button>
</twig:menu>
</td>
</tr>
{% else %}
@@ -309,8 +309,8 @@
</div>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-500" {{ stimulus_target('sortable', 'status') }}></span>
<a href="{{ path('app_admin_additionalservice_create', { 'id': accommodation.id }) }}" class="button button--primary button--small">
<span class="text-sm text-muted" {{ stimulus_target('sortable', 'status') }}></span>
<a href="{{ path('app_admin_additionalservice_create', { 'id': accommodation.id }) }}" class="btn-tool">
neu
</a>
</div>
@@ -3,7 +3,7 @@
{% block content %}
<twig:page:heading>Gruppenhäuser</twig:page:heading>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -44,14 +44,14 @@
{% endif %}
</td>
<td class="text-right">
<twig:dropdown>
<twig:dropdown:link url="{{ path('app_admin_accommodation_edit', { 'id': accommodation.id, 'r': return_url() }) }}">
<twig:menu>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_accommodation_edit', { 'id': accommodation.id, 'r': return_url() }) }}">
bearbeiten
</twig:dropdown:link>
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodation_delete', { 'id': accommodation.id, 'r': return_url() }) }}" warning>
</a>
<button type="button" class="menu-item-danger" role="menuitem" hx-get="{{ path('app_admin_accommodation_delete', { 'id': accommodation.id, 'r': return_url() }) }}" hx-target="body" hx-swap="beforeend">
löschen
</twig:dropdown:hxbutton>
</twig:dropdown>
</button>
</twig:menu>
</td>
</tr>
{% else %}
@@ -70,7 +70,7 @@
hx-get="{{ path('app_admin_accommodation_create') }}"
hx-target="body"
hx-swap="beforeend"
class="button button--primary button--small">
class="btn-primary">
neu
</button>
</div>
@@ -15,7 +15,7 @@
{{ form_row(form.maxAdolescentAge) }}
</div>
<div class="flex justify-end pt-8">
<button type="submit" class="button button--primary button--small">
<button type="submit" class="btn-primary">
speichern
</button>
</div>
@@ -3,7 +3,7 @@
{% if app.request.query.get('r') %}
{% set period_params = period_params | merge({ r: app.request.query.get('r') }) %}
{% endif %}
<tr class="border-t border-gray-200 align-top">
<tr class="border-t border-line align-top">
<td class="py-1 whitespace-nowrap">{{ period.dateFrom | date('d.m.Y') }} – {{ period.dateTo | date('d.m.Y') }}</td>
<td class="py-1 whitespace-nowrap">{{ period.nights }} {{ period.nights != 1 ? 'Nächte' : 'Nacht' }}</td>
<td class="py-1">
@@ -13,20 +13,20 @@
{% for line in period.lines %}
<div>{{ line.label }}</div>
{% else %}
<div class="text-gray-500">keine Positionen</div>
<div class="text-muted">keine Positionen</div>
{% endfor %}
</td>
<td class="py-1 text-right whitespace-nowrap">
{{ (period.total / 100) | format_currency(booking.pricingCurrency ?? booking.accommodation.currency) }}
</td>
<td class="py-1 text-right">
<twig:dropdown>
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodationbooking_period_edit', period_params) }}">
<twig:menu>
<button type="button" class="menu-item" role="menuitem" hx-get="{{ path('app_admin_accommodationbooking_period_edit', period_params) }}" hx-target="body" hx-swap="beforeend">
bearbeiten
</twig:dropdown:hxbutton>
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodationbooking_period_remove', period_params) }}" warning>
</button>
<button type="button" class="menu-item-danger" role="menuitem" hx-get="{{ path('app_admin_accommodationbooking_period_remove', period_params) }}" hx-target="body" hx-swap="beforeend">
entfernen
</twig:dropdown:hxbutton>
</twig:dropdown>
</button>
</twig:menu>
</td>
</tr>
@@ -1,10 +1,10 @@
{#- Itemised price table, the same lines the customer sees in the offer. Context: booking, priceBreakdown, currency. -#}
<table class="w-full text-sm">
<table class="w-full">
{% for period in priceBreakdown.periods | filter(p => p.position == 'leading') %}
{% include 'admin/accommodation_booking/_price_period.html.twig' %}
{% endfor %}
{% if priceBreakdown.periods is not empty %}
<tr class="border-t border-gray-200 font-medium">
<tr class="border-t border-line font-medium">
<td class="pt-2 pb-1" colspan="2">
Gruppe · {{ booking.mainDateFrom | date('d.m.Y') }} – {{ booking.mainDateTo | date('d.m.Y') }},
{{ priceBreakdown.nights }} {{ priceBreakdown.nights != 1 ? 'Nächte' : 'Nacht' }}
@@ -15,7 +15,7 @@
<tr>
<td class="py-1">
Basispreis
<span class="text-xs text-gray-500">für {{ priceBreakdown.includedPax }} Pers.</span>
<span class="text-xs text-muted">für {{ priceBreakdown.includedPax }} Pers.</span>
</td>
<td class="py-1 text-right whitespace-nowrap">{{ (priceBreakdown.basePrice / 100) | format_currency(currency) }}</td>
</tr>
@@ -24,7 +24,7 @@
<tr>
<td class="py-1">
Aufpreis Personenzahl
<span class="text-xs text-gray-500">für {{ priceBreakdown.effectivePax - priceBreakdown.includedPax }} Pers.</span>
<span class="text-xs text-muted">für {{ priceBreakdown.effectivePax - priceBreakdown.includedPax }} Pers.</span>
</td>
<td class="py-1 text-right whitespace-nowrap">{{ (priceBreakdown.additionalPersonsPrice / 100) | format_currency(currency) }}</td>
</tr>
@@ -64,10 +64,10 @@
{% for period in priceBreakdown.periods | filter(p => p.position == 'trailing') %}
{% include 'admin/accommodation_booking/_price_period.html.twig' %}
{% endfor %}
<tr class="border-t border-gray-200 font-semibold">
<tr class="border-t border-line font-semibold">
<td class="pt-2">
Gesamtpreis
<span class="block text-xs font-normal text-gray-500">zzgl. ortsabhängiger Gebühren</span>
<span class="block text-xs font-normal text-muted">zzgl. ortsabhängiger Gebühren</span>
</td>
<td class="pt-2 text-right whitespace-nowrap">{{ (priceBreakdown.total / 100) | format_currency(currency) }}</td>
</tr>
@@ -78,7 +78,7 @@
</tr>
{% endfor %}
{% if priceBreakdown.discountSubtotal is not null %}
<tr class="border-t border-gray-200">
<tr class="border-t border-line">
<td class="pt-2">Zwischensumme</td>
<td class="pt-2 text-right whitespace-nowrap">{{ (priceBreakdown.discountSubtotal / 100) | format_currency(currency) }}</td>
</tr>
@@ -90,7 +90,7 @@
</tr>
{% endif %}
{% if priceBreakdown.discounts is not empty or priceBreakdown.totalDiscountDetails is not null %}
<tr class="border-t border-gray-200 font-bold text-green-700">
<tr class="border-t border-line font-bold text-green-700">
<td class="pt-2">Gesamtpreis nach Rabatt</td>
<td class="pt-2 text-right whitespace-nowrap">{{ (priceBreakdown.discountedTotal / 100) | format_currency(currency) }}</td>
</tr>
@@ -1,5 +1,5 @@
{#- One split-off period of the admin price table. Context: period, currency. -#}
<tr class="border-t border-gray-200 font-medium">
<tr class="border-t border-line font-medium">
<td class="pt-2 pb-1" colspan="2">
{% if period.label ?? null %}{{ period.label }} · {% endif %}
{{ period.dateFrom | date('d.m.Y') }} – {{ period.dateTo | date('d.m.Y') }},
@@ -7,7 +7,7 @@
{% endif %}
<twig:page:heading>{{ booking.recordLabel }} {{ booking.groupName }}</twig:page:heading>
<p class="flex items-center gap-3 text-sm text-gray-500 mb-6">
<p class="flex items-center gap-3 text-sm text-muted mb-6">
{{ booking.accommodation.name }}
{# Only an Entwurf may still move house — see ChangeAccommodationController. #}
{% if booking.draft %}
@@ -15,7 +15,7 @@
hx-get="{{ path('app_admin_accommodationbooking_change_accommodation', back_params) }}"
hx-target="body"
hx-swap="beforeend"
class="button button--secondary button--small">ändern</button>
class="btn-tool">ändern</button>
{% endif %}
</p>
@@ -39,36 +39,36 @@
</div>
{# Saved by their own modals, which reprice the booking on the spot — see SplitPeriodController. #}
<div class="mt-6 border-t border-gray-200 pt-4">
<div class="mt-6 border-t border-line pt-4">
<div class="font-bold pb-1">Zeiträume</div>
<p class="text-xs text-gray-500 pb-2">
<p class="text-xs text-muted pb-2">
Anreise und Abreise umfassen den ganzen Aufenthalt. Abgeteilte Zeiträume, etwa für ein
Vorausteam, werden mit eigenen Positionen berechnet; Personen und Leistungen gelten
nur für den Zeitraum der Gruppe.
</p>
<table class="w-full text-sm">
<table class="w-full">
{% if booking.leadingPeriod %}
{% include 'admin/accommodation_booking/_period_row.html.twig' with { period: booking.leadingPeriod } %}
{% endif %}
<tr class="border-t border-gray-200">
<tr class="border-t border-line">
<td class="py-1 whitespace-nowrap">{{ booking.mainDateFrom | date('d.m.Y') }} – {{ booking.mainDateTo | date('d.m.Y') }}</td>
<td class="py-1 whitespace-nowrap">{{ booking.mainNights }} {{ booking.mainNights != 1 ? 'Nächte' : 'Nacht' }}</td>
<td class="py-1" colspan="2">Gruppe</td>
<td class="py-1 text-right">
{# One period per side, so only the free sides are offered. #}
{% if booking.leadingPeriod is null or booking.trailingPeriod is null %}
<twig:dropdown>
<twig:menu>
{% if booking.leadingPeriod is null %}
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodationbooking_period_split', back_params | merge({ position: 'leading' })) }}">
<button type="button" class="menu-item" role="menuitem" hx-get="{{ path('app_admin_accommodationbooking_period_split', back_params | merge({ position: 'leading' })) }}" hx-target="body" hx-swap="beforeend">
am Anfang abteilen
</twig:dropdown:hxbutton>
</button>
{% endif %}
{% if booking.trailingPeriod is null %}
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodationbooking_period_split', back_params | merge({ position: 'trailing' })) }}">
<button type="button" class="menu-item" role="menuitem" hx-get="{{ path('app_admin_accommodationbooking_period_split', back_params | merge({ position: 'trailing' })) }}" hx-target="body" hx-swap="beforeend">
am Ende abteilen
</twig:dropdown:hxbutton>
</button>
{% endif %}
</twig:dropdown>
</twig:menu>
{% endif %}
</td>
</tr>
@@ -94,7 +94,7 @@
{% for child in form.selectedAdditionalServices %}
<div class="relative flex items-start py-1">
<div class="min-w-0 flex-1 text-sm leading-4">
<label for="{{ child.vars.id }}" class="select-none font-medium text-gray-900">
<label for="{{ child.vars.id }}" class="select-none font-medium text-ink">
{{ child.vars.label }}
</label>
</div>
@@ -148,17 +148,17 @@
<twig:form:section title="Status">
{# Read-only: the status only ever moves through a named action on the detail page,
so that it cannot be set without the email and timestamp that belong to it. #}
<dl class="grid grid-cols-2 gap-y-1 text-sm">
<dt class="text-gray-500">Status</dt>
<dl class="grid grid-cols-2 gap-y-1">
<dt class="text-muted">Status</dt>
<dd>{% include 'admin/accommodation_booking/_status_label.html.twig' %}</dd>
<dt class="text-gray-500">Herkunft</dt>
<dt class="text-muted">Herkunft</dt>
<dd>{{ booking.origin.label }}</dd>
{% if booking.acceptedAt is not null %}
<dt class="text-gray-500">Angenommen</dt>
<dt class="text-muted">Angenommen</dt>
<dd>{{ booking.acceptedAt | date('d.m.Y, H:i') }}</dd>
{% endif %}
{% if booking.confirmedAt is not null %}
<dt class="text-gray-500">Bestätigt</dt>
<dt class="text-muted">Bestätigt</dt>
<dd>{{ booking.confirmedAt | date('d.m.Y, H:i') }}</dd>
{% endif %}
</dl>
@@ -173,17 +173,17 @@
{% set currency = booking.pricingCurrency ?? priceBreakdown.currency %}
<twig:form:section title="Preis">
{% include 'admin/accommodation_booking/_price_breakdown.html.twig' %}
<p class="text-xs text-gray-500 pt-2">
<p class="text-xs text-muted pt-2">
Stand der letzten Speicherung. Änderungen oben werden erst beim Speichern neu berechnet.
</p>
</twig:form:section>
{% endif %}
<div class="flex flex-col gap-3">
<button type="submit" class="button button--primary button--small w-full">
<button type="submit" class="btn-primary w-full">
speichern
</button>
<a href="{{ path('app_admin_accommodationbooking_show', back_params) }}" class="text-sm text-gray-500 hover:text-gray-900 hover:underline">
<a href="{{ path('app_admin_accommodationbooking_show', back_params) }}" class="text-sm text-muted hover:text-ink hover:underline">
← zurück ohne speichern
</a>
</div>
@@ -9,7 +9,7 @@
'modal_route': 'app_admin_accommodationbooking_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -90,29 +90,29 @@
<a href="{{ edit_url }}">{{ discounts | length > 0 ? (discounts | join(', ')) : '–' }}</a>
</td>
<td class="text-right">
<twig:dropdown>
<twig:dropdown:link url="{{ path('app_admin_accommodationbooking_show', { 'id': booking.id, 'r': return_url() }) }}">
<twig:menu>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_accommodationbooking_show', { 'id': booking.id, 'r': return_url() }) }}">
Details
</twig:dropdown:link>
<twig:dropdown:link url="{{ edit_url }}">
</a>
<a class="menu-item" role="menuitem" href="{{ edit_url }}">
bearbeiten
</twig:dropdown:link>
</a>
{# Copying leaves the original alone, so it is offered in every
status — see DuplicateController. #}
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodationbooking_duplicate', { 'id': booking.id, 'r': return_url() }) }}">
<button type="button" class="menu-item" role="menuitem" hx-get="{{ path('app_admin_accommodationbooking_duplicate', { 'id': booking.id, 'r': return_url() }) }}" hx-target="body" hx-swap="beforeend">
duplizieren
</twig:dropdown:hxbutton>
<twig:dropdown:link url="{{ path('app_admin_accommodationbooking_pdf', { 'id': booking.id }) }}">
</button>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_accommodationbooking_pdf', { 'id': booking.id }) }}">
PDF herunterladen
</twig:dropdown:link>
</a>
{# A record that has been in front of the customer gets discarded,
not removed — see DeleteController. #}
{% if booking.draft %}
<twig:dropdown:hxbutton url="{{ path('app_admin_accommodationbooking_delete', { 'id': booking.id, 'r': return_url() }) }}" warning>
<button type="button" class="menu-item-danger" role="menuitem" hx-get="{{ path('app_admin_accommodationbooking_delete', { 'id': booking.id, 'r': return_url() }) }}" hx-target="body" hx-swap="beforeend">
löschen
</twig:dropdown:hxbutton>
</button>
{% endif %}
</twig:dropdown>
</twig:menu>
</td>
</tr>
{% else %}
@@ -132,7 +132,7 @@
hx-get="{{ path('app_admin_accommodationbooking_create') }}"
hx-target="body"
hx-swap="beforeend"
class="button button--primary button--small">
class="btn-primary">
neu
</button>
</div>
@@ -5,13 +5,13 @@
<div class="text-xl font-bold pb-4">
Gruppenhaus ändern
</div>
<p class="text-sm text-gray-500 pb-4">
<p class="text-sm text-muted pb-4">
Achtung: Die gewählte Verpflegung und alle Zusatzleistungen müssen anschließend neu ausgewählt werden.
</p>
{{ form_start(form) }}
{{ form_row(form.accommodation) }}
<div class="flex justify-end pt-8">
<button type="submit" class="button button--primary button--small">
<button type="submit" class="btn-primary">
speichern
</button>
</div>
@@ -20,7 +20,7 @@
</div>
</div>
<div class="flex justify-end pt-8">
<button type="submit" class="button button--primary button--small">
<button type="submit" class="btn-primary">
speichern
</button>
</div>
@@ -15,7 +15,7 @@
{{ form_errors(line.amount) }}
</div>
<button type="button"
class="shrink-0 mt-2 text-gray-400 hover:text-red-500"
class="shrink-0 mt-2 text-muted hover:text-red-500"
data-action="form-collection#removeItem"
title="Position entfernen">
{{ icon('close', 'w-5 h-5') }}
@@ -28,7 +28,7 @@
<div class="text-xl font-bold pb-1">
{{ title }}
</div>
<p class="text-sm text-gray-500 pb-6">
<p class="text-sm text-muted pb-6">
Die Nächte werden vom Zeitraum der Gruppe abgezogen, der neu berechnet wird. Die Positionen
kommen zum Gesamtpreis hinzu und fallen nur unter den Rabatt auf den Gesamtpreis.
</p>
@@ -40,8 +40,8 @@
</div>
{% set prototype %}{{ period.line_row(form.lines.vars.prototype) }}{% endset %}
<div class="mt-6 border border-gray-200 rounded-md" {{ stimulus_controller('form-collection', { prototype: prototype|json_encode }) }}>
<div class="flex gap-2 px-4 py-2 bg-gray-100 border-b border-gray-200 rounded-t-md text-sm font-bold">
<div class="mt-6 border border-line rounded-md" {{ stimulus_controller('form-collection', { prototype: prototype|json_encode }) }}>
<div class="flex gap-2 px-4 py-2 bg-page border-b border-line rounded-t-md text-sm font-bold">
<div class="flex-1">Position</div>
{# w-5 matches the remove button's icon, so the heading sits over the amounts. #}
<div class="w-32 shrink-0">Betrag</div>
@@ -55,7 +55,7 @@
{% endfor %}
</div>
<button type="button"
class="mt-3 text-sm font-medium text-primary hover:underline"
class="mt-3 text-sm font-medium text-brand hover:underline"
data-action="form-collection#addItem">
+ Position hinzufügen
</button>
@@ -64,7 +64,7 @@
{% do form.lines.setRendered %}
<div class="flex justify-end pt-6">
<button type="submit" class="button button--primary button--small">
<button type="submit" class="btn-primary">
speichern
</button>
</div>
@@ -10,14 +10,14 @@
{{ booking.recordLabel }} · {% include 'admin/accommodation_booking/_status_label.html.twig' %}
{{ booking.groupName }}
</twig:page:heading>
<p class="text-sm text-gray-500 mb-6">{{ booking.accommodation.name }}</p>
<p class="text-sm text-muted mb-6">{{ booking.accommodation.name }}</p>
{# Same arrangement as the edit form: what was booked in the main column, status, the next
step and the actions in a sidebar that stays in view on wide screens. #}
<div class="xl:grid xl:grid-cols-3 xl:gap-6 xl:items-start space-y-6 xl:space-y-0">
<div class="xl:col-span-2 space-y-6">
<twig:form:section title="Aufenthalt">
<dl class="grid grid-cols-2 gap-y-2 text-sm">
<dl class="grid grid-cols-2 gap-y-2">
<dt class="font-medium">Gruppenhaus</dt>
<dd>{{ booking.accommodation.name }}</dd>
<dt class="font-medium">Anreise</dt>
@@ -48,7 +48,7 @@
{% if booking.boardServiceLabel or booking.additionalServices | length > 0 %}
<twig:form:section title="Leistungen">
<dl class="grid grid-cols-2 gap-y-2 text-sm">
<dl class="grid grid-cols-2 gap-y-2">
{% if booking.boardServiceLabel %}
<dt class="font-medium">Verpflegung</dt>
<dd>{{ booking.boardServiceLabel }}</dd>
@@ -69,7 +69,7 @@
{% endif %}
<twig:form:section title="Kontakt">
<dl class="grid grid-cols-2 gap-y-2 text-sm">
<dl class="grid grid-cols-2 gap-y-2">
<dt class="font-medium">Gruppenname</dt>
<dd>{{ booking.groupName }}</dd>
<dt class="font-medium">Anrede</dt>
@@ -101,51 +101,51 @@
<aside class="space-y-6 xl:sticky xl:top-8">
<twig:form:section title="Status">
<dl class="grid grid-cols-2 gap-y-1 text-sm">
<dt class="text-gray-500">Status</dt>
<dl class="grid grid-cols-2 gap-y-1">
<dt class="text-muted">Status</dt>
<dd>{% include 'admin/accommodation_booking/_status_label.html.twig' %}</dd>
<dt class="text-gray-500">Herkunft</dt>
<dt class="text-muted">Herkunft</dt>
<dd>{{ booking.origin.label }}</dd>
{% if booking.managedBy is not null %}
<dt class="text-gray-500">Bearbeiter:in</dt>
<dt class="text-muted">Bearbeiter:in</dt>
<dd>{{ booking.managedBy.displayName }}</dd>
{% endif %}
{% if booking.acceptedAt is not null %}
<dt class="text-gray-500">Angenommen</dt>
<dt class="text-muted">Angenommen</dt>
<dd>{{ booking.acceptedAt | date('d.m.Y, H:i') }}</dd>
{% endif %}
{% if booking.confirmedAt is not null %}
<dt class="text-gray-500">Bestätigt</dt>
<dt class="text-muted">Bestätigt</dt>
<dd>{{ booking.confirmedAt | date('d.m.Y, H:i') }}</dd>
{% endif %}
<dt class="text-gray-500">Eingegangen</dt>
<dt class="text-muted">Eingegangen</dt>
<dd>{{ booking.createdAt | date('d.m.Y, H:i') }}</dd>
{% if booking.updatedAt is not null and booking.updatedAt != booking.createdAt %}
<dt class="text-gray-500">Aktualisiert</dt>
<dt class="text-muted">Aktualisiert</dt>
<dd>{{ booking.updatedAt | date('d.m.Y, H:i') }}</dd>
{% endif %}
</dl>
</twig:form:section>
{# One pink button per page, for the next step; everything else is grey, and the one
{# One magenta button per page, for the next step; everything else is secondary, and the one
destructive action is set apart below the others. #}
{% set has_next_step = booking.draft or booking.requested or booking.received %}
{% if booking.draft or booking.requested %}
<twig:form:section title="Nächster Schritt: Angebot">
<p class="text-sm text-gray-500 mb-3">
<p class="text-sm text-muted mb-3">
Das Angebot wurde dem Kunden noch nicht zugestellt. Beim Versand wird der Zugangslink
erzeugt und die Buchung wartet anschließend auf die Annahme durch den Kunden.
</p>
<div class="flex flex-col gap-2">
<button type="button"
class="button button--primary button--small w-full"
class="btn-primary w-full"
hx-get="{{ path('app_admin_accommodationbooking_send_offer', { id: booking.id }) }}"
hx-target="body"
hx-swap="beforeend">
Angebot per E-Mail senden
</button>
<button type="button"
class="button button--neutral button--small w-full"
class="btn-secondary w-full"
hx-get="{{ path('app_admin_accommodationbooking_generate_access_link', { id: booking.id }) }}"
hx-target="body"
hx-swap="beforeend">
@@ -155,11 +155,11 @@
</twig:form:section>
{% elseif booking.received %}
<twig:form:section title="Nächster Schritt: Bestätigung">
<p class="text-sm text-gray-500 mb-3">
<p class="text-sm text-muted mb-3">
Die Buchung des Kunden ist eingegangen, aber es wurde noch keine Bestätigung verschickt.
</p>
<button type="button"
class="button button--primary button--small w-full"
class="btn-primary w-full"
hx-get="{{ path('app_admin_accommodationbooking_confirm', { id: booking.id }) }}"
hx-target="body"
hx-swap="beforeend">
@@ -170,13 +170,13 @@
<twig:form:section title="Zugangslink">
{% if not booking.customerAccessible %}
<p class="text-sm text-gray-500">
<p class="text-sm text-muted">
Ein Zugangslink wird beim Versand des Angebots erzeugt.
</p>
{% elseif accessLink %}
<div class="grid grid-cols-2 gap-2">
<button type="button"
class="button button--neutral button--small sm:text-xs w-full"
class="btn-secondary w-full"
data-controller="clipboard"
data-clipboard-content-value="{{ accessLink }}"
data-clipboard-label-value="Kopiert!"
@@ -184,21 +184,21 @@
{{ icon('copy', 'w-4 h-4') }} Link kopieren
</button>
<button type="button"
class="button button--neutral button--small sm:text-xs w-full"
class="btn-secondary w-full"
hx-get="{{ path('app_admin_accommodationbooking_send_access_link', { id: booking.id }) }}"
hx-target="body"
hx-swap="beforeend">
Link senden
</button>
</div>
<p class="text-xs text-gray-500 mt-2">
<p class="text-xs text-muted mt-2">
Gültig bis {{ accessLinkExpiresAt | date('d.m.Y') }}
{% if accessLinkExpiresAt < date() %}
<span class="text-red-600 font-medium">(abgelaufen)</span>
{% endif %}
</p>
{% else %}
<p class="text-sm text-gray-500">
<p class="text-sm text-muted">
Der Zugangslink wird beim Versand des Angebots erzeugt.
</p>
{% endif %}
@@ -207,23 +207,23 @@
<twig:form:section title="Aktionen">
<div class="flex flex-col gap-2">
<a href="{{ path('app_admin_accommodationbooking_edit', edit_params) }}"
class="button {{ has_next_step ? 'button--neutral' : 'button--primary' }} button--small w-full">
class="{{ has_next_step ? 'btn-secondary' : 'btn-primary' }} w-full">
bearbeiten
</a>
<button type="button"
class="button button--neutral button--small w-full"
class="btn-secondary w-full"
hx-get="{{ path('app_admin_accommodationbooking_duplicate', edit_params) }}"
hx-target="body"
hx-swap="beforeend">
duplizieren
</button>
<a href="{{ path('app_admin_accommodationbooking_pdf', { 'id': booking.id }) }}"
class="button button--neutral button--small w-full">
class="btn-secondary w-full">
PDF herunterladen
</a>
</div>
{% if not booking.confirmed and not booking.discarded %}
<div class="mt-4 pt-3 border-t border-gray-200 text-center">
<div class="mt-4 pt-3 border-t border-line text-center">
<button type="button"
class="text-sm font-medium text-red-600 hover:underline"
hx-get="{{ path('app_admin_accommodationbooking_discard', { id: booking.id }) }}"
@@ -235,7 +235,7 @@
{% endif %}
</twig:form:section>
<a href="{{ returnUrl }}" class="inline-block text-sm text-gray-500 hover:text-gray-900 hover:underline">
<a href="{{ returnUrl }}" class="inline-block text-sm text-muted hover:text-ink hover:underline">
← zurück
</a>
</aside>
@@ -17,11 +17,11 @@
</div>
<div class="flex justify-between pt-8">
<a href="{{ path('app_admin_accommodation_edit', { 'id': accommodation.id }) }}#prices"
class="button button--secondary button--small">
class="btn-secondary">
zurück
</a>
<button type="submit"
class="button button--primary button--small">
class="btn-primary">
speichern
</button>
</div>
@@ -18,11 +18,11 @@
</div>
<div class="flex justify-between pt-8">
<a href="{{ path('app_admin_accommodation_edit', { 'id': accommodation.id }) }}#additional-services"
class="button button--secondary button--small">
class="btn-secondary">
zurück
</a>
<button type="submit"
class="button button--primary button--small">
class="btn-primary">
speichern
</button>
</div>
@@ -12,11 +12,11 @@
</div>
<div class="flex justify-between pt-8">
<a href="{{ path('app_admin_accommodation_edit', { 'id': accommodation.id }) }}#board-services"
class="button button--secondary button--small">
class="btn-secondary">
zurück
</a>
<button type="submit"
class="button button--primary button--small">
class="btn-primary">
speichern
</button>
</div>
@@ -9,7 +9,7 @@
'modal_route': 'app_admin_bookingeditdraft_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -48,17 +48,17 @@
{% endif %}
</td>
<td>
<twig:dropdown>
<twig:dropdown:link url="{{ path('app_admin_bookingeditdraft_show', { 'id': draft.id, 'r': return_url() }) }}">
<twig:menu>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_bookingeditdraft_show', { 'id': draft.id, 'r': return_url() }) }}">
Details
</twig:dropdown:link>
<twig:dropdown:link url="{{ path('app_admin_bookingeditdraft_export', { 'id': draft.id }) }}">
</a>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_bookingeditdraft_export', { 'id': draft.id }) }}">
XLS-Export
</twig:dropdown:link>
<twig:dropdown:hxbutton url="{{ path('app_admin_bookingeditdraft_delete', { 'id': draft.id, 'r': return_url() }) }}" warning>
</a>
<button type="button" class="menu-item-danger" role="menuitem" hx-get="{{ path('app_admin_bookingeditdraft_delete', { 'id': draft.id, 'r': return_url() }) }}" hx-target="body" hx-swap="beforeend">
löschen
</twig:dropdown:hxbutton>
</twig:dropdown>
</button>
</twig:menu>
</td>
</tr>
{% else %}
@@ -2,12 +2,12 @@
{% block content %}
<twig:page:heading>Buchungsentwurf</twig:page:heading>
<h2 class="text-xl font-bold pb-4">
<h2 class="text-xl font-bold text-brand pb-4">
Vorgang {{ draft.bookingNumber }}
</h2>
{% include('_partials/_json.html.twig') with { 'value': draft.formData } %}
<div class="flex justify-end pt-8">
<a href="{{ returnUrl }}" class="button button--secondary button--small">
<a href="{{ returnUrl }}" class="btn-secondary">
zurück
</a>
</div>
+1 -1
View File
@@ -10,7 +10,7 @@
<twig:dashboard:widget title="{{ widget.title }}" emptyText="{{ widget.emptyText }}">
<twig:block name="actions">
{% if widget.actionUrl %}
<a href="{{ widget.actionUrl }}" class="text-sm font-normal text-primary">{{ widget.actionLabel }}</a>
<a href="{{ widget.actionUrl }}" class="text-sm text-brand hover:underline">{{ widget.actionLabel }}</a>
{% endif %}
</twig:block>
{% for entry in widget.entries %}
+5 -5
View File
@@ -9,7 +9,7 @@
'modal_route': 'app_admin_log_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -57,11 +57,11 @@
</td>
<td>
{% if entry.channel == 'bpn' %}
<twig:dropdown>
<twig:dropdown:link url="{{ path('app_admin_log_xmldumps', { 'id': entry.id }) }}">
<twig:menu>
<a class="menu-item" role="menuitem" href="{{ path('app_admin_log_xmldumps', { 'id': entry.id }) }}">
XML-Dumps
</twig:dropdown:link>
</twig:dropdown>
</a>
</twig:menu>
{% endif %}
</td>
</tr>
+1 -1
View File
@@ -9,7 +9,7 @@
</div>
{% else %}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
+31 -22
View File
@@ -9,8 +9,12 @@
<div class="w-64">
{{ form_row(form.travelCode) }}
</div>
<div>
{{ form_row(form.busOnly) }}
</div>
{# the main action until there is a result; then creating the list is #}
<button type="submit"
class="button button--primary button--small">
class="{{ result is null ? 'btn-primary' : 'btn-secondary' }}">
abrufen
</button>
</div>
@@ -18,44 +22,49 @@
{{ form_end(form) }}
{% if failed %}
{% include '_partials/_alert.html.twig' with {
level: 'warning',
messages: ['Die Teilnehmerliste konnte nicht von BusPro abgerufen werden. Bitte später erneut versuchen.'],
{% include 'admin/_partials/_alert.html.twig' with {
type: 'error',
message: 'Die Teilnehmerliste konnte nicht von BusPro abgerufen werden. Bitte später erneut versuchen.',
} %}
{% elseif result is not null %}
{% if result.data is empty %}
{% include '_partials/_alert.html.twig' with {
level: 'warning',
messages: ['Keine Empfänger für <code>%s</code> gefunden: Reisecode unbekannt oder keine bestätigten Teilnehmer.'|format(result.travelCode|e)],
} %}
{% set message %}Keine Empfänger für <code>{{ result.travelCode }}</code> gefunden: Reisecode unbekannt oder keine bestätigten Teilnehmer{{ result.busLeg ? ' unter den ' ~ result.busLeg.label }}.{% endset %}
{% include 'admin/_partials/_alert.html.twig' with {type: 'warning', message: message} %}
{% else %}
<div class="pb-4">
<h2 class="text-lg font-semibold">
<h2 class="text-lg font-bold text-brand">
{{ travel_label|default('Reise nicht im lokalen Reisebestand') }}
</h2>
<p class="text-sm text-gray-700">
{{ result.data|length }} Empfänger für <code>{{ result.travelCode }}</code>
<p class="text-sm text-ink">
{{ result.data|length }} Empfänger für <code>{{ result.travelCode }}</code>{% if result.busLeg %}, nur {{ result.busLeg.label }}{% endif %}
</p>
</div>
<div class="pb-6 text-sm">
{% if mailing_list is not null %}
<div class="pb-6">
{% for list in mailing_lists %}
<p>
Mailjet-Liste <code>{{ mailing_list.travelCode }}</code> (ID {{ mailing_list.mailjetListId }})
am {{ mailing_list.createdAt|date('d.m.Y, H:i') }} angelegt,
wird ab {{ mailing_list.deleteAfter|date('d.m.Y') }} automatisch gelöscht.
Mailjet-Liste <code>{{ list.name }}</code> (ID {{ list.mailjetListId }},
{{ list.busLeg ? 'nur ' ~ list.busLeg.label : 'alle Teilnehmer' }})
am {{ list.createdAt|date('d.m.Y, H:i') }} angelegt,
wird ab {{ list.deleteAfter|date('d.m.Y') }} automatisch gelöscht.
</p>
{% endfor %}
{% if mailing_list is not null %}
{# the list for this filter exists and is listed above #}
{% elseif travel_starts_at is null %}
<p class="text-gray-700">
<p class="text-ink">
Kein Reisebeginn bekannt, daher kann keine Mailjet-Liste angelegt werden.
</p>
{% else %}
<form method="post" action="{{ path('app_admin_travelmailing_createlist') }}">
<form method="post" action="{{ path('app_admin_travelmailing_createlist') }}"{% if mailing_lists is not empty %} class="pt-2"{% endif %}>
<input type="hidden" name="travelCode" value="{{ result.travelCode }}">
{% if result.busLeg %}
<input type="hidden" name="busOnly" value="1">
{% endif %}
<input type="hidden" name="_token" value="{{ csrf_token(constant('App\\Controller\\Admin\\TravelMailing\\CreateListController::CSRF_TOKEN_ID')) }}">
<button type="submit" class="button button--primary button--small">
Mailjet-Liste anlegen
<button type="submit" class="btn-primary">
Mailjet-Liste {{ list_name }} anlegen
</button>
<span class="pl-2 text-gray-700">
<span class="pl-2 text-ink">
Alle Empfänger werden ohne Opt-in eingetragen; die Liste wird 30 Tage nach Reisebeginn
({{ travel_starts_at|date('d.m.Y') }}) gelöscht.
</span>
@@ -63,7 +72,7 @@
{% endif %}
</div>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
+5 -5
View File
@@ -9,7 +9,7 @@
'modal_route': 'app_admin_user_filter',
}) }}
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner text-sm">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
@@ -69,11 +69,11 @@
{{ user.lastLoginAt | date('d.m.Y, H:i') }}
</td>
<td class="text-right">
<twig:dropdown>
<twig:dropdown:hxbutton url="{{ path('app_admin_user_permissions', { 'id': user.id, 'r': return_url() }) }}">
<twig:menu>
<button type="button" class="menu-item" role="menuitem" hx-get="{{ path('app_admin_user_permissions', { 'id': user.id, 'r': return_url() }) }}" hx-target="body" hx-swap="beforeend">
Berechtigungen
</twig:dropdown:hxbutton>
</twig:dropdown>
</button>
</twig:menu>
</td>
</tr>
{% else %}
@@ -5,12 +5,12 @@
{% endblock %}
{% block content %}
<div class="pb-4 text-sm text-gray-500">
<div class="pb-4 text-sm text-muted">
{{ user.email }}
</div>
<div class="font-bold pb-2">Aus BusPro</div>
<div class="pb-6 text-sm text-gray-500">
<div class="pb-6 text-sm text-muted">
<dl class="grid grid-cols-[8rem_1fr] gap-y-1">
<dt>Rollen</dt>
<dd>{{ user.roles | effective_roles | join(', ') | default('–') }}</dd>
@@ -26,18 +26,18 @@
<div class="font-bold pb-2">Freischaltung</div>
{% if approvableRoles is empty and selfRefusedRoles is empty %}
<div class="text-sm text-gray-500">
<div class="text-sm text-muted">
Keine offenen Freischaltungen.
</div>
{% else %}
<div class="text-sm text-gray-500 pb-4">
<div class="text-sm text-muted pb-4">
BusPro meldet diese Rollen für den Account. Sie sind erst nach der Freischaltung wirksam.
</div>
{% if approvableRoles is not empty %}
<div class="flex flex-wrap gap-2">
{% for role, label in approvableRoles %}
<button type="button"
class="button button--primary button--small"
class="btn-primary"
hx-get="{{ path('app_admin_user_approve_role', { id: user.id, role: role, r: returnUrl }) }}"
hx-target="body"
hx-swap="beforeend">
@@ -47,7 +47,7 @@
</div>
{% endif %}
{% if selfRefusedRoles is not empty %}
<div class="text-sm text-gray-500 pt-4">
<div class="text-sm text-muted pt-4">
{{ selfRefusedRoles | join(', ') }}: diese Rolle kannst du dir nicht selbst freischalten.
Bitte wende dich an eine:n andere:n Administrator:in.
</div>
+8 -3
View File
@@ -4,7 +4,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex,nofollow">
<title>{% block title %}MyE&amp;P{% endblock %}</title>
<meta name="color-scheme" content="light">
<title>{% block title %}MyE&amp;P Admin{% endblock %}</title>
<link rel="icon" href="{{ asset('build/favicon/favicon.ico') }}" sizes="32x32">
<link rel="icon" href="{{ asset('build/favicon/icon.svg') }}" type="image/svg+xml">
<link rel="apple-touch-icon" href="{{ asset('build/favicon/apple-touch-icon.png') }}">
@@ -15,8 +16,12 @@
{{ encore_entry_script_tags('admin') }}
{% endblock %}
</head>
<body class="bg-white text-gray-700 font-sans antialiased {{ booking_theme() }}">
<body class="bg-page text-ink font-sans antialiased">
<a href="#content"
class="sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-2 focus:z-50 focus:bg-white focus:px-3 focus:py-2 focus:font-bold focus:text-brand focus:shadow">Zum Inhalt springen</a>
{% block body %}{% endblock %}
{% block data_layer %}{% endblock %}
{# shows the toasts of htmx responses (HX-Trigger: showNotifications) #}
<div {{ stimulus_controller('toast') }}></div>
{% include '_partials/_flashes_admin.html.twig' %}
</body>
</html>
+12 -5
View File
@@ -2,17 +2,24 @@
{% set htmx_change_trigger = 'change delay:300ms' %}
{% macro stepFormField(form) %}
<div class="grid grid-cols-3 pb-2">
{% macro stepFormField(form, roomId, pool = null) %}
{# A room whose shared contingent the other selected rooms have used up #}
<div class="grid grid-cols-3 pb-2{{ pool is not null and form.quantity.vars.max_value == 0 ? ' opacity-50' }}">
<div class="col-span-2 pr-2">
<div class="font-semibold">
{{ form.vars.label_room }} {% if form.vars.is_inquiry %}(nur auf Anfrage){% endif %}
{{ form.vars.label_room }}
</div>
<div class="text-gray-500">
{% if form.vars.label_price_amount is defined and form.vars.label_price_amount is not null %}
{{ form.vars.label_price_amount|format_currency('EUR') }} pro Person
{% endif %}
</div>
{% if pool is not null %}
<div class="text-sm text-gray-500">
Dasselbe Zimmer wie: {{ pool.rooms|filter((room, id) => id != roomId)|map(room => room.label)|join(', ') }}
(insgesamt noch {{ pool.available }} verfügbar)
</div>
{% endif %}
</div>
<div>
{{ form_row(form, {
@@ -70,7 +77,7 @@
Zimmer
</h3>
{% for roomId, room in bookingCreateContext.groupedRooms.byRoom %}
{{ _self.stepFormField(form.roomSelections[roomId]) }}
{{ _self.stepFormField(form.roomSelections[roomId], roomId, bookingCreateContext.roomContingentPools[roomId] ?? null) }}
{% endfor %}
{% endif %}
{% if bookingCreateContext.groupedRooms.byPax is not empty %}
@@ -78,7 +85,7 @@
Betten
</h3>
{% for roomId, room in bookingCreateContext.groupedRooms.byPax %}
{{ _self.stepFormField(form.roomSelections[roomId]) }}
{{ _self.stepFormField(form.roomSelections[roomId], roomId, bookingCreateContext.roomContingentPools[roomId] ?? null) }}
{% endfor %}
{% endif %}
</div>
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff. Show more