This commit is contained in:
Thomas Peterson 2025-01-20 22:48:46 +01:00
parent e13304227d
commit 4ac4e19d0f
8 changed files with 222 additions and 34 deletions

View File

@ -28,8 +28,12 @@
}
.badge-yes {
@apply inline-flex rounded bg-lime-500 px-2 py-1 text-sm font-medium text-white hover:bg-opacity-90;
@apply inline-flex rounded-sm bg-lime-500 px-2 py-1 text-sm font-medium text-white hover:bg-opacity-90 min-w-20 justify-center shadow-xl;
}
.badge-no {
@apply inline-flex rounded bg-orange-500 px-2 py-1 text-sm font-medium text-white hover:bg-opacity-90;
@apply inline-flex rounded-sm bg-orange-500 px-2 py-1 text-sm font-medium text-white hover:bg-opacity-90 min-w-20 justify-center shadow-xl;
}
.table-icon, .button-icon {
@apply w-6;
}

View File

@ -1,4 +1,5 @@
{% extends 'backend_tailwind_base.html.twig' %}
{% do pagination.setSortableTemplate('tailwind_sortable.html.twig') %}
{% trans_default_domain 'core_news_list' %}
{% block header %}
<div>
@ -9,44 +10,56 @@
{{ 'News'|trans }} {{ 'List'|trans }}</h1>
</div>
<div class="flex flex-wrap items-center gap-4 justify-start shrink-0">
<a href="{{ path("psc_shop_news_backend_create") }}" class="inline-flex items-center justify-center py-1 gap-1 font-medium rounded-sm border px-4 text-sm text-white shadow-lg bg-psc-500 hover:bg-psc-600 hover:ring-2 hover:ring-psc-500 hover:ring-offset-2 min-h-[2.25rem]"><span class="fa fa-edit"></span> {{ 'Addnews'|trans }}</a>
<a href="{{ path("psc_shop_news_backend_create") }}" class="inline-flex items-center justify-center py-1 gap-1 font-medium rounded-sm px-4 text-sm text-white shadow-lg bg-psc-500 hover:bg-psc-600 hover:ring-2 hover:ring-psc-500 hover:ring-offset-2 min-h-[2.25rem]">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="button-icon">
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
</svg>
{{ 'Addnews'|trans }}</a>
</div>
{% endblock %}
{% block body %}
<div class="rounded-sm border bg-white px-7.5 py-6 shadow-lg dark:border-strokedark dark:bg-boxdark">
<div class="flex items-center justify-between p-2 h-14">
<div class="flex items-center gap-2"></div>
<div class="flex items-center justify-end w-full gap-2 md:max-w-md">
<div class="filament-tables-search-container flex items-center justify-end flex-1">
</div>
</div>
</div>
<div class="">
<div class="w-full grid grid-cols-4 border-t border-stroke px-4 bg-slate-100 py-4.5 dark:border-strokedark sm:grid-cols-8 md:px-6 2xl:px-7.5">
<div class="hidden sm:flex col-span-1 px-6 py-3">
{{ knp_pagination_sortable(pagination, 'Uid'|trans, 'news.uid') }}
</div>
<div class="col-span-1 px-6 py-3">{{ knp_pagination_sortable(pagination, 'active'|trans, 'news.enable') }}</div>
<div class="col-span-2 px-6 py-3">{{ knp_pagination_sortable(pagination, 'Name'|trans, 'news.title') }}</div>
<div class="hidden sm:flex sm:col-span-2 px-6 py-3">{{ knp_pagination_sortable(pagination, 'Introduction'|trans, 'news.introduction') }}</div>
<div class="hidden sm:flex col-span-1 px-6 py-3">{{ knp_pagination_sortable(pagination, 'Sortdate'|trans, 'news.sortDate') }}</div>
<div class="col-span-1 px-6 py-3">
{{ knp_pagination_sortable(pagination, 'active'|trans, 'news.enable') }}
</div>
<div class="col-span-2 px-6 py-3">
{{ knp_pagination_sortable(pagination, 'Name'|trans, 'news.title') }}
</div>
<div class="hidden sm:flex sm:col-span-2 px-6 py-3">
{{ knp_pagination_sortable(pagination, 'Introduction'|trans, 'news.introduction') }}
</div>
<div class="hidden sm:flex col-span-1 px-6 py-3">
{{ knp_pagination_sortable(pagination, 'Sortdate'|trans, 'news.sortDate') }}
</div>
<div class="col-span-1 px-6 py-3"></div>
</div>
{% for news in pagination %}
<div class="w-full grid grid-cols-4 border-t border-stroke px-4 py-4.5 dark:border-strokedark sm:grid-cols-8 md:px-6 2xl:px-7.5">
<div class="hidden sm:flex col-span-1 px-6 py-3">{{ news.uid }}</div>
<div class="col-span-1 px-6 py-3">{% if news.enable %}<span class="badge-yes">{{'yes'|trans}}</span>{% else %}<span
class="badge-no">{{'no'|trans}}</span>{% endif %}</div>
<div class="col-span-1 px-6 py-3">{% if news.enable %}<div class="badge-yes">{{'yes'|trans}}</div>{% else %}<div
class="badge-no">{{'no'|trans}}</div>{% endif %}</div>
<div class="col-span-2 px-6 py-3">{{ news.title }}</div>
<div class="hidden sm:flex sm:col-span-2 px-6 py-3">{{ news.introduction }}</div>
<div class="hidden sm:flex col-span-1 px-6 py-3">{{ news.sortDate|date('d.m.Y') }}</div>
<div class="col-span-1 px-6 py-3 text-end">
<a href="{{ path("psc_shop_news_backend_edit", {uid: news.uid}) }}"
class="btn btn-info btn-sm"><span class="fa fa-edit"></span></a>
<a href="{{ path("psc_shop_news_backend_delete", {uid: news.uid}) }}"
class="btn btn-danger btn-sm"><span class="fa fa-trash"></span></a>
<div class="col-span-1 px-6 py-3 text-end flex flex-row gap-2 justify-end">
<a href="{{ path("psc_shop_news_backend_edit", {uid: news.uid}) }}" class="">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="table-icon">
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
</svg>
</a>
<a href="{{ path("psc_shop_news_backend_delete", {uid: news.uid}) }}" class="">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="table-icon">
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
</svg>
</a>
</div>
</div>
{% endfor %}

