feat: door access codes display and admin crud
This commit is contained in:
1 parent
91419294b8
commit
afa3f17d77
20 files changed
+1428
No files matched your search
@@ -0,0 +1,37 @@
|
||||
{# Creating and editing an access code. See admin/_modal_resource.html.twig for how it closes. #}
|
||||
{% extends 'htmx_modal.html.twig' %}
|
||||
|
||||
{% block title %}
|
||||
{%- if code.id -%}
|
||||
{{ code.label }} bearbeiten
|
||||
{%- else -%}
|
||||
Code hinzufügen
|
||||
{%- endif -%}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ form_start(form, { attr: {
|
||||
'hx-post': form.vars.action,
|
||||
'hx-target': '#htmx-modal',
|
||||
'hx-swap': 'outerHTML',
|
||||
} }) }}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
<div class="space-y-4">
|
||||
{{ form_row(form.label) }}
|
||||
{{ form_row(form.description) }}
|
||||
{{ form_row(form.code) }}
|
||||
{{ form_row(form.validFrom) }}
|
||||
{{ form_row(form.visibility) }}
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-2 pt-6">
|
||||
<button type="button" class="button button--neutral" {{ stimulus_action('modal', 'close') }}>
|
||||
Abbrechen
|
||||
</button>
|
||||
<button type="submit" class="button button--primary">
|
||||
Speichern
|
||||
</button>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% extends 'htmx_confirmation_modal.html.twig' %}
|
||||
|
||||
{% block title %}Code löschen?{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
Der Code für <em>{{ code.label }}</em> (gültig ab
|
||||
{{ code.validFrom|format_date(pattern: 'd.MM.y') }}) wird gelöscht.
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block button_confirm %}Löschen{% endblock %}
|
||||
@@ -0,0 +1,82 @@
|
||||
{#
|
||||
Maintaining the codes: every row there is, in a table, newest per door first.
|
||||
|
||||
The counterpart of access_code/index.html.twig, which shows one card per door with the code
|
||||
that works today and nothing else. Everything the quick look leaves out is here -- rows the
|
||||
controller marked `upcoming` or `superseded`, muted and labelled -- because this is the
|
||||
screen on which a rotation is planned and checked.
|
||||
|
||||
„Für wen" is the visibility itself: it decides who is served the row and says so in the same
|
||||
breath, so there is nothing to keep in step between the two.
|
||||
#}
|
||||
{% extends 'layout.html.twig' %}
|
||||
|
||||
{% block title %}Zugangscodes verwalten · E&P Platz{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<a class="text-sm text-gray-500 hover:text-gray-900" href="{{ path('app_access_code') }}">← Zugangscodes</a>
|
||||
|
||||
<div class="flex flex-wrap items-baseline justify-between gap-2 pt-2">
|
||||
<div>
|
||||
<h1>Zugangscodes verwalten</h1>
|
||||
</div>
|
||||
<button type="button" class="button button--small button--primary"
|
||||
hx-get="{{ path('app_admin_access_code_new') }}"
|
||||
hx-target="body"
|
||||
hx-swap="beforeend">Code hinzufügen</button>
|
||||
</div>
|
||||
|
||||
{% if rows is empty %}
|
||||
<p class="pt-8 text-sm text-gray-500">Noch nichts hinterlegt.</p>
|
||||
{% else %}
|
||||
<div class="pt-8 overflow-x-auto">
|
||||
<table class="w-full text-left text-sm">
|
||||
<thead class="border-b border-gray-200 text-gray-500">
|
||||
<tr>
|
||||
<th class="py-2 pr-4 font-semibold">Bezeichnung</th>
|
||||
<th class="py-2 pr-4 font-semibold">Beschreibung</th>
|
||||
<th class="py-2 pr-4 font-semibold">Code</th>
|
||||
<th class="py-2 pr-4 font-semibold">sichtbar für</th>
|
||||
<th class="py-2 pr-4 font-semibold">gültig ab</th>
|
||||
<th class="py-2 font-semibold"><span class="sr-only">Aktionen</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200">
|
||||
{% for row in rows %}
|
||||
{% set muted = row.upcoming or row.superseded %}
|
||||
<tr data-access-code class="{{ muted ? 'text-gray-400' : '' }}">
|
||||
<td class="py-2 pr-4 font-semibold">{{ row.code.label }}</td>
|
||||
<td class="py-2 pr-4">{{ row.code.description }}</td>
|
||||
<td class="py-2 pr-4 font-mono">{{ row.code.code }}</td>
|
||||
<td class="py-2 pr-4">
|
||||
{% if row.code.visibility.isRestricted %}
|
||||
<span class="badge bg-gray-100 text-gray-600">{{ row.code.visibility.label }}</span>
|
||||
{% else %}
|
||||
{{ row.code.visibility.label }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="py-2 pr-4 whitespace-nowrap">
|
||||
{{ row.code.validFrom|format_date(pattern: 'd.MM.y') }}
|
||||
{% if row.upcoming %}
|
||||
<span class="badge bg-amber-100 text-amber-800 ml-1">noch nicht gültig</span>
|
||||
{% elseif row.superseded %}
|
||||
<span class="badge bg-gray-100 text-gray-600 ml-1">ersetzt</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="py-2">
|
||||
<div class="flex justify-end gap-2">
|
||||
<button type="button" class="button button--small button--neutral"
|
||||
hx-get="{{ path('app_admin_access_code_edit', { id: row.code.id }) }}"
|
||||
hx-target="body" hx-swap="beforeend">Bearbeiten</button>
|
||||
<button type="button" class="button button--small button--neutral"
|
||||
hx-get="{{ path('app_admin_access_code_delete', { id: row.code.id }) }}"
|
||||
hx-target="body" hx-swap="beforeend">Löschen</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user