wip: functionality for new role 'management'

This commit is contained in:
Björn Fromme
2024-02-14 10:42:01 +01:00
parent f80e600310
commit e95310c3a1
50 changed files with 350 additions and 129 deletions
@@ -0,0 +1,91 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Dokumentenübersicht{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Dokumentenübersicht
</h1>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
{{ knp_pagination_sortable(pagination, 'Dateiname', 'upload.originalFilename') }}
</th>
<th>
Dateigröße
</th>
<th>
Upload am
</th>
<th>
Upload von
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for document in pagination %}
<tr>
<td>
{{ document.displayName ? document.displayName : document.originalFilename }}
</td>
<td>
{{ document.size|file_size }}
</td>
<td>
{{ document.createdAt|date('d.m.Y') }}
</td>
<td>
{{ document.createdBy }}
</td>
<td>
<div class="flex items-center space-x-2 justify-end">
<button type="button"
class="text-red-500"
hx-get="{{ path('app_administrative_system_document_delete', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete') }}
</button>
<button type="button"
hx-get="{{ path('app_administrative_system_document_replace', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('refresh') }}
</button>
<button type="button"
hx-get="{{ path('app_administrative_system_document_edit', { 'uuid': document.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('edit') }}
</button>
<a href="{{ path('app_common_download', { 'uuid': document.uuid }) }}"
title="Download">
{{ icon('download') }}
</a>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="5">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ knp_pagination_render(pagination) }}
</div>
</div>
<button type="button"
class="btn"
hx-get="{{ path('app_administrative_system_document_upload') }}"
hx-target="body"
hx-swap="beforeend">
Dokumente hinzufügen
</button>
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div>
Möchtest du das Dokument <em>{{ document }}</em> wirklich löschen?
</div>
{% endblock %}
@@ -0,0 +1,15 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Dokument umbenennen{% endblock %}
{% block content %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' } }) }}
<div class="pb-4">
{{ form_row(form.displayName) }}
</div>
<button type="submit" class="btn">
aktualisieren
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -0,0 +1,20 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Dokument ersetzen{% endblock %}
{% block content %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' } }) }}
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_document'),
'max_filesize': 5,
'max_files': 1,
'accepted_files': 'application/pdf',
} %}
</div>
<button type="submit" class="btn">
ersetzen
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -0,0 +1,19 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Dokumente hinzufügen{% endblock %}
{% block content %}
{{ form_start(form, { 'attr': { 'hx-post': app.request.uri, 'hx-target': '#htmx-modal', 'hx-swap': 'outerHTML' }}) }}
<div class="pb-4">
{% include '_partials/_upload_collection_form.html.twig' with {
'endpoint_upload': path('_uploader_upload_document'),
'max_filesize': 5,
'accepted_files': 'application/pdf',
} %}
</div>
<button type="submit" class="btn">
Uploads speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -0,0 +1,15 @@
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.question) }}
{{ form_row(form.answer) }}
</div>
<div class="flex items-center space-x-2">
<button type="submit" class="btn">
Speichern
</button>
<a href="{{ path('app_administrative_system_faq_index') }}" class="btn btn--secondary">
Abbrechen
</a>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
@@ -0,0 +1,12 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Einstellungen - FAQ anlegen{% endblock %}
{% block content %}
<div class="max-w-screen-sm">
<h1 class="text-2xl font-bold pb-8">
FAQ anlegen
</h1>
{% include 'administrative/system/faq/_form.html.twig' %}
</div>
{% endblock %}
@@ -0,0 +1,12 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Einstellungen - FAQ bearbeiten{% endblock %}
{% block content %}
<div class="max-w-screen-sm">
<h1 class="text-2xl font-bold pb-8">
FAQ bearbeiten
</h1>
{% include 'administrative/system/faq/_form.html.twig' %}
</div>
{% endblock %}
@@ -0,0 +1,65 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Einstellungen - FAQ{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
FAQ
</h1>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th class="w-2/5">
Frage
</th>
<th class="w-2/5">
Antwort
</th>
<th></th>
</tr>
</thead>
<tbody {{ stimulus_controller('sortable', { 'endpoint': path('app_administrative_system_faq_sort') }) }}>
{% for faq in faqs %}
<tr {{ stimulus_target('sortable', 'item') }} data-item-id="{{ faq.id }}">
<td>
{{ faq.question }}
</td>
<td>
{{ faq.answer|u.truncate(64, '...') }}
</td>
<td>
<div class="flex items-center space-x-2 justify-end">
<button type="button"
class="text-red-500"
title="FAQ löschen"
hx-get="{{ path('app_administrative_system_faq_delete', { 'id': faq.id }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete') }}
</button>
<a href="{{ path('app_administrative_system_faq_edit', { 'id': faq.id }) }}">
{{ icon('edit') }}
</a>
<button type="button" class="cursor-move" {{ stimulus_target('sortable', 'handle') }}>
{{ icon('sort') }}
</button>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="3">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<a href="{{ path('app_administrative_system_faq_create') }}" class="btn">
Neu
</a>
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div>
Möchtest du die FAQ <em>{{ faq.question }}</em> wirklich löschen?
</div>
{% endblock %}