Files
oslstats/internal/view/adminview/confirm_dialog.templ
2026-02-13 20:51:39 +11:00

48 lines
1.8 KiB
Plaintext

package adminview
import "fmt"
templ ConfirmDeleteRole(roleID int, roleName string) {
<!-- Modal Overlay -->
<div
class="fixed inset-0 bg-crust/80 flex items-center justify-center z-50"
@click.self="document.getElementById('confirm-dialog').innerHTML = ''"
>
<div class="bg-surface0 border border-surface1 rounded-lg w-full max-w-md p-6">
<div class="flex items-start space-x-4">
<div class="flex-shrink-0">
<svg class="w-12 h-12 text-red" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
</svg>
</div>
<div class="flex-1">
<h3 class="text-lg font-bold text-text mb-2">Delete Role</h3>
<p class="text-sm text-subtext0 mb-4">
Are you sure you want to delete the role <span class="font-semibold text-text">{ roleName }</span>?
This action cannot be undone and will remove this role from all users who have it assigned.
</p>
<div class="flex justify-end space-x-2">
<button
type="button"
class="px-4 py-2 bg-surface1 text-text rounded hover:bg-surface2 transition"
@click="document.getElementById('confirm-dialog').innerHTML = ''"
>
Cancel
</button>
<button
type="button"
class="px-4 py-2 bg-red text-mantle rounded font-semibold hover:bg-maroon transition"
hx-delete={ fmt.Sprintf("/admin/roles/%d", roleID) }
hx-target="#admin-content"
hx-swap="innerHTML"
hx-on::before-request="document.getElementById('confirm-dialog').innerHTML = ''; document.getElementById('role-modal').innerHTML = ''"
>
Delete Role
</button>
</div>
</div>
</div>
</div>
</div>
}