Admin Panel v6
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
@page "/admin/mobs"
|
||||
@model Mobs.IndexModel
|
||||
@using Server.Data.Enums
|
||||
@{
|
||||
ViewData["Title"] = "Mobs";
|
||||
}
|
||||
|
||||
<div class="space-y-6">
|
||||
<!-- Header -->
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-white">Mobs</h1>
|
||||
<p class="text-gray-400 mt-1">Manage mob definitions (@Model.MobCount total)</p>
|
||||
<p class="text-gray-400 mt-1">Manage mob definitions</p>
|
||||
</div>
|
||||
<a href="/admin/mobs/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">
|
||||
@@ -18,7 +20,140 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card p-8 text-center">
|
||||
<p class="text-gray-400">Mob editor coming soon...</p>
|
||||
<!-- 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>
|
||||
<div class="w-40">
|
||||
<label class="label">Type</label>
|
||||
<select name="type" class="input">
|
||||
<option value="">All Types</option>
|
||||
@foreach (var t in Enum.GetValues<MobType>())
|
||||
{
|
||||
<option value="@t" selected="@(Model.TypeFilter == t)">@t</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="w-40">
|
||||
<label class="label">Category</label>
|
||||
<select name="category" class="input">
|
||||
<option value="">All Categories</option>
|
||||
@foreach (var c in Enum.GetValues<MobCategory>())
|
||||
{
|
||||
<option value="@c" selected="@(Model.CategoryFilter == c)">@c</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-secondary">Filter</button>
|
||||
<a href="/admin/mobs" class="btn btn-secondary">Clear</a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Mobs Table -->
|
||||
<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">Type</th>
|
||||
<th class="table-header w-28">Category</th>
|
||||
<th class="table-header w-24">Tier</th>
|
||||
<th class="table-header w-20">HP</th>
|
||||
<th class="table-header w-20">DMG</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 mob in Model.Mobs)
|
||||
{
|
||||
<tr class="hover:bg-gray-700/30">
|
||||
<td class="table-cell font-mono text-gray-500">@mob.Id</td>
|
||||
<td class="table-cell">
|
||||
<span class="font-medium text-white">@mob.Name</span>
|
||||
@if (!string.IsNullOrEmpty(mob.Description))
|
||||
{
|
||||
<p class="text-xs text-gray-500 truncate max-w-xs">@mob.Description</p>
|
||||
}
|
||||
</td>
|
||||
<td class="table-cell">
|
||||
<span class="badge @(mob.Type == MobType.Boss ? "badge-legendary" : mob.Type == MobType.Elite ? "badge-epic" : "badge-common")">
|
||||
@mob.Type
|
||||
</span>
|
||||
</td>
|
||||
<td class="table-cell text-gray-400">@mob.Category</td>
|
||||
<td class="table-cell text-gray-400">@mob.MinTier - @mob.MaxTier</td>
|
||||
<td class="table-cell text-green-400">@mob.BaseHealth</td>
|
||||
<td class="table-cell text-red-400">@mob.BasePhysicalDamage</td>
|
||||
<td class="table-cell">
|
||||
@if (mob.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/mobs/edit?id=@mob.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(@mob.Id, '@mob.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.Mobs.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="9" class="table-cell text-center text-gray-500 py-12">
|
||||
No mobs found. <a href="/admin/mobs/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 Mob</h3>
|
||||
<p class="text-gray-400 mb-4">Are you sure you want to delete "<span id="deleteItemName" class="text-white"></span>"?</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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user