feat: news messages to be displayed on teamers' dashboards

This commit is contained in:
Björn Fromme
2024-06-23 18:37:33 +02:00
parent b58bd9f34f
commit fbad0d4e06
18 changed files with 505 additions and 0 deletions
@@ -0,0 +1,10 @@
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-4">
{{ form_row(form.status) }}
{{ form_row(form.message) }}
</div>
<button type="submit" class="btn">
Speichern
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
@@ -0,0 +1,84 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}News{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
News
</h1>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
{{ icon('eye', 'w-4 h-4') }}
</th>
<th class="w-1/2">
Nachricht
</th>
<th>
Status
</th>
<th>
erstellt
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for item in news %}
<tr>
<td>
{% if item == activeNews %}
<svg viewBox="0 0 5 5" class="{{ html_classes('h-4 w-4 fill-current', { 'text-blue-600': item.status == 1, 'text-red-600': item.status == 2 }) }}">
<circle cx="3" cy="3" r="2" />
</svg>
{% endif %}
</td>
<td>
{{ item.message | u.truncate(48, '...') }}
</td>
<td>
{{ ('label.news.status.' ~ item.status) | trans }}
</td>
<td>
{{ item.createdAt | date('d.m.Y') }}
</td>
<td>
<div class="flex items-center space-x-2 justify-end">
<button type="button"
hx-get="{{ path('app_administrative_system_news_edit', { 'id': item.id }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('edit') }}
</button>
<button type="button"
class="text-red-500"
hx-get="{{ path('app_administrative_system_news_delete', { 'id': item.id }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('delete') }}
</button>
</div>
</td>
</tr>
{% else %}
<tr>
<td colspan="3">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<button type="button"
class="btn"
hx-get="{{ path('app_administrative_system_news_create') }}"
hx-target="body"
hx-swap="beforeend">
Neu
</button>
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}News anlegen{% endblock %}
{% block content %}
{% include 'administrative/system/news/form.html.twig' %}
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div>
Möchtest du die News wirklich löschen?
</div>
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}News bearbeiten{% endblock %}
{% block content %}
{% include 'administrative/system/news/form.html.twig' %}
{% endblock %}
+8
View File
@@ -11,6 +11,14 @@
{% if not teamer.photo %}
{% include '_partials/_toast.html.twig' with { level: 'info', messages: ['Bitte lade ein Foto von dir hoch'] } %}
{% endif %}
{% if news is not null %}
<div class="{{ html_classes('p-4 mb-4 flex items-start space-x-2 text-gray-100 rounded-md', { 'bg-blue-600': news.status == 1, 'bg-red-600': news.status == 2 }) }}">
{{ icon('alert', 'w-5 h-5 flex-shrink-0') }}
<div class="leading-relaxed text-base">
{{ news.message | nl2br }}
</div>
</div>
{% endif %}
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div class="bg-gray-100 border border-gray-200 rounded-md px-4 py-2">
<h2 class="font-bold text-lg pb-2">