Compare commits
78
Commits
3f806669c6
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15ca0badc4 | ||
|
|
8a02b28d00 | ||
|
|
4530d2434b | ||
|
|
d283a07b5c | ||
|
|
3332e36448 | ||
|
|
6dbc6efa78 | ||
|
|
99e6119311 | ||
|
|
ebad54e989 | ||
|
|
50ef662dd3 | ||
|
|
f22d1f1199 | ||
|
|
2c51ddf86f | ||
|
|
74080b0488 | ||
|
|
8f4c4d8267 | ||
|
|
e9b0de44f1 | ||
|
|
3c19401d8b | ||
|
|
6b16c88a5b | ||
|
|
852bffb073 | ||
|
|
981e9f2762 | ||
|
|
8b44c7f14d | ||
|
|
64fac372c0 | ||
|
|
eda7856e48 | ||
|
|
9ba6529ee0 | ||
|
|
e976342c09 | ||
|
|
4e50f23558 | ||
|
|
5ca9b812c3 | ||
|
|
ec3fd68695 | ||
|
|
fa0ffcf636 | ||
|
|
7095456d36 | ||
|
|
acd8e78e55 | ||
|
|
126a0680db | ||
|
|
f7611b3ac1 | ||
|
|
f45ac6ac0b | ||
|
|
e0496dc61f | ||
|
|
8f4bc9a8ef | ||
|
|
77d7000df3 | ||
|
|
ab6ffd4eda | ||
|
|
e285646bb2 | ||
|
|
6c89f1b8a9 | ||
|
|
bfef08b519 | ||
|
|
d760ed3cdf | ||
|
|
2ef831c5c4 | ||
|
|
8898320e21 | ||
|
|
8b5b7584b1 | ||
|
|
e72616fdbf | ||
|
|
abf9c1be0b | ||
|
|
cd7cc7f8fc | ||
|
|
3c34cfa76a | ||
|
|
9d0cdd7f52 | ||
|
|
9583612fdc | ||
|
|
0bc77b7463 | ||
|
|
4ff963d1e2 | ||
|
|
f9d2ff084d | ||
|
|
7aefe88610 | ||
|
|
09eea86183 | ||
|
|
ddfaa4b440 | ||
|
|
d3b9b0611b | ||
|
|
fe0c854f1d | ||
|
|
0b736b51fb | ||
|
|
af97468b2d | ||
|
|
a0170f5952 | ||
|
|
2f4f9800dd | ||
|
|
9fedc5b5d3 | ||
|
|
a35f91ac63 | ||
|
|
890e04f8a6 | ||
|
|
5e4e574076 | ||
|
|
2a041d25a0 | ||
|
|
df6734c939 | ||
|
|
8070fda64d | ||
|
|
d06b647dac | ||
|
|
a84275b40e | ||
|
|
2ec2a4c93f | ||
|
|
de4aedd26e | ||
|
|
5090f72fab | ||
|
|
c00dd86eb4 | ||
|
|
300bb2058f | ||
|
|
3fe510e64e | ||
|
|
48691227cb | ||
|
|
34ff630b75 |
No files matched your search
@@ -70,6 +70,10 @@ APP_BPN_CRM_ID_TEAMER=1070
|
||||
APP_DEFAULT_EMAIL_FROM=[email protected]
|
||||
APP_DEFAULT_EMAIL_TO=[email protected]
|
||||
|
||||
# Reply-To of every mail of an assignment mailing, so answers reach the shared inbox rather
|
||||
# than the manager who happened to send it.
|
||||
APP_ASSIGNMENT_MAILING_REPLY_TO=[email protected]
|
||||
|
||||
# Regular expressions of the only recipients a mail may actually reach. Everything else is
|
||||
# stripped from the envelope and a mail left without a recipient is not sent at all, see
|
||||
# App\EventListener\EmailRecipientWhitelistSubscriber. Empty means no filtering, which is what
|
||||
@@ -94,6 +98,8 @@ MYEP_OAUTH2_URL_RESOURCE_OWNER_DETAILS=https://my.ep-reisen.de/api/userinfo
|
||||
MYEP_OAUTH2_SCOPES=email,id,roles,profile
|
||||
# Shared key the sibling websites send in the X-Api-Key header. Empty here: set it per stage.
|
||||
APPLICATION_FORM_API_KEY=
|
||||
# Shared key n8n reads the assignments feed with, in the X-Api-Key header. Empty here: set it per stage.
|
||||
N8N_API_KEY=
|
||||
# Booking link for the Team-Infocall, substituted for {bookingUrl} in the application form
|
||||
# receipt mail. Empty here: set it per stage. While it is empty that mail is not sent at all -
|
||||
# an invitation with a dead booking link is worse than none.
|
||||
|
||||
@@ -10,5 +10,7 @@ APP_TRUSTED_HOSTS='^localhost$'
|
||||
# loaded in the test environment - so the throwaway key the tests send belongs here.
|
||||
# Keep it in sync with ApplicationFormControllerTest::KEY.
|
||||
APPLICATION_FORM_API_KEY=test-application-form-api-key
|
||||
# Keep in sync with Api\Assignment\ListControllerTest::KEY.
|
||||
N8N_API_KEY=test-n8n-api-key
|
||||
# The receipt mail refuses to render without it, and several tests send that mail.
|
||||
APPLICATION_FORM_BOOKING_URL=https://bookings.example.com/team-infocall
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
|
||||
/*
|
||||
* Shows a questionnaire question only while its show_if holds, mirroring
|
||||
* App\Model\Questionnaire\Definition::isVisible(): the condition must be met and the question it
|
||||
* depends on must itself be shown.
|
||||
*
|
||||
* Every question row carries data-question-key; a conditional one also data-show-if, the JSON
|
||||
* {question, operator, value} that App\Form\QuestionnaireType writes. A hidden row stays in the
|
||||
* form and is submitted: a draft keeps its answer, and the server drops it on submit.
|
||||
*/
|
||||
export default class extends Controller {
|
||||
|
||||
connect() {
|
||||
this.update()
|
||||
}
|
||||
|
||||
update() {
|
||||
const visible = {}
|
||||
|
||||
// Rows come in definition order, and a condition may only name an earlier question, so
|
||||
// the question a row depends on has always been decided by the time the row is reached.
|
||||
for (const row of this.element.querySelectorAll('[data-question-key]')) {
|
||||
const key = row.dataset.questionKey
|
||||
const condition = row.dataset.showIf ? JSON.parse(row.dataset.showIf) : null
|
||||
|
||||
visible[key] = null === condition
|
||||
|| (true === visible[condition.question] && this.isMet(condition))
|
||||
|
||||
row.hidden = false === visible[key]
|
||||
}
|
||||
}
|
||||
|
||||
isMet({ question, operator, value }) {
|
||||
const answer = this.answer(question)
|
||||
|
||||
if (null === answer) {
|
||||
return false
|
||||
}
|
||||
|
||||
switch (operator) {
|
||||
case 'equals':
|
||||
return answer === value
|
||||
case 'in':
|
||||
return value.includes(answer)
|
||||
case 'lte':
|
||||
return Number(answer) <= value
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
answer(key) {
|
||||
const row = this.element.querySelector(`[data-question-key="${key}"]`)
|
||||
|
||||
if (null === row) {
|
||||
return null
|
||||
}
|
||||
|
||||
const checked = row.querySelector('input[type="radio"]:checked')
|
||||
|
||||
if (null !== checked) {
|
||||
return checked.value
|
||||
}
|
||||
|
||||
const select = row.querySelector('select')
|
||||
|
||||
if (null !== select) {
|
||||
return '' === select.value ? null : select.value
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,36 @@ export default class extends Controller {
|
||||
|
||||
connect() {
|
||||
this.element.rows = this.minRowsValue
|
||||
this.minHeight = null
|
||||
|
||||
// A textarea inside a hidden block (a questionnaire follow-up, a modal tab) has no layout
|
||||
// yet: measured now, its floor would be 0 and it would collapse to nothing. It is measured
|
||||
// once it is rendered instead - ResizeObserver reports the switch from display: none.
|
||||
this.observer = new ResizeObserver(() => this.measure())
|
||||
this.observer.observe(this.element)
|
||||
this.measure()
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.observer.disconnect()
|
||||
}
|
||||
|
||||
measure() {
|
||||
if (null !== this.minHeight || 0 === this.element.getClientRects().length) {
|
||||
return
|
||||
}
|
||||
|
||||
this.minHeight = this.element.scrollHeight
|
||||
this.observer.disconnect()
|
||||
this.resize()
|
||||
}
|
||||
|
||||
resize() {
|
||||
// until it has been rendered there is nothing to size; its rows keep it at the floor
|
||||
if (null === this.minHeight) {
|
||||
return
|
||||
}
|
||||
|
||||
this.element.style.height = 'auto'
|
||||
this.element.style.height = `${Math.max(this.element.scrollHeight, this.minHeight)}px`
|
||||
}
|
||||
|
||||
@@ -1,22 +1,108 @@
|
||||
import { Controller } from '@hotwired/stimulus'
|
||||
|
||||
// pixels the mouse has to move before a press becomes a drag, so clicks on bars still work
|
||||
const DRAG_THRESHOLD = 4
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ 'today' ]
|
||||
static targets = [ 'scroller', 'today' ]
|
||||
|
||||
connect() {
|
||||
if (false === this.hasTodayTarget) {
|
||||
this.drag = null
|
||||
this.suppressClick = this.suppressClick.bind(this)
|
||||
requestAnimationFrame(() => this.scrollToToday({ behavior: 'instant' }))
|
||||
}
|
||||
|
||||
scrollerTargetConnected(scroller) {
|
||||
// capture phase, so a drag ending on a link or button does not also open it
|
||||
scroller.addEventListener('click', this.suppressClick, true)
|
||||
}
|
||||
|
||||
scrollerTargetDisconnected(scroller) {
|
||||
scroller.removeEventListener('click', this.suppressClick, true)
|
||||
}
|
||||
|
||||
// centres today's column; the house column stays in front of the left part
|
||||
scrollToToday({ behavior = 'smooth' } = {}) {
|
||||
if (false === this.hasScrollerTarget || false === this.hasTodayTarget) {
|
||||
return
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const containerRect = this.element.getBoundingClientRect()
|
||||
const todayRect = this.todayTarget.getBoundingClientRect()
|
||||
const scroller = this.scrollerTarget
|
||||
const scrollerRect = scroller.getBoundingClientRect()
|
||||
const todayRect = this.todayTarget.getBoundingClientRect()
|
||||
|
||||
const scrollLeft = todayRect.left - containerRect.left + this.element.scrollLeft
|
||||
const centered = scrollLeft - (this.element.clientWidth / 2) + (todayRect.width / 2)
|
||||
const maxScrollLeft = this.element.scrollWidth - this.element.clientWidth
|
||||
const scrollLeft = todayRect.left - scrollerRect.left + scroller.scrollLeft
|
||||
const centered = scrollLeft - (scroller.clientWidth / 2) + (todayRect.width / 2)
|
||||
const maxScrollLeft = scroller.scrollWidth - scroller.clientWidth
|
||||
|
||||
this.element.scrollLeft = Math.min(Math.max(0, centered), maxScrollLeft)
|
||||
})
|
||||
scroller.scrollTo({ left: Math.min(Math.max(0, centered), maxScrollLeft), behavior })
|
||||
}
|
||||
|
||||
// pressing the mouse button on the timeline and moving drags it along; touch scrolls natively
|
||||
startDrag(event) {
|
||||
if (0 !== event.button || 'mouse' !== event.pointerType) {
|
||||
return
|
||||
}
|
||||
|
||||
// a drag without a following click must not swallow the next one
|
||||
this.dragged = false
|
||||
this.drag = {
|
||||
pointerId: event.pointerId,
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
scrollLeft: this.scrollerTarget.scrollLeft,
|
||||
scrollTop: this.scrollerTarget.scrollTop,
|
||||
moved: false,
|
||||
}
|
||||
}
|
||||
|
||||
moveDrag(event) {
|
||||
if (null === this.drag || event.pointerId !== this.drag.pointerId) {
|
||||
return
|
||||
}
|
||||
|
||||
const dx = event.clientX - this.drag.x
|
||||
const dy = event.clientY - this.drag.y
|
||||
|
||||
if (false === this.drag.moved) {
|
||||
if (Math.hypot(dx, dy) < DRAG_THRESHOLD) {
|
||||
return
|
||||
}
|
||||
this.drag.moved = true
|
||||
this.scrollerTarget.setPointerCapture(event.pointerId)
|
||||
this.scrollerTarget.classList.add('timeline--dragging')
|
||||
window.getSelection()?.removeAllRanges()
|
||||
}
|
||||
|
||||
this.scrollerTarget.scrollLeft = this.drag.scrollLeft - dx
|
||||
this.scrollerTarget.scrollTop = this.drag.scrollTop - dy
|
||||
}
|
||||
|
||||
endDrag(event) {
|
||||
if (null === this.drag || event.pointerId !== this.drag.pointerId) {
|
||||
return
|
||||
}
|
||||
|
||||
this.dragged = this.drag.moved
|
||||
this.drag = null
|
||||
this.scrollerTarget.classList.remove('timeline--dragging')
|
||||
if (this.scrollerTarget.hasPointerCapture(event.pointerId)) {
|
||||
this.scrollerTarget.releasePointerCapture(event.pointerId)
|
||||
}
|
||||
}
|
||||
|
||||
// links are draggable by default, which would take over the press
|
||||
preventNativeDrag(event) {
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
suppressClick(event) {
|
||||
if (true !== this.dragged) {
|
||||
return
|
||||
}
|
||||
|
||||
this.dragged = false
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,12 @@ export default class extends Controller {
|
||||
this.openValue = false
|
||||
}
|
||||
|
||||
closeOutside(event) {
|
||||
if (false === this.element.contains(event.target)) {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
|
||||
open() {
|
||||
this.openValue = true
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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 |
@@ -1,8 +1,8 @@
|
||||
<mjml>
|
||||
<mj-head>
|
||||
<mj-font name="Lato" href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" />
|
||||
<mj-preview>MyE&P Team</mj-preview>
|
||||
<mj-title>MyE&P Team</mj-title>
|
||||
<mj-preview>E&P Team</mj-preview>
|
||||
<mj-title>E&P Team</mj-title>
|
||||
<mj-attributes>
|
||||
<mj-all font-family="Lato, Verdana, Arial, 'Helvetica neue', sans-serif" />
|
||||
</mj-attributes>
|
||||
@@ -125,9 +125,9 @@
|
||||
<mj-text color="#FFFFFF" font-size="14px" line-height="18px">
|
||||
E&P Reisen und Events GmbH
|
||||
<br />
|
||||
Aachener Str. 326-328
|
||||
Neue Weyerstraße 6
|
||||
<br />
|
||||
50933 Köln
|
||||
50676 Köln
|
||||
</mj-text>
|
||||
</mj-column>
|
||||
<mj-column>
|
||||
|
||||
Binary file not shown.
@@ -1,36 +1,3 @@
|
||||
/* lato-regular - latin */
|
||||
@font-face {
|
||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url('../fonts/lato-v24-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
||||
}
|
||||
/* lato-italic - latin */
|
||||
@font-face {
|
||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
||||
font-family: 'Lato';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
src: url('../fonts/lato-v24-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
||||
}
|
||||
/* lato-700 - latin */
|
||||
@font-face {
|
||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url('../fonts/lato-v24-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
||||
}
|
||||
/* lato-900 - latin */
|
||||
@font-face {
|
||||
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url('../fonts/lato-v24-latin-900.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
|
||||
}
|
||||
|
||||
.htmx-indicator{
|
||||
@apply invisible;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@import "./components/badge.css";
|
||||
@import "./components/autocomplete.css";
|
||||
@import "./components/button.css";
|
||||
@import "./components/datatable.css";
|
||||
@import "./components/datepicker.css";
|
||||
@import "./components/toast.css";
|
||||
@import "./components/tooltip.css";
|
||||
@import "./components/timeline.css";
|
||||
@import "./components/mail-body.css";
|
||||
@import "./components/questionnaire.css";
|
||||
|
||||
+2
-27
@@ -1,4 +1,6 @@
|
||||
@import "tailwindcss";
|
||||
@import "toastify-js/src/toastify.css" layer(base);
|
||||
@import "./ep-design.css";
|
||||
@import "./_base.css" layer(base);
|
||||
@import "./_components.css" layer(components);
|
||||
|
||||
@@ -6,33 +8,6 @@
|
||||
|
||||
@source inline("rotate-90");
|
||||
|
||||
@theme {
|
||||
--font-sans: Lato, sans-serif;
|
||||
--font-weight-semibold: 700;
|
||||
--font-weight-bold: 900;
|
||||
--color-primary: #3d8ccb;
|
||||
--color-secondary: #f9c700;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tailwind 3 defaults that Tailwind 4 changed: borders were gray-200 instead of currentColor,
|
||||
* and buttons had a pointer cursor.
|
||||
*/
|
||||
@layer base {
|
||||
*,
|
||||
::after,
|
||||
::before,
|
||||
::backdrop,
|
||||
::file-selector-button {
|
||||
border-color: var(--color-gray-200, currentcolor);
|
||||
}
|
||||
|
||||
button:not(:disabled),
|
||||
[role="button"]:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Thin scrollbars without a track for inner scrolling areas. The page scrollbar takes its
|
||||
* style from <html>, which body * leaves out. Firefox and Chrome/Edge 121+ honour these;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
.btn {
|
||||
@apply inline-flex space-x-1 justify-center items-center rounded-lg text-sm uppercase font-semibold py-2.5 px-4;
|
||||
@apply bg-primary text-white hover:bg-primary/80 shadow-md disabled:opacity-50 disabled:cursor-not-allowed;
|
||||
}
|
||||
|
||||
.btn--small {
|
||||
@apply text-xs py-1 px-2 rounded-md;
|
||||
}
|
||||
|
||||
.btn--secondary {
|
||||
@apply bg-secondary text-gray-800 hover:bg-secondary/80;
|
||||
}
|
||||
|
||||
.btn--active {
|
||||
@apply shadow-none;
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* A table wider than its column scrolls inside this box, at every width: let overflow, it would
|
||||
* run past the right edge of the page content - out of line with the buttons above it - and make
|
||||
* the whole page scroll sideways. The row menus (components/dropdown.html.twig) are fixed to the
|
||||
* viewport while open, so this box does not clip them.
|
||||
*/
|
||||
.data-table-wrapper {
|
||||
@apply overflow-x-auto lg:overflow-x-visible mb-8;
|
||||
@apply overflow-x-auto mb-8;
|
||||
}
|
||||
|
||||
.data-table-wrapper__inner {
|
||||
@apply align-middle inline-block min-w-full overflow-hidden lg:overflow-visible;
|
||||
@apply align-middle inline-block min-w-full;
|
||||
}
|
||||
|
||||
table {
|
||||
@@ -14,12 +20,13 @@ tbody {
|
||||
@apply bg-white;
|
||||
}
|
||||
|
||||
/* rows and head as the table head of the apps portal (EP/apps frontend/components/ui.ts) */
|
||||
tr {
|
||||
@apply border border-gray-300;
|
||||
@apply border-b border-line;
|
||||
}
|
||||
|
||||
th {
|
||||
@apply px-4 py-2 bg-gray-200 text-left leading-4 font-bold text-primary align-top;
|
||||
@apply px-4 py-2 bg-white border-b-2 border-brand text-left text-[11px] leading-4 font-semibold uppercase tracking-wide text-brand align-top;
|
||||
}
|
||||
|
||||
td {
|
||||
@@ -32,5 +39,5 @@ table.horizontal td {
|
||||
}
|
||||
|
||||
.data-table tbody tr {
|
||||
@apply hover:bg-gray-100;
|
||||
@apply hover:bg-brand-light/50;
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
.flatpickr-day.selected,
|
||||
.flatpickr-day.selected:hover,
|
||||
.flatpickr-day.selected:focus {
|
||||
background-color: var(--color-secondary);
|
||||
border-color: var(--color-secondary);
|
||||
background-color: var(--color-brand);
|
||||
border-color: var(--color-brand);
|
||||
}
|
||||
|
||||
.flatpickr-monthDropdown-months,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* A questionnaire "pick" (App\Form\Questionnaire\AbstractPickType): a checkbox, and below it the
|
||||
* fields that only matter once it is ticked (templates/forms.html.twig, questionnaire_pick_*). They stay in the form, and are submitted, while
|
||||
* hidden; the form type drops them. The child combinator keeps a nested pick (a guiding type
|
||||
* inside a teamer) from answering for its parent.
|
||||
*/
|
||||
.questionnaire-pick:not(:has(> .questionnaire-pick__head input:checked)) > .questionnaire-pick__body {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,4 +1,66 @@
|
||||
.scroll-container {
|
||||
/*
|
||||
* The timeline (administrative/assignment/timeline.html.twig): one grid per house with a fixed
|
||||
* house column and one column per day. The header, the background and every house share the
|
||||
* column template, so their columns line up; --timeline-days is set on .timeline.
|
||||
*/
|
||||
.timeline {
|
||||
--timeline-label: 11rem;
|
||||
--timeline-day: 1.75rem;
|
||||
|
||||
@apply overflow-auto;
|
||||
max-height: calc(100vh - 320px);
|
||||
max-height: calc(100vh - 260px);
|
||||
}
|
||||
|
||||
.timeline-grid {
|
||||
display: grid;
|
||||
grid-template-columns: var(--timeline-label) repeat(var(--timeline-days), var(--timeline-day));
|
||||
}
|
||||
|
||||
.timeline-background {
|
||||
@apply pointer-events-none absolute inset-0;
|
||||
grid-template-rows: 100%;
|
||||
}
|
||||
|
||||
.timeline-header {
|
||||
@apply sticky top-0 z-20 border-b-2 border-brand bg-white;
|
||||
}
|
||||
|
||||
.timeline-corner {
|
||||
@apply sticky left-0 z-10 border-r border-line bg-white;
|
||||
}
|
||||
|
||||
.timeline-house {
|
||||
@apply relative border-b border-line py-1;
|
||||
grid-auto-rows: 1.75rem;
|
||||
}
|
||||
|
||||
.timeline-house-label {
|
||||
@apply sticky left-0 z-10 -my-1 border-r border-line bg-white px-3 py-2;
|
||||
}
|
||||
|
||||
.timeline-bar {
|
||||
@apply relative z-[1] mx-px my-0.5 flex min-w-0 items-center gap-x-1 overflow-hidden whitespace-nowrap px-1.5 text-xs leading-none;
|
||||
}
|
||||
|
||||
/* the states differ in shape too, not only in colour: dashed, outlined, filled */
|
||||
.timeline-bar--open {
|
||||
@apply border border-dashed border-muted bg-white text-muted;
|
||||
}
|
||||
|
||||
.timeline-bar--pending {
|
||||
@apply border border-brand bg-brand-light text-brand-dark;
|
||||
}
|
||||
|
||||
.timeline-bar--staffed {
|
||||
@apply border border-emerald-800 bg-emerald-700 text-white;
|
||||
}
|
||||
|
||||
/* timeline_scroll_controller.js: an open hand over the timeline, a closed one while dragging */
|
||||
.timeline {
|
||||
@apply cursor-grab;
|
||||
}
|
||||
|
||||
.timeline--dragging,
|
||||
.timeline--dragging * {
|
||||
@apply cursor-grabbing select-none;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
@import "toastify-js/src/toastify.css";
|
||||
|
||||
.toastify {
|
||||
@apply shadow-lg rounded-sm;
|
||||
}
|
||||
|
||||
.toastify--success {
|
||||
@apply text-gray-100;
|
||||
background: var(--color-emerald-600);
|
||||
}
|
||||
|
||||
.toastify--warning {
|
||||
@apply text-gray-100;
|
||||
background: var(--color-red-600);
|
||||
}
|
||||
|
||||
.toastify--info {
|
||||
@apply text-gray-100;
|
||||
background: var(--color-blue-600);
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
@import "tippy.js/dist/tippy.css";
|
||||
|
||||
.tippy-box {
|
||||
background-color: var(--color-primary);
|
||||
background-color: var(--color-brand);
|
||||
}
|
||||
|
||||
.tippy-box[data-placement^='top'] > .tippy-arrow::before {
|
||||
border-top-color: var(--color-primary);
|
||||
border-top-color: var(--color-brand);
|
||||
}
|
||||
.tippy-box[data-placement^='bottom'] > .tippy-arrow::before {
|
||||
border-bottom-color: var(--color-primary);
|
||||
border-bottom-color: var(--color-brand);
|
||||
}
|
||||
.tippy-box[data-placement^='left'] > .tippy-arrow::before {
|
||||
border-left-color: var(--color-primary);
|
||||
border-left-color: var(--color-brand);
|
||||
}
|
||||
.tippy-box[data-placement^='right'] > .tippy-arrow::before {
|
||||
border-right-color: var(--color-primary);
|
||||
border-right-color: var(--color-brand);
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
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
+1018
-665
File diff suppressed because it is too large.
Load diff
@@ -190,6 +190,18 @@ texts:
|
||||
|
||||
Im E&P-Team Portal findest du unter "Saisonunterlagen" die Vorlagen zum Herunterladen und kannst deine unterschriebenen Unterlagen direkt hochladen.
|
||||
|
||||
# Nightly for the first week after the trip, then weekly, for as long as a questionnaire of the
|
||||
# placement is not submitted. One mail per teamer, listing every such placement.
|
||||
reminder_questionnaire:
|
||||
label: 'Erinnerung: Feedbackbogen ausfüllen'
|
||||
placeholders: ['destinations']
|
||||
subject: 'Reminder: Offener Feedbackbogen'
|
||||
headline: 'Hallo aus Köln,'
|
||||
body: |-
|
||||
für folgende Einsätze fehlt uns noch dein Feedbackbogen: **{destinations}**
|
||||
|
||||
Bitte fülle ihn spätestens drei Tage nach Reiseende aus. Du findest ihn im E&P-Team Portal auf deiner Startseite. Ein gespeicherter Entwurf zählt erst, wenn du ihn abschickst.
|
||||
|
||||
reminder_invoice_upload:
|
||||
label: 'Erinnerung: Honorarnote hochladen'
|
||||
placeholders: ['destination', 'invoiceUploadDeadlineDays']
|
||||
@@ -273,4 +285,5 @@ placeholders:
|
||||
dateTo: 'Ende des Einsatzes'
|
||||
diffInDays: 'Tage bis zum Beginn des Einsatzes'
|
||||
tasks: 'Noch offene Punkte der Saison-Checkliste, kommagetrennt'
|
||||
destinations: 'Einsätze mit noch offenem Feedbackbogen, kommagetrennt'
|
||||
workMonth: 'Monat der Arbeitszeiten, z. B. "März 2026"'
|
||||
@@ -1,3 +1,3 @@
|
||||
knp_menu:
|
||||
twig:
|
||||
template: _partials/_menu.html.twig
|
||||
template: _partials/_sidebar_menu.html.twig
|
||||
@@ -2,7 +2,11 @@ framework:
|
||||
mailer:
|
||||
# "main" has to stay first: it is the transport every mail without an explicit
|
||||
# X-Transport header goes out over, which is all of them apart from the teamer
|
||||
# mailing. Reordering this quietly moves the whole application to Mailjet.
|
||||
# mailing and the nightly cron reminders (App\Email\Mailer::MAILJET_TRANSPORT).
|
||||
# Reordering this quietly sends everything over MAILING_MAILER_DSN.
|
||||
#
|
||||
# Production points both DSNs at the same Mailjet account. The split keeps the volume
|
||||
# mail on Mailjet should the low-volume mail ever move to another SMTP server.
|
||||
transports:
|
||||
main: '%env(MAILER_DSN)%'
|
||||
mailing: '%env(MAILING_MAILER_DSN)%'
|
||||
@@ -68,6 +68,28 @@ oneup_uploader:
|
||||
namer: app.upload_namer
|
||||
storage:
|
||||
directory: '%kernel.project_dir%/uploads/work_month'
|
||||
# PDFs of mailing templates and of single assignment mailings. Keys and directories are
|
||||
# exactly Upload::TYPE_MAILING_TEMPLATE and TYPE_MAILING_ATTACHMENT, like above. The
|
||||
# dropzone limits size and type in the browser only, so the same limits are enforced
|
||||
# here: 5 MB (5 * 1024 * 1024) and PDF by content, whatever the file is called.
|
||||
mailing_template:
|
||||
frontend: dropzone
|
||||
use_orphanage: true
|
||||
namer: app.upload_namer
|
||||
max_size: 5242880
|
||||
allowed_mimetypes:
|
||||
application/pdf: []
|
||||
storage:
|
||||
directory: '%kernel.project_dir%/uploads/mailing_template'
|
||||
mailing_attachment:
|
||||
frontend: dropzone
|
||||
use_orphanage: true
|
||||
namer: app.upload_namer
|
||||
max_size: 5242880
|
||||
allowed_mimetypes:
|
||||
application/pdf: []
|
||||
storage:
|
||||
directory: '%kernel.project_dir%/uploads/mailing_attachment'
|
||||
chunks:
|
||||
maxage: 86400
|
||||
storage:
|
||||
|
||||
@@ -13,6 +13,7 @@ security:
|
||||
memory:
|
||||
users:
|
||||
api: { roles: [ ROLE_API ] }
|
||||
n8n: { roles: [ ROLE_API_ASSIGNMENTS ] }
|
||||
|
||||
role_hierarchy:
|
||||
ROLE_TEAM_ADMIN: [ ROLE_ADMINISTRATIVE ]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
twig:
|
||||
default_path: '%kernel.project_dir%/templates'
|
||||
form_themes: ['forms.html.twig']
|
||||
globals:
|
||||
app_name: Team
|
||||
paths:
|
||||
'%kernel.project_dir%/assets/images': images
|
||||
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
# Questionnaire a teamer fills in after a placement with bus escort, in addition to
|
||||
# teamer_feedback.yaml and on the same page (App\Service\Questionnaire\DispositionContext).
|
||||
# Answered once per ride: the teamer first says whether they escorted the outbound bus, the return
|
||||
# bus or both (per_bus_leg), and fills in these sections for each, stored as one response per leg.
|
||||
#
|
||||
# Replaces the Google form "Bus-Feedback 25-26"; the question-by-question spec, with every decision
|
||||
# taken, is kept locally outside the repository. Questions whose answer the
|
||||
# disposition already knows (travel date, destination, Reiseleitung, first pickup) are not asked:
|
||||
# they are snapshotted into the response's context instead.
|
||||
#
|
||||
# Labels, help texts, section titles and option labels may be edited in place. Renaming or
|
||||
# removing a question or option key, or changing a type, needs a new version: copy this file to
|
||||
# bus_feedback.v1.yaml first, then bump `version` here. Submitted answers are keyed by it.
|
||||
#
|
||||
# Parsed and validated by App\Config\QuestionnaireCatalog; QuestionnaireCatalogTest builds it.
|
||||
#
|
||||
# per_bus_leg: answered once per escorted ride (App\Enum\BusLeg) instead of once per placement.
|
||||
#
|
||||
# Question fields: key, label, type (text | textarea | choice | multi | date | rating),
|
||||
# required (default false), help, widget (choice only: radio | dropdown, default radio),
|
||||
# options (choice and multi only), show_if ({question, equals | in | lte}, earlier questions only).
|
||||
|
||||
key: bus_feedback
|
||||
version: 1
|
||||
title: "Bus-Feedback"
|
||||
per_bus_leg: true
|
||||
|
||||
sections:
|
||||
- key: bus_trip
|
||||
title: "Busfahrt"
|
||||
questions:
|
||||
- key: bus_company
|
||||
label: "Bus-Unternehmen:"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: boonk, label: "Boonk Reisen" }
|
||||
- { key: piccolonia, label: "Piccolonia" }
|
||||
- { key: heess, label: "Heeß" }
|
||||
- { key: finkbeiner, label: "Finkbeiner" }
|
||||
- { key: other, label: "Anderes Unternehmen" }
|
||||
|
||||
- key: bus_company_other
|
||||
label: "Name des Busunternehmens:"
|
||||
type: text
|
||||
required: true
|
||||
show_if: { question: bus_company, equals: other }
|
||||
|
||||
- key: bus_team
|
||||
title: "Busteam"
|
||||
questions:
|
||||
- key: driver_names
|
||||
label: "Busfahrer-Namen:"
|
||||
type: text
|
||||
required: true
|
||||
|
||||
- key: bus_first_pickup
|
||||
title: "1. Abfahrtsort"
|
||||
questions:
|
||||
- key: on_time_at_first_pickup
|
||||
label: "Bus pünktlich am 1. Abfahrtsort?"
|
||||
type: choice
|
||||
required: true
|
||||
options:
|
||||
- { key: "yes", label: "Ja" }
|
||||
- { key: "no", label: "Nein" }
|
||||
|
||||
- key: delay_at_first_pickup
|
||||
label: "Wieviel Verspätung hatte der Bus am 1. Abfahrtsort?"
|
||||
type: text
|
||||
required: true
|
||||
show_if: { question: on_time_at_first_pickup, equals: "no" }
|
||||
|
||||
- key: bus_rating
|
||||
title: "Bewertung Bus & Fahrer"
|
||||
questions:
|
||||
- key: overall_impression
|
||||
label: "Gesamteindruck des Busses"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_good, label: "Sehr gut" }
|
||||
- { key: good, label: "Gut" }
|
||||
- { key: ok, label: "OK" }
|
||||
- { key: not_so_good, label: "nicht so gut" }
|
||||
- { key: bad, label: "schlecht" }
|
||||
|
||||
- key: vehicle_age
|
||||
label: "Alter des Fahrzeugs"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_new, label: "Sehr neu" }
|
||||
- { key: new, label: "neu" }
|
||||
- { key: ok, label: "OK" }
|
||||
- { key: somewhat_old, label: "etwas älter" }
|
||||
- { key: very_old, label: "sehr alt" }
|
||||
|
||||
- key: seating_comfort
|
||||
label: "Sitzkomfort im Bus"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_good, label: "Sehr gut" }
|
||||
- { key: good, label: "Gut" }
|
||||
- { key: ok, label: "OK" }
|
||||
- { key: not_so_good, label: "nicht so gut" }
|
||||
- { key: bad, label: "schlecht" }
|
||||
|
||||
- key: driver_friendliness
|
||||
label: "Freundlichkeit der Fahrer"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_friendly, label: "Sehr freundlich" }
|
||||
- { key: friendly, label: "freundlich" }
|
||||
- { key: ok, label: "OK" }
|
||||
- { key: not_so_friendly, label: "nicht so freundlich" }
|
||||
- { key: unfriendly, label: "unfreundlich" }
|
||||
|
||||
- key: breaks
|
||||
label: "Pausenzeiten"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_good, label: "Sehr gut" }
|
||||
- { key: good, label: "Gut" }
|
||||
- { key: ok, label: "OK" }
|
||||
- { key: not_so_good, label: "nicht so gut" }
|
||||
- { key: unacceptable, label: "geht gar nicht" }
|
||||
|
||||
- key: temperature
|
||||
label: "Temperatur im Bus"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_good, label: "Sehr gut" }
|
||||
- { key: good, label: "Gut" }
|
||||
- { key: ok, label: "OK" }
|
||||
- { key: not_so_good, label: "nicht so gut" }
|
||||
- { key: unacceptable, label: "geht gar nicht" }
|
||||
|
||||
- key: guest_behaviour
|
||||
label: "Verhalten der Gäste im Bus"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_good, label: "Sehr gut" }
|
||||
- { key: good, label: "Gut" }
|
||||
- { key: ok, label: "OK" }
|
||||
- { key: not_so_good, label: "nicht so gut" }
|
||||
- { key: unacceptable, label: "geht gar nicht" }
|
||||
|
||||
- key: bus_pickups
|
||||
title: "Ladestellen"
|
||||
questions:
|
||||
- key: drivers_knew_pickups
|
||||
label: "Waren den Fahrern alle Abfahrtsorte bekannt?"
|
||||
type: choice
|
||||
required: true
|
||||
options:
|
||||
- { key: "yes", label: "Ja" }
|
||||
- { key: "no", label: "Nein" }
|
||||
|
||||
- key: unknown_pickups
|
||||
label: "Welche Abfahrtsorte waren nicht bekannt? Gab es dadurch Probleme?"
|
||||
type: textarea
|
||||
required: true
|
||||
show_if: { question: drivers_knew_pickups, equals: "no" }
|
||||
|
||||
- key: bus_destination
|
||||
title: "Zielkenntnis"
|
||||
questions:
|
||||
- key: drivers_knew_destination
|
||||
label: "War den Busfahrern der Zielort und die Ausladestelle bekannt?"
|
||||
type: choice
|
||||
required: true
|
||||
options:
|
||||
- { key: "yes", label: "Ja" }
|
||||
- { key: "no", label: "Nein" }
|
||||
|
||||
- key: bus_equipment
|
||||
title: "Bus, Technik & Allgemeines"
|
||||
questions:
|
||||
- key: video
|
||||
label: "Video/DVD-Gerät"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: working, label: "funktionstüchtig" }
|
||||
- { key: broken, label: "defekt" }
|
||||
- { key: missing, label: "nicht vorhanden" }
|
||||
|
||||
- key: wc
|
||||
label: "WC"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: working, label: "funktionstüchtig" }
|
||||
- { key: broken, label: "defekt" }
|
||||
- { key: closed, label: "nicht geöffnet" }
|
||||
|
||||
- key: luggage
|
||||
label: "Gepäck"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: trailer, label: "Anhänger" }
|
||||
- { key: ski_box, label: "Skikoffer" }
|
||||
- { key: trailer_and_ski_box, label: "Anhänger und Skikoffer" }
|
||||
- { key: none, label: "Kein Anhänger oder Skikoffer" }
|
||||
|
||||
- key: smoking
|
||||
label: "Rauchen im Bus"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: driver, label: "Busfahrer hat im Bus geraucht" }
|
||||
- { key: driver_and_guests, label: "Busfahrer und Gäste haben im Bus geraucht" }
|
||||
- { key: nobody, label: "Es wurde nicht geraucht" }
|
||||
|
||||
- key: snow_chains
|
||||
label: "Schneeketten"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: fitted, label: "Fahrer hat Ketten aufgezogen" }
|
||||
- { key: not_needed, label: "Ketten wurden nicht gebraucht" }
|
||||
- { key: not_fitted, label: "Ketten nicht aufgezogen (trotz starkem Schneefall)" }
|
||||
|
||||
- key: bus_damage
|
||||
title: "Schäden"
|
||||
questions:
|
||||
- key: bus_damage
|
||||
label: "Entstanden während der Fahrt Schäden am Bus?"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: none, label: "Keine Schäden" }
|
||||
- { key: settled_with_driver, label: "Bereits mit Fahrer abgeklärt" }
|
||||
- { key: claim_expected, label: "Da wird vom Busunternehmen noch was kommen" }
|
||||
|
||||
- key: damage_description
|
||||
label: "Was ist passiert?"
|
||||
type: textarea
|
||||
required: true
|
||||
show_if: { question: bus_damage, equals: claim_expected }
|
||||
|
||||
- key: bus_remarks
|
||||
title: "Anmerkungen zur Busfahrt"
|
||||
questions:
|
||||
- key: bus_remarks
|
||||
label: "Das ging gar nicht / ist besonders hervorzuheben:"
|
||||
type: textarea
|
||||
@@ -0,0 +1,159 @@
|
||||
# Questionnaire the house manager fills in once per travel (Destination) after it has ended.
|
||||
#
|
||||
# From the stakeholder briefing of 2026-11-11.
|
||||
# What the travel already knows (product, house, dates, teamers) is not asked: it is snapshotted
|
||||
# into the response's context. Its last point, "Bewerte dein Wochenteam", is not a question: the
|
||||
# page lists the travel's teamers after the form, each linking to the existing rating form.
|
||||
#
|
||||
# Labels, help texts, section titles and option labels may be edited in place. Renaming or
|
||||
# removing a question or option key, or changing a type, needs a new version: copy this file to
|
||||
# house_manager_feedback.v1.yaml first, then bump `version` here. Submitted answers are keyed by it.
|
||||
#
|
||||
# Parsed and validated by App\Config\QuestionnaireCatalog; QuestionnaireCatalogTest builds it.
|
||||
#
|
||||
# Besides the types of teamer_feedback.yaml, this one uses the house manager's widgets, whose
|
||||
# options are what can be picked per teamer or item:
|
||||
# teamer_guidings (guiding types; count and participants each), teamer_courses (course types;
|
||||
# days × hours per day and the days it took place) and programme (items with their participants,
|
||||
# plus "Sonstiges" as free text; "other" is reserved for it).
|
||||
|
||||
key: house_manager_feedback
|
||||
version: 1
|
||||
title: "Hausleitungsfeedback"
|
||||
description: |-
|
||||
Dein Feedback zur Reise. Du kannst den Fragebogen jederzeit als Entwurf speichern und später
|
||||
weiter ausfüllen.
|
||||
|
||||
sections:
|
||||
- key: arrival
|
||||
title: "Gruppe & Anreise"
|
||||
questions:
|
||||
- key: groups_in_house
|
||||
label: "Gruppe(n) im Haus?"
|
||||
type: choice
|
||||
required: true
|
||||
options: &yes_no
|
||||
- { key: ja, label: "Ja" }
|
||||
- { key: nein, label: "Nein" }
|
||||
|
||||
- key: bus_arrival
|
||||
label: "Busanreise?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
|
||||
- key: bus_late
|
||||
label: "Unpünktlich?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
show_if: { question: bus_arrival, equals: ja }
|
||||
|
||||
- key: bus_arrival_time
|
||||
label: "Wann kam der Bus?"
|
||||
type: text
|
||||
required: true
|
||||
show_if: { question: bus_late, equals: ja }
|
||||
|
||||
- key: no_shows
|
||||
label: "Gab es No-Shows?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
|
||||
- key: unused_services
|
||||
label: "Wurden Leistungen nicht bezogen?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
|
||||
- key: unused_services_details
|
||||
label: "Bitte trage hier den Vorfall des Kunden mit VG-Nummer ein:"
|
||||
type: textarea
|
||||
required: true
|
||||
show_if: { question: unused_services, equals: ja }
|
||||
|
||||
- key: guidings_and_courses
|
||||
title: "Guidings & Kurse"
|
||||
questions:
|
||||
- key: guidings
|
||||
label: "Gab es Guidings?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
|
||||
- key: guiding_teamers
|
||||
label: "Wer hat das Guiding gegeben?"
|
||||
help: "Bitte wähle aus, mehrere sind möglich."
|
||||
type: teamer_guidings
|
||||
required: true
|
||||
options:
|
||||
- { key: half_day, label: "Halbtagesguiding" }
|
||||
- { key: full_day, label: "Ganztagesguiding" }
|
||||
show_if: { question: guidings, equals: ja }
|
||||
|
||||
- key: courses
|
||||
label: "Gab es Kurse?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
|
||||
- key: course_teamers
|
||||
label: "Wer hat welchen Kurs gegeben?"
|
||||
help: "Bitte wähle aus, mehrere sind möglich."
|
||||
type: teamer_courses
|
||||
required: true
|
||||
options:
|
||||
- { key: ski_beginner, label: "Ski-Anfänger:innen-Kurs" }
|
||||
- { key: ski_advanced, label: "Ski-Fortgeschrittenen-Kurs" }
|
||||
- { key: snowboard_beginner, label: "Snowboard-Anfänger:innen-Kurs" }
|
||||
- { key: snowboard_advanced, label: "Snowboard-Fortgeschrittenen-Kurs" }
|
||||
show_if: { question: courses, equals: ja }
|
||||
|
||||
- key: activities
|
||||
title: "Programm"
|
||||
questions:
|
||||
- key: programme_deviations
|
||||
label: "Gab es Besonderheiten/Abweichungen vom Beispiel-Programm, welches im Reisebriefing verschickt wurde?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
|
||||
- key: programme_deviations_details
|
||||
label: "Bitte beschreibe, was genau."
|
||||
type: textarea
|
||||
required: true
|
||||
show_if: { question: programme_deviations, equals: ja }
|
||||
|
||||
- key: programme
|
||||
label: "Welches Programm hat stattgefunden?"
|
||||
help: "Mehrere sind möglich."
|
||||
type: programme
|
||||
required: true
|
||||
options:
|
||||
- { key: village_check, label: "Dorfcheck am Anreisetag" }
|
||||
- { key: mulled_wine_party, label: "Glühweinparty" }
|
||||
- { key: slope_snack, label: "Pistensnack" }
|
||||
- { key: hut_evening, label: "Hüttenabend" }
|
||||
- { key: torch_hike, label: "Fackelwanderung" }
|
||||
- { key: toboggan_evening, label: "Rodelabend" }
|
||||
- { key: witches_cauldron, label: "Hexenkessel" }
|
||||
|
||||
- key: closing
|
||||
title: "Vorkommnisse & Gruppe"
|
||||
questions:
|
||||
- key: incidents
|
||||
label: "Gab es besondere Vorkommnisse, z. B. schwerwiegende Verletzungen oder Beschwerden?"
|
||||
type: choice
|
||||
required: true
|
||||
options: *yes_no
|
||||
|
||||
- key: incidents_details
|
||||
label: "Was ist passiert?"
|
||||
type: textarea
|
||||
required: true
|
||||
show_if: { question: incidents, equals: ja }
|
||||
|
||||
- key: group_feedback
|
||||
label: "Feedback zur Gruppe"
|
||||
type: textarea
|
||||
@@ -0,0 +1,137 @@
|
||||
# Questionnaire every teamer fills in after a placement (Disposition, not SeasonAssignment).
|
||||
#
|
||||
# Replaces the Google form "RL-Feedback 25-26"; the question-by-question spec, with every decision
|
||||
# taken, is kept locally outside the repository. A teamer who escorted the bus
|
||||
# also gets bus_feedback.yaml, on the same page. Questions whose answer the disposition already
|
||||
# knows (name, job profile, house, arrival day) are not asked: they are snapshotted into the
|
||||
# response's context instead.
|
||||
#
|
||||
# Labels, help texts, section titles and option labels may be edited in place. Renaming or
|
||||
# removing a question or option key, or changing a type, needs a new version: copy this file to
|
||||
# teamer_feedback.v1.yaml first, then bump `version` here. Submitted answers are keyed by it.
|
||||
#
|
||||
# Parsed and validated by App\Config\QuestionnaireCatalog; QuestionnaireCatalogTest builds it.
|
||||
#
|
||||
# Question fields: key, label, type (text | textarea | choice | multi | date | rating),
|
||||
# required (default false), help, widget (choice only: radio | dropdown, default radio),
|
||||
# options (choice and multi only), show_if ({question, equals | in | lte}, earlier questions only).
|
||||
|
||||
key: teamer_feedback
|
||||
version: 1
|
||||
title: "Wochenteamer:innen-Feedback"
|
||||
description: |-
|
||||
Nur durch euer Feedback können wir besser werden! 🙂
|
||||
|
||||
Bei Bewertunsskalen: 1= schlecht, 5 = sehr gut
|
||||
|
||||
sections:
|
||||
- key: organisation
|
||||
title: "Organisation & Ablauf"
|
||||
questions:
|
||||
- key: office_briefing_rating
|
||||
label: "Wie gut hast du dich vorab vom Büro gebrieft gefühlt?"
|
||||
type: rating
|
||||
required: true
|
||||
|
||||
- key: office_briefing_low_reason
|
||||
label: "Wenn 1 - 3 Sterne Bewertung, warum?"
|
||||
type: textarea
|
||||
required: true
|
||||
show_if: { question: office_briefing_rating, lte: 3 }
|
||||
|
||||
- key: team_week_seminar
|
||||
label: "War das Wochenteam-Seminar hilfreich für dich? Warst du bzw. wurdest du gut vorbereitet?"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_helpful, label: "Ja, die Schulung war sehr hilfreich und ich fühlte mich bestens vorbereitet." }
|
||||
- { key: mostly_helpful, label: "Ja, größtenteils – einige Themen hätte man noch vertiefen können." }
|
||||
- { key: partly_helpful, label: "Es ging – die Schulung war teilweise hilfreich, aber nicht ausreichend für alle Aufgaben." }
|
||||
- { key: rather_not_helpful, label: "Eher nein – ich fühlte mich in vielen Bereichen unvorbereitet." }
|
||||
- { key: not_helpful, label: "Nein, die Schulung war kaum hilfreich und hat mich nicht auf den Arbeitsalltag vorbereitet." }
|
||||
- { key: not_attended, label: "Ich habe nicht teilgenommen." }
|
||||
|
||||
- key: onsite_organisation_rating
|
||||
label: "Wie gut lief die Reiseorganisation vor Ort?"
|
||||
type: rating
|
||||
required: true
|
||||
|
||||
- key: had_organisational_problems
|
||||
label: "Gab es organisatorische Probleme?"
|
||||
type: choice
|
||||
required: true
|
||||
options:
|
||||
- { key: "yes", label: "Ja" }
|
||||
- { key: "no", label: "Nein" }
|
||||
|
||||
- key: organisational_problems
|
||||
label: "Wenn ja, welche?"
|
||||
type: text
|
||||
show_if: { question: had_organisational_problems, equals: "yes" }
|
||||
|
||||
- key: communication
|
||||
title: "Kommunikation & Zusammenarbeit"
|
||||
questions:
|
||||
- key: teamer_collaboration_rating
|
||||
label: "Wie lief die Kommunikation & Zusammenarbeit mit den E&P Teamer:innen vor Ort während der Reise?"
|
||||
type: rating
|
||||
required: true
|
||||
|
||||
- key: support_wished
|
||||
label: "Welche Unterstützung hättest du dir zusätzlich gewünscht?"
|
||||
type: textarea
|
||||
|
||||
- key: house_manager_problem_handling
|
||||
label: "Wie ist deine Hausleitung mit Problemen vor Ort umgegangen?"
|
||||
type: choice
|
||||
widget: dropdown
|
||||
required: true
|
||||
options:
|
||||
- { key: very_good, label: "Sehr gut – Probleme wurden schnell, fair und lösungsorientiert behandelt." }
|
||||
- { key: good, label: "Gut – die meisten Anliegen wurden ernst genommen und bearbeitet." }
|
||||
- { key: mixed, label: "Teils gut/teils schlecht – manche Probleme wurden gelöst, andere nicht." }
|
||||
- { key: rather_poor, label: "Eher schlecht – es wurde wenig unternommen oder nicht auf Augenhöhe kommuniziert." }
|
||||
- { key: very_poor, label: "Sehr schlecht – Probleme wurden ignoriert oder verschlimmert." }
|
||||
|
||||
- key: felt_overwhelmed
|
||||
label: "Gab es Momente, in denen du dich überfordert gefühlt hast?"
|
||||
type: choice
|
||||
required: true
|
||||
options:
|
||||
- { key: "yes", label: "Ja" }
|
||||
- { key: "no", label: "Nein" }
|
||||
|
||||
- key: overwhelmed_reason
|
||||
label: "Wenn ja, wodurch?"
|
||||
type: textarea
|
||||
show_if: { question: felt_overwhelmed, equals: "yes" }
|
||||
|
||||
- key: improvement
|
||||
title: "Verbesserung"
|
||||
questions:
|
||||
- key: wished_differently
|
||||
label: "Was hättest du dir anders oder besser gewünscht?"
|
||||
type: textarea
|
||||
|
||||
- key: would_work_again
|
||||
label: "Würdest du wieder als Reiseleitung für E&P arbeiten?"
|
||||
type: choice
|
||||
required: true
|
||||
options:
|
||||
- { key: "yes", label: "Ja" }
|
||||
- { key: "no", label: "Nein" }
|
||||
|
||||
- key: would_not_work_again_reason
|
||||
label: "Wenn nein, warum nicht?"
|
||||
type: textarea
|
||||
show_if: { question: would_work_again, equals: "no" }
|
||||
|
||||
- key: other
|
||||
title: "Sonstiges"
|
||||
questions:
|
||||
- key: anything_else
|
||||
label: |-
|
||||
Du hast nun schon vieles beantwortet,
|
||||
aber nirgendwo konntest du folgende Aspekte loswerden:
|
||||
type: textarea
|
||||
+68
-1
@@ -40,6 +40,37 @@ parameters:
|
||||
# rejects every request instead of letting them through.
|
||||
application_form_api_key: '%env(string:APPLICATION_FORM_API_KEY)%'
|
||||
|
||||
# Shared key n8n reads the assignments feed with (GET /api/assignments). Same rules as above.
|
||||
n8n_api_key: '%env(string:N8N_API_KEY)%'
|
||||
|
||||
# What the n8n assignments feed covers: assignments in these houses (matched against the first
|
||||
# three characters of destination.hotelCode) for these job profiles - guide, course and
|
||||
# service-team work. Job profile ids are database ids, so check them against production.
|
||||
assignment_export.house_codes: [ DPW, DGS, DWW, DKI, DKS ]
|
||||
assignment_export.job_profile_ids:
|
||||
- 5 # Reiseleitung
|
||||
- 9 # Reiseleitung Ski
|
||||
- 10 # Reiseleitung Snowboard
|
||||
- 3 # Kursleitung Ski Anfänger:innen
|
||||
- 14 # Kursleitung Ski Fortgeschrittene
|
||||
- 18 # Kursleitung Ski Anfänger:innen + Fortgeschrittene
|
||||
- 36 # Kursleitung Ski Kinder Anfänger:innen & Kinderbetreuung
|
||||
- 37 # Kursleitung Ski Kinder Fortgeschrittene
|
||||
- 38 # Kursleitung Ski Kinder
|
||||
- 4 # Kursleitung Snowboard Anfänger:innen
|
||||
- 15 # Kursleitung Snowboard Fortgeschrittene
|
||||
- 19 # Kursleitung Snowboard Anfänger:innen + Fortgeschrittene
|
||||
- 47 # Kursleitung Snowboard Kinder/Jugendliche Anfänger:innen
|
||||
- 20 # Reise- und Kursleitung Ski Anfänger:innen
|
||||
- 21 # Reise- und Kursleitung Ski Fortgeschrittene
|
||||
- 22 # Reise- und Kursleitung Ski Anfänger:innen + Fortgeschrittene
|
||||
- 23 # Reise- und Kursleitung Snowboard Anfänger:innen
|
||||
- 24 # Reise- und Kursleitung Snowboard Fortgeschrittene
|
||||
- 25 # Reise- und Kursleitung Snowboard Anfänger:innen + Fortgeschrittene
|
||||
- 6 # Serviceteam 40h (ST40)
|
||||
- 13 # Serviceteam 25h (ST25)
|
||||
- 16 # Serviceteam 10h (ST10)
|
||||
|
||||
# Booking link the application form receipt mail invites the applicant to. A deployment
|
||||
# value rather than part of the wording, so a new booking system does not need an edit in
|
||||
# every stage's mail text.
|
||||
@@ -47,6 +78,7 @@ parameters:
|
||||
|
||||
default_email_from: '%env(APP_DEFAULT_EMAIL_FROM)%'
|
||||
default_email_to: '%env(APP_DEFAULT_EMAIL_TO)%'
|
||||
assignment_mailing_reply_to: '%env(APP_ASSIGNMENT_MAILING_REPLY_TO)%'
|
||||
|
||||
# Per deployment and not per environment: staging and production run the same compiled
|
||||
# environment and differ only in their .env.local. The csv processor turns an unset
|
||||
@@ -90,6 +122,18 @@ parameters:
|
||||
season_start: '11-01'
|
||||
season_end: '04-01'
|
||||
|
||||
# The teamer questionnaires after a placement (config/questionnaires/teamer_feedback.yaml, plus
|
||||
# bus_feedback.yaml for a bus escort) are offered for placements ending on or after this day
|
||||
# (Y-m-d), and stay pending - on the dashboard and in the daily reminder - until submitted.
|
||||
# Without a cutoff every past placement would be pending at once.
|
||||
questionnaire_go_live: '2026-11-10'
|
||||
|
||||
# The house manager's questionnaire about a travel (config/questionnaires/house_manager_feedback.yaml)
|
||||
# is offered for travels ending on or after this day (Y-m-d), and keeps the travel pending - in
|
||||
# the list, on the dashboard and in the daily reminder - until submitted. Teamer ratings stay
|
||||
# pending as before, whatever this date.
|
||||
house_manager_questionnaire_go_live: '2026-11-11'
|
||||
|
||||
# How far ahead of the destination's first travel day a season assignment's checklist
|
||||
# entries fall due. A relative date expression, applied to destination.dateFrom, and the
|
||||
# single definition of both deadlines: the first is this offset, the second defaults to
|
||||
@@ -151,12 +195,17 @@ services:
|
||||
# Only the path enters the container - the file itself is parsed on demand by
|
||||
# App\Config\EmailTextCatalog, since its contents matter on few requests.
|
||||
$emailTextsFile: '%kernel.project_dir%/config/email_texts.yaml'
|
||||
# Likewise parsed on demand, by App\Config\QuestionnaireCatalog.
|
||||
$questionnaireDir: '%kernel.project_dir%/config/questionnaires'
|
||||
$questionnaireGoLive: '%questionnaire_go_live%'
|
||||
$houseManagerQuestionnaireGoLive: '%house_manager_questionnaire_go_live%'
|
||||
$mailingBusTransport: '%mailing_bus_transport%'
|
||||
$seasonStart: '%season_start%'
|
||||
$seasonEnd: '%season_end%'
|
||||
$seasonTaskDeadlineOffset: '%season_task_deadline_offset%'
|
||||
$autoAssignmentJobProfiles: '%auto_assignment_job_profiles%'
|
||||
$autoAssignmentFees: '%auto_assignment_fees%'
|
||||
$assignmentMailingReplyTo: '%assignment_mailing_reply_to%'
|
||||
|
||||
# Tagged by interface rather than listed by hand: order between collectors is
|
||||
# irrelevant, so the only thing an explicit list could add here is the chance to
|
||||
@@ -293,6 +342,9 @@ services:
|
||||
- name: knp_menu.menu_builder
|
||||
method: createTeamerMenu
|
||||
alias: default_teamer
|
||||
- name: knp_menu.menu_builder
|
||||
method: createUserMenu
|
||||
alias: default_user
|
||||
|
||||
App\Menu\AdminMenuBuilder:
|
||||
arguments:
|
||||
@@ -428,7 +480,10 @@ services:
|
||||
|
||||
App\Security\AccessToken\ApiKeyTokenHandler:
|
||||
arguments:
|
||||
$apiKey: '%application_form_api_key%'
|
||||
# user identifier in security.yaml's api_user_provider => key
|
||||
$apiKeys:
|
||||
api: '%application_form_api_key%'
|
||||
n8n: '%n8n_api_key%'
|
||||
$logger: '@monolog.logger.api'
|
||||
|
||||
App\Controller\Api\ApplicationFormController:
|
||||
@@ -436,6 +491,13 @@ services:
|
||||
$logger: '@monolog.logger.api'
|
||||
tags: [ 'controller.service_arguments' ]
|
||||
|
||||
App\Controller\Api\Assignment\ListController:
|
||||
arguments:
|
||||
$houseCodes: '%assignment_export.house_codes%'
|
||||
$jobProfileIds: '%assignment_export.job_profile_ids%'
|
||||
$logger: '@monolog.logger.api'
|
||||
tags: [ 'controller.service_arguments' ]
|
||||
|
||||
App\EventListener\EmailRecipientWhitelistSubscriber:
|
||||
arguments:
|
||||
$allowedRecipients: '%mail_recipient_whitelist%'
|
||||
@@ -463,4 +525,9 @@ when@dev:
|
||||
|
||||
when@test:
|
||||
parameters:
|
||||
# a job profile id ListControllerTest inserts itself - db_test has no job profiles
|
||||
assignment_export.job_profile_ids: [ 900001 ]
|
||||
mailing_bus_transport: 'sync'
|
||||
# the questionnaire tests need it offered; any day before the placements they create
|
||||
questionnaire_go_live: '2026-01-01'
|
||||
house_manager_questionnaire_go_live: '2026-01-01'
|
||||
+2
-1
@@ -121,7 +121,8 @@ Three failure modes worth knowing because they are quiet rather than loud:
|
||||
|
||||
- **`.env.local` missing from the deploy path.** `APP_ENV` falls back to `dev` and
|
||||
`MAILING_MAILER_DSN` to `null://null`. The worker then consumes every message and
|
||||
delivers nothing, reporting success and recording no failure. The quietest failure in the
|
||||
delivers nothing, reporting success and recording no failure - mailings and the nightly
|
||||
cron reminders alike, which both go out over it. The quietest failure in the
|
||||
whole system.
|
||||
- **No worker consuming `mailing`.** Mailings queue up indefinitely while the admin is told
|
||||
they are on their way. `messenger:stats` shows it immediately.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Adds questionnaire_response: a respondent's answers to one questionnaire from
|
||||
* config/questionnaires/, for now the teamer questionnaire after a placement.
|
||||
*
|
||||
* Written by hand rather than taken from doctrine:migrations:diff, which also carries the
|
||||
* pre-existing drift of the dev database.
|
||||
*/
|
||||
final class Version20261027140000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add questionnaire_response';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE questionnaire_response (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, questionnaire VARCHAR(64) NOT NULL, version INT NOT NULL, status VARCHAR(16) NOT NULL, submitted_at DATETIME DEFAULT NULL, answers JSON NOT NULL, context JSON NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, disposition_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_A0400276D17F50A6 (uuid), UNIQUE INDEX questionnaire_disposition (questionnaire, disposition_id), INDEX IDX_A0400276287B65ED (disposition_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci`');
|
||||
$this->addSql('ALTER TABLE questionnaire_response ADD CONSTRAINT FK_A0400276287B65ED FOREIGN KEY (disposition_id) REFERENCES disposition (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE questionnaire_response DROP FOREIGN KEY FK_A0400276287B65ED');
|
||||
$this->addSql('DROP TABLE questionnaire_response');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Replaces the staffing matrix's split flag with one flag per ski level.
|
||||
*
|
||||
* A split row takes over every level it has, so it keeps planning the same assignments. The way
|
||||
* back folds the two flags into one, which loses a row that takes over one level of two.
|
||||
*
|
||||
* Written by hand rather than taken from doctrine:migrations:diff, which also carries the
|
||||
* pre-existing drift of the dev database.
|
||||
*/
|
||||
final class Version20261105100000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Replace staffing_rule.split with split_beginner / split_advanced';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE staffing_rule ADD split_beginner TINYINT NOT NULL, ADD split_advanced TINYINT NOT NULL');
|
||||
$this->addSql('UPDATE staffing_rule SET split_beginner = split AND ski_beginner, split_advanced = split AND ski_advanced');
|
||||
$this->addSql('ALTER TABLE staffing_rule DROP split');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE staffing_rule ADD split TINYINT NOT NULL');
|
||||
$this->addSql('UPDATE staffing_rule SET split = split_beginner OR split_advanced');
|
||||
$this->addSql('ALTER TABLE staffing_rule DROP split_beginner, DROP split_advanced');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Numbers the places of an assignment, for the n8n placements feed ("platz_id").
|
||||
*
|
||||
* Existing active placements are numbered 1..n per assignment in creation order; called-off ones
|
||||
* stay without a number, they hold no place. n8n has not seen a place number yet, so the initial
|
||||
* order is free to choose.
|
||||
*
|
||||
* Written by hand rather than taken from doctrine:migrations:diff, which also carries the
|
||||
* pre-existing drift of the dev database.
|
||||
*/
|
||||
final class Version20261106100000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add disposition.slot and number the active placements per assignment';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE disposition ADD slot SMALLINT DEFAULT NULL');
|
||||
$this->addSql(<<<'SQL'
|
||||
UPDATE disposition
|
||||
INNER JOIN (
|
||||
SELECT id, ROW_NUMBER() OVER (PARTITION BY assignment_id ORDER BY id) AS slot
|
||||
FROM disposition
|
||||
WHERE status <> 'called_off' AND assignment_id IS NOT NULL
|
||||
) AS numbered ON numbered.id = disposition.id
|
||||
SET disposition.slot = numbered.slot
|
||||
SQL);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE disposition DROP slot');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Written by hand from the diff, keeping only questionnaire_response: doctrine:migrations:diff
|
||||
* also sweeps in the pre-existing drift of the dev database.
|
||||
*/
|
||||
final class Version20261110120000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Answer the bus feedback once per escorted leg';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("ALTER TABLE questionnaire_response ADD leg VARCHAR(16) DEFAULT '' NOT NULL");
|
||||
$this->addSql('DROP INDEX questionnaire_disposition ON questionnaire_response');
|
||||
$this->addSql('CREATE UNIQUE INDEX questionnaire_disposition_leg ON questionnaire_response (questionnaire, disposition_id, leg)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX questionnaire_disposition_leg ON questionnaire_response');
|
||||
$this->addSql('CREATE UNIQUE INDEX questionnaire_disposition ON questionnaire_response (questionnaire, disposition_id)');
|
||||
$this->addSql('ALTER TABLE questionnaire_response DROP leg');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Written by hand from the diff, keeping only questionnaire_response: doctrine:migrations:diff
|
||||
* also sweeps in the pre-existing drift of the dev database.
|
||||
*/
|
||||
final class Version20261111100000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Let a questionnaire response be about a travel, for the house manager questionnaire';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE questionnaire_response ADD destination_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE questionnaire_response ADD CONSTRAINT FK_A0400276816C6140 FOREIGN KEY (destination_id) REFERENCES destination (id) ON DELETE CASCADE');
|
||||
$this->addSql('CREATE INDEX IDX_A0400276816C6140 ON questionnaire_response (destination_id)');
|
||||
$this->addSql('CREATE UNIQUE INDEX questionnaire_destination ON questionnaire_response (questionnaire, destination_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX questionnaire_destination ON questionnaire_response');
|
||||
$this->addSql('ALTER TABLE questionnaire_response DROP FOREIGN KEY FK_A0400276816C6140');
|
||||
$this->addSql('DROP INDEX IDX_A0400276816C6140 ON questionnaire_response');
|
||||
$this->addSql('ALTER TABLE questionnaire_response DROP destination_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Written by hand from the diff, keeping only the mailing tables and upload.mailing_template_id:
|
||||
* doctrine:migrations:diff also sweeps in the pre-existing drift of the dev database.
|
||||
*/
|
||||
final class Version20261111115642 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add mailing templates and the record of sent assignment mailings';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE mailing_template (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_4A7CB3AFD17F50A6 (uuid), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE mailing (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, subject VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, recipient_count INT NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, template_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_3ED9315ED17F50A6 (uuid), INDEX IDX_3ED9315E5DA0FB8 (template_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE mailing_assignment (mailing_id INT NOT NULL, assignment_id INT NOT NULL, INDEX IDX_D6941DCB3931AB76 (mailing_id), INDEX IDX_D6941DCBD19302F8 (assignment_id), PRIMARY KEY (mailing_id, assignment_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('CREATE TABLE mailing_attachment (mailing_id INT NOT NULL, upload_id INT NOT NULL, INDEX IDX_9F0E80CA3931AB76 (mailing_id), INDEX IDX_9F0E80CACCCFBA31 (upload_id), PRIMARY KEY (mailing_id, upload_id)) DEFAULT CHARACTER SET utf8mb4');
|
||||
$this->addSql('ALTER TABLE mailing ADD CONSTRAINT FK_3ED9315E5DA0FB8 FOREIGN KEY (template_id) REFERENCES mailing_template (id)');
|
||||
$this->addSql('ALTER TABLE mailing_assignment ADD CONSTRAINT FK_D6941DCB3931AB76 FOREIGN KEY (mailing_id) REFERENCES mailing (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE mailing_assignment ADD CONSTRAINT FK_D6941DCBD19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE mailing_attachment ADD CONSTRAINT FK_9F0E80CA3931AB76 FOREIGN KEY (mailing_id) REFERENCES mailing (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE mailing_attachment ADD CONSTRAINT FK_9F0E80CACCCFBA31 FOREIGN KEY (upload_id) REFERENCES upload (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE upload ADD mailing_template_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE upload ADD CONSTRAINT FK_17BDE61F223E1F4B FOREIGN KEY (mailing_template_id) REFERENCES mailing_template (id)');
|
||||
$this->addSql('CREATE INDEX IDX_17BDE61F223E1F4B ON upload (mailing_template_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE upload DROP FOREIGN KEY FK_17BDE61F223E1F4B');
|
||||
$this->addSql('DROP INDEX IDX_17BDE61F223E1F4B ON upload');
|
||||
$this->addSql('ALTER TABLE upload DROP mailing_template_id');
|
||||
$this->addSql('ALTER TABLE mailing DROP FOREIGN KEY FK_3ED9315E5DA0FB8');
|
||||
$this->addSql('ALTER TABLE mailing_assignment DROP FOREIGN KEY FK_D6941DCB3931AB76');
|
||||
$this->addSql('ALTER TABLE mailing_assignment DROP FOREIGN KEY FK_D6941DCBD19302F8');
|
||||
$this->addSql('ALTER TABLE mailing_attachment DROP FOREIGN KEY FK_9F0E80CA3931AB76');
|
||||
$this->addSql('ALTER TABLE mailing_attachment DROP FOREIGN KEY FK_9F0E80CACCCFBA31');
|
||||
$this->addSql('DROP TABLE mailing_attachment');
|
||||
$this->addSql('DROP TABLE mailing_assignment');
|
||||
$this->addSql('DROP TABLE mailing');
|
||||
$this->addSql('DROP TABLE mailing_template');
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Service\Cron\DispositionReminderService;
|
||||
use App\Service\Cron\DispositionStatusService;
|
||||
use App\Service\Cron\FeedbackReminderService;
|
||||
use App\Service\Cron\FlushLogsService;
|
||||
use App\Service\Cron\QuestionnaireReminderService;
|
||||
use App\Service\Cron\SeasonTaskReminderService;
|
||||
use App\Service\Cron\UploadReminderService;
|
||||
use App\Service\Cron\WorkMonthReminderService;
|
||||
@@ -29,6 +30,7 @@ class CronCommand extends Command
|
||||
private readonly DispositionReminderService $dispositionReminderService,
|
||||
private readonly SeasonTaskReminderService $seasonTaskReminderService,
|
||||
private readonly WorkMonthReminderService $workMonthReminderService,
|
||||
private readonly QuestionnaireReminderService $questionnaireReminderService,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -68,6 +70,9 @@ class CronCommand extends Command
|
||||
$message = $this->workMonthReminderService->sendReminders();
|
||||
$io->info($message);
|
||||
|
||||
$message = $this->questionnaireReminderService->sendReminders();
|
||||
$io->info($message);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ enum EmailTextKey: string
|
||||
case REMINDER_INVOICE_UPLOAD = 'reminder_invoice_upload';
|
||||
case REMINDER_INVOICE_UPLOAD_FINAL = 'reminder_invoice_upload_final';
|
||||
case REMINDER_DISPOSITION = 'reminder_disposition';
|
||||
case REMINDER_QUESTIONNAIRE = 'reminder_questionnaire';
|
||||
case REMINDER_SEASON_TASKS = 'reminder_season_tasks';
|
||||
case REMINDER_WORK_MONTH_UPLOAD = 'reminder_work_month_upload';
|
||||
case WORK_MONTH_REJECTED = 'work_month_rejected';
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
<?php
|
||||
|
||||
namespace App\Config;
|
||||
|
||||
use App\Enum\ChoiceWidget;
|
||||
use App\Enum\ConditionOperator;
|
||||
use App\Enum\QuestionType;
|
||||
use App\Model\Questionnaire\Condition;
|
||||
use App\Model\Questionnaire\Definition;
|
||||
use App\Model\Questionnaire\Option;
|
||||
use App\Model\Questionnaire\Question;
|
||||
use App\Model\Questionnaire\Section;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* Reads questionnaire definitions from config/questionnaires/.
|
||||
*
|
||||
* `<key>.yaml` is the current version of a questionnaire; `<key>.v<n>.yaml` keeps an older one that
|
||||
* responses were submitted under, so they can still be rendered with the labels they were given.
|
||||
*
|
||||
* Files are parsed lazily and memoised, like EmailTextCatalog. A definition is checked strictly
|
||||
* while it is built - unknown fields, unknown types, duplicate keys and show_if conditions that
|
||||
* point at a later question or a non-existent option all throw - because a typo in the YAML should
|
||||
* fail in QuestionnaireCatalogTest, not in front of a teamer.
|
||||
*/
|
||||
class QuestionnaireCatalog
|
||||
{
|
||||
/**
|
||||
* The questionnaire every teamer fills in after a placement; see DispositionVoter::QUESTIONNAIRE.
|
||||
*/
|
||||
public const string TEAMER_FEEDBACK = 'teamer_feedback';
|
||||
|
||||
/**
|
||||
* The one a teamer who escorted the bus fills in as well, on the same page.
|
||||
*/
|
||||
public const string BUS_FEEDBACK = 'bus_feedback';
|
||||
|
||||
/**
|
||||
* The one a house manager fills in about a travel; see DestinationVoter::QUESTIONNAIRE. Its
|
||||
* subject is a Destination rather than a Disposition.
|
||||
*/
|
||||
public const string HOUSE_MANAGER_FEEDBACK = 'house_manager_feedback';
|
||||
|
||||
private const array ROOT_FIELDS = ['key', 'version', 'title', 'description', 'per_bus_leg', 'sections'];
|
||||
private const array SECTION_FIELDS = ['key', 'title', 'questions'];
|
||||
private const array QUESTION_FIELDS = ['key', 'label', 'type', 'required', 'help', 'widget', 'options', 'show_if'];
|
||||
private const array OPTION_FIELDS = ['key', 'label'];
|
||||
|
||||
// A question key becomes a form field name and a JSON key in stored answers.
|
||||
private const string KEY_PATTERN = '/^[a-z][a-z0-9_]*$/';
|
||||
|
||||
private const int RATING_MIN = 1;
|
||||
private const int RATING_MAX = 5;
|
||||
|
||||
/**
|
||||
* @var array<string, Definition> keyed by file path
|
||||
*/
|
||||
private array $definitions = [];
|
||||
|
||||
public function __construct(
|
||||
private readonly string $questionnaireDir,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A services.yaml go-live parameter as a date: questionnaire_go_live for the teamer
|
||||
* questionnaire (placements ending on or after it), house_manager_questionnaire_go_live for the
|
||||
* house manager's (travels ending on or after it). Either stays pending until submitted.
|
||||
* Without it, every past placement or travel would be pending and reminded of at once.
|
||||
*/
|
||||
public static function parseGoLive(string $goLive): \DateTimeImmutable
|
||||
{
|
||||
return \DateTimeImmutable::createFromFormat('!Y-m-d', $goLive)
|
||||
?: throw new \InvalidArgumentException(sprintf('Questionnaire go-live "%s" is not a Y-m-d date', $goLive));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $version null for the current version
|
||||
*/
|
||||
public function get(string $key, ?int $version = null): Definition
|
||||
{
|
||||
$current = $this->load($this->questionnaireDir.'/'.$key.'.yaml');
|
||||
|
||||
if (null === $version || $version === $current->version) {
|
||||
return $current;
|
||||
}
|
||||
|
||||
return $this->load(sprintf('%s/%s.v%d.yaml', $this->questionnaireDir, $key, $version));
|
||||
}
|
||||
|
||||
/**
|
||||
* The keys of the questionnaires there are, i.e. of their current files.
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function keys(): array
|
||||
{
|
||||
$keys = [];
|
||||
|
||||
foreach (glob($this->questionnaireDir.'/*.yaml') ?: [] as $file) {
|
||||
if (1 === preg_match('/^([a-z0-9_]+)\.yaml$/', basename($file), $match)) {
|
||||
$keys[] = $match[1];
|
||||
}
|
||||
}
|
||||
|
||||
sort($keys);
|
||||
|
||||
return $keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Every definition in the directory, archived versions included.
|
||||
*
|
||||
* @return list<Definition>
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
$files = glob($this->questionnaireDir.'/*.yaml') ?: [];
|
||||
sort($files);
|
||||
|
||||
return array_map($this->load(...), $files);
|
||||
}
|
||||
|
||||
private function load(string $file): Definition
|
||||
{
|
||||
if (!is_file($file)) {
|
||||
throw new \InvalidArgumentException(sprintf('Questionnaire definition "%s" does not exist', $file));
|
||||
}
|
||||
|
||||
return $this->definitions[$file] ??= $this->build(Yaml::parseFile($file), basename($file));
|
||||
}
|
||||
|
||||
private function build(mixed $data, string $file): Definition
|
||||
{
|
||||
$this->assertFields($data, self::ROOT_FIELDS, ['key', 'version', 'title', 'sections'], $file);
|
||||
|
||||
if (1 !== preg_match('/^(?<key>[a-z0-9_]+)(\.v(?<version>\d+))?\.yaml$/', $file, $name)) {
|
||||
throw $this->error($file, 'file name must be <key>.yaml or <key>.v<version>.yaml');
|
||||
}
|
||||
|
||||
if ($data['key'] !== $name['key']) {
|
||||
throw $this->error($file, sprintf('key "%s" does not match the file name', $data['key']));
|
||||
}
|
||||
|
||||
if (!is_int($data['version']) || $data['version'] < 1) {
|
||||
throw $this->error($file, 'version must be a positive integer');
|
||||
}
|
||||
|
||||
if (isset($name['version']) && (int) $name['version'] !== $data['version']) {
|
||||
throw $this->error($file, sprintf('version %d does not match the file name', $data['version']));
|
||||
}
|
||||
|
||||
if (!is_array($data['sections']) || [] === $data['sections'] || !array_is_list($data['sections'])) {
|
||||
throw $this->error($file, 'sections must be a non-empty list');
|
||||
}
|
||||
|
||||
$perBusLeg = $data['per_bus_leg'] ?? false;
|
||||
|
||||
if (!is_bool($perBusLeg)) {
|
||||
throw $this->error($file, 'per_bus_leg must be true or false');
|
||||
}
|
||||
|
||||
$sections = [];
|
||||
$sectionKeys = [];
|
||||
/** @var array<string, Question> $questions every question parsed so far, for show_if */
|
||||
$questions = [];
|
||||
|
||||
foreach ($data['sections'] as $index => $sectionData) {
|
||||
$context = sprintf('%s: section #%d', $file, $index + 1);
|
||||
$this->assertFields($sectionData, self::SECTION_FIELDS, ['key', 'questions'], $context);
|
||||
$key = $this->key($sectionData['key'], $context);
|
||||
|
||||
if (in_array($key, $sectionKeys, true)) {
|
||||
throw $this->error($context, sprintf('duplicate section key "%s"', $key));
|
||||
}
|
||||
|
||||
$sectionKeys[] = $key;
|
||||
$context = sprintf('%s: section "%s"', $file, $key);
|
||||
|
||||
if (!is_array($sectionData['questions']) || [] === $sectionData['questions'] || !array_is_list($sectionData['questions'])) {
|
||||
throw $this->error($context, 'questions must be a non-empty list');
|
||||
}
|
||||
|
||||
$sectionQuestions = [];
|
||||
|
||||
foreach ($sectionData['questions'] as $questionData) {
|
||||
$question = $this->buildQuestion($questionData, $questions, $context);
|
||||
|
||||
$questions[$question->key] = $question;
|
||||
$sectionQuestions[] = $question;
|
||||
}
|
||||
|
||||
$sections[] = new Section($key, $this->optionalString($sectionData['title'] ?? null, 'title', $context), $sectionQuestions);
|
||||
}
|
||||
|
||||
return new Definition(
|
||||
$data['key'],
|
||||
$data['version'],
|
||||
$this->string($data['title'], 'title', $file),
|
||||
$this->optionalString($data['description'] ?? null, 'description', $file),
|
||||
$sections,
|
||||
$perBusLeg,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, Question> $earlier
|
||||
*/
|
||||
private function buildQuestion(mixed $data, array $earlier, string $context): Question
|
||||
{
|
||||
$this->assertFields($data, self::QUESTION_FIELDS, ['key', 'label', 'type'], $context.': question');
|
||||
$key = $this->key($data['key'], $context.': question');
|
||||
$context = sprintf('%s: question "%s"', $context, $key);
|
||||
|
||||
if (isset($earlier[$key])) {
|
||||
throw $this->error($context, 'duplicate question key');
|
||||
}
|
||||
|
||||
$type = QuestionType::tryFrom((string) $data['type'])
|
||||
?? throw $this->error($context, sprintf('unknown type "%s"', $data['type']));
|
||||
|
||||
$required = $data['required'] ?? false;
|
||||
|
||||
if (!is_bool($required)) {
|
||||
throw $this->error($context, 'required must be true or false');
|
||||
}
|
||||
|
||||
$widget = null;
|
||||
|
||||
if (array_key_exists('widget', $data)) {
|
||||
if (QuestionType::CHOICE !== $type) {
|
||||
throw $this->error($context, 'widget is only allowed on a choice question');
|
||||
}
|
||||
|
||||
$widget = ChoiceWidget::tryFrom((string) $data['widget'])
|
||||
?? throw $this->error($context, sprintf('unknown widget "%s"', $data['widget']));
|
||||
} elseif (QuestionType::CHOICE === $type) {
|
||||
$widget = ChoiceWidget::RADIO;
|
||||
}
|
||||
|
||||
$options = [];
|
||||
|
||||
if ($type->hasOptions()) {
|
||||
$options = $this->buildOptions($data['options'] ?? null, $context);
|
||||
} elseif (array_key_exists('options', $data)) {
|
||||
throw $this->error($context, sprintf('options are not allowed on a %s question', $type->value));
|
||||
}
|
||||
|
||||
$showIf = array_key_exists('show_if', $data)
|
||||
? $this->buildCondition($data['show_if'], $earlier, $context)
|
||||
: null;
|
||||
|
||||
return new Question(
|
||||
$key,
|
||||
$this->string($data['label'], 'label', $context),
|
||||
$type,
|
||||
$required,
|
||||
$this->optionalString($data['help'] ?? null, 'help', $context),
|
||||
$widget,
|
||||
$options,
|
||||
$showIf,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<Option>
|
||||
*/
|
||||
private function buildOptions(mixed $data, string $context): array
|
||||
{
|
||||
if (!is_array($data) || [] === $data || !array_is_list($data)) {
|
||||
throw $this->error($context, 'options must be a non-empty list');
|
||||
}
|
||||
|
||||
$options = [];
|
||||
$keys = [];
|
||||
|
||||
foreach ($data as $optionData) {
|
||||
$this->assertFields($optionData, self::OPTION_FIELDS, self::OPTION_FIELDS, $context.': option');
|
||||
// An option key is stored as the answer; YAML would turn an unquoted 1 into an int.
|
||||
$key = $this->key((string) $optionData['key'], $context.': option');
|
||||
|
||||
if (in_array($key, $keys, true)) {
|
||||
throw $this->error($context, sprintf('duplicate option key "%s"', $key));
|
||||
}
|
||||
|
||||
$keys[] = $key;
|
||||
$options[] = new Option($key, $this->string($optionData['label'], 'option label', $context));
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, Question> $earlier
|
||||
*/
|
||||
private function buildCondition(mixed $data, array $earlier, string $context): Condition
|
||||
{
|
||||
$context .= ': show_if';
|
||||
$operators = array_map(static fn (ConditionOperator $operator): string => $operator->value, ConditionOperator::cases());
|
||||
$this->assertFields($data, ['question', ...$operators], ['question'], $context);
|
||||
|
||||
$given = array_values(array_intersect($operators, array_keys($data)));
|
||||
|
||||
if (1 !== count($given)) {
|
||||
throw $this->error($context, sprintf('needs exactly one of %s', implode(', ', $operators)));
|
||||
}
|
||||
|
||||
$operator = ConditionOperator::from($given[0]);
|
||||
$value = $data[$given[0]];
|
||||
|
||||
// Only an earlier question can be answered by the time this one is reached, and it rules
|
||||
// out cycles without having to look for them.
|
||||
$controlling = $earlier[$data['question']]
|
||||
?? throw $this->error($context, sprintf('question "%s" is not an earlier question', $data['question']));
|
||||
|
||||
match ($operator) {
|
||||
ConditionOperator::EQUALS, ConditionOperator::IN => $this->assertOptionValue($controlling, $operator, $value, $context),
|
||||
ConditionOperator::LTE => $this->assertRatingValue($controlling, $value, $context),
|
||||
};
|
||||
|
||||
return new Condition($controlling->key, $operator, $value);
|
||||
}
|
||||
|
||||
private function assertOptionValue(Question $controlling, ConditionOperator $operator, mixed $value, string $context): void
|
||||
{
|
||||
if (QuestionType::CHOICE !== $controlling->type) {
|
||||
throw $this->error($context, sprintf('%s needs a choice question, "%s" is %s', $operator->value, $controlling->key, $controlling->type->value));
|
||||
}
|
||||
|
||||
$values = ConditionOperator::IN === $operator ? $value : [$value];
|
||||
|
||||
if (!is_array($values) || [] === $values || !array_is_list($values)) {
|
||||
throw $this->error($context, 'in needs a non-empty list of option keys');
|
||||
}
|
||||
|
||||
foreach ($values as $optionKey) {
|
||||
if (!is_string($optionKey) || null === $controlling->getOption($optionKey)) {
|
||||
throw $this->error($context, sprintf('"%s" is not an option of "%s"', is_string($optionKey) ? $optionKey : json_encode($optionKey), $controlling->key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function assertRatingValue(Question $controlling, mixed $value, string $context): void
|
||||
{
|
||||
if (QuestionType::RATING !== $controlling->type) {
|
||||
throw $this->error($context, sprintf('lte needs a rating question, "%s" is %s', $controlling->key, $controlling->type->value));
|
||||
}
|
||||
|
||||
if (!is_int($value) || $value < self::RATING_MIN || $value > self::RATING_MAX) {
|
||||
throw $this->error($context, sprintf('lte needs a rating from %d to %d', self::RATING_MIN, self::RATING_MAX));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $allowed
|
||||
* @param list<string> $required
|
||||
*/
|
||||
private function assertFields(mixed $data, array $allowed, array $required, string $context): void
|
||||
{
|
||||
if (!is_array($data) || array_is_list($data)) {
|
||||
throw $this->error($context, 'must be a mapping');
|
||||
}
|
||||
|
||||
if ([] !== $unknown = array_diff(array_keys($data), $allowed)) {
|
||||
throw $this->error($context, sprintf('unknown field(s) %s', implode(', ', $unknown)));
|
||||
}
|
||||
|
||||
if ([] !== $missing = array_diff($required, array_keys($data))) {
|
||||
throw $this->error($context, sprintf('missing field(s) %s', implode(', ', $missing)));
|
||||
}
|
||||
}
|
||||
|
||||
private function key(mixed $value, string $context): string
|
||||
{
|
||||
if (!is_string($value) || 1 !== preg_match(self::KEY_PATTERN, $value)) {
|
||||
throw $this->error($context, sprintf('key %s must be lower snake_case', json_encode($value)));
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function string(mixed $value, string $field, string $context): string
|
||||
{
|
||||
if (!is_string($value) || '' === trim($value)) {
|
||||
throw $this->error($context, sprintf('%s must be a non-empty string', $field));
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function optionalString(mixed $value, string $field, string $context): ?string
|
||||
{
|
||||
return null === $value ? null : $this->string($value, $field, $context);
|
||||
}
|
||||
|
||||
private function error(string $context, string $message): \UnexpectedValueException
|
||||
{
|
||||
return new \UnexpectedValueException(sprintf('%s: %s', $context, $message));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\Autocomplete;
|
||||
|
||||
use App\Repository\AssignmentRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class AssignmentController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly AssignmentRepository $assignmentRepository)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/admin/autocomplete/assignment', name: 'app_admin_autocomplete_assignment')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$query = json_decode($request->getContent(), true, 512, JSON_THROW_ON_ERROR);
|
||||
$queryString = (string) $query['search'];
|
||||
} catch (\JsonException $e) {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
return $this->json($this->assignmentRepository->getMailingAutocompletionData($queryString));
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ namespace App\Controller\Admin\Teamer;
|
||||
use App\Entity\Teamer;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use App\Repository\ApplicationRepository;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Service\Teamer\AccountDeletionHandler;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -18,7 +18,7 @@ class DeleteAccountController extends AbstractController
|
||||
public function __construct(
|
||||
private readonly AccountDeletionHandler $accountDeletionHandler,
|
||||
private readonly ApplicationRepository $applicationRepository,
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ class DeleteAccountController extends AbstractController
|
||||
return $this->render('admin/teamer/modal_delete_account.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'pendingApplicationCount' => count($this->applicationRepository->getPendingForTeamer($teamer, 100)),
|
||||
'upcomingDispositionCount' => count($this->dispositionRepository->getUpcomingDispositionsByTeamer($teamer, 100)),
|
||||
// season assignments included: an active season placement is an open commitment as well
|
||||
'upcomingPlacementCount' => count($this->upcomingPlacementCollector->collect($teamer)),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,12 @@ class TimelineController extends AbstractController
|
||||
|
||||
$filterDto = $this->filterHandler->getFilterSettings();
|
||||
|
||||
// Only a house manager without a staff role is kept to their own houses. BusPro also lists
|
||||
// admins and managers as house managers; they see everything like any staff member.
|
||||
$houseManagerOnly = $this->isGranted('ROLE_HOUSE_MANAGER') && false === $this->isGranted('ROLE_ADMINISTRATIVE');
|
||||
|
||||
$hotelCodes = null;
|
||||
if ($this->isGranted('ROLE_HOUSE_MANAGER')) {
|
||||
if ($houseManagerOnly) {
|
||||
$filterDto->setHotels([]);
|
||||
$hotelCodes = $user->getHotelCodes();
|
||||
}
|
||||
@@ -44,12 +48,13 @@ class TimelineController extends AbstractController
|
||||
->getListQuery($filterDto, 'destination.dateFrom', $hotelCodes)
|
||||
->getResult()
|
||||
;
|
||||
$timelineData = $this->timelineService->preprocess($assignments);
|
||||
$period = $filterDto->getPeriod();
|
||||
|
||||
return $this->render('administrative/assignment/timeline.html.twig', [
|
||||
'data' => $timelineData,
|
||||
'period' => $period,
|
||||
'houses' => $this->timelineService->preprocess($assignments, $period),
|
||||
'calendar' => $this->timelineService->getCalendar($period),
|
||||
'filterDto' => $filterDto,
|
||||
'houseManagerOnly' => $houseManagerOnly,
|
||||
]);
|
||||
}
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use App\Controller\Traits\AuthenticatedUserTrait;
|
||||
use App\Email\MailBodyRenderer;
|
||||
use App\Entity\Upload;
|
||||
use App\Entity\User;
|
||||
use App\Form\AssignmentMailingAddType;
|
||||
use App\Form\AssignmentMailingType;
|
||||
use App\Model\AssignmentMailingDto;
|
||||
use App\Model\TeamerMailingRecipientsDto;
|
||||
use App\Service\Teamer\AssignmentMailingDraftHandler;
|
||||
use App\Service\Teamer\AssignmentMailingService;
|
||||
use App\Service\Teamer\MailingAttachmentHandler;
|
||||
use App\Service\Teamer\TeamerMailingService;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Contracts\Service\Attribute\Required;
|
||||
|
||||
/**
|
||||
* What the actions of the assignment mailing share: the draft, the form over its wording and the
|
||||
* pieces of the compose page that htmx swaps on their own.
|
||||
*/
|
||||
abstract class AbstractAssignmentMailingController extends AbstractController
|
||||
{
|
||||
use AuthenticatedUserTrait;
|
||||
|
||||
protected AssignmentMailingDraftHandler $draftHandler;
|
||||
protected AssignmentMailingService $mailingService;
|
||||
protected MailingAttachmentHandler $attachmentHandler;
|
||||
protected TeamerMailingService $teamerMailingService;
|
||||
protected MailBodyRenderer $mailBodyRenderer;
|
||||
|
||||
#[Required]
|
||||
public function setMailingDependencies(
|
||||
AssignmentMailingDraftHandler $draftHandler,
|
||||
AssignmentMailingService $mailingService,
|
||||
MailingAttachmentHandler $attachmentHandler,
|
||||
TeamerMailingService $teamerMailingService,
|
||||
MailBodyRenderer $mailBodyRenderer,
|
||||
): void {
|
||||
$this->draftHandler = $draftHandler;
|
||||
$this->mailingService = $mailingService;
|
||||
$this->attachmentHandler = $attachmentHandler;
|
||||
$this->teamerMailingService = $teamerMailingService;
|
||||
$this->mailBodyRenderer = $mailBodyRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* The form over the draft: a GET shows the parked wording, a POST carries the current one.
|
||||
* Assignments and template stay what the draft says, the form has no fields for them.
|
||||
*/
|
||||
protected function createMailingForm(Request $request, ?AssignmentMailingDto $mailingDto = null): FormInterface
|
||||
{
|
||||
$form = $this->createForm(AssignmentMailingType::class, $mailingDto ?? $this->draftHandler->getDraft());
|
||||
$form->handleRequest($request);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* What the composing user would receive, see the teamer mailing's renderPreview().
|
||||
*
|
||||
* @return array{subject: string, bodyHtml: string, colleagues: array<int, array{fullName: string, email: string}>}
|
||||
*/
|
||||
protected function renderPreview(AssignmentMailingDto $mailingDto): array
|
||||
{
|
||||
$values = $this->teamerMailingService->placeholderValuesForUser($this->getAuthenticatedUser());
|
||||
|
||||
return [
|
||||
'subject' => $this->teamerMailingService->render($mailingDto->getSubject(), $values),
|
||||
'bodyHtml' => $this->mailBodyRenderer->render($mailingDto->getMessage(), $values),
|
||||
'colleagues' => $this->mailingService->getPreviewColleagues($mailingDto),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* For administrative/assignment_mailing/_assignments.html.twig.
|
||||
*/
|
||||
protected function assignmentsContext(AssignmentMailingDto $mailingDto): array
|
||||
{
|
||||
return [
|
||||
'mailingDto' => $mailingDto,
|
||||
'addForm' => $this->createForm(AssignmentMailingAddType::class)->createView(),
|
||||
] + $this->recipientsContext($mailingDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* The recipients and the house managers in CC, named on the compose page and in the
|
||||
* confirmation.
|
||||
*
|
||||
* @return array{recipients: TeamerMailingRecipientsDto, houseManagers: User[]}
|
||||
*/
|
||||
protected function recipientsContext(AssignmentMailingDto $mailingDto): array
|
||||
{
|
||||
$recipients = $this->mailingService->resolveRecipients($mailingDto);
|
||||
|
||||
return [
|
||||
'recipients' => $recipients,
|
||||
'houseManagers' => array_merge(...array_values($this->mailingService->resolveHouseManagerCc($mailingDto, $recipients))),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* For administrative/assignment_mailing/_attachments.html.twig.
|
||||
*/
|
||||
protected function attachmentsContext(AssignmentMailingDto $mailingDto): array
|
||||
{
|
||||
return [
|
||||
'mailingDto' => $mailingDto,
|
||||
'pending' => $this->attachmentHandler->getPending(Upload::TYPE_MAILING_ATTACHMENT),
|
||||
'maxAttachmentBytes' => MailingAttachmentHandler::MAX_TOTAL_BYTES,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use App\Entity\Assignment;
|
||||
use App\Form\AssignmentMailingAddType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class AddAssignmentController extends AbstractAssignmentMailingController
|
||||
{
|
||||
#[Route('/administrative/assignment/mailing/add', name: 'app_administrative_assignment_mailing_add', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$mailingDto = $this->draftHandler->getDraft();
|
||||
|
||||
$form = $this->createForm(AssignmentMailingAddType::class);
|
||||
$form->handleRequest($request);
|
||||
|
||||
/** @var Assignment|null $assignment */
|
||||
$assignment = $form->isSubmitted() && $form->isValid() ? $form->get('assignment')->getData() : null;
|
||||
|
||||
if (null !== $assignment && false === $assignment->isDeleted()
|
||||
&& false === in_array($assignment, $mailingDto->getAssignments(), true)) {
|
||||
$this->draftHandler->saveDraft(
|
||||
$mailingDto->setAssignments([...$mailingDto->getAssignments(), $assignment])
|
||||
);
|
||||
|
||||
// read back, so the list comes in the draft's order
|
||||
$mailingDto = $this->draftHandler->getDraft();
|
||||
}
|
||||
|
||||
return $this->render('administrative/assignment_mailing/assignments.html.twig', [
|
||||
'preview' => $this->renderPreview($mailingDto),
|
||||
] + $this->assignmentsContext($mailingDto));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\Upload;
|
||||
use App\Repository\MailingTemplateRepository;
|
||||
use App\Service\Teamer\TeamerMailingService;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* Compose a mail to the teamers confirmed on a set of assignments.
|
||||
*
|
||||
* Arriving from the overview's "Mail an Teamer:innen" (?start=1, plus the ticked assignments)
|
||||
* starts a new mailing for them; arriving otherwise continues the one in the draft. A submit of the form sends the preview
|
||||
* to the composing user, the real send goes through the confirmation modal.
|
||||
*/
|
||||
class ComposeController extends AbstractAssignmentMailingController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(private readonly MailingTemplateRepository $mailingTemplateRepository)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/administrative/assignment/mailing', name: 'app_administrative_assignment_mailing_compose')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
if (true === $request->query->has('start')) {
|
||||
$omitted = $this->draftHandler->startDraft(array_filter($request->query->all('assignments'), 'is_string'));
|
||||
$this->attachmentHandler->discardPending(Upload::TYPE_MAILING_ATTACHMENT);
|
||||
|
||||
if ($omitted > 0) {
|
||||
$this->addFlash('info', 1 === $omitted
|
||||
? 'Ein Einsatz ohne bestätigte Teamer:innen wurde weggelassen'
|
||||
: sprintf('%d Einsätze ohne bestätigte Teamer:innen wurden weggelassen', $omitted));
|
||||
}
|
||||
|
||||
// without the selection in the address, a reload continues this mailing instead of
|
||||
// starting it over
|
||||
return $this->redirectToRoute('app_administrative_assignment_mailing_compose', [
|
||||
'r' => $request->query->get('r'),
|
||||
]);
|
||||
}
|
||||
|
||||
$form = $this->createMailingForm($request);
|
||||
$mailingDto = $form->getData();
|
||||
|
||||
if ($form->isSubmitted()) {
|
||||
$this->draftHandler->saveDraft($mailingDto);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if (null !== $error = $this->mailingService->validateAttachments($mailingDto)) {
|
||||
$this->addFlash('error', $error);
|
||||
} else {
|
||||
$this->mailingService->sendPreview($mailingDto, $this->getAuthenticatedUser());
|
||||
|
||||
$this->addFlash('success', sprintf(
|
||||
'Die Vorschau wurde an %s gesendet',
|
||||
$this->getAuthenticatedUser()->getUserIdentifier()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// no redirect after the preview mail, the composed mail has to survive it
|
||||
return $this->render('administrative/assignment_mailing/compose.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'mailingDto' => $mailingDto,
|
||||
'preview' => $this->renderPreview($mailingDto),
|
||||
'templates' => $this->mailingTemplateRepository->findActive(),
|
||||
'placeholders' => TeamerMailingService::PLACEHOLDERS,
|
||||
'hasDraft' => $this->draftHandler->hasDraft(),
|
||||
'returnUrl' => $this->getReturnUrl($request, 'app_administrative_assignment_index'),
|
||||
] + $this->assignmentsContext($mailingDto) + $this->attachmentsContext($mailingDto));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class ConfirmController extends AbstractAssignmentMailingController
|
||||
{
|
||||
#[Route('/administrative/assignment/mailing/confirm', name: 'app_administrative_assignment_mailing_confirm', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$form = $this->createMailingForm($request);
|
||||
$mailingDto = $form->getData();
|
||||
|
||||
$this->draftHandler->saveDraft($mailingDto);
|
||||
|
||||
// Only the wording is carried on in hidden fields. Assignments, template and the dropped
|
||||
// files are the draft's and the upload session's, which is where the send reads them.
|
||||
return $this->render('administrative/assignment_mailing/modal_confirm.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'mailingDto' => $mailingDto,
|
||||
'valid' => $form->isSubmitted() && $form->isValid(),
|
||||
'attachmentError' => $this->mailingService->validateAttachments($mailingDto),
|
||||
'attachmentSize' => $this->mailingService->getAttachmentSize($mailingDto),
|
||||
] + $this->recipientsContext($mailingDto) + $this->attachmentsContext($mailingDto));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use App\Entity\Upload;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class DiscardController extends AbstractAssignmentMailingController
|
||||
{
|
||||
#[Route('/administrative/assignment/mailing/discard', name: 'app_administrative_assignment_mailing_discard')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(): Response
|
||||
{
|
||||
$this->draftHandler->resetDraft();
|
||||
$this->attachmentHandler->discardPending(Upload::TYPE_MAILING_ATTACHMENT);
|
||||
|
||||
return $this->redirectToRoute('app_administrative_assignment_index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* Parks the wording typed so far and answers with its preview, in one request for the same
|
||||
* reason as the teamer mailing's draft route.
|
||||
*/
|
||||
class DraftController extends AbstractAssignmentMailingController
|
||||
{
|
||||
#[Route('/administrative/assignment/mailing/draft', name: 'app_administrative_assignment_mailing_draft', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$mailingDto = $this->createMailingForm($request)->getData();
|
||||
|
||||
$this->draftHandler->saveDraft($mailingDto);
|
||||
|
||||
return $this->render('admin/teamer/_mailing_preview.html.twig', $this->renderPreview($mailingDto));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use App\Entity\Assignment;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class RemoveAssignmentController extends AbstractAssignmentMailingController
|
||||
{
|
||||
#[Route('/administrative/assignment/mailing/remove/{uuid}', name: 'app_administrative_assignment_mailing_remove', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
Assignment $assignment,
|
||||
): Response {
|
||||
$mailingDto = $this->draftHandler->getDraft();
|
||||
$mailingDto->setAssignments(array_filter(
|
||||
$mailingDto->getAssignments(),
|
||||
fn (Assignment $selected) => $selected !== $assignment
|
||||
));
|
||||
|
||||
$this->draftHandler->saveDraft($mailingDto);
|
||||
|
||||
return $this->render('administrative/assignment_mailing/assignments.html.twig', [
|
||||
'preview' => $this->renderPreview($mailingDto),
|
||||
] + $this->assignmentsContext($mailingDto));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class SendController extends AbstractAssignmentMailingController
|
||||
{
|
||||
#[Route('/administrative/assignment/mailing/send', name: 'app_administrative_assignment_mailing_send', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$form = $this->createMailingForm($request);
|
||||
$mailingDto = $form->getData();
|
||||
|
||||
if (false === $form->isSubmitted() || false === $form->isValid()) {
|
||||
return $this->backToCompose('Die Mail konnte nicht gesendet werden, Betreff oder Nachricht fehlen');
|
||||
}
|
||||
|
||||
if (null !== $error = $this->mailingService->validateAttachments($mailingDto)) {
|
||||
return $this->backToCompose($error);
|
||||
}
|
||||
|
||||
$recipients = $this->mailingService->resolveRecipients($mailingDto);
|
||||
|
||||
if (0 === $recipients->getEligibleCount()) {
|
||||
return $this->backToCompose('Die Mail konnte nicht gesendet werden, sie hat keine Empfänger:innen');
|
||||
}
|
||||
|
||||
$this->mailingService->send($mailingDto, $recipients, $this->getAuthenticatedUser());
|
||||
|
||||
// it is on its way, the next mailing starts on a blank page
|
||||
$this->draftHandler->resetDraft();
|
||||
|
||||
// not "wurde gesendet", see the teamer mailing: nothing has reached a mail server yet
|
||||
$this->addFlash('success', sprintf(
|
||||
'Die Mail wird an %d Teamer:innen gesendet',
|
||||
$recipients->getEligibleCount()
|
||||
));
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_assignment_index'));
|
||||
}
|
||||
|
||||
private function backToCompose(string $error): Response
|
||||
{
|
||||
$this->addFlash('error', $error);
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_assignment_mailing_compose'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\AssignmentMailing;
|
||||
|
||||
use App\Form\AssignmentMailingType;
|
||||
use App\Repository\MailingTemplateRepository;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* Picks the template the mailing starts from: its subject and message replace what is in the
|
||||
* form, and its files join the mailing. Picking none keeps the wording and drops the files.
|
||||
*
|
||||
* Answers with the subject and message fields, the attachments and the preview, the last two
|
||||
* swapped out of band.
|
||||
*/
|
||||
class TemplateController extends AbstractAssignmentMailingController
|
||||
{
|
||||
public function __construct(private readonly MailingTemplateRepository $mailingTemplateRepository)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/administrative/assignment/mailing/template', name: 'app_administrative_assignment_mailing_template', methods: ['POST'])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$mailingDto = $this->createMailingForm($request)->getData();
|
||||
|
||||
$template = $this->mailingTemplateRepository->findActiveByUuid((string) $request->request->get('template'));
|
||||
$mailingDto->setTemplate($template);
|
||||
|
||||
if (null !== $template) {
|
||||
$mailingDto
|
||||
->setSubject($template->getSubject())
|
||||
->setMessage($template->getMessage())
|
||||
;
|
||||
}
|
||||
|
||||
$this->draftHandler->saveDraft($mailingDto);
|
||||
|
||||
// a fresh form, so the fields show the template's wording rather than what was posted
|
||||
return $this->render('administrative/assignment_mailing/template.html.twig', [
|
||||
'form' => $this->createForm(AssignmentMailingType::class, $mailingDto)->createView(),
|
||||
'preview' => $this->renderPreview($mailingDto),
|
||||
] + $this->attachmentsContext($mailingDto));
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Controller\Administrative\Disposition;
|
||||
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\Disposition;
|
||||
use App\Event\DispositionCalledOffEvent;
|
||||
use App\Form\DispositionCallOffType;
|
||||
@@ -33,7 +32,7 @@ class CallOffController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$disposition->setStatus(Assignment::STATUS_CALLED_OFF);
|
||||
$disposition->setStatus(Disposition::STATUS_CALLED_OFF);
|
||||
$sendNotification = $form->get('sendNotification')->getData();
|
||||
|
||||
$this->entityManager->flush();
|
||||
@@ -46,7 +45,7 @@ class CallOffController extends AbstractController
|
||||
$assignment = $disposition->getAssignment();
|
||||
|
||||
$this->logger->info('Call off disposition', [
|
||||
'assignment_id' => $disposition->getId(),
|
||||
'disposition_id' => $disposition->getId(),
|
||||
'destination' => (string) $assignment->getDestination(),
|
||||
'job_profile' => $assignment->getJobProfile()->getName(),
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\QuestionnaireResponse;
|
||||
use App\Repository\QuestionnaireResponseRepository;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Routing\Requirement\Requirement;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* One submitted questionnaire: what the disposition or travel knew when it was submitted, then the
|
||||
* answers, rendered with the definition version they were given under.
|
||||
*/
|
||||
class DetailController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
private readonly QuestionnaireResponseRepository $responseRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
// the requirement keeps /administrative/questionnaire/list from being read as a uuid
|
||||
#[Route('/administrative/questionnaire/{uuid}', name: 'app_administrative_questionnaire_detail', requirements: ['uuid' => Requirement::UUID])]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
QuestionnaireResponse $response,
|
||||
Request $request,
|
||||
): Response {
|
||||
// a draft is still the teamer's
|
||||
if (false === $response->isSubmitted()) {
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
// the other responses of the same placement, e.g. the bus feedback beside the teamer feedback,
|
||||
// or the other leg's; a travel's questionnaire has none
|
||||
$siblings = null === $response->getDisposition() ? [] : array_filter(
|
||||
array_merge(...array_values($this->responseRepository->findByDisposition($response->getDisposition()))),
|
||||
static fn (QuestionnaireResponse $sibling): bool => $sibling !== $response && $sibling->isSubmitted(),
|
||||
);
|
||||
|
||||
return $this->render('administrative/questionnaire/detail.html.twig', [
|
||||
'definition' => $this->catalog->get($response->getQuestionnaire(), $response->getVersion()),
|
||||
'response' => $response,
|
||||
'siblings' => array_map(fn (QuestionnaireResponse $sibling): array => [
|
||||
'response' => $sibling,
|
||||
'title' => $this->catalog->get($sibling->getQuestionnaire(), $sibling->getVersion())->title,
|
||||
], array_values($siblings)),
|
||||
'returnUrl' => $this->getReturnUrl($request, 'app_administrative_questionnaire_index'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\Assignment;
|
||||
use App\Form\QuestionnaireType;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Service\Questionnaire\DestinationContext;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The house manager's questionnaire as a house manager gets it for the travel of this assignment,
|
||||
* with the travel's teamers - before or after the trip. Opened from an assignment, since that is
|
||||
* where the office tries out the teamer questionnaires too. Nothing is saved: "Absenden" shows
|
||||
* the answers as they would be stored, "Entwurf speichern" just keeps them in the form.
|
||||
*/
|
||||
class HouseManagerTestController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/administrative/questionnaire/test-house-manager/{uuid}', name: 'app_administrative_questionnaire_test_house_manager')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
Assignment $assignment,
|
||||
Request $request,
|
||||
): Response {
|
||||
$destination = $assignment->getDestination();
|
||||
$definition = $this->catalog->get(QuestionnaireCatalog::HOUSE_MANAGER_FEEDBACK);
|
||||
$dispositions = $this->dispositionRepository->findForHouseManagerQuestionnaire($destination);
|
||||
|
||||
$form = $this->createForm(QuestionnaireType::class, [
|
||||
$definition->key => DestinationContext::initialAnswers($destination),
|
||||
], [
|
||||
'definitions' => [$definition],
|
||||
'travel' => DestinationContext::travel($destination, $dispositions),
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
$submitted = null;
|
||||
$draft = false;
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if (QuestionnaireType::isFinal($form)) {
|
||||
$submitted = $definition->withoutHiddenAnswers($form->getData()[$definition->key]);
|
||||
} else {
|
||||
$draft = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('administrative/questionnaire/test_house_manager.html.twig', [
|
||||
'assignment' => $assignment,
|
||||
'destination' => $destination,
|
||||
'dispositions' => $dispositions,
|
||||
'definition' => $definition,
|
||||
'context' => DestinationContext::build($destination, $dispositions),
|
||||
'form' => $form,
|
||||
'submitted' => $submitted,
|
||||
'draft' => $draft,
|
||||
'returnUrl' => $this->getReturnUrl($request, 'app_administrative_assignment_index'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Repository\QuestionnaireResponseRepository;
|
||||
use App\Service\Common\QuestionnaireResponseFilterHandler;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The submitted responses to one questionnaire: teamer, bus or house manager feedback. Only
|
||||
* administrative users read them here: the teamer ones rate the house manager among others, so
|
||||
* house managers are deliberately not let in. A house manager reads their own travel's
|
||||
* questionnaire in the HouseManager area.
|
||||
*/
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly QuestionnaireResponseFilterHandler $filterHandler,
|
||||
private readonly QuestionnaireResponseRepository $responseRepository,
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/administrative/questionnaire/list/{questionnaire}',
|
||||
name: 'app_administrative_questionnaire_index',
|
||||
requirements: ['questionnaire' => '[a-z0-9_]+'],
|
||||
defaults: ['questionnaire' => QuestionnaireCatalog::TEAMER_FEEDBACK],
|
||||
)]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(string $questionnaire, Request $request): Response
|
||||
{
|
||||
$keys = $this->catalog->keys();
|
||||
|
||||
if (!in_array($questionnaire, $keys, true)) {
|
||||
throw $this->createNotFoundException(sprintf('No questionnaire "%s"', $questionnaire));
|
||||
}
|
||||
|
||||
$filterDto = $this->filterHandler->getFilterSettings();
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
$this->responseRepository->getListQuery($questionnaire, $filterDto),
|
||||
$request->query->getInt('page', 1),
|
||||
$request->query->getInt('limit', 50),
|
||||
[
|
||||
'defaultSortFieldName' => 'response.submittedAt',
|
||||
'defaultSortDirection' => 'desc',
|
||||
]
|
||||
);
|
||||
|
||||
return $this->render('administrative/questionnaire/index.html.twig', [
|
||||
'definition' => $this->catalog->get($questionnaire),
|
||||
// for switching between the questionnaires
|
||||
'definitions' => array_map($this->catalog->get(...), $keys),
|
||||
'pagination' => $pagination,
|
||||
'filterDto' => $filterDto,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Entity\Assignment;
|
||||
use App\Form\QuestionnaireType;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The questionnaires as a teamer gets them, for trying out on any assignment - before or after the
|
||||
* trip, placed or not. It shows what a placement on this assignment gets - the teamer feedback,
|
||||
* and the bus feedback too for a bus escort; ?bus_escort=1 or 0 tries the other case. Nothing is
|
||||
* saved: "Absenden" shows the answers as they would be stored, "Entwurf speichern" just keeps them
|
||||
* in the form.
|
||||
*/
|
||||
class TestController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/administrative/questionnaire/test/{uuid}', name: 'app_administrative_questionnaire_test')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
Assignment $assignment,
|
||||
Request $request,
|
||||
): Response {
|
||||
$busEscort = $request->query->has('bus_escort')
|
||||
? $request->query->getBoolean('bus_escort')
|
||||
: $assignment->hasBusEscort();
|
||||
$definitions = [$this->catalog->get(QuestionnaireCatalog::TEAMER_FEEDBACK)];
|
||||
|
||||
if ($busEscort) {
|
||||
$definitions[] = $this->catalog->get(QuestionnaireCatalog::BUS_FEEDBACK);
|
||||
}
|
||||
|
||||
$form = $this->createForm(QuestionnaireType::class, [], ['definitions' => $definitions]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
$submitted = null;
|
||||
$draft = false;
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if (QuestionnaireType::isFinal($form)) {
|
||||
$submitted = array_map(static fn (array $set): array => [
|
||||
'definition' => $set['definition'],
|
||||
'leg' => $set['leg'],
|
||||
'answers' => $set['definition']->withoutHiddenAnswers($set['answers']),
|
||||
], QuestionnaireType::answerSets($form->getData(), $definitions));
|
||||
} else {
|
||||
$draft = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('administrative/questionnaire/test.html.twig', [
|
||||
'assignment' => $assignment,
|
||||
'form' => $form,
|
||||
'submitted' => $submitted,
|
||||
'draft' => $draft,
|
||||
'busEscort' => $busEscort,
|
||||
'returnUrl' => $this->getReturnUrl($request, 'app_administrative_assignment_index'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,9 @@ class TaskDeadlineController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$applyToAll = true === $form->get('applyToAll')->getData();
|
||||
$appliedCount = $applyToAll ? ($seasonAssignment?->applyDeadlinesToOpenTasks($task) ?? 0) : 0;
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Change season assignment task deadlines', [
|
||||
@@ -54,9 +57,13 @@ class TaskDeadlineController extends AbstractController
|
||||
'task' => $task->getTaskKey(),
|
||||
'deadline_override_1' => $task->getDeadlineOverride1()?->format('Y-m-d'),
|
||||
'deadline_override_2' => $task->getDeadlineOverride2()?->format('Y-m-d'),
|
||||
'apply_to_all' => $applyToAll,
|
||||
'applied_count' => $appliedCount,
|
||||
]);
|
||||
|
||||
$this->addFlash('success', 'Die Fristen wurden gespeichert');
|
||||
$this->addFlash('success', $applyToAll
|
||||
? 'Die Fristen wurden für alle offenen Einträge gespeichert'
|
||||
: 'Die Fristen wurden gespeichert');
|
||||
|
||||
return new HxRedirectResponse($returnUrl);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\System;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The settings overview, linked from the sidebar instead of a submenu of every settings page.
|
||||
* The template shows each role only the pages it may open.
|
||||
*/
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
#[Route('/administrative/system', name: 'app_administrative_system_index')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('administrative/system/index.html.twig');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\System\MailingTemplate;
|
||||
|
||||
use App\Controller\Traits\AuthenticatedUserTrait;
|
||||
use App\Entity\MailingTemplate;
|
||||
use App\Entity\Upload;
|
||||
use App\Form\MailingTemplateType;
|
||||
use App\Service\Teamer\MailingAttachmentHandler;
|
||||
use App\Service\Teamer\TeamerMailingDraftHandler;
|
||||
use App\Service\Teamer\TeamerMailingService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class CreateController extends AbstractController
|
||||
{
|
||||
use AuthenticatedUserTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly MailingAttachmentHandler $attachmentHandler,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/administrative/system/mailing-template/create', name: 'app_administrative_system_mailing_template_create')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$template = (new MailingTemplate())->setMessage(TeamerMailingDraftHandler::NEW_MESSAGE);
|
||||
|
||||
$form = $this->createForm(MailingTemplateType::class, $template);
|
||||
$form->handleRequest($request);
|
||||
|
||||
// files left over from a template form that was never saved must not end up on this one
|
||||
if (false === $form->isSubmitted()) {
|
||||
$this->attachmentHandler->discardPending(Upload::TYPE_MAILING_TEMPLATE);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if (null !== $error = $this->attachmentHandler->validateTemplateAttachments($template, [])) {
|
||||
$form->addError(new FormError($error));
|
||||
}
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->attachmentHandler->saveTemplateAttachments($template, [], $this->getAuthenticatedUser());
|
||||
$this->entityManager->persist($template);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Die Mailvorlage wurde angelegt');
|
||||
$this->logger->info('Create mailing template', [
|
||||
'mailing_template_id' => $template->getId(),
|
||||
'mailing_template_name' => $template->getName(),
|
||||
'attachments' => $template->getAttachments()->count(),
|
||||
]);
|
||||
|
||||
return $this->redirectToRoute('app_administrative_system_mailing_template_index');
|
||||
}
|
||||
|
||||
return $this->render('administrative/system/mailing_template/create.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'template' => $template,
|
||||
'pending' => $this->attachmentHandler->getPending(Upload::TYPE_MAILING_TEMPLATE),
|
||||
'placeholders' => TeamerMailingService::PLACEHOLDERS,
|
||||
'maxAttachmentBytes' => MailingAttachmentHandler::MAX_TOTAL_BYTES,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\System\MailingTemplate;
|
||||
|
||||
use App\Entity\MailingTemplate;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* Soft, so the mailings sent from the template keep pointing at it - and at its files, which are
|
||||
* left where they are.
|
||||
*/
|
||||
class DeleteController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/administrative/system/mailing-template/delete/{uuid}', name: 'app_administrative_system_mailing_template_delete')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
MailingTemplate $template,
|
||||
Request $request,
|
||||
): Response {
|
||||
if (true === $request->isMethod('POST')) {
|
||||
$template->setDeleted();
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Die Mailvorlage wurde gelöscht');
|
||||
$this->logger->info('Delete mailing template', [
|
||||
'mailing_template_id' => $template->getId(),
|
||||
'mailing_template_name' => $template->getName(),
|
||||
]);
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_system_mailing_template_index'));
|
||||
}
|
||||
|
||||
return $this->render('administrative/system/mailing_template/modal_delete.html.twig', [
|
||||
'template' => $template,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\System\MailingTemplate;
|
||||
|
||||
use App\Controller\Traits\AuthenticatedUserTrait;
|
||||
use App\Entity\MailingTemplate;
|
||||
use App\Entity\Upload;
|
||||
use App\Form\MailingTemplateType;
|
||||
use App\Service\Teamer\MailingAttachmentHandler;
|
||||
use App\Service\Teamer\TeamerMailingService;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class EditController extends AbstractController
|
||||
{
|
||||
use AuthenticatedUserTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly MailingAttachmentHandler $attachmentHandler,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/administrative/system/mailing-template/edit/{uuid}', name: 'app_administrative_system_mailing_template_edit')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
MailingTemplate $template,
|
||||
Request $request,
|
||||
): Response {
|
||||
if (true === $template->isDeleted()) {
|
||||
throw $this->createNotFoundException('Die Mailvorlage wurde gelöscht');
|
||||
}
|
||||
|
||||
$form = $this->createForm(MailingTemplateType::class, $template);
|
||||
$form->handleRequest($request);
|
||||
|
||||
// files left over from a template form that was never saved must not end up on this one
|
||||
if (false === $form->isSubmitted()) {
|
||||
$this->attachmentHandler->discardPending(Upload::TYPE_MAILING_TEMPLATE);
|
||||
}
|
||||
|
||||
/** @var Upload[] $remove */
|
||||
$remove = $form->has('removeAttachments')
|
||||
? iterator_to_array($form->get('removeAttachments')->getData() ?? [], false)
|
||||
: [];
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if (null !== $error = $this->attachmentHandler->validateTemplateAttachments($template, $remove)) {
|
||||
$form->addError(new FormError($error));
|
||||
}
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->attachmentHandler->saveTemplateAttachments($template, $remove, $this->getAuthenticatedUser());
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Die Mailvorlage wurde aktualisiert');
|
||||
$this->logger->info('Edit mailing template', [
|
||||
'mailing_template_id' => $template->getId(),
|
||||
'mailing_template_name' => $template->getName(),
|
||||
'attachments' => $template->getAttachments()->count(),
|
||||
'attachments_removed' => count($remove),
|
||||
]);
|
||||
|
||||
return $this->redirectToRoute('app_administrative_system_mailing_template_index');
|
||||
}
|
||||
|
||||
return $this->render('administrative/system/mailing_template/edit.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'template' => $template,
|
||||
'pending' => $this->attachmentHandler->getPending(Upload::TYPE_MAILING_TEMPLATE),
|
||||
'placeholders' => TeamerMailingService::PLACEHOLDERS,
|
||||
'maxAttachmentBytes' => MailingAttachmentHandler::MAX_TOTAL_BYTES,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Administrative\System\MailingTemplate;
|
||||
|
||||
use App\Repository\MailingTemplateRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly MailingTemplateRepository $mailingTemplateRepository)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/administrative/system/mailing-template', name: 'app_administrative_system_mailing_template_index')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('administrative/system/mailing_template/index.html.twig', [
|
||||
'templates' => $this->mailingTemplateRepository->findActive(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\System\StaffingRule;
|
||||
namespace App\Controller\Administrative\System\StaffingRule;
|
||||
|
||||
use App\Entity\StaffingRule;
|
||||
use App\Form\StaffingRuleType;
|
||||
@@ -21,8 +21,8 @@ class CreateController extends AbstractController
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/admin/system/staffing-rule/create', name: 'app_admin_system_staffing_rule_create')]
|
||||
#[IsGranted('ROLE_TEAM_ADMIN')]
|
||||
#[Route('/administrative/system/staffing-rule/create', name: 'app_administrative_system_staffing_rule_create')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$rule = new StaffingRule();
|
||||
@@ -39,10 +39,10 @@ class CreateController extends AbstractController
|
||||
'product_code' => $rule->getProductCode(),
|
||||
]);
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_admin_system_staffing_rule_index'));
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_system_staffing_rule_index'));
|
||||
}
|
||||
|
||||
return $this->render('admin/system/staffing_rule/modal_create.html.twig', [
|
||||
return $this->render('administrative/system/staffing_rule/modal_create.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\System\StaffingRule;
|
||||
namespace App\Controller\Administrative\System\StaffingRule;
|
||||
|
||||
use App\Entity\StaffingRule;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
@@ -20,8 +20,8 @@ class DeleteController extends AbstractController
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/admin/system/staffing-rule/delete/{uuid}', name: 'app_admin_system_staffing_rule_delete')]
|
||||
#[IsGranted('ROLE_TEAM_ADMIN')]
|
||||
#[Route('/administrative/system/staffing-rule/delete/{uuid}', name: 'app_administrative_system_staffing_rule_delete')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(StaffingRule $rule, Request $request): Response
|
||||
{
|
||||
if (true === $request->isMethod('POST')) {
|
||||
@@ -34,10 +34,10 @@ class DeleteController extends AbstractController
|
||||
'product_code' => $rule->getProductCode(),
|
||||
]);
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_admin_system_staffing_rule_index'));
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_system_staffing_rule_index'));
|
||||
}
|
||||
|
||||
return $this->render('admin/system/staffing_rule/modal_delete.html.twig', [
|
||||
return $this->render('administrative/system/staffing_rule/modal_delete.html.twig', [
|
||||
'rule' => $rule,
|
||||
]);
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\System\StaffingRule;
|
||||
namespace App\Controller\Administrative\System\StaffingRule;
|
||||
|
||||
use App\Entity\StaffingRule;
|
||||
use App\Form\StaffingRuleType;
|
||||
@@ -21,8 +21,8 @@ class EditController extends AbstractController
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/admin/system/staffing-rule/edit/{uuid}', name: 'app_admin_system_staffing_rule_edit')]
|
||||
#[IsGranted('ROLE_TEAM_ADMIN')]
|
||||
#[Route('/administrative/system/staffing-rule/edit/{uuid}', name: 'app_administrative_system_staffing_rule_edit')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(StaffingRule $rule, Request $request): Response
|
||||
{
|
||||
$form = $this->createForm(StaffingRuleType::class, $rule);
|
||||
@@ -37,10 +37,10 @@ class EditController extends AbstractController
|
||||
'product_code' => $rule->getProductCode(),
|
||||
]);
|
||||
|
||||
return new HxRedirectResponse($this->generateUrl('app_admin_system_staffing_rule_index'));
|
||||
return new HxRedirectResponse($this->generateUrl('app_administrative_system_staffing_rule_index'));
|
||||
}
|
||||
|
||||
return $this->render('admin/system/staffing_rule/modal_edit.html.twig', [
|
||||
return $this->render('administrative/system/staffing_rule/modal_edit.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\System\StaffingRule;
|
||||
namespace App\Controller\Administrative\System\StaffingRule;
|
||||
|
||||
use App\Service\Assignment\StaffingConfigurationException;
|
||||
use App\Service\Export\StaffingPreviewExporter;
|
||||
@@ -21,8 +21,8 @@ class ExportController extends AbstractController
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/admin/system/staffing-rule/export', name: 'app_admin_system_staffing_rule_export')]
|
||||
#[IsGranted('ROLE_TEAM_ADMIN')]
|
||||
#[Route('/administrative/system/staffing-rule/export', name: 'app_administrative_system_staffing_rule_export')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(): Response
|
||||
{
|
||||
try {
|
||||
@@ -30,13 +30,13 @@ class ExportController extends AbstractController
|
||||
} catch (StaffingConfigurationException $e) {
|
||||
$this->addFlash('error', 'Ein Jobprofil oder Honorar der Besetzungsmatrix ist nicht (mehr) vorhanden: '.$e->getMessage());
|
||||
|
||||
return $this->redirectToRoute('app_admin_system_staffing_rule_index');
|
||||
return $this->redirectToRoute('app_administrative_system_staffing_rule_index');
|
||||
}
|
||||
|
||||
if ([] === $rows) {
|
||||
$this->addFlash('error', 'Keine Daten für den Export vorhanden');
|
||||
|
||||
return $this->redirectToRoute('app_admin_system_staffing_rule_preview');
|
||||
return $this->redirectToRoute('app_administrative_system_staffing_rule_preview');
|
||||
}
|
||||
|
||||
$spreadsheet = $this->previewExporter->export($rows);
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\System\StaffingRule;
|
||||
namespace App\Controller\Administrative\System\StaffingRule;
|
||||
|
||||
use App\Repository\StaffingRuleRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -14,11 +14,11 @@ class IndexController extends AbstractController
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/admin/system/staffing-rule', name: 'app_admin_system_staffing_rule_index')]
|
||||
#[IsGranted('ROLE_TEAM_ADMIN')]
|
||||
#[Route('/administrative/system/staffing-rule', name: 'app_administrative_system_staffing_rule_index')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(): Response
|
||||
{
|
||||
return $this->render('admin/system/staffing_rule/index.html.twig', [
|
||||
return $this->render('administrative/system/staffing_rule/index.html.twig', [
|
||||
'rules' => $this->staffingRuleRepository->getList(),
|
||||
]);
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin\System\StaffingRule;
|
||||
namespace App\Controller\Administrative\System\StaffingRule;
|
||||
|
||||
use App\Service\Assignment\StaffingConfigurationException;
|
||||
use App\Service\Export\StaffingPreviewExporter;
|
||||
@@ -19,8 +19,8 @@ class PreviewController extends AbstractController
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/admin/system/staffing-rule/preview', name: 'app_admin_system_staffing_rule_preview')]
|
||||
#[IsGranted('ROLE_TEAM_ADMIN')]
|
||||
#[Route('/administrative/system/staffing-rule/preview', name: 'app_administrative_system_staffing_rule_preview')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
try {
|
||||
@@ -28,7 +28,7 @@ class PreviewController extends AbstractController
|
||||
} catch (StaffingConfigurationException $e) {
|
||||
$this->addFlash('error', 'Ein Jobprofil oder Honorar der Besetzungsmatrix ist nicht (mehr) vorhanden: '.$e->getMessage());
|
||||
|
||||
return $this->redirectToRoute('app_admin_system_staffing_rule_index');
|
||||
return $this->redirectToRoute('app_administrative_system_staffing_rule_index');
|
||||
}
|
||||
|
||||
// The candidates are a computed list, not a query: page the finished rows. The Excel
|
||||
@@ -39,7 +39,7 @@ class PreviewController extends AbstractController
|
||||
$request->query->getInt('limit', 50),
|
||||
);
|
||||
|
||||
return $this->render('admin/system/staffing_rule/preview.html.twig', [
|
||||
return $this->render('administrative/system/staffing_rule/preview.html.twig', [
|
||||
'pagination' => $pagination,
|
||||
]);
|
||||
}
|
||||
+3
-3
@@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class RecentAssignmentsController extends AbstractController
|
||||
class RecentDispositionsController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
@@ -19,7 +19,7 @@ class RecentAssignmentsController extends AbstractController
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/administrative/teamer/recent-assignments/{uuid}', name: 'app_administrative_teamer_recent_assignments')]
|
||||
#[Route('/administrative/teamer/recent-dispositions/{uuid}', name: 'app_administrative_teamer_recent_dispositions')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Teamer $teamer, Request $request): Response
|
||||
{
|
||||
@@ -38,7 +38,7 @@ class RecentAssignmentsController extends AbstractController
|
||||
]
|
||||
);
|
||||
|
||||
return $this->render('administrative/teamer/recent_assignments.html.twig', [
|
||||
return $this->render('administrative/teamer/recent_dispositions.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'pagination' => $pagination,
|
||||
]);
|
||||
+8
-16
@@ -3,7 +3,7 @@
|
||||
namespace App\Controller\Administrative\Teamer;
|
||||
|
||||
use App\Entity\Teamer;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -11,34 +11,26 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class UpcomingAssignmentsController extends AbstractController
|
||||
class UpcomingDispositionsController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/administrative/teamer/upcoming-assignments/{uuid}', name: 'app_administrative_teamer_upcoming_assignments')]
|
||||
#[Route('/administrative/teamer/upcoming-dispositions/{uuid}', name: 'app_administrative_teamer_upcoming_dispositions')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Teamer $teamer, Request $request): Response
|
||||
{
|
||||
$query = $this
|
||||
->dispositionRepository
|
||||
->getUpcomingDispositionsByTeamerQuery($teamer)
|
||||
;
|
||||
|
||||
// an array rather than a query: dispositions and season assignments are merged in PHP
|
||||
$pagination = $this->paginator->paginate(
|
||||
$query,
|
||||
$this->upcomingPlacementCollector->collect($teamer),
|
||||
$request->query->getInt('page', 1),
|
||||
10,
|
||||
[
|
||||
'defaultSortFieldName' => 'destination.dateFrom',
|
||||
'defaultSortDirection' => 'asc',
|
||||
]
|
||||
10
|
||||
);
|
||||
|
||||
return $this->render('administrative/teamer/upcoming_assignments.html.twig', [
|
||||
return $this->render('administrative/teamer/upcoming_dispositions.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'pagination' => $pagination,
|
||||
]);
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Api\Assignment;
|
||||
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\Disposition;
|
||||
use App\Entity\Upload;
|
||||
use App\Enum\PlaceStatus;
|
||||
use App\Model\AssignmentExportQueryDto;
|
||||
use App\Repository\AssignmentRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The assignments feed n8n reads: one row per place of the houses' guide, course and service-team
|
||||
* assignments overlapping a date range. A row is a place, not a person - re-staffing a place
|
||||
* changes the person on the same platz_id, and an open place has person_id null. A called-off
|
||||
* assignment is left out entirely, as is a place the office struck.
|
||||
*
|
||||
* The field names are the consumer's (German), the n8n workflow is built on them; the path and the
|
||||
* query parameters follow the app's English URL vocabulary, and errors are English, like every
|
||||
* response of the api firewall.
|
||||
*/
|
||||
class ListController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param list<string> $houseCodes
|
||||
* @param list<int> $jobProfileIds
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly AssignmentRepository $assignmentRepository,
|
||||
private readonly array $houseCodes,
|
||||
private readonly array $jobProfileIds,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/api/assignments', name: 'app_api_assignment_list', methods: ['GET'])]
|
||||
#[IsGranted('ROLE_API_ASSIGNMENTS')]
|
||||
public function index(
|
||||
#[MapQueryString(validationFailedStatusCode: Response::HTTP_BAD_REQUEST)]
|
||||
// Deliberately without a default: the resolver would hand that over unvalidated for a
|
||||
// request without any query string, instead of the 400 naming from and to.
|
||||
AssignmentExportQueryDto $query,
|
||||
): JsonResponse {
|
||||
$rows = [];
|
||||
|
||||
$assignments = $this->assignmentRepository->findForExport(
|
||||
$query->getFromDate(),
|
||||
$query->getToDate(),
|
||||
$this->houseCodes,
|
||||
$this->jobProfileIds,
|
||||
);
|
||||
|
||||
foreach ($assignments as $assignment) {
|
||||
foreach ($assignment->getPlaces() as $slot => $disposition) {
|
||||
$rows[] = $this->row($assignment, $slot, $disposition);
|
||||
}
|
||||
}
|
||||
|
||||
// the range and the count, never the rows - they name people
|
||||
$this->logger->info('Assignments exported', [
|
||||
'from' => $query->from,
|
||||
'to' => $query->to,
|
||||
'assignments' => count($assignments),
|
||||
'places' => count($rows),
|
||||
]);
|
||||
|
||||
return new JsonResponse($rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function row(Assignment $assignment, int $slot, ?Disposition $disposition): array
|
||||
{
|
||||
$destination = $assignment->getDestination();
|
||||
$jobProfile = $assignment->getJobProfile();
|
||||
$teamer = $disposition?->getTeamer();
|
||||
$code = (string) $destination->getCode();
|
||||
|
||||
return [
|
||||
'platz_id' => sprintf('%d-%d', $assignment->getId(), $slot),
|
||||
'einsatz_id' => $assignment->getId(),
|
||||
'person_id' => $teamer?->getId(),
|
||||
'vorname' => $teamer?->getFirstName(),
|
||||
'nachname' => $teamer?->getLastName(),
|
||||
'haus' => substr((string) $destination->getHotelCode(), 0, 3),
|
||||
'von' => $destination->getDateFrom()->format('Y-m-d'),
|
||||
'bis' => $destination->getDateTo()->format('Y-m-d'),
|
||||
'jobprofil_id' => $jobProfile->getId(),
|
||||
'jobprofil' => $jobProfile->getName(),
|
||||
'status' => PlaceStatus::fromDisposition($disposition)->value,
|
||||
'unter_26' => $this->isUnder26($disposition, $assignment),
|
||||
'vertrag_liegt_vor' => $this->hasCheckedContract($disposition),
|
||||
// Older codes carry a slash ("DPWBSP/030229"), current ones do not.
|
||||
'reise_code' => '' === $code ? null : str_replace('/', '', $code),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Under 26 on the first day of the assignment.
|
||||
*/
|
||||
private function isUnder26(?Disposition $disposition, Assignment $assignment): ?bool
|
||||
{
|
||||
if (null === $dateOfBirth = $disposition?->getTeamer()?->getDateOfBirth()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $dateOfBirth->modify('+26 years') > $assignment->getDestination()->getDateFrom();
|
||||
}
|
||||
|
||||
/**
|
||||
* Only once the office has checked it - an uploaded contract alone does not count. Null where
|
||||
* there is no contract to have: an open place, or an assignment that skips the formalities.
|
||||
*/
|
||||
private function hasCheckedContract(?Disposition $disposition): ?bool
|
||||
{
|
||||
if (null === $disposition || true === $disposition->isSkipFormalities()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return true === $disposition->getDocumentByType(Upload::TYPE_CONTRACT)?->isConfirmed();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Common;
|
||||
|
||||
use App\Controller\Traits\ReturnUrlTrait;
|
||||
use App\Form\QuestionnaireResponseFilterType;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use App\Service\Common\QuestionnaireResponseFilterHandler;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* One filter for both questionnaire lists; it returns to the list it was opened from.
|
||||
*/
|
||||
class QuestionnaireResponseFilterController extends AbstractController
|
||||
{
|
||||
use ReturnUrlTrait;
|
||||
|
||||
public function __construct(private readonly QuestionnaireResponseFilterHandler $filterHandler)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/common/questionnaire-response/filter', name: 'app_common_questionnaire_response_filter')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$formData = $this->filterHandler->getFilterSettings();
|
||||
$form = $this->createForm(QuestionnaireResponseFilterType::class, $formData);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->filterHandler->handleRequest($form);
|
||||
|
||||
return new HxRedirectResponse($this->getReturnUrl($request, 'app_administrative_questionnaire_index'));
|
||||
}
|
||||
|
||||
return $this->render('common/modal_questionnaire_response_filter.html.twig', [
|
||||
'filterForm' => $form->createView(),
|
||||
'filterDto' => $form->getData(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/common/questionnaire-response/filter/reset', name: 'app_common_questionnaire_response_filter_reset')]
|
||||
#[IsGranted('ROLE_ADMINISTRATIVE')]
|
||||
public function reset(Request $request): Response
|
||||
{
|
||||
$this->filterHandler->resetFilterSettings();
|
||||
|
||||
return $this->redirect($this->getReturnUrl($request, 'app_administrative_questionnaire_index'));
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,8 @@ class TimelineFilterController extends AbstractController
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$formData = $this->filterHandler->getFilterSettings();
|
||||
if ($this->isGranted('ROLE_HOUSE_MANAGER')) {
|
||||
// a house manager without a staff role sees only their own houses, see TimelineController
|
||||
if ($this->isGranted('ROLE_HOUSE_MANAGER') && false === $this->isGranted('ROLE_ADMINISTRATIVE')) {
|
||||
$formData->setHotels([]);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
namespace App\Controller\HouseManager\Feedback;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\Destination;
|
||||
use App\Entity\User;
|
||||
use App\Repository\DestinationRepository;
|
||||
use App\Repository\DispositionRepository;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -11,12 +14,21 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The house manager's ended travels with something still to do, one row per travel: the
|
||||
* questionnaire about it (from the go-live on), and the ratings of its teamers, each linked.
|
||||
*/
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
private readonly \DateTimeImmutable $goLive;
|
||||
|
||||
public function __construct(
|
||||
private readonly DestinationRepository $destinationRepository,
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
string $houseManagerQuestionnaireGoLive,
|
||||
) {
|
||||
$this->goLive = QuestionnaireCatalog::parseGoLive($houseManagerQuestionnaireGoLive);
|
||||
}
|
||||
|
||||
#[Route('/house-manager/pending-feedback', name: 'app_house_manager_feedback_index')]
|
||||
@@ -26,23 +38,22 @@ class IndexController extends AbstractController
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
|
||||
$query = $this
|
||||
->dispositionRepository
|
||||
->getDispositionsWithPendingFeedbackQuery($user->getHotelCodes())
|
||||
;
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
$query,
|
||||
$this->destinationRepository->getPendingForHouseManagerQuery($user->getHotelCodes(), $this->goLive, new \DateTimeImmutable('today'), $user->getTeamer()),
|
||||
$request->query->getInt('page', 1),
|
||||
$request->query->getInt('limit', 50),
|
||||
[
|
||||
'defaultSortFieldName' => 'destination.dateFrom',
|
||||
'defaultSortFieldName' => 'destination.dateTo',
|
||||
'defaultSortDirection' => 'asc',
|
||||
]
|
||||
);
|
||||
|
||||
$destinations = array_map(static fn (array $row): Destination => $row[0], iterator_to_array($pagination));
|
||||
|
||||
return $this->render('house_manager/feedback/index.html.twig', [
|
||||
'pagination' => $pagination,
|
||||
'placements' => $this->dispositionRepository->findForHouseManagerByDestinations($destinations),
|
||||
'goLive' => $this->goLive,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Controller\HouseManager;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\User;
|
||||
use App\Repository\DestinationRepository;
|
||||
use App\Repository\DispositionRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -11,8 +13,14 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly DispositionRepository $dispositionRepository)
|
||||
{
|
||||
private readonly \DateTimeImmutable $goLive;
|
||||
|
||||
public function __construct(
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly DestinationRepository $destinationRepository,
|
||||
string $houseManagerQuestionnaireGoLive,
|
||||
) {
|
||||
$this->goLive = QuestionnaireCatalog::parseGoLive($houseManagerQuestionnaireGoLive);
|
||||
}
|
||||
|
||||
#[Route('/house-manager', name: 'app_house_manager_index')]
|
||||
@@ -27,14 +35,16 @@ class IndexController extends AbstractController
|
||||
->findNewDispositionsByHotelCodes($user->getHotelCodes())
|
||||
;
|
||||
|
||||
$pendingFeedbacks = $this
|
||||
->dispositionRepository
|
||||
->findDispositionsWithPendingFeedbackByHotelCodes($user->getHotelCodes())
|
||||
$pendingTravels = $this
|
||||
->destinationRepository
|
||||
->getPendingForHouseManagerQuery($user->getHotelCodes(), $this->goLive, new \DateTimeImmutable('today'), $user->getTeamer())
|
||||
->getResult()
|
||||
;
|
||||
|
||||
return $this->render('house_manager/index.html.twig', [
|
||||
'newDispositions' => $newDispositions,
|
||||
'pendingFeedbacks' => $pendingFeedbacks,
|
||||
'pendingTravels' => $pendingTravels,
|
||||
'goLive' => $this->goLive,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\HouseManager\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\Destination;
|
||||
use App\Entity\User;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Repository\QuestionnaireResponseRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Routing\Requirement\Requirement;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The submitted questionnaire about a travel, read-only, for the house's managers; below it the
|
||||
* travel's teamers and their ratings, as on the form. Until it is submitted, the form is shown.
|
||||
*/
|
||||
class DetailController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
private readonly QuestionnaireResponseRepository $responseRepository,
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/house-manager/questionnaire/{id}/answers', name: 'app_house_manager_questionnaire_detail', requirements: ['id' => Requirement::DIGITS])]
|
||||
#[IsGranted('QUESTIONNAIRE', subject: 'destination')]
|
||||
public function index(Destination $destination): Response
|
||||
{
|
||||
$response = $this->responseRepository->findForDestination($destination);
|
||||
|
||||
if (true !== $response?->isSubmitted()) {
|
||||
return $this->redirectToRoute('app_house_manager_questionnaire_edit', ['id' => $destination->getId()]);
|
||||
}
|
||||
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
|
||||
return $this->render('house_manager/questionnaire/detail.html.twig', [
|
||||
'destination' => $destination,
|
||||
'dispositions' => $this->dispositionRepository->findForHouseManagerQuestionnaire($destination, $user->getTeamer()),
|
||||
'definition' => $this->catalog->get($response->getQuestionnaire(), $response->getVersion()),
|
||||
'response' => $response,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\HouseManager\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\Destination;
|
||||
use App\Entity\QuestionnaireResponse;
|
||||
use App\Entity\User;
|
||||
use App\Form\QuestionnaireType;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Repository\QuestionnaireResponseRepository;
|
||||
use App\Service\Questionnaire\DestinationContext;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Routing\Requirement\Requirement;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The house manager's questionnaire about a travel, one per travel whoever of the house's managers
|
||||
* fills it in. Saved as a draft until submitted; submitted answers are final and only shown
|
||||
* read-only (DetailController). Below the form, the travel's teamers link to the existing rating
|
||||
* form ("Bewerte dein Wochenteam"), independent of the questionnaire.
|
||||
*/
|
||||
class EditController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
private readonly QuestionnaireResponseRepository $responseRepository,
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/house-manager/questionnaire/{id}', name: 'app_house_manager_questionnaire_edit', requirements: ['id' => Requirement::DIGITS])]
|
||||
#[IsGranted('QUESTIONNAIRE', subject: 'destination')]
|
||||
public function index(Destination $destination, Request $request): Response
|
||||
{
|
||||
$response = $this->responseRepository->findForDestination($destination);
|
||||
|
||||
if (true === $response?->isSubmitted()) {
|
||||
return $this->redirectToRoute('app_house_manager_questionnaire_detail', ['id' => $destination->getId()]);
|
||||
}
|
||||
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$definition = $this->catalog->get(QuestionnaireCatalog::HOUSE_MANAGER_FEEDBACK);
|
||||
$dispositions = $this->dispositionRepository->findForHouseManagerQuestionnaire($destination, $user->getTeamer());
|
||||
|
||||
$form = $this->createForm(QuestionnaireType::class, [
|
||||
$definition->key => $response?->getAnswers() ?? DestinationContext::initialAnswers($destination),
|
||||
], [
|
||||
'definitions' => [$definition],
|
||||
'travel' => DestinationContext::travel($destination, $dispositions),
|
||||
]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$answers = $form->getData()[$definition->key];
|
||||
$context = DestinationContext::build($destination, $dispositions);
|
||||
$final = QuestionnaireType::isFinal($form);
|
||||
|
||||
if (null === $response) {
|
||||
$response = QuestionnaireResponse::forDestination($definition, $destination);
|
||||
$this->entityManager->persist($response);
|
||||
}
|
||||
|
||||
if (true === $final) {
|
||||
$response->submit($definition, $answers, $context, new \DateTimeImmutable());
|
||||
} else {
|
||||
$response->saveDraft($answers, $context);
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info($final ? 'Submit house manager questionnaire' : 'Save house manager questionnaire draft', [
|
||||
'questionnaire' => $response->getQuestionnaire(),
|
||||
'questionnaire_response_id' => $response->getId(),
|
||||
'destination_id' => $destination->getId(),
|
||||
]);
|
||||
|
||||
if (true === $final) {
|
||||
$this->addFlash('success', 'Danke! Dein Fragebogen wurde abgeschickt.');
|
||||
|
||||
return $this->redirectToRoute('app_house_manager_questionnaire_detail', ['id' => $destination->getId()]);
|
||||
}
|
||||
|
||||
$this->addFlash('success', 'Dein Entwurf wurde gespeichert.');
|
||||
|
||||
return $this->redirectToRoute('app_house_manager_questionnaire_edit', ['id' => $destination->getId()]);
|
||||
}
|
||||
|
||||
return $this->render('house_manager/questionnaire/edit.html.twig', [
|
||||
'destination' => $destination,
|
||||
'dispositions' => $dispositions,
|
||||
'form' => $form,
|
||||
'lastSaved' => null === $response ? null : $response->getUpdatedAt() ?? $response->getCreatedAt(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,8 @@
|
||||
namespace App\Controller\Teamer\Disposition;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Repository\DispositionRepository;
|
||||
use App\Service\Season\SeasonAssignmentResolver;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -14,7 +15,8 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
class UpcomingController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DispositionRepository $dispositionRepository,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
private readonly SeasonAssignmentResolver $seasonAssignmentResolver,
|
||||
private readonly PaginatorInterface $paginator,
|
||||
) {
|
||||
}
|
||||
@@ -27,24 +29,18 @@ class UpcomingController extends AbstractController
|
||||
$user = $this->getUser();
|
||||
$teamer = $user->getTeamer();
|
||||
|
||||
$query = $this
|
||||
->dispositionRepository
|
||||
->getUpcomingDispositionsByTeamerQuery($teamer)
|
||||
;
|
||||
|
||||
// an array rather than a query: dispositions and season assignments are merged in PHP
|
||||
$pagination = $this->paginator->paginate(
|
||||
$query,
|
||||
$this->upcomingPlacementCollector->collect($teamer),
|
||||
$request->query->getInt('page', 1),
|
||||
9,
|
||||
[
|
||||
'defaultSortFieldName' => 'destination.dateFrom',
|
||||
'defaultSortDirection' => 'asc',
|
||||
]
|
||||
9
|
||||
);
|
||||
|
||||
return $this->render('teamer/disposition/upcoming.html.twig', [
|
||||
'teamer' => $teamer,
|
||||
'pagination' => $pagination,
|
||||
// the season page shows only this one, so only this one is linked
|
||||
'linkedSeasonAssignment' => $this->seasonAssignmentResolver->resolveFor($teamer),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Controller\Teamer;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\Application;
|
||||
use App\Entity\Assignment;
|
||||
use App\Entity\Disposition;
|
||||
use App\Entity\Feedback;
|
||||
use App\Entity\News;
|
||||
use App\Entity\User;
|
||||
use App\Service\Season\SeasonAssignmentResolver;
|
||||
use App\Service\Teamer\UpcomingPlacementCollector;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -16,8 +19,11 @@ use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly UpcomingPlacementCollector $upcomingPlacementCollector,
|
||||
private readonly SeasonAssignmentResolver $seasonAssignmentResolver,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/teamer', name: 'app_teamer_index')]
|
||||
@@ -66,6 +72,18 @@ class IndexController extends AbstractController
|
||||
|
||||
$dispositionDocuments = $this->processDocuments($upcomingDispositions);
|
||||
|
||||
$pendingQuestionnaires = $this
|
||||
->entityManager
|
||||
->getRepository(Disposition::class)
|
||||
->findPendingQuestionnaireByTeamer(
|
||||
$teamer,
|
||||
QuestionnaireCatalog::parseGoLive($this->getParameter('questionnaire_go_live')),
|
||||
)
|
||||
;
|
||||
|
||||
// the list merges in season assignments; the document notices above stay on dispositions
|
||||
$upcomingPlacements = array_slice($this->upcomingPlacementCollector->collect($teamer), 0, 5);
|
||||
|
||||
return $this->render('teamer/index.html.twig', [
|
||||
'news' => $news,
|
||||
'teamer' => $teamer,
|
||||
@@ -73,8 +91,11 @@ class IndexController extends AbstractController
|
||||
'recentFeedback' => $recentFeedback,
|
||||
'pendingApplications' => $pendingApplications,
|
||||
'currentDispositions' => $currentDispositions,
|
||||
'upcomingDispositions' => $upcomingDispositions,
|
||||
'upcomingPlacements' => $upcomingPlacements,
|
||||
// the season page shows only this one, so only this one is linked
|
||||
'linkedSeasonAssignment' => $this->seasonAssignmentResolver->resolveFor($teamer),
|
||||
'dispositionDocuments' => $dispositionDocuments,
|
||||
'pendingQuestionnaires' => $pendingQuestionnaires,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Teamer\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\Disposition;
|
||||
use App\Entity\QuestionnaireResponse;
|
||||
use App\Repository\QuestionnaireResponseRepository;
|
||||
use App\Service\Questionnaire\DispositionContext;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The teamer's own submitted questionnaires for a placement, read-only - the bus feedback once per
|
||||
* escorted leg - each rendered with the definition version it was submitted under.
|
||||
*/
|
||||
class DetailController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
private readonly QuestionnaireResponseRepository $responseRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/teamer/questionnaire/{uuid}/detail', name: 'app_teamer_questionnaire_detail')]
|
||||
#[IsGranted('ROLE_TEAMER')]
|
||||
#[IsGranted('QUESTIONNAIRE', subject: 'disposition')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
Disposition $disposition,
|
||||
): Response {
|
||||
$submitted = [];
|
||||
$open = false;
|
||||
$responses = $this->responseRepository->findByDisposition($disposition);
|
||||
|
||||
// what applies now, plus anything submitted under an earlier state of the assignment
|
||||
$keys = array_unique([...DispositionContext::questionnaires($disposition->getAssignment()), ...array_keys($responses)]);
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$done = array_filter($responses[$key] ?? [], static fn (QuestionnaireResponse $response): bool => $response->isSubmitted());
|
||||
|
||||
foreach ($done as $response) {
|
||||
$submitted[] = [
|
||||
'definition' => $this->catalog->get($key, $response->getVersion()),
|
||||
'response' => $response,
|
||||
];
|
||||
}
|
||||
|
||||
$open = $open || [] === $done;
|
||||
}
|
||||
|
||||
if ([] === $submitted) {
|
||||
return $this->redirectToRoute('app_teamer_questionnaire_edit', ['uuid' => $disposition->getUuid()]);
|
||||
}
|
||||
|
||||
return $this->render('teamer/questionnaire/detail.html.twig', [
|
||||
'disposition' => $disposition,
|
||||
'submitted' => $submitted,
|
||||
'open' => $open,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Teamer\Questionnaire;
|
||||
|
||||
use App\Config\QuestionnaireCatalog;
|
||||
use App\Entity\Disposition;
|
||||
use App\Entity\QuestionnaireResponse;
|
||||
use App\Form\QuestionnaireType;
|
||||
use App\Repository\QuestionnaireResponseRepository;
|
||||
use App\Service\Questionnaire\DispositionContext;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
/**
|
||||
* The teamer's questionnaires after a placement on one page: the teamer feedback, and after a bus
|
||||
* escort the bus feedback too, once per ride the teamer escorted. Saved as drafts until submitted;
|
||||
* one submit submits all of them, each questionnaire and leg as a response of its own. Submitted ones are final and only shown read-only
|
||||
* (DetailController).
|
||||
*
|
||||
* Only the questionnaires not yet submitted are offered, so one that applies later - an escort
|
||||
* added after the teamer submitted - can still be filled in.
|
||||
*/
|
||||
class EditController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly QuestionnaireCatalog $catalog,
|
||||
private readonly QuestionnaireResponseRepository $responseRepository,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
#[Route('/teamer/questionnaire/{uuid}', name: 'app_teamer_questionnaire_edit')]
|
||||
#[IsGranted('ROLE_TEAMER')]
|
||||
#[IsGranted('QUESTIONNAIRE', subject: 'disposition')]
|
||||
public function index(
|
||||
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
||||
Disposition $disposition,
|
||||
Request $request,
|
||||
): Response {
|
||||
$responses = $this->responseRepository->findByDisposition($disposition);
|
||||
$definitions = [];
|
||||
|
||||
foreach (DispositionContext::questionnaires($disposition->getAssignment()) as $key) {
|
||||
if ([] === array_filter($responses[$key] ?? [], static fn (QuestionnaireResponse $response): bool => $response->isSubmitted())) {
|
||||
$definitions[] = $this->catalog->get($key);
|
||||
}
|
||||
}
|
||||
|
||||
if ([] === $definitions) {
|
||||
return $this->redirectToRoute('app_teamer_questionnaire_detail', ['uuid' => $disposition->getUuid()]);
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($definitions as $definition) {
|
||||
$stored = $responses[$definition->key] ?? [];
|
||||
|
||||
$data[$definition->key] = $definition->perBusLeg
|
||||
? QuestionnaireType::legData(array_column(array_map(
|
||||
static fn (QuestionnaireResponse $response): array => [$response->getLeg()->value, $response->getAnswers()],
|
||||
$stored,
|
||||
), 1, 0))
|
||||
: ($stored[0] ?? null)?->getAnswers() ?? [];
|
||||
}
|
||||
|
||||
$form = $this->createForm(QuestionnaireType::class, $data, ['definitions' => $definitions]);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$context = DispositionContext::build($disposition);
|
||||
$final = QuestionnaireType::isFinal($form);
|
||||
$saved = [];
|
||||
|
||||
foreach (QuestionnaireType::answerSets($form->getData(), $definitions) as ['definition' => $definition, 'leg' => $leg, 'answers' => $answers]) {
|
||||
$response = array_find(
|
||||
$responses[$definition->key] ?? [],
|
||||
static fn (QuestionnaireResponse $response): bool => $response->getLeg() === $leg,
|
||||
);
|
||||
|
||||
if (null === $response) {
|
||||
$response = QuestionnaireResponse::forDisposition($definition, $disposition, $leg);
|
||||
$this->entityManager->persist($response);
|
||||
}
|
||||
|
||||
if (true === $final) {
|
||||
$response->submit($definition, $answers, $context, new \DateTimeImmutable());
|
||||
} else {
|
||||
$response->saveDraft($answers, $context);
|
||||
}
|
||||
|
||||
$saved[] = $response;
|
||||
}
|
||||
|
||||
// the draft of a bus leg the teamer no longer says they escorted; never submitted, so
|
||||
// nothing refers to it
|
||||
$dropped = [];
|
||||
|
||||
foreach ($definitions as $definition) {
|
||||
foreach ($responses[$definition->key] ?? [] as $response) {
|
||||
if (!in_array($response, $saved, true)) {
|
||||
$this->entityManager->remove($response);
|
||||
$dropped[] = $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
foreach ($saved as $response) {
|
||||
$this->logger->info($final ? 'Submit questionnaire' : 'Save questionnaire draft', [
|
||||
'questionnaire' => $response->getQuestionnaire(),
|
||||
'leg' => $response->getLeg()?->value,
|
||||
'questionnaire_response_id' => $response->getId(),
|
||||
'disposition_id' => $disposition->getId(),
|
||||
'teamer_id' => $disposition->getTeamer()->getId(),
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($dropped as $response) {
|
||||
$this->logger->info('Remove questionnaire draft of a bus leg no longer chosen', [
|
||||
'questionnaire' => $response->getQuestionnaire(),
|
||||
'leg' => $response->getLeg()?->value,
|
||||
'disposition_id' => $disposition->getId(),
|
||||
'teamer_id' => $disposition->getTeamer()->getId(),
|
||||
]);
|
||||
}
|
||||
|
||||
if (true === $final) {
|
||||
$this->addFlash('success', 'Danke! Dein Fragebogen wurde abgeschickt.');
|
||||
|
||||
return $this->redirectToRoute('app_teamer_questionnaire_detail', ['uuid' => $disposition->getUuid()]);
|
||||
}
|
||||
|
||||
$this->addFlash('success', 'Dein Entwurf wurde gespeichert.');
|
||||
|
||||
return $this->redirectToRoute('app_teamer_questionnaire_edit', ['uuid' => $disposition->getUuid()]);
|
||||
}
|
||||
|
||||
$drafts = array_filter(array_merge(...array_values($responses)), static fn (QuestionnaireResponse $response): bool => !$response->isSubmitted());
|
||||
|
||||
return $this->render('teamer/questionnaire/edit.html.twig', [
|
||||
'disposition' => $disposition,
|
||||
'form' => $form,
|
||||
'lastSaved' => [] === $drafts ? null : max(array_map(
|
||||
static fn (QuestionnaireResponse $response): \DateTimeInterface => $response->getUpdatedAt() ?? $response->getCreatedAt(),
|
||||
$drafts,
|
||||
)),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,9 @@ use Psr\Log\LoggerInterface;
|
||||
* is called inside the visitor's own form submission on another website. A delivery
|
||||
* confirmation would need machinery nothing else here has.
|
||||
*
|
||||
* Goes over MAILER_DSN like every transactional mail; MAILING_MAILER_DSN is for the bulk teamer
|
||||
* mailing only.
|
||||
* Goes over MAILER_DSN like every transactional mail; MAILING_MAILER_DSN is for mail sent in
|
||||
* volume, the teamer mailing and the cron reminders (Mailer::MAILJET_TRANSPORT). Production
|
||||
* points both at Mailjet.
|
||||
*/
|
||||
class ApplicationFormSubmissionMailer
|
||||
{
|
||||
|
||||
+36
-1
@@ -14,6 +14,17 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class Mailer
|
||||
{
|
||||
/**
|
||||
* The mailer transport for mail sent in volume - the teamer mailing and the nightly cron
|
||||
* reminders: Mailjet (MAILING_MAILER_DSN, mailer.yaml). Pass it as the 'transport' option;
|
||||
* every other mail goes over MAILER_DSN.
|
||||
*
|
||||
* Production points both DSNs at the same Mailjet account, so today the split changes
|
||||
* nothing there. It keeps the volume mail on Mailjet should the low-volume mail ever move to
|
||||
* another SMTP server.
|
||||
*/
|
||||
public const string MAILJET_TRANSPORT = 'mailing';
|
||||
|
||||
public function __construct(
|
||||
private readonly MailerInterface $mailer,
|
||||
private readonly BodyRendererInterface $bodyRenderer,
|
||||
@@ -75,10 +86,29 @@ class Mailer
|
||||
$email->getHeaders()->addTextHeader('X-Transport', $config['transport']);
|
||||
}
|
||||
|
||||
// No mail is tracked, whatever the Mailjet account is set to: no open pixel, no links
|
||||
// rewritten through Mailjet's redirect domain - staff mail is not a campaign. On every mail,
|
||||
// not just the volume transport, because production sends all of it over Mailjet; another
|
||||
// SMTP server would merely pass the headers on. They only work over SMTP (mailjet+smtp, the
|
||||
// DSN we use) - the Send API refuses them - and Symfony's SMTP transport leaves them alone.
|
||||
$email->getHeaders()
|
||||
->addTextHeader('X-Mailjet-TrackOpen', '0')
|
||||
->addTextHeader('X-Mailjet-TrackClick', '0')
|
||||
;
|
||||
|
||||
if (null !== $config['bus_transport']) {
|
||||
$email->getHeaders()->addTextHeader('X-Bus-Transport', $config['bus_transport']);
|
||||
}
|
||||
|
||||
if (null !== $config['reply_to']) {
|
||||
$email->replyTo($config['reply_to']);
|
||||
}
|
||||
|
||||
// on every mail of a multi-recipient 'to', like the rest of the mail
|
||||
if ([] !== $config['cc']) {
|
||||
$email->cc(...$config['cc']);
|
||||
}
|
||||
|
||||
foreach ($config['attachments'] as $attachment) {
|
||||
/* @var EmailAttachmentInterface $attachment */
|
||||
$attachment->attachTo($email);
|
||||
@@ -92,13 +122,14 @@ class Mailer
|
||||
public function send(TemplatedEmail $email): void
|
||||
{
|
||||
$recipients = array_map(fn (Address $address) => $address->toString(), $email->getTo());
|
||||
$cc = array_map(fn (Address $address) => $address->toString(), $email->getCc());
|
||||
|
||||
try {
|
||||
$this->mailer->send($email);
|
||||
$this->logger->info('Send email', [
|
||||
'to' => $recipients,
|
||||
'subject' => $email->getSubject(),
|
||||
]);
|
||||
] + ([] !== $cc ? ['cc' => $cc] : []));
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$this->logger->error('Email could not be sent', [
|
||||
'to' => $recipients,
|
||||
@@ -120,6 +151,8 @@ class Mailer
|
||||
'attachments' => [],
|
||||
'transport' => null,
|
||||
'bus_transport' => null,
|
||||
'reply_to' => null,
|
||||
'cc' => [],
|
||||
])
|
||||
->setRequired([
|
||||
'template',
|
||||
@@ -132,6 +165,8 @@ class Mailer
|
||||
->setAllowedTypes('attachments', 'array')
|
||||
->setAllowedTypes('transport', ['null', 'string'])
|
||||
->setAllowedTypes('bus_transport', ['null', 'string'])
|
||||
->setAllowedTypes('reply_to', ['null', 'string'])
|
||||
->setAllowedTypes('cc', 'string[]')
|
||||
;
|
||||
|
||||
return $resolver->resolve($options);
|
||||
|
||||
@@ -256,13 +256,22 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the teamer escorts the bus: the "Busbegleitung ab" pickup is set. 0 is stored for
|
||||
* "Keine Busbegleitung" as well as null, so this is not a plain null check.
|
||||
*/
|
||||
public function hasBusEscort(): bool
|
||||
{
|
||||
return 0 !== (int) $this->pickup;
|
||||
}
|
||||
|
||||
public function getEffectivePickupDate(): ?\DateTimeImmutable
|
||||
{
|
||||
if (null !== $this->pickupDate) {
|
||||
return $this->pickupDate;
|
||||
}
|
||||
|
||||
if (0 !== (int) $this->pickup && null !== $destination = $this->getDestination()) {
|
||||
if ($this->hasBusEscort() && null !== $destination = $this->getDestination()) {
|
||||
return $destination
|
||||
->getDateFrom()
|
||||
->modify('-1 day')
|
||||
@@ -472,6 +481,78 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The lowest place number no active placement holds - the one a new placement takes.
|
||||
*/
|
||||
public function getNextFreeSlot(): int
|
||||
{
|
||||
return $this->nextFreeSlotIn(array_flip($this->getHeldSlots()));
|
||||
}
|
||||
|
||||
/**
|
||||
* The places the n8n feed reports, as place number => the active placement filling it, or
|
||||
* null for an open place. A place is a row there, not a person, so a called-off teamer's place
|
||||
* is open again under the same number rather than gone.
|
||||
*
|
||||
* Every held place is listed, topped up with the lowest free numbers to availableDispositions.
|
||||
* Lowering the count while a high number is still held therefore drops an open low number, not
|
||||
* the held one; a held place beyond the count is still listed, it has a person on it.
|
||||
*
|
||||
* @return array<int, Disposition|null>
|
||||
*/
|
||||
public function getPlaces(): array
|
||||
{
|
||||
$places = [];
|
||||
$unnumbered = [];
|
||||
|
||||
foreach ($this->getActiveDispositions() as $disposition) {
|
||||
if (null === $slot = $disposition->getSlot()) {
|
||||
$unnumbered[] = $disposition;
|
||||
} else {
|
||||
$places[$slot] = $disposition;
|
||||
}
|
||||
}
|
||||
|
||||
// Without a number only when created outside DisposeController; such a placement takes
|
||||
// the next free number after the numbered ones, so that nobody drops out of the feed.
|
||||
foreach ($unnumbered as $disposition) {
|
||||
$places[$this->nextFreeSlotIn($places)] = $disposition;
|
||||
}
|
||||
|
||||
while (count($places) < (int) $this->availableDispositions) {
|
||||
$places[$this->nextFreeSlotIn($places)] = null;
|
||||
}
|
||||
|
||||
ksort($places);
|
||||
|
||||
return $places;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<int>
|
||||
*/
|
||||
private function getHeldSlots(): array
|
||||
{
|
||||
return array_values(array_filter(
|
||||
$this->getActiveDispositions()->map(fn (Disposition $disposition) => $disposition->getSlot())->toArray(),
|
||||
fn (?int $slot) => null !== $slot,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, mixed> $places
|
||||
*/
|
||||
private function nextFreeSlotIn(array $places): int
|
||||
{
|
||||
$slot = 1;
|
||||
|
||||
while (array_key_exists($slot, $places)) {
|
||||
++$slot;
|
||||
}
|
||||
|
||||
return $slot;
|
||||
}
|
||||
|
||||
public function getConfirmedDispositions(): Collection
|
||||
{
|
||||
return $this->dispositions->filter(function (Disposition $disposition) {
|
||||
|
||||
@@ -80,6 +80,16 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
|
||||
private bool $feedbackWaived = false;
|
||||
|
||||
/**
|
||||
* The numbered place on the assignment this placement fills - the n8n feed's "platz_id" is
|
||||
* "<assignment id>-<slot>", and n8n hangs the Wechselpass off it. Taken once, here at creation,
|
||||
* and never renumbered: a replacement takes the number the called-off teamer freed, whoever
|
||||
* stays keeps theirs. A called-off placement keeps its number for the record but no longer
|
||||
* holds it (Assignment::getPlaces()).
|
||||
*/
|
||||
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
|
||||
private ?int $slot = null;
|
||||
|
||||
public function __construct(Application $application)
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
@@ -89,6 +99,7 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
? static::STATUS_CONFIRMED
|
||||
: static::STATUS_NEW;
|
||||
$this->assignment = $application->getAssignment();
|
||||
$this->slot = $this->assignment?->getNextFreeSlot();
|
||||
$this->teamer = $application->getTeamer();
|
||||
$this->pickup = $application->getPickup();
|
||||
$this->specialAgreements = $application->getRequests();
|
||||
@@ -373,4 +384,16 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSlot(): ?int
|
||||
{
|
||||
return $this->slot;
|
||||
}
|
||||
|
||||
public function setSlot(?int $slot): static
|
||||
{
|
||||
$this->slot = $slot;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,10 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
||||
|
||||
public function getCategoryLabel(): ?string
|
||||
{
|
||||
if (null === $this->category) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return self::getCategories()[$this->category] ?? null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Traits\BlameableEntity;
|
||||
use App\Entity\Traits\SoftDeletableEntity;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Repository\MailingRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
/**
|
||||
* The record of one assignment mailing as it was sent: wording after any change made for it,
|
||||
* the assignments it went to and every file attached. Blameable names the sender, createdAt is
|
||||
* when it was handed to the queue.
|
||||
*
|
||||
* It is also what owns the files added to this one mailing - they belong to no template, and the
|
||||
* worker reads them by path after the request that sent the mailing has long ended.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: MailingRepository::class)]
|
||||
class Mailing implements BlameableEntityInterface, TimestampableEntityInterface, SoftDeletableEntityInterface
|
||||
{
|
||||
use BlameableEntity;
|
||||
use TimestampableEntity;
|
||||
use SoftDeletableEntity;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 36, unique: true)]
|
||||
private string $uuid;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $subject = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $message = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?MailingTemplate $template = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Assignment>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Assignment::class)]
|
||||
#[ORM\JoinTable(name: 'mailing_assignment')]
|
||||
private Collection $assignments;
|
||||
|
||||
/**
|
||||
* The template's files and the ones added to this mailing alike. A template file is shared
|
||||
* with every mailing that sent it, which is why this is not a column on Upload.
|
||||
*
|
||||
* @var Collection<int, Upload>
|
||||
*/
|
||||
#[ORM\ManyToMany(targetEntity: Upload::class)]
|
||||
#[ORM\JoinTable(name: 'mailing_attachment')]
|
||||
private Collection $attachments;
|
||||
|
||||
#[ORM\Column]
|
||||
private int $recipientCount = 0;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
$this->assignments = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUuid(): string
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function getSubject(): ?string
|
||||
{
|
||||
return $this->subject;
|
||||
}
|
||||
|
||||
public function setSubject(?string $subject): static
|
||||
{
|
||||
$this->subject = $subject;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
public function setMessage(?string $message): static
|
||||
{
|
||||
$this->message = $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTemplate(): ?MailingTemplate
|
||||
{
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
public function setTemplate(?MailingTemplate $template): static
|
||||
{
|
||||
$this->template = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Assignment>
|
||||
*/
|
||||
public function getAssignments(): Collection
|
||||
{
|
||||
return $this->assignments;
|
||||
}
|
||||
|
||||
public function addAssignment(Assignment $assignment): static
|
||||
{
|
||||
if (!$this->assignments->contains($assignment)) {
|
||||
$this->assignments->add($assignment);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Upload>
|
||||
*/
|
||||
public function getAttachments(): Collection
|
||||
{
|
||||
return $this->attachments;
|
||||
}
|
||||
|
||||
public function addAttachment(Upload $attachment): static
|
||||
{
|
||||
if (!$this->attachments->contains($attachment)) {
|
||||
$this->attachments->add($attachment);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRecipientCount(): int
|
||||
{
|
||||
return $this->recipientCount;
|
||||
}
|
||||
|
||||
public function setRecipientCount(int $recipientCount): static
|
||||
{
|
||||
$this->recipientCount = $recipientCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Traits\BlameableEntity;
|
||||
use App\Entity\Traits\SoftDeletableEntity;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Repository\MailingTemplateRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* A reusable starting point for an assignment mailing, shared by all managers and admins.
|
||||
*
|
||||
* Picking it fills subject and message of a mailing, which can then be changed for that one
|
||||
* mailing without touching the template. Its attachments always go out with the mailing.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: MailingTemplateRepository::class)]
|
||||
class MailingTemplate implements BlameableEntityInterface, TimestampableEntityInterface, SoftDeletableEntityInterface
|
||||
{
|
||||
use BlameableEntity;
|
||||
use TimestampableEntity;
|
||||
use SoftDeletableEntity;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 36, unique: true)]
|
||||
private string $uuid;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Assert\NotBlank(message: 'Bitte gib einen Namen an')]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Assert\NotBlank(message: 'Bitte gib einen Betreff an')]
|
||||
private ?string $subject = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
#[Assert\NotBlank(message: 'Bitte gib eine Nachricht ein')]
|
||||
private ?string $message = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Upload>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Upload::class, mappedBy: 'mailingTemplate')]
|
||||
#[ORM\OrderBy(['id' => \SortDirection::Ascending])]
|
||||
private Collection $attachments;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
$this->attachments = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->name;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUuid(): string
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(?string $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSubject(): ?string
|
||||
{
|
||||
return $this->subject;
|
||||
}
|
||||
|
||||
public function setSubject(?string $subject): static
|
||||
{
|
||||
$this->subject = $subject;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMessage(): ?string
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
public function setMessage(?string $message): static
|
||||
{
|
||||
$this->message = $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Upload>
|
||||
*/
|
||||
public function getAttachments(): Collection
|
||||
{
|
||||
return $this->attachments;
|
||||
}
|
||||
|
||||
public function addAttachment(Upload $attachment): static
|
||||
{
|
||||
if (!$this->attachments->contains($attachment)) {
|
||||
$this->attachments->add($attachment);
|
||||
$attachment->setMailingTemplate($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeAttachment(Upload $attachment): static
|
||||
{
|
||||
if ($this->attachments->removeElement($attachment) && $attachment->getMailingTemplate() === $this) {
|
||||
$attachment->setMailingTemplate(null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAttachmentSize(): int
|
||||
{
|
||||
return array_sum($this->attachments->map(fn (Upload $upload) => (int) $upload->getSize())->toArray());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Entity\Traits\BlameableEntity;
|
||||
use App\Entity\Traits\TimestampableEntity;
|
||||
use App\Enum\BusLeg;
|
||||
use App\Enum\QuestionnaireResponseStatus;
|
||||
use App\Model\Questionnaire\Definition;
|
||||
use App\Repository\QuestionnaireResponseRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
|
||||
/**
|
||||
* One respondent's answers to one questionnaire (config/questionnaires/), a draft until submitted.
|
||||
*
|
||||
* Answers are keyed by question key and only mean something together with the definition of
|
||||
* $questionnaire in $version. $context holds what the subject already knew - for a disposition,
|
||||
* who, where, when and the escort pickup - so those questions are not asked and the response stays
|
||||
* readable when the assignment is edited later.
|
||||
*
|
||||
* A per-bus-leg questionnaire (Definition::$perBusLeg) has one response per escorted leg, the
|
||||
* others one per disposition.
|
||||
*
|
||||
* Its subject is a Disposition (the teamer's questionnaires) or a Destination (the house manager's,
|
||||
* one per travel), each a nullable foreign key of its own rather than a generic subject column.
|
||||
* Exactly one is set. Each unique key leaves out the rows of the other subject: MariaDB lets the
|
||||
* NULLs repeat.
|
||||
*
|
||||
* Not soft-deletable: nothing in the UI deletes a response, and it goes with its subject.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: QuestionnaireResponseRepository::class)]
|
||||
#[ORM\HasLifecycleCallbacks]
|
||||
#[ORM\UniqueConstraint(name: 'questionnaire_disposition_leg', columns: ['questionnaire', 'disposition_id', 'leg'])]
|
||||
#[ORM\UniqueConstraint(name: 'questionnaire_destination', columns: ['questionnaire', 'destination_id'])]
|
||||
class QuestionnaireResponse implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
{
|
||||
use BlameableEntity;
|
||||
use TimestampableEntity;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: 'string', length: 36, unique: true)]
|
||||
private string $uuid;
|
||||
|
||||
#[ORM\Column(length: 64)]
|
||||
private string $questionnaire;
|
||||
|
||||
#[ORM\Column]
|
||||
private int $version;
|
||||
|
||||
#[ORM\Column(length: 16, enumType: QuestionnaireResponseStatus::class)]
|
||||
private QuestionnaireResponseStatus $status = QuestionnaireResponseStatus::DRAFT;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?\DateTimeImmutable $submittedAt = null;
|
||||
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
#[ORM\Column(type: Types::JSON)]
|
||||
private array $answers = [];
|
||||
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
#[ORM\Column(type: Types::JSON)]
|
||||
private array $context = [];
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(onDelete: 'CASCADE')]
|
||||
private ?Disposition $disposition = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(onDelete: 'CASCADE')]
|
||||
private ?Destination $destination = null;
|
||||
|
||||
/**
|
||||
* A BusLeg value, or '' for a questionnaire without legs rather than null: part of the unique
|
||||
* key, and MariaDB lets NULLs repeat in one.
|
||||
*/
|
||||
#[ORM\Column(length: 16, options: ['default' => ''])]
|
||||
private string $leg = '';
|
||||
|
||||
private function __construct(Definition $definition)
|
||||
{
|
||||
$this->uuid = Uuid::v4();
|
||||
$this->questionnaire = $definition->key;
|
||||
$this->version = $definition->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BusLeg|null $leg required for a per-bus-leg questionnaire, refused for any other
|
||||
*/
|
||||
public static function forDisposition(Definition $definition, Disposition $disposition, ?BusLeg $leg = null): static
|
||||
{
|
||||
if ($definition->perBusLeg !== (null !== $leg)) {
|
||||
throw new \LogicException(sprintf('Questionnaire "%s" %s a bus leg', $definition->key, $definition->perBusLeg ? 'needs' : 'takes no'));
|
||||
}
|
||||
|
||||
$instance = new static($definition);
|
||||
$instance->disposition = $disposition;
|
||||
$instance->leg = $leg->value ?? '';
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public static function forDestination(Definition $definition, Destination $destination): static
|
||||
{
|
||||
if ($definition->perBusLeg) {
|
||||
throw new \LogicException(sprintf('Questionnaire "%s" needs a bus leg, a travel has none', $definition->key));
|
||||
}
|
||||
|
||||
$instance = new static($definition);
|
||||
$instance->destination = $destination;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keeps every answer, including those to questions that are hidden right now: switching an
|
||||
* answer back restores the follow-up already written.
|
||||
*
|
||||
* @param array<string, mixed> $answers
|
||||
* @param array<string, mixed> $context
|
||||
*/
|
||||
public function saveDraft(array $answers, array $context): static
|
||||
{
|
||||
$this->assertDraft();
|
||||
|
||||
$this->answers = $answers;
|
||||
$this->context = $context;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Final. Keeps only the answers to questions that are shown, and records the definition version
|
||||
* they were given under - the draft may have been started under an older one.
|
||||
*
|
||||
* @param array<string, mixed> $answers
|
||||
* @param array<string, mixed> $context
|
||||
*/
|
||||
public function submit(Definition $definition, array $answers, array $context, \DateTimeImmutable $now): static
|
||||
{
|
||||
$this->assertDraft();
|
||||
|
||||
if ($definition->key !== $this->questionnaire) {
|
||||
throw new \LogicException(sprintf('Response to "%s" cannot be submitted with "%s"', $this->questionnaire, $definition->key));
|
||||
}
|
||||
|
||||
$this->answers = $definition->withoutHiddenAnswers($answers);
|
||||
$this->context = $context;
|
||||
$this->version = $definition->version;
|
||||
$this->status = QuestionnaireResponseStatus::SUBMITTED;
|
||||
$this->submittedAt = $now;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isSubmitted(): bool
|
||||
{
|
||||
return QuestionnaireResponseStatus::SUBMITTED === $this->status;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUuid(): string
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function getQuestionnaire(): string
|
||||
{
|
||||
return $this->questionnaire;
|
||||
}
|
||||
|
||||
public function getVersion(): int
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
public function getStatus(): QuestionnaireResponseStatus
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function getSubmittedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->submittedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getAnswers(): array
|
||||
{
|
||||
return $this->answers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getContext(): array
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
public function getDisposition(): ?Disposition
|
||||
{
|
||||
return $this->disposition;
|
||||
}
|
||||
|
||||
public function getDestination(): ?Destination
|
||||
{
|
||||
return $this->destination;
|
||||
}
|
||||
|
||||
public function getLeg(): ?BusLeg
|
||||
{
|
||||
return BusLeg::tryFrom($this->leg);
|
||||
}
|
||||
|
||||
private function assertDraft(): void
|
||||
{
|
||||
if ($this->isSubmitted()) {
|
||||
throw new \LogicException(sprintf('Questionnaire response %s is already submitted', $this->uuid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,6 +208,30 @@ class SeasonAssignment implements BlameableEntityInterface, TimestampableEntityI
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies both deadline overrides of $source onto every other entry that is not ticked off,
|
||||
* empty ones included - an empty override resets the entry to its computed deadline. Entries
|
||||
* already done keep theirs: their deadline is history by then.
|
||||
*
|
||||
* @return int the number of entries changed, $source not counted
|
||||
*/
|
||||
public function applyDeadlinesToOpenTasks(SeasonAssignmentTask $source): int
|
||||
{
|
||||
$count = 0;
|
||||
|
||||
foreach ($this->tasks as $task) {
|
||||
if ($task === $source || $task->isDone()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$task->setDeadlineOverride1($source->getDeadlineOverride1());
|
||||
$task->setDeadlineOverride2($source->getDeadlineOverride2());
|
||||
++$count;
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Upload>
|
||||
*/
|
||||
|
||||
Loaded 100 of 415 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user