{% extends "dashboard_layout.blade.rs" %}
{% block content %}
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6">
<div>
<h1 class="text-2xl font-bold text-slate-800">{{ name }} Management</h1>
<p class="text-sm text-slate-500">Kelola data {{ name }} dengan mudah dan cepat.</p>
</div>
<div>
<a href="/{{ snake_name }}s/create" class="inline-flex items-center justify-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg shadow-sm transition-colors duration-200" hx-boost="true">
<svg class="w-5 h-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>
Tambah Baru
</a>
</div>
</div>
<div class="bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-left text-sm text-slate-600">
<thead class="bg-slate-50 text-slate-500 uppercase text-xs font-bold border-b border-slate-100">
<tr>
<th class="px-6 py-4">ID</th>
{{th_cols}}
<th class="px-6 py-4">Created At</th>
<th class="px-6 py-4 text-right">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
{% for item in items %}
<tr class="hover:bg-slate-50/50 transition-colors">
<td class="px-6 py-4 font-medium text-slate-800">#{{ item.id }}</td>
{{td_cols}}
<td class="px-6 py-4 text-slate-400">{{ item.created_at }}</td>
<td class="px-6 py-4 text-right space-x-2">
<a href="/{{ snake_name }}s/{{ item.id }}/edit" class="inline-flex items-center px-3 py-1.5 bg-blue-50 text-blue-600 hover:bg-blue-100 text-xs font-semibold rounded-lg transition-colors" 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-3 py-1.5 bg-red-50 text-red-600 hover:bg-red-100 text-xs font-semibold rounded-lg transition-colors">Hapus</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="10" class="px-6 py-8 text-center text-slate-400 italic">Data kosong.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}