141 lines
7.0 KiB
Plaintext
141 lines
7.0 KiB
Plaintext
@page "/admin/loottables"
|
|
@model LootTables.IndexModel
|
|
@{
|
|
ViewData["Title"] = "Loot Tables";
|
|
}
|
|
|
|
<div class="space-y-6">
|
|
<!-- Header -->
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-3xl font-bold text-white">Loot Tables</h1>
|
|
<p class="text-gray-400 mt-1">Manage loot table definitions</p>
|
|
</div>
|
|
<a href="/admin/loottables/edit" class="btn btn-primary flex items-center gap-2">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
|
</svg>
|
|
Create Loot Table
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="card p-4">
|
|
<form method="get" class="flex flex-wrap items-end gap-4">
|
|
<div class="flex-1 min-w-[200px]">
|
|
<label class="label">Search</label>
|
|
<input type="text" name="search" value="@Model.Search" class="input" placeholder="Search by name..." />
|
|
</div>
|
|
<button type="submit" class="btn btn-secondary">Filter</button>
|
|
<a href="/admin/loottables" class="btn btn-secondary">Clear</a>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Loot Tables List -->
|
|
<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">Tier</th>
|
|
<th class="table-header w-24">Drops</th>
|
|
<th class="table-header w-24">Entries</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 table in Model.LootTables)
|
|
{
|
|
<tr class="hover:bg-gray-700/30">
|
|
<td class="table-cell font-mono text-gray-500">@table.Id</td>
|
|
<td class="table-cell">
|
|
<span class="font-medium text-white">@table.Name</span>
|
|
@if (!string.IsNullOrEmpty(table.Description))
|
|
{
|
|
<p class="text-xs text-gray-500 truncate max-w-xs">@table.Description</p>
|
|
}
|
|
</td>
|
|
<td class="table-cell">
|
|
<span class="text-gray-400">@table.MinTier - @table.MaxTier</span>
|
|
</td>
|
|
<td class="table-cell">
|
|
<span class="text-gray-400">@table.MinDrops - @table.MaxDrops</span>
|
|
@if (table.GuaranteedDrop)
|
|
{
|
|
<span class="ml-1 text-green-400 text-xs">✓</span>
|
|
}
|
|
</td>
|
|
<td class="table-cell">
|
|
<span class="badge badge-common">@table.Entries.Count</span>
|
|
</td>
|
|
<td class="table-cell">
|
|
@if (table.IsEnabled)
|
|
{
|
|
<span class="w-3 h-3 bg-green-500 rounded-full inline-block" title="Enabled"></span>
|
|
}
|
|
else
|
|
{
|
|
<span class="w-3 h-3 bg-red-500 rounded-full inline-block" title="Disabled"></span>
|
|
}
|
|
</td>
|
|
<td class="table-cell">
|
|
<div class="flex items-center gap-1">
|
|
<a href="/admin/loottables/edit?id=@table.Id" class="p-1.5 hover:bg-gray-700 rounded" title="Edit">
|
|
<svg class="w-4 h-4 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
|
|
</svg>
|
|
</a>
|
|
<button type="button" onclick="confirmDelete(@table.Id, '@table.Name.Replace("'", "\\'"))" class="p-1.5 hover:bg-gray-700 rounded" title="Delete">
|
|
<svg class="w-4 h-4 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
@if (!Model.LootTables.Any())
|
|
{
|
|
<tr>
|
|
<td colspan="7" class="table-cell text-center text-gray-500 py-12">
|
|
No loot tables found. <a href="/admin/loottables/edit" class="text-indigo-400 hover:underline">Create one?</a>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Delete Modal -->
|
|
<div id="deleteModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50">
|
|
<div class="bg-gray-800 rounded-xl p-6 max-w-md w-full mx-4 border border-gray-700">
|
|
<h3 class="text-lg font-semibold text-white mb-2">Delete Loot Table</h3>
|
|
<p class="text-gray-400 mb-4">Are you sure you want to delete "<span id="deleteItemName" class="text-white"></span>"? All entries will be deleted.</p>
|
|
<form method="post" asp-page-handler="Delete" class="flex justify-end gap-3">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="id" id="deleteItemId" />
|
|
<button type="button" onclick="closeDeleteModal()" class="btn btn-secondary">Cancel</button>
|
|
<button type="submit" class="btn btn-danger">Delete</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script>
|
|
function confirmDelete(id, name) {
|
|
document.getElementById('deleteItemId').value = id;
|
|
document.getElementById('deleteItemName').textContent = name;
|
|
document.getElementById('deleteModal').classList.remove('hidden');
|
|
document.getElementById('deleteModal').classList.add('flex');
|
|
}
|
|
function closeDeleteModal() {
|
|
document.getElementById('deleteModal').classList.add('hidden');
|
|
document.getElementById('deleteModal').classList.remove('flex');
|
|
}
|
|
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeDeleteModal(); });
|
|
</script>
|
|
}
|