{% extends "layouts/app.blade.rs" %}
{% block content %}
<div class="max-w-7xl mx-auto px-4 py-6 text-xs sm:text-sm">
<div class="flex justify-between items-center mb-4 pb-3 border-b border-borderBg">
<div>
<h1 class="text-base font-bold text-white tracking-tight code-font">{{ name }} Management</h1>
<p class="text-slate-400 text-[10px] mt-0.5">Manage your {{ snake_name }} list efficiently.</p>
</div>
<div>
<a href="/{{ snake_name }}s/create" class="inline-flex items-center bg-primary hover:bg-blue-600 text-white font-bold py-1.5 px-3 rounded text-[11px] transition shadow" hx-boost="true">
<svg class="w-3.5 h-3.5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
Create New
</a>
</div>
</div>
<div class="bg-cardBg border border-borderBg rounded shadow-md overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-left text-xs border-collapse">
<thead>
<tr class="bg-darkBg/60 text-slate-400 uppercase font-bold border-b border-borderBg text-[10px]">
<th class="px-3 py-2">ID</th>
{{th_cols}}
<th class="px-3 py-2">Created At</th>
<th class="px-3 py-2 text-right">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-borderBg text-slate-300">
{% for item in items %}
<tr class="hover:bg-darkBg/30 transition text-[11px]">
<td class="px-3 py-2 text-slate-400 code-font">#{{ item.id }}</td>
{{td_cols}}
<td class="px-3 py-2 text-slate-500 code-font">{{ item.created_at }}</td>
<td class="px-3 py-2 text-right space-x-1.5">
<a href="/{{ snake_name }}s/{{ item.id }}/edit" class="inline-flex items-center px-2 py-0.5 bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20 text-[10px] font-semibold rounded transition" hx-boost="true">Edit</a>
<form action="/{{ snake_name }}s/{{ item.id }}/delete" method="POST" class="inline" hx-boost="true" onsubmit="return confirm('Yakin ingin menghapus?')">
<button type="submit" class="inline-flex items-center px-2 py-0.5 bg-danger/10 text-danger border border-danger/20 hover:bg-danger/20 text-[10px] font-semibold rounded transition">Delete</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="10" class="px-3 py-6 text-center text-slate-500 italic">No records found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}