feat: admin dashboard widgets
This commit is contained in:
@@ -1,10 +1,23 @@
|
||||
{% extends 'layout_admin.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>
|
||||
<twig:page:heading>
|
||||
MyE&P Admin
|
||||
</h1>
|
||||
<p>
|
||||
Coming soon, stay tuned.
|
||||
</p>
|
||||
</twig:page:heading>
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||
|
||||
{% for widget in widgets %}
|
||||
<twig:dashboard:widget title="{{ widget.title }}" emptyText="{{ widget.emptyText }}">
|
||||
<twig:block name="actions">
|
||||
{% if widget.actionUrl %}
|
||||
<a href="{{ widget.actionUrl }}" class="text-sm font-normal text-primary">{{ widget.actionLabel }}</a>
|
||||
{% endif %}
|
||||
</twig:block>
|
||||
{% for entry in widget.entries %}
|
||||
<twig:dashboard:entry icon="{{ entry.icon }}" url="{{ entry.url }}">{{ entry.label }}</twig:dashboard:entry>
|
||||
{% endfor %}
|
||||
</twig:dashboard:widget>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{% set url = url ?? null %}
|
||||
{% set icon = icon ?? null %}
|
||||
{% set body %}
|
||||
{% if icon %}{{ icon(icon, 'w-4 h-4 shrink-0') }}{% endif %}
|
||||
<span class="whitespace-nowrap">{{ block('content') }}</span>
|
||||
{% endset %}
|
||||
<li class="py-2 first:pt-0 last:pb-0 overflow-x-hidden">
|
||||
{% if url %}
|
||||
<a href="{{ url }}" {{ attributes.defaults({class: 'flex items-center space-x-1'}).without('url', 'icon') }}>{{ body }}</a>
|
||||
{% else %}
|
||||
<div {{ attributes.defaults({class: 'flex items-center space-x-1'}).without('url', 'icon') }}>{{ body }}</div>
|
||||
{% endif %}
|
||||
</li>
|
||||
@@ -0,0 +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>
|
||||
{% block actions %}{% endblock %}
|
||||
</h2>
|
||||
{% if entries|trim is empty %}
|
||||
{% block empty %}
|
||||
<p class="py-2 text-sm text-gray-500">{{ emptyText }}</p>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
<ul class="divide-y divide-gray-200">{{ entries }}</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in New Issue
Block a user