View File

@ -0,0 +1,40 @@
{# tailwindcss Sliding pagination control implementation #}
{% if pageCount > 1 %}
<div class="inline-block">
<div class="flex items-baseline flex-row border border-gray-400 rounded-sm w-auto">
{% if first is defined and current != first %}
<span class="bg-white text-blue-600 px-3 py-2 text-lg border-r border-gray-400 font-bold">
<a href="{{ path(route, knp_pagination_query(query, first)) }}">&lt;&lt;</a>
</span>
{% endif %}
{% if previous is defined %}
<span class="bg-white text-blue-600 px-3 text-lg py-2 border-r border-gray-400">
<a rel="prev" href="{{ path(route, knp_pagination_query(query, previous)) }}">&lt;</a>
</span>
{% endif %}
{% for page in pagesInRange %}
{% if page != current %}
<span class="bg-white text-blue-600 px-3 py-2 text-lg border-r border-gray-400">
<a href="{{ path(route, knp_pagination_query(query, page)) }}">{{ page }}</a>
</span>
{% else %}
<span class="bg-blue-600 text-white px-3 py-2 text-lg font-bold">{{ page }}</span>
{% endif %}
{% endfor %}
{% if next is defined %}
<span class="bg-white text-blue-600 px-3 py-2 text-lg border-r border-gray-400">
<a rel="next" href="{{ path(route, knp_pagination_query(query, next)) }}">&gt;</a>
</span>
{% endif %}
{% if last is defined and current != last %}
<span class="bg-white text-blue-600 px-3 py-2 text-lg border-gray-400 font-bold">
<a href="{{ path(route, knp_pagination_query(query, last)) }}">&gt;&gt;</a>
</span>
{% endif %}
</div>
</div>
{% endif %}

View File

@ -0,0 +1,20 @@
<a{% for attr, value in options %} {{ attr }}="{{ value }}"{% endfor %}>
<span class="flex flex-row gap-2">
{% if sorted %}
{% if direction != 'desc' %}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="table-icon">
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 15.75 7.5-7.5 7.5 7.5" />
</svg>
{% else %}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="table-icon">
<path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" />
</svg>
{% endif %}
{% else %}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="table-icon">
<path stroke-linecap="round" stroke-linejoin="round" d="m4.5 15.75 7.5-7.5 7.5 7.5" />
</svg>
{% endif %}
{{ title }}
</span>
</a>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long