收口后台删除确认事件

This commit is contained in:
2026-04-25 13:19:13 +08:00
parent 2d4593c597
commit d875dd08ec
4 changed files with 24 additions and 2 deletions
+11
View File
@@ -84,4 +84,15 @@ export function bindAdminAutoactControls() {
void toggleAutoactEvent(toggleButton);
}
});
document.addEventListener("submit", (event) => {
if (!(event.target instanceof HTMLFormElement)) {
return;
}
const confirmMessage = event.target.getAttribute("data-autoact-delete-confirm");
if (confirmMessage && !window.confirm(confirmMessage)) {
event.preventDefault();
}
});
}
+11
View File
@@ -193,4 +193,15 @@ export function bindAdminFishingEventsControls() {
void toggleFishingEvent(toggleButton);
}
});
document.addEventListener("submit", (event) => {
if (!(event.target instanceof HTMLFormElement)) {
return;
}
const confirmMessage = event.target.getAttribute("data-fishing-delete-confirm");
if (confirmMessage && !window.confirm(confirmMessage)) {
event.preventDefault();
}
});
}
@@ -106,7 +106,7 @@
</td>
<td class="p-3">
<form action="{{ route('admin.autoact.destroy', $event->id) }}" method="POST"
class="inline" onsubmit="return confirm('确定要删除此事件吗?')">
class="inline" data-autoact-delete-confirm="确定要删除此事件吗?">
@csrf
@method('DELETE')
<button type="submit"
@@ -98,7 +98,7 @@
编辑
</button>
<form action="{{ route('admin.fishing.destroy', $event->id) }}" method="POST"
class="inline" onsubmit="return confirm('确定删除事件「{{ $event->name }}」?')">
class="inline" data-fishing-delete-confirm="确定删除事件「{{ $event->name }}」?">
@csrf @method('DELETE')
<button type="submit"
class="px-3 py-1 bg-red-50 text-red-600 rounded text-xs font-bold hover:bg-red-100 transition">