diff --git a/assets/controllers/dropdown_controller.js b/assets/controllers/dropdown_controller.js
deleted file mode 100644
index 27071b2..0000000
--- a/assets/controllers/dropdown_controller.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import { Controller } from '@hotwired/stimulus'
-
-/*
- * Pins the hover menu of templates/components/dropdown.html.twig to the viewport while it is open.
- *
- * The menu sits in the last cell of data tables, whose wrapper scrolls horizontally when a table is
- * wider than its column (components/datatable.css). A scrolling box clips everything absolutely
- * positioned inside it, so on the last rows the menu would vanish into a scrollbar. Fixed
- * positioning takes it out of that box; it stays a descendant of the hover group, so the CSS
- * group-hover that shows and hides it keeps working unchanged.
- *
- * Right-aligned to the button like before, and flipped above it when there is no room below.
- */
-export default class extends Controller {
-
- static targets = [ 'button', 'menu' ]
-
- connect () {
- this.boundPosition = this.position.bind(this)
- }
-
- open () {
- this.position()
- window.addEventListener('scroll', this.boundPosition, true)
- window.addEventListener('resize', this.boundPosition)
- }
-
- close () {
- window.removeEventListener('scroll', this.boundPosition, true)
- window.removeEventListener('resize', this.boundPosition)
- }
-
- position () {
- const button = this.buttonTarget.getBoundingClientRect()
- const menu = this.menuTarget
-
- menu.style.position = 'fixed'
- menu.style.left = `${Math.max(0, button.right - menu.offsetWidth)}px`
-
- // the menu's own top padding bridges the gap to the button, so the hover is not lost
- // on the way down; when flipped, it covers the button from below instead
- const fitsBelow = button.top + menu.offsetHeight <= window.innerHeight
- menu.style.top = `${fitsBelow ? button.top : Math.max(0, button.bottom - menu.offsetHeight)}px`
- menu.style.right = 'auto'
- }
-
- disconnect () {
- this.close()
- }
-}
diff --git a/assets/controllers/menu_controller.js b/assets/controllers/menu_controller.js
new file mode 100644
index 0000000..ccade46
--- /dev/null
+++ b/assets/controllers/menu_controller.js
@@ -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])')]
+ }
+}
diff --git a/assets/styles/ep-design.css b/assets/styles/ep-design.css
index 1c8b3a8..cb3964f 100644
--- a/assets/styles/ep-design.css
+++ b/assets/styles/ep-design.css
@@ -144,9 +144,9 @@
@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) */
+ /* 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 shrink-0 items-center justify-center rounded text-muted hover:bg-page hover:text-brand aria-expanded:bg-page aria-expanded:text-brand;
+ @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 {
@@ -154,11 +154,11 @@
}
.menu-item {
- @apply block w-full px-3 py-1.5 text-left text-ink no-underline hover:bg-page hover:text-brand focus:bg-page;
+ @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 text-left text-red-800 hover:bg-page hover:text-red-900 focus:bg-page;
+ @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 {
@@ -273,6 +273,43 @@
@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 last part 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 whitespace-nowrap;
+ }
+
+ .entry-link > :last-child {
+ @apply min-w-0 shrink truncate;
+ }
+
+ .entry-link > .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;
diff --git a/src/Twig/Components/DropDown.php b/src/Twig/Components/DropDown.php
deleted file mode 100644
index 680a77a..0000000
--- a/src/Twig/Components/DropDown.php
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
+
+ class="menu-item"
+ role="menuitem">
Details
löschen
-
+
{% else %}
diff --git a/templates/admin/index.html.twig b/templates/admin/index.html.twig
index 03a8406..d82df29 100644
--- a/templates/admin/index.html.twig
+++ b/templates/admin/index.html.twig
@@ -3,304 +3,112 @@
{% block content %}
-
-
- Neue Bewerbungen
- {% if newApplicationsCount > 0 or pendingApplicationsCount > 0 %}
- {{ newApplicationsCount }} neu, {{ pendingApplicationsCount }} in Bearbeitung
- {% endif %}
-
-
-
+
+ {% for application in applications %}
+ {% set assignment = application.assignment %}
+
+ {% endfor %}
+
-
-
- Neue Einteilungen
-
-
-
+
+ {% for disposition in newDispositions %}
+
+ {% include '_partials/_disposition_data.html.twig' with {disposition: disposition} %}
+
+ {% endfor %}
+
-
-
- Neue Honorarverträge
- {% if newContractsCount > 0 or pendingContractsCount > 0 %}
- {{ newContractsCount }} neu, {{ pendingContractsCount }} in Bearbeitung
- {% endif %}
-
-
-
- {% for document in newContracts %}
- {% set assignment = document.disposition.assignment %}
-
-
- {{ icon('download', 'w-4 h-4 shrink-0') }}
- {{ document.owner.teamer.fullName(true) }}
- {% include '_partials/_dot.html.twig' %}
- {{ assignment.destination.dateFrom|date('d.m.y') }} - {{ assignment.destination.dateTo|date('d.m.y') }}
- {% include '_partials/_dot.html.twig' %}
- {{ assignment.destination.hotel }}
-
-
- {% else %}
-
- -
-
- {% endfor %}
-
-
-
+
+ {% for document in newContracts %}
+ {% set assignment = document.disposition.assignment %}
+
+ {% endfor %}
+
-
-
- Neue Honorarnoten
- {% if newInvoicesCount > 0 or pendingInvoicesCount > 0 %}
- {{ newInvoicesCount }} neu, {{ pendingInvoicesCount }} in Bearbeitung
- {% endif %}
-
-
-
- {% for document in newInvoices %}
- {% set assignment = document.disposition.assignment %}
-
-
- {{ icon('download', 'w-4 h-4 shrink-0') }}
- {{ document.owner.teamer.fullName(true) }}
- {{ assignment.destination.dateFrom|date('d.m.y') }} - {{ assignment.destination.dateTo|date('d.m.y') }}
- {% include '_partials/_dot.html.twig' %}
- {{ assignment.destination.hotel }}
-
-
- {% else %}
-
- -
-
- {% endfor %}
-
-
-
+
+ {% for document in newInvoices %}
+ {% set assignment = document.disposition.assignment %}
+
+ {% endfor %}
+
-
-
- Neue Führerscheine
- {% if newDriverLicensesCount > 0 %}
- {{ newDriverLicensesCount }} neu
- {% endif %}
-
-
-
- {% for document in newDriverLicenses %}
-
-
- {{ icon('download', 'w-4 h-4 shrink-0') }}
- {{ document.owner.teamer.fullName(true) }}
- {% include '_partials/_dot.html.twig' %}
- {{ document.createdAt|date('d.m.y') }}
-
-
- {% else %}
-
- -
-
- {% endfor %}
-
-
-
+
+ {% for document in newDriverLicenses %}
+
+ {% endfor %}
+
-
+
+ {% for assignment in assignments %}
+
+ {% endfor %}
+
-
-
- Neue Verfügbarkeiten
-
-
-
+
+ {% for availability in availabilities %}
+
+ {% endfor %}
+
-
-
- Neue Feedbacks
- {% if pendingFeedbacksCount > 0 %}
- {{ pendingFeedbacksCount }} freizugeben
- {% endif %}
-
-
- {% for feedback in feedbacks %}
-
-
- {{ icon('feedback', 'w-4 h-4 shrink-0') }}
- {{ feedback.teamer }}
- {% if feedback.destinationName %}
- {% include '_partials/_dot.html.twig' %}
- {{ feedback.destinationName }}
- {% endif %}
- {% if feedback.jobProfileName %}
- {% include '_partials/_dot.html.twig' %}
- {{ feedback.jobProfileName }}
- {% endif %}
-
-
- {% else %}
-
- -
-
- {% endfor %}
-
-
+
+ {% for feedback in feedbacks %}
+
+ {% endfor %}
+
{% set overdueFeedbacksCount = overdueFeedbacks|length %}
-
-
- Überfällige Feedbacks
- {% if overdueFeedbacksCount > 0 %}
- {{ overdueFeedbacksCount }} überfällig
- {% endif %}
-
-
-
+
+ {% for disposition in overdueFeedbacks %}
+ {% set assignment = disposition.assignment %}
+
+ {% endfor %}
+
{% set overdueContractsCount = overdueContracts|length %}
-
-
- Überfällige Honorarverträge
- {% if overdueContractsCount > 0 %}
- {{ overdueContractsCount }} überfällig
- {% endif %}
-
-
-
+
+ {% for disposition in overdueContracts %}
+ {% set assignment = disposition.assignment %}
+
+ {% endfor %}
+
{% endblock %}
diff --git a/templates/admin/work_month/index.html.twig b/templates/admin/work_month/index.html.twig
index 5225eaa..4b94ce7 100644
--- a/templates/admin/work_month/index.html.twig
+++ b/templates/admin/work_month/index.html.twig
@@ -89,19 +89,17 @@
{% endif %}
-
+
Nachweis ansehen
{% if workMonth.status.value == 'submitted' %}
@@ -110,24 +108,22 @@
{% endif %}
{% if workMonth.status.value in ['submitted', 'approved'] %}
{% endif %}
-
+
{% else %}
diff --git a/templates/administrative/assignment/detail.html.twig b/templates/administrative/assignment/detail.html.twig
index 4247912..8dde19b 100644
--- a/templates/administrative/assignment/detail.html.twig
+++ b/templates/administrative/assignment/detail.html.twig
@@ -223,11 +223,10 @@
hx-swap="none">
{{ icon('chair', html_classes('w-5 h-5', { 'text-emerald-700': disposition.syncedWithBusProNet, 'text-gray-400': not disposition.syncedWithBusProNet })) }}
-
+
@@ -235,18 +234,16 @@
{% if is_granted('ADMIN_DOCUMENT_UPLOAD', disposition) %}
Honorarvertrag hochladen
@@ -255,9 +252,8 @@
{% endif %}
{% if is_granted('CALL_OFF', disposition) %}
@@ -266,16 +262,15 @@
{% endif %}
{% if is_granted('DELETE', disposition) %}
löschen
{% endif %}
-
+
diff --git a/templates/administrative/assignment/index.html.twig b/templates/administrative/assignment/index.html.twig
index 89e1283..865ba10 100644
--- a/templates/administrative/assignment/index.html.twig
+++ b/templates/administrative/assignment/index.html.twig
@@ -188,11 +188,10 @@
-
+
@@ -200,9 +199,8 @@
{% if is_granted('CALL_OFF', assignment) %}
@@ -210,43 +208,38 @@
{% endif %}
+ class="menu-item"
+ role="menuitem">
duplizieren
{% if is_granted('EDIT', assignment) %}
+ class="menu-item"
+ role="menuitem">
bearbeiten
{% endif %}
{% if is_granted('PUBLISH', assignment) %}
veröffentlichen
{% endif %}
Vorschau Reiseleitungsfeedback
Vorschau Hausleitungsfeedback
-
+
{% else %}
diff --git a/templates/administrative/season_assignment/index.html.twig b/templates/administrative/season_assignment/index.html.twig
index 33fc4d1..c3197c9 100644
--- a/templates/administrative/season_assignment/index.html.twig
+++ b/templates/administrative/season_assignment/index.html.twig
@@ -87,29 +87,26 @@
{{ seasonAssignment.jobProfile.name }}
-
+
+ class="menu-item"
+ role="menuitem">
Details
+ class="menu-item"
+ role="menuitem">
bearbeiten
löschen
-
+
{% if seasonAssignment.deleted %}
gel. am {{ seasonAssignment.deletedAt | date('d.m.Y') }}
diff --git a/templates/administrative/system/destination/index.html.twig b/templates/administrative/system/destination/index.html.twig
index 3f7a05f..48bb4a6 100644
--- a/templates/administrative/system/destination/index.html.twig
+++ b/templates/administrative/system/destination/index.html.twig
@@ -65,29 +65,26 @@
{{ destination.dateTo | date('d.m.Y') }}
-
+
löschen
+ class="menu-item"
+ role="menuitem">
duplizieren
+ class="menu-item"
+ role="menuitem">
bearbeiten
-
+
{% else %}
diff --git a/templates/components/dashboard/entry.html.twig b/templates/components/dashboard/entry.html.twig
new file mode 100644
index 0000000..4e32647
--- /dev/null
+++ b/templates/components/dashboard/entry.html.twig
@@ -0,0 +1,30 @@
+{#-
+ One line of a dashboard:widget. Its text is `parts` (shown with dots between them) or the content
+ block; `icon` in front. With `url` the line is a link, without one but with hx-* attributes a
+ button (opening a modal, say), otherwise plain text.
+-#}
+{% set url = url ?? null %}
+{% set icon = icon ?? null %}
+{% set parts = parts ?? null %}
+{% set is_button = not url and attributes.all|keys|filter(k => k starts with 'hx-')|length > 0 %}
+{% set body %}
+ {% if icon %}{{ include('_partials/_icon.html.twig', {icon: icon, class: 'size-4 text-muted'}) }}{% endif %}
+ {% if parts is not null %}
+ {% for part in parts|filter(p => p is not empty) %}
+ {% if not loop.first %}· {% endif %}
+ {{ part }}
+ {% endfor %}
+ {% else %}
+ {{ block('content') }}
+ {% endif %}
+{% endset %}
+{% set attrs = attributes.defaults({class: 'entry-link'}).without('url', 'icon', 'parts') %}
+
+ {% if url %}
+ {{ body }}
+ {% elseif is_button %}
+ {{ body }}
+ {% else %}
+ {{ body }}
+ {% endif %}
+
diff --git a/templates/components/dashboard/widget.html.twig b/templates/components/dashboard/widget.html.twig
new file mode 100644
index 0000000..233c209
--- /dev/null
+++ b/templates/components/dashboard/widget.html.twig
@@ -0,0 +1,25 @@
+{#-
+ A card of entries, as on a dashboard. `title`; optional `meta` (a short count beside the title,
+ such as "3 neu, 2 in Bearbeitung"), `emptyText` and `scroll` (for work queues that would grow the
+ card without limit); the `actions` block goes to the right of the header, typically "alle anzeigen".
+-#}
+{% set emptyText = emptyText ?? 'Keine Einträge vorhanden.' %}
+{% set meta = meta ?? null %}
+{% set scroll = scroll ?? false %}
+{% set entries %}{% block content %}{% endblock %}{% endset %}
+
+
+
{{ title }}
+
+ {% if meta %}{{ meta }} {% endif %}
+ {% block actions %}{% endblock %}
+
+
+ {% if entries|trim is empty %}
+ {% block empty %}
+ {{ emptyText }}
+ {% endblock %}
+ {% else %}
+
+ {% endif %}
+
diff --git a/templates/components/dropdown.html.twig b/templates/components/dropdown.html.twig
deleted file mode 100644
index 2db447e..0000000
--- a/templates/components/dropdown.html.twig
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- Funktionen
- {{ icon('dots', 'w-6 h-6') }}
-
-
-
diff --git a/templates/components/menu.html.twig b/templates/components/menu.html.twig
new file mode 100644
index 0000000..0efb4ff
--- /dev/null
+++ b/templates/components/menu.html.twig
@@ -0,0 +1,13 @@
+{#-
+ A "⋯" menu (menu_controller.js), opened by click or tap, never by hover. The items go in the
+ content block: links or buttons with the class `menu-item` (or `menu-item-danger`) and
+ role="menuitem". Choosing one closes the menu.
+-#}
+{% set label = label ?? 'Aktionen' %}
+
+ ⋯
+
+
diff --git a/templates/manager/index.html.twig b/templates/manager/index.html.twig
index f4ef7de..61a5eff 100644
--- a/templates/manager/index.html.twig
+++ b/templates/manager/index.html.twig
@@ -2,126 +2,50 @@
{% block content %}
-
-
- Neue Honorarverträge
- {% if newContractsCount > 0 or pendingContractsCount > 0 %}
- {{ newContractsCount }} neu, {{ pendingContractsCount }} in Bearbeitung
- {% endif %}
-
-
-
- {% for document in newContracts %}
- {% set assignment = document.disposition.assignment %}
-
-
- {{ icon('download', 'w-4 h-4 shrink-0') }}
- {{ document.owner.teamer.fullName(true) }}
- {% include '_partials/_dot.html.twig' %}
- {{ assignment.destination.dateFrom|date('d.m.y') }} - {{ assignment.destination.dateTo|date('d.m.y') }}
- {% include '_partials/_dot.html.twig' %}
- {{ assignment.destination.hotel }}
-
-
- {% else %}
-
- -
-
- {% endfor %}
-
-
-
-
-
- Neue Honorarnoten
- {% if newInvoicesCount > 0 or pendingInvoicesCount > 0 %}
- {{ newInvoicesCount }} neu, {{ pendingInvoicesCount }} in Bearbeitung
- {% endif %}
-
-
-
- {% for document in newInvoices %}
- {% set assignment = document.disposition.assignment %}
-
-
- {{ icon('download', 'w-4 h-4 shrink-0') }}
- {{ document.owner.teamer.fullName(true) }}
- {{ assignment.destination.dateFrom|date('d.m.y') }} - {{ assignment.destination.dateTo|date('d.m.y') }}
- {% include '_partials/_dot.html.twig' %}
- {{ assignment.destination.hotel }}
-
-
- {% else %}
-
- -
-
- {% endfor %}
-
-
-
-
-
- Neue Einteilungen
-
-
-
+
+ {% for document in newContracts %}
+ {% set assignment = document.disposition.assignment %}
+
+ {% endfor %}
+
+
+
+ {% for document in newInvoices %}
+ {% set assignment = document.disposition.assignment %}
+
+ {% endfor %}
+
+
+
+ {% for disposition in dispositions %}
+
+ {% include '_partials/_disposition_data.html.twig' with {disposition: disposition} %}
+
+ {% endfor %}
+
+
{% set overdueFeedbacksCount = overdueFeedbacks|length %}
-
-
- Überfällige Feedbacks
- {% if overdueFeedbacksCount > 0 %}
- {{ overdueFeedbacksCount }} überfällig
- {% endif %}
-
-
-
+
+ {% for disposition in overdueFeedbacks %}
+ {% set assignment = disposition.assignment %}
+
+ {% endfor %}
+
{% endblock %}