feat(admin): add draw management features including create, update, delete, and batch delete functionalities

- Implemented API functions for creating, updating, and deleting draws.
- Enhanced the admin draws console with UI components for managing draws.
- Added internationalization support for new draw management actions and messages.
This commit is contained in:
2026-05-25 18:00:43 +08:00
parent eb02252431
commit f080e6ba8e
15 changed files with 948 additions and 24 deletions

View File

@@ -0,0 +1,25 @@
import type { AdminDrawListItem } from "@/types/api/admin-draws";
const CANCELLABLE_STATUSES = new Set(["pending", "open", "closing", "closed"]);
export function drawHasNoBets(row: AdminDrawListItem): boolean {
return (row.total_bet_minor ?? 0) === 0;
}
export function canEditDrawRow(row: AdminDrawListItem): boolean {
if (!drawHasNoBets(row)) {
return false;
}
return row.status === "pending" || row.status === "open";
}
export function canDeleteDrawRow(row: AdminDrawListItem): boolean {
return row.status === "pending" && drawHasNoBets(row);
}
export function canCancelDrawRow(row: AdminDrawListItem): boolean {
if (!drawHasNoBets(row)) {
return false;
}
return CANCELLABLE_STATUSES.has(row.status);
}