Files

69 lines
3.0 KiB
Plaintext

@page "/admin/npcs/shops"
@model Npcs.ShopsModel
@{
ViewData["Title"] = "NPC Shops";
}
<div class="space-y-6">
<div class="flex items-center justify-between">
<div>
<h1 class="text-3xl font-bold text-white">NPC Shops</h1>
<p class="text-gray-400 mt-1">Create and manage shop inventories for NPCs</p>
</div>
<a href="/admin/npcs/shops/edit" class="btn btn-primary">Create Shop</a>
</div>
<div class="card p-4">
<form method="get" class="flex items-end gap-4">
<div class="flex-1">
<label class="label">Search</label>
<input type="text" name="search" value="@Model.Search" class="input" placeholder="Search by shop name..." />
</div>
<button class="btn btn-secondary" type="submit">Filter</button>
<a class="btn btn-secondary" href="/admin/npcs/shops">Clear</a>
</form>
</div>
<div class="card overflow-hidden">
<table class="w-full">
<thead class="bg-gray-900/50">
<tr>
<th class="table-header w-16">ID</th>
<th class="table-header">Name</th>
<th class="table-header w-24">Slots</th>
<th class="table-header w-20">Enabled</th>
<th class="table-header w-24">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-700">
@foreach (var s in Model.Shops)
{
<tr class="hover:bg-gray-700/30">
<td class="table-cell font-mono text-gray-500">@s.Id</td>
<td class="table-cell text-white font-medium">@s.Name</td>
<td class="table-cell text-gray-300">@Model.ItemCountByShopId.GetValueOrDefault(s.Id)</td>
<td class="table-cell text-gray-300">@(s.IsEnabled ? "Yes" : "No")</td>
<td class="table-cell">
<div class="flex gap-2">
<a href="/admin/npcs/shops/edit?id=@s.Id" class="btn btn-secondary btn-sm">Edit</a>
<form method="post" asp-page-handler="Delete" class="inline" onsubmit="return confirm('Delete this shop?');">
@Html.AntiForgeryToken()
<input type="hidden" name="id" value="@s.Id" />
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
</form>
</div>
</td>
</tr>
}
@if (!Model.Shops.Any())
{
<tr>
<td colspan="5" class="table-cell text-center text-gray-500 py-10">No shops found.</td>
</tr>
}
</tbody>
</table>
</div>
</div>