feat: adopt E&P corporate design in admin
This commit is contained in:
1 parent
55378b2bbc
commit
c660bd68de
36 files changed
+866
-544
No files matched your search
@@ -1,5 +1,5 @@
|
||||
{% if app.session.flashBag.peek('error')|length > 0 %}
|
||||
{% include '_partials/_toast.html.twig' with { level: 'warning', messages: app.flashes('error') } %}
|
||||
{% include '_partials/_toast.html.twig' with { level: 'error', messages: app.flashes('error') } %}
|
||||
{% endif %}
|
||||
{% if app.session.flashBag.peek('success')|length > 0 %}
|
||||
{% include '_partials/_toast.html.twig' with { level: 'success', messages: app.flashes('success') } %}
|
||||
|
||||
@@ -28,9 +28,10 @@
|
||||
name="q"
|
||||
value="{{ filter.q }}"
|
||||
placeholder="{{ form.q.vars.attr.placeholder|default('Suchen…') }}"
|
||||
class="block w-64 rounded-md border-0 py-1.5 pl-9 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-primary text-sm">
|
||||
aria-label="Suchen"
|
||||
class="input w-64 pl-9">
|
||||
<div class="absolute inset-y-0 left-0 flex items-center pl-2.5 pointer-events-none">
|
||||
{{ icon('search', 'w-4 h-4 text-gray-500') }}
|
||||
{{ icon('search', 'w-4 h-4 text-muted') }}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -39,13 +40,13 @@
|
||||
hx-get="{{ path(modal_route, app.request.query.all) }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend"
|
||||
class="button button--secondary button--small inline-flex items-center gap-1.5">
|
||||
class="btn-tool">
|
||||
{{ icon('filter', 'w-4 h-4') }}
|
||||
Filter{% if filter.activeCount > 0 %} ({{ filter.activeCount }}){% endif %}
|
||||
</button>
|
||||
|
||||
{% if filter.isActive %}
|
||||
<a href="{{ path(route) }}" class="text-sm text-gray-600 underline hover:text-gray-900">
|
||||
<a href="{{ path(route) }}" class="text-sm text-brand underline hover:text-brand-dark">
|
||||
zurücksetzen
|
||||
</a>
|
||||
{% endif %}
|
||||
@@ -54,11 +55,11 @@
|
||||
{% if chips|length > 0 %}
|
||||
<div class="flex flex-wrap items-center gap-2 pt-3">
|
||||
{% for chip in chips %}
|
||||
<span class="inline-flex items-center gap-1.5 rounded-full bg-gray-100 border border-gray-300 pl-3 {{ chip.isRemovable ? 'pr-1' : 'pr-3' }} py-1 text-xs text-gray-700">
|
||||
<span class="inline-flex items-center gap-1.5 rounded-full bg-brand-light border border-line pl-3 {{ chip.isRemovable ? 'pr-1' : 'pr-3' }} py-1 text-xs text-ink">
|
||||
<span><span class="font-bold">{{ chip.label }}:</span> {{ chip.value }}</span>
|
||||
{% if chip.isRemovable %}
|
||||
<a href="{{ path(route, filter_query_without(chip.removeKeys)) }}"
|
||||
class="inline-flex items-center justify-center w-4 h-4 rounded-full hover:bg-gray-300"
|
||||
class="inline-flex items-center justify-center w-4 h-4 rounded-full hover:bg-white"
|
||||
aria-label="Filter „{{ chip.label }}“ entfernen">
|
||||
{{ icon('close', 'w-3 h-3') }}
|
||||
</a>
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
{% extends 'knp_menu.html.twig' %}
|
||||
|
||||
{% block list %}
|
||||
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
|
||||
{% if item.level == 0 %}
|
||||
<div class="min-h-full flex grow flex-col gap-y-5 lg:border-r border-gray-200 bg-white md:pr-6">
|
||||
<nav class="flex flex-1 flex-col">
|
||||
<ul role="list" class="space-y-1">
|
||||
{{ block('children') }}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
{% else %}
|
||||
<ul class="{{ html_classes('mt-1 px-2', { 'hidden': not matcher.isCurrent(item) }) }}" {{ stimulus_target('sidebar-menu', 'submenu') }}>
|
||||
{{ block('children') }}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block item %}
|
||||
{% if item.displayed %}
|
||||
<li>
|
||||
{%- if item.hasChildren and item.displayChildren %}
|
||||
<div {{ stimulus_controller('sidebar-menu', {'expanded': matcher.isAncestor(item)}, {'closed': 'hidden', 'iconClosed': 'text-gray-400', 'iconExpanded': 'text-gray-500'}) }}>
|
||||
{%- endif %}
|
||||
{%- if item.uri is not empty %}
|
||||
{{ block('linkElement') }}
|
||||
{%- else %}
|
||||
{{ block('spanElement') }}
|
||||
{%- endif %}
|
||||
{{ block('list') }}
|
||||
{%- if item.hasChildren and item.displayChildren %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block linkElement %}
|
||||
{% import _self as knp_menu %}
|
||||
<a href="{{ item.uri }}"
|
||||
class="{{ html_classes('', {
|
||||
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold': item.level == 1,
|
||||
'block rounded-md py-2 pr-2 pl-9 text-sm leading-6': item.level > 1,
|
||||
'text-gray-700 hover:bg-gray-50': not (matcher.isCurrent(item) or matcher.isAncestor(item)),
|
||||
'bg-gray-100 text-gray-900': matcher.isCurrent(item) or matcher.isAncestor(item),
|
||||
}) }}"
|
||||
{{ knp_menu.attributes(item.linkAttributes) }}>
|
||||
{{ block('label') }}
|
||||
</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block spanElement %}
|
||||
{% import _self as knp_menu %}
|
||||
{% if item.hasChildren %}
|
||||
<button type="button"
|
||||
{{ stimulus_action('sidebar-menu', 'toggleSubmenu') }}
|
||||
{{ stimulus_target('sidebar-menu', 'button') }}
|
||||
{{ knp_menu.attributes(item.linkAttributes) }}
|
||||
class="{{ html_classes('hover:bg-gray-50 flex items-center w-full text-left rounded-md p-2 gap-x-3 text-sm leading-6 font-semibold text-gray-700', { 'bg-gray-50': matcher.isAncestor(item) }) }}"
|
||||
aria-expanded="false">
|
||||
{{ block('label') }}
|
||||
</button>
|
||||
{% elseif item.extras.divider is defined %}
|
||||
<hr class="my-4 h-px bg-gray-200">
|
||||
{% else %}
|
||||
<div class="hover:bg-gray-50 group flex gap-x-3 rounded-md p-2 text-sm leading-5 font-semibold text-gray-700"
|
||||
role="button">
|
||||
{{ block('label') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block label %}
|
||||
{% if item.extras.icon is defined %}
|
||||
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 ' ~ ((matcher.isCurrent(item) or matcher.isAncestor(item)) ? 'text-gray-600' : 'text-gray-400')) }}
|
||||
<span class="flex-1">{{ item.label|raw }}</span>
|
||||
{% else %}
|
||||
{{ item.label|raw }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{% if pageCount > 0 %}
|
||||
<div class="bg-gray-100 border border-gray-300 border-t-0 px-4 py-3 flex items-center justify-between sm:px-4">
|
||||
<div class="border-t border-line px-5 py-3 flex items-center justify-between">
|
||||
<div class="flex-1 flex items-center justify-between">
|
||||
<div class="flex items-center space-x-4">
|
||||
<div class="text-sm leading-5 text-gray-700">
|
||||
<div class="text-sm leading-5 text-muted">
|
||||
{{ 'paginator.info'|trans({ '{from}': firstItemNumber, '{to}': lastItemNumber, '{total}': totalCount })|raw }}
|
||||
</div>
|
||||
<select name="limit"
|
||||
class="text-sm py-1 border-gray-300"
|
||||
aria-label="Einträge pro Seite"
|
||||
class="input w-auto py-1"
|
||||
hx-get="{{ path(route, query|merge({(pageParameterName): 1})) }}"
|
||||
hx-replace-url="{{ path(route, query|merge({(pageParameterName): 1})) }}"
|
||||
hx-target="body">
|
||||
@@ -19,43 +20,43 @@
|
||||
<nav class="relative z-0 inline-flex">
|
||||
{% if pageCount > 1 %}
|
||||
{% if first is defined and current != first %}
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): first})) }}" class="relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white">
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): first})) }}" class="relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m18.75 4.5-7.5 7.5 7.5 7.5m-6-15L5.25 12l7.5 7.5" />
|
||||
</svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if previous is defined %}
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): previous})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white" aria-label="Previous">
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): previous})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white" aria-label="Vorherige Seite">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5 8.25 12l7.5-7.5" />
|
||||
</svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if current > 3 %}
|
||||
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-700">
|
||||
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-line bg-white text-sm leading-5 text-muted">
|
||||
...
|
||||
</span>
|
||||
{% endif %}
|
||||
{% for page in pagesInRange %}
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): page})) }}" class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm leading-5 font-medium focus:z-10 hover:bg-secondary {% if page == current %}bg-primary text-white hover:text-white{% else %}bg-white text-gray-700 hover:text-white{% endif %}">
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): page})) }}" class="-ml-px relative inline-flex items-center px-4 py-2 border text-sm leading-5 focus:z-10 {% if page == current %}border-brand bg-brand font-bold text-white{% else %}border-line bg-white text-brand hover:bg-brand hover:text-white{% endif %}"{% if page == current %} aria-current="page"{% endif %}>
|
||||
{{ page }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% if current < pageCount - 3 %}
|
||||
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium text-gray-700">
|
||||
<span class="-ml-px relative inline-flex items-center px-4 py-2 border border-line bg-white text-sm leading-5 text-muted">
|
||||
...
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if next is defined %}
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): next})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white" aria-label="Next">
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): next})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white" aria-label="Nächste Seite">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m8.25 4.5 7.5 7.5-7.5 7.5" />
|
||||
</svg>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if last is defined and current != last %}
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): last})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-gray-300 bg-white text-sm leading-5 font-medium hover:bg-secondary hover:text-white">
|
||||
<a href="{{ path(route, query|merge({(pageParameterName): last})) }}" class="-ml-px relative inline-flex items-center px-2 py-2 border border-line bg-white text-sm leading-5 text-brand hover:bg-brand hover:text-white">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="m5.25 4.5 7.5 7.5-7.5 7.5m6-15 7.5 7.5-7.5 7.5" />
|
||||
</svg>
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between items-center pt-8">
|
||||
<a href="{{ path(route) }}" class="text-sm text-gray-600 underline hover:text-gray-900">
|
||||
<a href="{{ path(route) }}" class="text-sm text-brand underline hover:text-brand-dark">
|
||||
auf Standard zurücksetzen
|
||||
</a>
|
||||
<button type="submit" class="button button--primary button--small">
|
||||
<button type="submit" class="btn-primary">
|
||||
anwenden
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{#
|
||||
A notice in the style of the apps template's Alert.tsx: `type` is success, error, warning or
|
||||
info, `message` the text. Errors are announced at once (role="alert"), the others politely.
|
||||
#}
|
||||
{% set styles = {
|
||||
success: ['border-emerald-700 bg-emerald-50 text-emerald-950', 'Erledigt'],
|
||||
error: ['border-red-700 bg-red-50 text-red-950', 'Fehler'],
|
||||
warning: ['border-amber-600 bg-amber-50 text-amber-950', 'Achtung'],
|
||||
info: ['border-brand bg-brand-light text-ink', 'Hinweis'],
|
||||
} %}
|
||||
{% set style = styles[type ?? 'info'] %}
|
||||
<div role="{{ type == 'error' ? 'alert' : 'status' }}" class="notice {{ style[0] }}"><span class="sr-only">{{ style[1] }}: </span>{{ message }}</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
{#
|
||||
E&P header as in the apps template: logo, app name behind a thin line, a deep blue bar below.
|
||||
Embed it and fill its blocks:
|
||||
- `header_nav`: the main views as `.header-tab` links, for apps with few views (layout_tabs)
|
||||
- `header_end`: season, user menu, help link and, in the sidebar layout, the menu button
|
||||
`app_name` and `home_path` come from the embedding template; `header_width` lines the header up with
|
||||
a centred content column (layout_sidebar), without it the header runs full width (layout_tabs).
|
||||
#}
|
||||
<header class="shrink-0 print:hidden">
|
||||
<div class="border-b border-line bg-white">
|
||||
<div class="flex items-stretch gap-x-6 text-sm {{ header_width ?? 'px-4' }}">
|
||||
<a href="{{ home_path }}" class="flex shrink-0 items-center gap-3 py-2">
|
||||
<img src="{{ asset('build/images/ep-logo.svg') }}" alt="E&P Reisen & Events" width="157" height="48" class="h-9 w-auto">
|
||||
<span class="pl-3 border-l border-line font-black uppercase tracking-wide text-brand">{{ app_name }}</span>
|
||||
</a>
|
||||
{% block header_nav %}{% endblock %}
|
||||
<div class="ml-auto flex items-stretch gap-x-4">
|
||||
{% block header_end %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-2 bg-brand" aria-hidden="true"></div>
|
||||
</header>
|
||||
@@ -0,0 +1,63 @@
|
||||
{#
|
||||
KnpMenu template for the admin sidebar (layout_admin.html.twig). Items of the first level:
|
||||
- a link (`.sidebar-link`); with children, they show below it while it or a child is current
|
||||
- without a URI but with children: a group that opens in place (<details>), open while a child is current
|
||||
- extras `heading` (a group heading) or `divider` (a line)
|
||||
- extras `icon`: rendered with _partials/_icon.html.twig (`icon`, `class`), as myep's icon() does
|
||||
#}
|
||||
{% extends 'knp_menu.html.twig' %}
|
||||
|
||||
{% block list %}
|
||||
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
|
||||
{% if item.level == 0 %}
|
||||
<ul class="space-y-1">
|
||||
{{ block('children') }}
|
||||
</ul>
|
||||
{% elseif item.uri is empty or matcher.isCurrent(item) or matcher.isAncestor(item) %}
|
||||
<ul class="mt-1 space-y-1">
|
||||
{{ block('children') }}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block item %}
|
||||
{% if item.displayed and item.extras.heading is defined %}
|
||||
<li class="sidebar-heading">{{ item.label }}</li>
|
||||
{% elseif item.displayed and item.extras.divider is defined %}
|
||||
<li><hr class="my-4 border-line"></li>
|
||||
{% elseif item.displayed %}
|
||||
<li>
|
||||
{% if item.uri is empty and item.hasChildren and item.displayChildren %}
|
||||
<details class="sidebar-group" {{ matcher.isAncestor(item) ? 'open' }}>
|
||||
<summary class="sidebar-link {{ matcher.isAncestor(item) ? 'text-brand' }}">{{ block('label') }}</summary>
|
||||
{{ block('list') }}
|
||||
</details>
|
||||
{% else %}
|
||||
{{ block('linkElement') }}
|
||||
{{ block('list') }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block linkElement %}
|
||||
{% import _self as knp_menu %}
|
||||
{% set is_current = matcher.isCurrent(item) %}
|
||||
<a href="{{ item.uri }}"
|
||||
class="{{ item.level == 1 ? 'sidebar-link' : 'sidebar-sublink' }} {{ not is_current and item.level == 1 and matcher.isAncestor(item) ? 'sidebar-link--ancestor' }}"
|
||||
{% if is_current %}aria-current="page"{% endif %}
|
||||
{{ knp_menu.attributes(item.linkAttributes) }}>{{ block('label') }}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block label -%}
|
||||
{% if item.extras.icon is defined -%}
|
||||
{{ include('_partials/_icon.html.twig', {
|
||||
icon: item.extras.icon,
|
||||
class: 'size-5 shrink-0 ' ~ (matcher.isCurrent(item) or matcher.isAncestor(item) ? 'text-brand' : 'text-muted'),
|
||||
}) }}
|
||||
<span class="flex-1">{{ item.label }}</span>
|
||||
{%- else -%}
|
||||
{{ item.label }}
|
||||
{%- endif %}
|
||||
{%- endblock %}
|
||||
@@ -4,7 +4,8 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>{% block title %}MyE&P{% endblock %}</title>
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>{% block title %}MyE&P Admin{% endblock %}</title>
|
||||
<link rel="icon" href="{{ asset('build/favicon/favicon.ico') }}" sizes="32x32">
|
||||
<link rel="icon" href="{{ asset('build/favicon/icon.svg') }}" type="image/svg+xml">
|
||||
<link rel="apple-touch-icon" href="{{ asset('build/favicon/apple-touch-icon.png') }}">
|
||||
@@ -15,8 +16,12 @@
|
||||
{{ encore_entry_script_tags('admin') }}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body class="bg-white text-gray-700 font-sans antialiased {{ booking_theme() }}">
|
||||
<body class="bg-page text-ink font-sans antialiased">
|
||||
<a href="#content"
|
||||
class="sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-2 focus:z-50 focus:bg-white focus:px-3 focus:py-2 focus:font-bold focus:text-brand focus:shadow">Zum Inhalt springen</a>
|
||||
{% block body %}{% endblock %}
|
||||
{% block data_layer %}{% endblock %}
|
||||
{# shows the toasts of htmx responses (HX-Trigger: showNotifications) #}
|
||||
<div {{ stimulus_controller('toast') }}></div>
|
||||
{% include '_partials/_flashes_admin.html.twig' %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +1,9 @@
|
||||
{% set variant = variant ?? 'primary' %}
|
||||
{% set cva = html_cva('badge', {
|
||||
variant: {
|
||||
primary: 'bg-primary text-white',
|
||||
success: 'bg-green-500 text-white',
|
||||
warning: 'bg-red-500 text-white',
|
||||
primary: 'bg-brand-light text-brand',
|
||||
success: 'bg-emerald-50 text-emerald-950',
|
||||
warning: 'bg-amber-100 text-amber-950',
|
||||
}
|
||||
}, [], { variant: 'primary' }) %}
|
||||
<span {{ attributes.defaults({class: cva.apply({variant: variant})}).without('variant') }}>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
{% set weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'] %}
|
||||
<div class="space-y-4 mb-4">
|
||||
{% set rows = [
|
||||
{label: 'Preis', key: 'hasPrice', color: 'bg-brand-mid', legend: 'Preiskonfigurationen'},
|
||||
{label: 'Verpfl.', key: 'hasBoard', color: 'bg-emerald-600', legend: 'Verpflegungsleistungen'},
|
||||
{label: 'Zusatzl.', key: 'hasAdditional', color: 'bg-amber-500', legend: 'optionale Zusatzleistungen'},
|
||||
{label: 'n. v.', key: 'isBlocked', color: 'bg-red-700', legend: 'nicht verfügbar'},
|
||||
] %}
|
||||
<div class="divide-y divide-line">
|
||||
{% for month in months %}
|
||||
{% set totalCols = month.firstDow + (month.days | length) %}
|
||||
<div>
|
||||
<div class="text-sm font-semibold mb-1">{{ month.label }}</div>
|
||||
<div class="px-5 py-4">
|
||||
<h3 class="mb-2 text-xs font-bold uppercase tracking-wide text-brand">{{ month.label }}</h3>
|
||||
<div class="overflow-x-auto">
|
||||
<div class="w-max">
|
||||
<div class="flex">
|
||||
@@ -11,11 +17,11 @@
|
||||
{% for col in 0..(totalCols - 1) %}
|
||||
{% set dow = col % 7 %}
|
||||
<div class="w-6 text-center">
|
||||
<span class="block text-xs leading-none {{ dow >= 5 ? 'text-red-400' : 'text-gray-300' }}">{{ weekdays[dow] }}</span>
|
||||
<span class="block text-[10px] leading-4 {{ dow >= 5 ? 'font-bold text-red-700' : 'text-muted' }}">{{ weekdays[dow] }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="flex mb-0.5">
|
||||
<div class="mb-1 flex">
|
||||
<div class="w-20 shrink-0"></div>
|
||||
{% if month.firstDow > 0 %}
|
||||
{% for i in 1..month.firstDow %}
|
||||
@@ -24,20 +30,16 @@
|
||||
{% endif %}
|
||||
{% for dayNum, day in month.days %}
|
||||
<div class="w-6 text-center">
|
||||
<span class="{{ html_classes('block text-xs leading-none cursor-default', {'font-bold text-secondary': day.isToday, 'text-gray-500': not day.isToday}) }}"
|
||||
<span class="{{ html_classes('mx-auto block w-5 cursor-default text-xs leading-5', {'bg-brand font-bold text-white': day.isToday, 'text-ink': not day.isToday}) }}"
|
||||
{% if day.isToday %}title="heute"{% endif %}
|
||||
{% if day.tooltip %}{{ stimulus_controller('tooltip', {'content': day.tooltip}) }}{% endif %}
|
||||
>{{ dayNum }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% for row in [
|
||||
{label: 'Preis', key: 'hasPrice', color: 'bg-blue-500'},
|
||||
{label: 'Verpfl.', key: 'hasBoard', color: 'bg-green-500'},
|
||||
{label: 'Zusatzl.', key: 'hasAdditional', color: 'bg-amber-500'},
|
||||
{label: 'n. v.', key: 'isBlocked', color: 'bg-red-500'},
|
||||
] %}
|
||||
<div class="flex items-center mt-0.5">
|
||||
<div class="w-20 shrink-0 text-xs text-gray-500">{{ row.label }}</div>
|
||||
{% for row in rows %}
|
||||
<div class="mt-0.5 flex items-center">
|
||||
<div class="w-20 shrink-0 text-xs text-muted">{{ row.label }}</div>
|
||||
{% if month.firstDow > 0 %}
|
||||
{% for i in 1..month.firstDow %}
|
||||
<div class="w-6 px-px"><div class="h-3"></div></div>
|
||||
@@ -45,7 +47,7 @@
|
||||
{% endif %}
|
||||
{% for dayNum, day in month.days %}
|
||||
<div class="w-6 px-px">
|
||||
<div class="h-3 {{ attribute(day, row.key) ? row.color : 'bg-gray-100' }}"></div>
|
||||
<div class="h-3 {{ attribute(day, row.key) ? row.color : 'bg-page' }}"></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
@@ -55,17 +57,10 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-2 mb-4 text-sm text-gray-600">
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="inline-block w-4 h-3 bg-blue-500"></span> Preiskonfigurationen
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="inline-block w-4 h-3 bg-green-500"></span> Verpflegungsleistungen
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="inline-block w-4 h-3 bg-amber-500"></span> optionale Zusatzleistungen
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="inline-block w-4 h-3 bg-red-500"></span> nicht verfügbar
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-2 border-t border-line px-5 py-3 text-xs text-muted">
|
||||
{% for row in rows %}
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="inline-block h-3 w-4 {{ row.color }}" aria-hidden="true"></span> {{ row.legend }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
@@ -1,17 +1,23 @@
|
||||
<div id="calendar-wrapper">
|
||||
<twig:calendar:grid :months="months"/>
|
||||
<div class="flex items-center justify-between mt-4">
|
||||
<button class="button button--secondary button--small"
|
||||
hx-get="{{ path('app_admin_accommodation_calendar', {id: accommodation.id, month: prevMonth}) }}"
|
||||
hx-target="#calendar-wrapper"
|
||||
hx-swap="outerHTML">
|
||||
← {{ prevLabel }}
|
||||
</button>
|
||||
<button class="button button--secondary button--small"
|
||||
hx-get="{{ path('app_admin_accommodation_calendar', {id: accommodation.id, month: nextMonth}) }}"
|
||||
hx-target="#calendar-wrapper"
|
||||
hx-swap="outerHTML">
|
||||
{{ nextLabel }} →
|
||||
</button>
|
||||
{#- The card is the swap target, so the month navigation replaces the whole calendar -#}
|
||||
<section id="calendar-wrapper" class="card" aria-labelledby="calendar-title">
|
||||
<div class="flex flex-wrap items-center justify-between gap-4 border-b border-line px-5 py-3">
|
||||
<h2 id="calendar-title" class="section-title">Kalender</h2>
|
||||
<div class="flex gap-2">
|
||||
<button type="button"
|
||||
class="btn-tool"
|
||||
hx-get="{{ path('app_admin_accommodation_calendar', {id: accommodation.id, month: prevMonth}) }}"
|
||||
hx-target="#calendar-wrapper"
|
||||
hx-swap="outerHTML">
|
||||
← {{ prevLabel }}
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn-tool"
|
||||
hx-get="{{ path('app_admin_accommodation_calendar', {id: accommodation.id, month: nextMonth}) }}"
|
||||
hx-target="#calendar-wrapper"
|
||||
hx-swap="outerHTML">
|
||||
{{ nextLabel }} →
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<twig:calendar:grid :months="months"/>
|
||||
</section>
|
||||
@@ -1,15 +1,15 @@
|
||||
{% set emptyText = emptyText ?? 'Keine Einträge vorhanden.' %}
|
||||
{% set entries %}{% block content %}{% endblock %}{% endset %}
|
||||
<div {{ attributes.defaults({class: 'bg-gray-100 border border-gray-200 rounded-md px-4 py-2'}).without('title', 'emptyText') }}>
|
||||
<h2 class="flex justify-between pb-2">
|
||||
<span class="font-bold text-lg">{{ title }}</span>
|
||||
<div {{ attributes.defaults({class: 'card px-5 py-4'}).without('title', 'emptyText') }}>
|
||||
<div class="flex justify-between pb-3">
|
||||
<h2 class="section-title">{{ title }}</h2>
|
||||
{% block actions %}{% endblock %}
|
||||
</h2>
|
||||
</div>
|
||||
{% if entries|trim is empty %}
|
||||
{% block empty %}
|
||||
<p class="py-2 text-sm text-gray-500">{{ emptyText }}</p>
|
||||
<p class="py-2 text-sm text-muted">{{ emptyText }}</p>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
<ul class="divide-y divide-gray-200">{{ entries }}</ul>
|
||||
<ul class="divide-y divide-line">{{ entries }}</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -1,12 +1,9 @@
|
||||
{% set warning = warning ?? false %}
|
||||
{% set method = method ?? 'get' %}
|
||||
<button type="button"
|
||||
class="{{ html_classes('block px-4 py-2 text-sm w-full text-left', {
|
||||
'text-red-500 hover:text-primary': warning,
|
||||
'text-gray-700 hover:text-primary': not warning
|
||||
}) }}"
|
||||
class="{{ warning ? 'menu-item-danger' : 'menu-item' }}"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
{{ stimulus_action('menu', 'choose') }}
|
||||
{{ attributes
|
||||
.defaults({
|
||||
'hx-target': 'body',
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
<div class="relative inline-block text-left group cursor-pointer">
|
||||
{#- The "⋯" menu of a row or card (menu_controller.js); fill it with dropdown:link and dropdown:hxbutton -#}
|
||||
<div class="relative inline-block text-left" {{ stimulus_controller('menu') }}>
|
||||
<button type="button"
|
||||
class="flex items-center text-gray-400 hover:text-gray-600 focus:outline-hidden focus:ring-0"
|
||||
aria-expanded="true"
|
||||
aria-haspopup="true">
|
||||
<span class="sr-only">Funktionen</span>
|
||||
{{ icon('dots', 'w-6 h-6') }}
|
||||
class="btn-more"
|
||||
aria-haspopup="menu"
|
||||
aria-expanded="false"
|
||||
aria-label="Funktionen"
|
||||
{{ stimulus_target('menu', 'button') }}
|
||||
{{ stimulus_action('menu', 'toggle') }}>
|
||||
{{ icon('dots', 'size-5') }}
|
||||
</button>
|
||||
<div class="hidden group-hover:block absolute right-0 top-0 z-10 w-56 origin-top-right pt-4"
|
||||
role="menu"
|
||||
aria-orientation="vertical"
|
||||
aria-labelledby="menu-button"
|
||||
tabindex="-1">
|
||||
<div class="rounded-md bg-white shadow-lg ring-1 ring-black/5 focus:outline-hidden">
|
||||
<div class="py-1 menu menu--pulldown" role="none">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu-panel" role="menu" hidden {{ stimulus_target('menu', 'panel') }}>
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,10 +1,7 @@
|
||||
{% set warning = warning ?? false %}
|
||||
<a href="{{ url }}"
|
||||
class="{{ html_classes('block px-4 py-2 text-sm w-full', {
|
||||
'text-red-500 hover:text-primary': warning,
|
||||
'text-gray-700 hover:text-primary': not warning
|
||||
}) }}"
|
||||
class="{{ warning ? 'menu-item-danger' : 'menu-item' }}"
|
||||
role="menuitem"
|
||||
tabindex="-1">
|
||||
{{ stimulus_action('menu', 'choose') }}>
|
||||
{{ block('content') }}
|
||||
</a>
|
||||
@@ -1,11 +1,11 @@
|
||||
{#- A titled panel grouping the fields of a long admin form. No overflow-hidden: the dots
|
||||
dropdowns inside must be able to open past its edge. -#}
|
||||
<div {{ attributes.defaults({class: 'bg-white border border-gray-200 rounded-md'}).without('title') }}>
|
||||
<div class="flex items-center justify-between gap-4 px-4 py-2 bg-gray-100 border-b border-gray-200 rounded-t-md font-bold">
|
||||
{{ title }}
|
||||
{#- A titled card grouping the fields of a long admin form. No overflow-hidden: the "⋯" menus
|
||||
inside must be able to open past its edge. -#}
|
||||
<div {{ attributes.defaults({class: 'card'}).without('title') }}>
|
||||
<div class="flex items-center justify-between gap-4 border-b border-line px-5 py-3">
|
||||
<h2 class="section-title">{{ title }}</h2>
|
||||
{% block actions %}{% endblock %}
|
||||
</div>
|
||||
<div class="p-4">
|
||||
<div class="p-5">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1 +1 @@
|
||||
<h1 class="text-2xl font-bold pb-8">{{ block('content') }}</h1>
|
||||
<h1 class="pb-6 text-2xl font-bold text-brand">{{ block('content') }}</h1>
|
||||
+82
-225
@@ -1,236 +1,93 @@
|
||||
{% use 'form_div_layout.html.twig' %}
|
||||
{#
|
||||
Form theme in the look of the apps template's Field.tsx: a real label, the hint and the error
|
||||
below the input, which gets aria-invalid and aria-describedby.
|
||||
#}
|
||||
{% extends 'form_div_layout.html.twig' %}
|
||||
|
||||
{%- block form_row -%}
|
||||
{%- set widget_attr = {} -%}
|
||||
{%- if help is not empty -%}
|
||||
{%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%}
|
||||
{%- endif -%}
|
||||
<div{% with {attr: row_attr} %}{{ block('attributes') }}{% endwith %}>
|
||||
{{- form_label(form) -}}
|
||||
{{- form_widget(form, widget_attr) -}}
|
||||
{{- form_errors(form) -}}
|
||||
{{- form_help(form) -}}
|
||||
{% block form_row %}
|
||||
{% set describedBy = [help ? id ~ '_help', errors|length ? id ~ '_errors']|filter(v => v) %}
|
||||
{% set widget_attr = {attr: {'aria-describedby': describedBy ? describedBy|join(' ')}|filter(v => v)
|
||||
|merge(errors|length ? {'aria-invalid': 'true'} : {})} %}
|
||||
<div class="{{ row_attr.class ?? '' }}">
|
||||
{{ form_label(form) }}
|
||||
{{ form_widget(form, widget_attr) }}
|
||||
{{ form_help(form) }}
|
||||
{{ form_errors(form) }}
|
||||
</div>
|
||||
{%- endblock form_row -%}
|
||||
|
||||
{%- block form_label -%}
|
||||
{% set class = 'block font-bold pb-2' %}
|
||||
{% if errors|length %}
|
||||
{% set class = class ~ ' text-red-500' %}
|
||||
{% endif %}
|
||||
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ class)|trim}) %}
|
||||
{{ parent() }}
|
||||
{%- endblock form_label -%}
|
||||
|
||||
{%- block form_errors -%}
|
||||
{%- if errors|length > 0 -%}
|
||||
<ul class="pb-2">
|
||||
{%- for error in errors -%}
|
||||
<li class="text-red-500">{{ error.message }}</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{%- endif -%}
|
||||
{%- endblock form_errors -%}
|
||||
|
||||
{%- block form_widget_simple -%}
|
||||
{%- set type = type|default('text') -%}
|
||||
{%- if type != 'hidden' -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%}
|
||||
{%- endif -%}
|
||||
{%- if disabled is defined and disabled == true -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{{ parent() }}
|
||||
{%- endblock form_widget_simple -%}
|
||||
|
||||
{%- block textarea_widget -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%}
|
||||
{%- endif -%}
|
||||
{%- if disabled is defined and disabled == true -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
|
||||
{%- endif -%}
|
||||
{{ parent() }}
|
||||
{%- endblock textarea_widget -%}
|
||||
|
||||
{%- block checkbox_widget -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' h-4 w-4 rounded-sm text-primary')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-red-500 text-red-500 ring-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-gray-300 focus:ring-primary' }) -%}
|
||||
{%- endif -%}
|
||||
{%- if attr.disabled is defined and attr.disabled == true -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
|
||||
{%- endif -%}
|
||||
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
|
||||
{%- endblock checkbox_widget -%}
|
||||
{% endblock %}
|
||||
|
||||
{# the box in front of its label, the hint below #}
|
||||
{% block checkbox_row %}
|
||||
<div class="relative flex items-start">
|
||||
<div class="flex h-6 items-center">
|
||||
{{ form_widget(form) }}
|
||||
</div>
|
||||
<div class="{{ html_classes('ml-3 leading-6', { 'text-red-500': errors|length }) }}">
|
||||
<label for="{{ form.vars.id }}">
|
||||
{{ form.vars.label }}
|
||||
</label>
|
||||
{{- form_errors(form) -}}
|
||||
</div>
|
||||
{% set describedBy = [help ? id ~ '_help', errors|length ? id ~ '_errors']|filter(v => v) %}
|
||||
<div class="{{ row_attr.class ?? '' }}">
|
||||
<label class="flex items-center gap-2 pt-6" for="{{ id }}">
|
||||
{{ form_widget(form, {attr: {class: 'rounded'}|merge(describedBy ? {'aria-describedby': describedBy|join(' ')} : {})}) }}
|
||||
{{ label }}
|
||||
</label>
|
||||
{{ form_help(form) }}
|
||||
{{ form_errors(form) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{%- block choice_widget_collapsed -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%}
|
||||
{%- endif -%}
|
||||
{%- if disabled is defined and disabled == true -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
|
||||
{%- endif -%}
|
||||
{{ parent() }}
|
||||
{%- endblock choice_widget_collapsed -%}
|
||||
|
||||
{%- block choice_widget_expanded -%}
|
||||
{%- for child in form %}
|
||||
<div class="relative flex items-start py-2 first:pt-0">
|
||||
<div class="min-w-0 flex-1 text-sm leading-4">
|
||||
<label for="{{ child.vars.id }}" class="select-none font-medium text-gray-900">
|
||||
{{ child.vars.label }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="ml-3 flex h-4 items-center">
|
||||
{{- form_widget(child) -}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor -%}
|
||||
{%- endblock choice_widget_expanded -%}
|
||||
|
||||
{%- block birthday_widget -%}
|
||||
<div class="grid grid-cols-3 gap-x-1">
|
||||
{{ form_widget(form.children['day']) }}
|
||||
{{ form_widget(form.children['month']) }}
|
||||
{{ form_widget(form.children['year']) }}
|
||||
</div>
|
||||
{%- endblock -%}
|
||||
|
||||
{% block abbreviated_date_widget %}
|
||||
{%- set class = 'flex items-center space-x-1 ' ~ attr.class|default('') -%}
|
||||
{%- do form.setRendered -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{%- endif -%}
|
||||
<div class="{{ class }}">
|
||||
{{ form_widget(form.month, { 'attr': attr })}}
|
||||
<span>/</span>
|
||||
{{ form_widget(form.year, { 'attr': attr })}}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{%- block money_widget -%}
|
||||
{% set currency_class = 'absolute top-1/2 transform -translate-y-1/2 right-0 mr-2' %}
|
||||
{% if errors|length %}
|
||||
{% set currency_class = currency_class ~ ' text-red-500' %}
|
||||
{% else %}
|
||||
{% set currency_class = currency_class ~ ' text-gray-600' %}
|
||||
{% block form_label %}
|
||||
{% if label is not same as(false) %}
|
||||
{% set label_attr = label_attr|merge({class: 'field-label mb-1 ' ~ (label_attr.class ?? '')}) %}
|
||||
{{ parent() }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block form_label_content %}
|
||||
{{- parent() -}}
|
||||
{%- if required %}<span aria-hidden="true" class="text-red-800"> *</span><span class="sr-only"> (Pflichtfeld)</span>{% endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{% block form_widget_simple %}
|
||||
{% set attr = attr|merge({class: 'input ' ~ (attr.class ?? '')}) %}
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block choice_widget_collapsed %}
|
||||
{% set attr = attr|merge({class: 'input ' ~ (attr.class ?? '')}) %}
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block form_help %}
|
||||
{% if help %}
|
||||
<p id="{{ id }}_help" class="mt-1 text-xs text-slate-600">{{ help }}</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block form_errors %}
|
||||
{% if errors|length %}
|
||||
<p id="{{ id }}_errors" class="mt-1 text-xs font-bold text-red-800">
|
||||
{%- for error in errors %}{{ error.message }}{% if not loop.last %} {% endif %}{% endfor -%}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{# myep additions for the admin forms #}
|
||||
|
||||
{% block textarea_widget %}
|
||||
{% set attr = attr|merge({class: 'input ' ~ (attr.class ?? '')}) %}
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
{# a list of boxes or radios, each in front of its label #}
|
||||
{% block choice_widget_expanded %}
|
||||
<div {{ block('widget_container_attributes') }}>
|
||||
{% for child in form %}
|
||||
<label class="flex items-center gap-2 py-1 text-sm" for="{{ child.vars.id }}">
|
||||
{{ form_widget(child) }}
|
||||
{{ child.vars.label|trans(child.vars.label_translation_parameters, child.vars.translation_domain) }}
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{# the currency inside the field, on the right #}
|
||||
{% block money_widget %}
|
||||
<div class="relative">
|
||||
{{ block('form_widget_simple') }}
|
||||
<span class="{{ currency_class }}">{{ money_pattern|replace({'{{ widget }}': ''})|trim }}</span>
|
||||
<span class="pointer-events-none absolute top-1/2 right-0 mr-3 -translate-y-1/2 text-sm text-muted">{{ money_pattern|replace({'{{ widget }}': ''})|trim }}</span>
|
||||
</div>
|
||||
{%- endblock money_widget -%}
|
||||
|
||||
{%- block datepicker_widget -%}
|
||||
{%- set minDate = form.vars.min_date ? form.vars.min_date | date('Y-m-d') : null -%}
|
||||
{%- set maxDate = form.vars.max_date ? form.vars.max_date | date('Y-m-d') : null -%}
|
||||
{%- set displayValue = value ? value|date('d.m.Y') : '' -%}
|
||||
{%- set inputClass = 'block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm' -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set inputClass = inputClass ~ ' ring-red-500 placeholder:red-500 focus:ring-red-500' -%}
|
||||
{%- else -%}
|
||||
{%- set inputClass = inputClass ~ ' placeholder:text-gray-900 focus:ring-primary' -%}
|
||||
{%- endif -%}
|
||||
{%- if disabled is defined and disabled == true -%}
|
||||
{%- set inputClass = inputClass ~ ' cursor-not-allowed' -%}
|
||||
{%- endif -%}
|
||||
<div {{ stimulus_controller('datepicker', { 'minDate': minDate, 'maxDate': maxDate, 'disableWeekends': form.vars.disable_weekends }) }}>
|
||||
<input type="text"
|
||||
id="{{ id }}"
|
||||
class="{{ inputClass }}"
|
||||
value="{{ displayValue }}"
|
||||
{% if attr.placeholder is defined %}placeholder="{{ attr.placeholder }}"{% endif %}
|
||||
{% if attr['aria-describedby'] is defined %}aria-describedby="{{ attr['aria-describedby'] }}"{% endif %}
|
||||
{% if required %}required{% endif %}
|
||||
{% if disabled is defined and disabled %}disabled{% endif %}
|
||||
{{ stimulus_target('datepicker', 'field') }} />
|
||||
<input type="hidden"
|
||||
name="{{ form.vars.full_name }}"
|
||||
value="{{ value }}"
|
||||
{{ stimulus_target('datepicker', 'hiddenField') }} />
|
||||
</div>
|
||||
{%- endblock datepicker_widget %}
|
||||
|
||||
{%- block autocomplete_widget -%}
|
||||
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' autocomplete-input block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
|
||||
{%- if errors|length -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
|
||||
{% else %}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%}
|
||||
{%- endif -%}
|
||||
{%- if disabled is defined and disabled == true -%}
|
||||
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
|
||||
{%- endif -%}
|
||||
<div class="autocomplete"
|
||||
{{ stimulus_controller('autocomplete', {
|
||||
'action': form.vars.action ?? null,
|
||||
'endpointUrl': form.vars.endpoint_url ?? null,
|
||||
'choices': form.vars.choices ?? null
|
||||
}) }}
|
||||
>
|
||||
<input type="text"
|
||||
class="{{ attr.class }}"
|
||||
value="{{ form.vars.initial_label }}"
|
||||
{{ stimulus_target('autocomplete', 'input') }}>
|
||||
<ul class="autocomplete-result-list"></ul>
|
||||
<input type="hidden"
|
||||
name="{{ form.vars.full_name }}"
|
||||
{{ stimulus_target('autocomplete', 'field') }}
|
||||
value="{{ form.vars.value }}">
|
||||
<button type="button"
|
||||
class="autocomplete-icon hidden"
|
||||
{{ stimulus_action('autocomplete', 'reset') }}
|
||||
{{ stimulus_target('autocomplete', 'resetButton') }}>
|
||||
{{ icon('close', 'w-4 h-4 text-gray-700') }}
|
||||
</button>
|
||||
<div class="autocomplete-icon"
|
||||
{{ stimulus_target('autocomplete', 'searchIcon') }}>
|
||||
{{ icon('search', 'w-4 h-4 text-gray-700') }}
|
||||
</div>
|
||||
</div>
|
||||
{%- endblock autocomplete_widget -%}
|
||||
|
||||
{%- block multiselect_widget -%}
|
||||
<div class="relative" {{ stimulus_controller('multiselect', { 'placeholder': form.vars.empty_label }) }}>
|
||||
<div {{ stimulus_action('multiselect', 'toggle', 'click')}}
|
||||
role="button"
|
||||
class="relative rounded-md border border-gray-300 flex items-start space-x-2 px-3">
|
||||
<div {{ stimulus_target('multiselect', 'label') }} class="flex-1 min-h-8 py-1.5 text-gray-900 text-sm"></div>
|
||||
{{ icon('dots', 'w-4 h-4 mt-2') }}
|
||||
</div>
|
||||
<div {{ stimulus_target('multiselect', 'dropdown')}} class="absolute z-10 top-full -mt-1.5 left-0 inset-x-0 max-h-48 overflow-y-auto px-3 py-2 bg-white shadow-lg rounded-md rounded-t-none border border-gray-300 border-t-0 hidden">
|
||||
{% for item in form.children %}
|
||||
{{ form_row(item, { 'attr': { 'data-action': 'multiselect#update', 'data-multiselect-target': 'choice', 'data-label': item.vars.label } }) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endblock multiselect_widget -%}
|
||||
{% endblock %}
|
||||
@@ -1,28 +1,27 @@
|
||||
<div id="htmx-confirmation-modal" class="fixed top-0 left-0 z-50 inset-0" {{ stimulus_controller('modal') }}>
|
||||
<div class="absolute top-0 left-0 inset-0 bg-black/80" {{ stimulus_action('modal', 'close', 'click') }}></div>
|
||||
<div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white p-8 w-full max-w-3xl rounded-md">
|
||||
<div class="flex justify-between border-b border-gray-200 pb-2 mb-4">
|
||||
<div class="flex items-center space-x-2">
|
||||
{{ icon('alert', 'w-8 h-8') }}
|
||||
<div class="text-xl font-bold">
|
||||
<div id="htmx-confirmation-modal" class="fixed inset-0 z-50" {{ stimulus_controller('modal') }}>
|
||||
<div class="absolute inset-0 bg-ink/35 backdrop-blur-[3px]" {{ stimulus_action('modal', 'close', 'click') }}></div>
|
||||
<div class="card absolute top-1/2 left-1/2 w-full max-w-3xl -translate-x-1/2 -translate-y-1/2 p-6"
|
||||
role="alertdialog" aria-modal="true" aria-labelledby="htmx-confirmation-modal-title">
|
||||
<div class="mb-4 flex items-center justify-between gap-4 border-b border-line pb-3">
|
||||
<div class="flex items-center gap-2 text-brand">
|
||||
{{ icon('alert', 'size-7 shrink-0') }}
|
||||
<h2 id="htmx-confirmation-modal-title" class="text-xl font-bold">
|
||||
{% block title %}Bist du sicher?{% endblock %}
|
||||
</div>
|
||||
</h2>
|
||||
</div>
|
||||
<button type="button" class="inline-block" {{ stimulus_action('modal', 'close') }}>
|
||||
{{ icon('close', 'w-8 h-8') }}
|
||||
</button>
|
||||
<button type="button" class="btn-tool" {{ stimulus_action('modal', 'close') }}>Schließen</button>
|
||||
</div>
|
||||
{% block content %}{% endblock %}
|
||||
<div class="mt-6 flex items-center justify-between">
|
||||
<button type="button"
|
||||
class="button button--warning"
|
||||
class="btn-primary"
|
||||
{% block button_attribute %}
|
||||
hx-post="{{ app.request.uri }}"
|
||||
hx-vals="{{ { _token: csrf_token(csrf_token_id) }|json_encode|e('html_attr') }}"
|
||||
{% endblock %}>
|
||||
{% block button_confirm %}Ja{% endblock %}
|
||||
</button>
|
||||
<button type="button" class="button button--neutral" {{ stimulus_action('modal', 'close') }}>
|
||||
<button type="button" class="btn-secondary" {{ stimulus_action('modal', 'close') }}>
|
||||
{% block button_cancel %}Abbrechen{% endblock %}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
<div id="htmx-modal"
|
||||
class="fixed inset-0 w-full h-full z-50" {{ stimulus_controller('modal') }} {{ stimulus_action('modal', 'close', 'modal-close@window') }}>
|
||||
<div class="absolute inset-0 w-full h-full bg-black/70" {{ stimulus_action('modal', 'close', 'click') }}></div>
|
||||
<div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 px-4 w-full max-w-3xl">
|
||||
<div class="relative bg-white py-8 rounded-md">
|
||||
<div class="flex justify-between pb-4 px-8">
|
||||
<div class="text-2xl font-bold">
|
||||
class="fixed inset-0 z-50 h-full w-full" {{ stimulus_controller('modal') }} {{ stimulus_action('modal', 'close', 'modal-close@window') }}>
|
||||
<div class="absolute inset-0 h-full w-full bg-ink/35 backdrop-blur-[3px]" {{ stimulus_action('modal', 'close', 'click') }}></div>
|
||||
<div class="absolute top-1/2 left-1/2 w-full max-w-3xl -translate-x-1/2 -translate-y-1/2 px-4">
|
||||
<div class="card relative py-6" role="dialog" aria-modal="true" aria-labelledby="htmx-modal-title">
|
||||
<div class="flex items-center justify-between gap-4 px-6 pb-4">
|
||||
<h2 id="htmx-modal-title" class="text-xl font-bold text-brand">
|
||||
{% block title %}{% endblock %}
|
||||
</div>
|
||||
<button type="button"
|
||||
class="inline-flex items-center justify-center bg-gray-200 rounded-md w-10 h-10"
|
||||
{{ stimulus_action('modal', 'close') }}>
|
||||
<svg class="w-8 h-8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="200" y1="56" x2="56" y2="200" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="200" y1="200" x2="56" y2="56" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>
|
||||
</button>
|
||||
</h2>
|
||||
<button type="button" class="btn-tool" {{ stimulus_action('modal', 'close') }}>Schließen</button>
|
||||
</div>
|
||||
<div class="max-h-svh overflow-y-auto">
|
||||
<div class="px-8">
|
||||
<div class="max-h-[75svh] overflow-y-auto">
|
||||
<div class="px-6">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,49 +1,50 @@
|
||||
{#
|
||||
The admin in the sidebar layout of the E&P corporate design: the KnpMenu menu `admin_main` in a
|
||||
left sidebar from lg up, below that in a drawer behind the menu button.
|
||||
#}
|
||||
{% extends 'base_admin.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<div class="max-w-screen-2xl mx-auto px-4 lg:px-8 lg:grid lg:grid-cols-4 gap-8 py-8">
|
||||
<div class="lg:col-span-4 flex items-center justify-between pb-4 lg:pb-0">
|
||||
<a href="{{ path(app.user ? 'app_admin_dashboard' : 'app_login') }}">
|
||||
<img class="h-8 w-auto" src="{{ asset('build/images/logo_ep.svg') }}" alt="My E&P Admin">
|
||||
</a>
|
||||
{% if app.user %}
|
||||
<div class="flex items-center space-x-4">
|
||||
<button type="button"
|
||||
class="lg:hidden"
|
||||
{{ stimulus_controller('mobilenav', [], [], { 'mobilenav': '#mobilenav' }) }}
|
||||
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'open' }) }}>
|
||||
{{ icon('menu', 'w-8 h-8 text-gray-700') }}
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="hidden lg:block sticky top-0 h-screen">
|
||||
{% if app.user %}
|
||||
{{ knp_menu_render(knp_menu_get('admin_main')) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="lg:col-span-3">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div id="mobilenav"
|
||||
class="fixed z-50 top-0 left-0 inset-0 pr-16 bg-black/70 -translate-x-full"
|
||||
{{ stimulus_controller('mobilenav', [], { 'closed': '-translate-x-full' }, { 'mobilenav': '#mobilenav' }) }}
|
||||
>
|
||||
<div class="h-screen w-full bg-white">
|
||||
<div class="flex justify-between p-8">
|
||||
<img src="{{ asset('build/images/logo_ep.svg') }}" alt="" class="block w-auto h-8">
|
||||
<button type="button"
|
||||
{{ stimulus_action('mobilenav', 'trigger', null, { 'mode': 'close' }) }}>
|
||||
{{ icon('close', 'w-8 h-8') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="w-full h-full p-8 pt-0 overflow-y-auto">
|
||||
<div {{ stimulus_controller('drawer') }}>
|
||||
{% embed 'admin/_partials/_header.html.twig' with {
|
||||
app_name: 'MyE&P Admin',
|
||||
home_path: path(app.user ? 'app_admin_dashboard' : 'app_login'),
|
||||
header_width: 'mx-auto max-w-screen-2xl px-4 lg:px-8',
|
||||
} %}
|
||||
{% block header_end %}
|
||||
{% if app.user %}
|
||||
{{ knp_menu_render(knp_menu_get('admin_main')) }}
|
||||
<span class="hidden self-center text-muted sm:inline">{{ app.user.userIdentifier }}</span>
|
||||
<button type="button" class="btn-tool self-center lg:hidden" aria-haspopup="dialog"
|
||||
{{ stimulus_action('drawer', 'open') }}>Menü</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endembed %}
|
||||
|
||||
<div class="mx-auto max-w-screen-2xl gap-8 px-4 py-8 lg:grid lg:grid-cols-[14.5rem_minmax(0,1fr)] lg:px-8">
|
||||
<nav aria-label="Hauptmenü" class="hidden lg:block">
|
||||
{% if app.user %}
|
||||
{{ knp_menu_render('admin_main') }}
|
||||
{% endif %}
|
||||
</nav>
|
||||
<main id="content" tabindex="-1" class="min-w-0 outline-none">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
</div>
|
||||
|
||||
{% if app.user %}
|
||||
<dialog class="drawer" aria-label="Hauptmenü" {{ stimulus_target('drawer', 'dialog') }}
|
||||
{{ stimulus_action('drawer', 'closeOnBackdrop', 'click') }}>
|
||||
{# fills the dialog, so only clicks beside the drawer reach the dialog element itself #}
|
||||
<div class="flex h-full flex-col">
|
||||
<div class="flex items-center justify-between p-4">
|
||||
<img src="{{ asset('build/images/ep-logo.svg') }}" alt="" class="h-9 w-auto">
|
||||
<button type="button" class="btn-tool" {{ stimulus_action('drawer', 'close') }}>Schließen</button>
|
||||
</div>
|
||||
<nav class="flex-1 overflow-y-auto px-4 pb-8">
|
||||
{{ knp_menu_render('admin_main') }}
|
||||
</nav>
|
||||
</div>
|
||||
</dialog>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% include '_partials/_flashes_admin.html.twig' %}
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user