save
This commit is contained in:
parent
1ed14b5549
commit
642546040a
13 changed files with 406 additions and 20 deletions
62
src/views/admin/products/index.twig
Normal file
62
src/views/admin/products/index.twig
Normal file
|
@ -0,0 +1,62 @@
|
|||
<section class="flex flex-col gap-4">
|
||||
{% include 'lib/alert.twig' %}
|
||||
|
||||
<h3 class="text-2xl font-semibold">
|
||||
Categories
|
||||
</h3>
|
||||
<a href="/admin/categories/add">
|
||||
{% include 'lib/buttons/primary.twig' with {
|
||||
label: 'Create a Category'
|
||||
} %}
|
||||
</a>
|
||||
<table class="min-w-full">
|
||||
<tr>
|
||||
<th class="py-2">
|
||||
Category ID
|
||||
</th>
|
||||
<th class="py-2">
|
||||
Title
|
||||
</th>
|
||||
<th class="py-2">
|
||||
Slug
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% macro renderCategory(category, depth) %}
|
||||
<tr>
|
||||
<td class="border px-4 py-2">
|
||||
{{ category.id }}
|
||||
</td>
|
||||
<td class="border px-4 py-2">
|
||||
{% if depth > 0 %}
|
||||
{% for i in 1..depth %}
|
||||
-
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{{ category.label }}
|
||||
</td>
|
||||
<td class="border px-4 py-2">
|
||||
{{ category.value }}
|
||||
</td>
|
||||
</tr>
|
||||
{% if category.children is defined and category.children is not empty %}
|
||||
{% for child in category.children %}
|
||||
{{ _self.renderCategory(child, depth + 1) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% if categories is not empty %}
|
||||
{% for category in categories %}
|
||||
{{ _self.renderCategory(category, 0) }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td class="border px-4 py-2" colspan="3">
|
||||
No categories yet.
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table></section>
|
Loading…
Add table
Add a link
Reference in a new issue