feat(admin, players): enhance player management and admin interfaces
Some checks failed
lotteryadmin CI / build (push) Has been cancelled

Updated the player management components to improve error handling and display for various operations, including ticket loading and transaction retrieval. Introduced new status badges for better visual representation of player statuses. Enhanced localization support for error messages and improved the overall user experience in the admin console. Refactored components for better maintainability and clarity.
This commit is contained in:
2026-06-22 10:50:59 +08:00
parent d6c7d2c361
commit c6119da9f8
31 changed files with 777 additions and 463 deletions

View File

@@ -24,6 +24,8 @@ import { useCachedPlayTypeOptions } from "@/hooks/use-cached-play-type-options";
import { useAsyncEffect } from "@/hooks/use-async-effect";
import { useTranslationRef } from "@/hooks/use-translation-ref";
import { getAdminDraws, getAdminDrawFinanceSummary } from "@/api/admin-draws";
import { DrawStatusBadge } from "@/modules/draws/draw-status-badge";
import { drawStatusLabel } from "@/modules/draws/draw-display";
import { getAdminPlayers } from "@/api/admin-player";
import { downloadAdminReportJob, postAdminReportJob } from "@/api/admin-report-jobs";
import {
@@ -50,6 +52,7 @@ import {
import { useAdminProfile } from "@/stores/admin-session";
import { adminAgentDisplayLabel } from "@/components/admin/admin-agent-columns";
import { AdminNoResourceState, AdminTableNoResourceRow } from "@/components/admin/admin-no-resource-state";
import { AdminStatusBadge } from "@/components/admin/admin-status-badge";
import { AdminDateRangeField } from "@/components/admin/admin-date-range-field";
import { AdminListPaginationFooter } from "@/components/admin/admin-list-pagination-footer";
import { Button } from "@/components/ui/button";
@@ -1214,7 +1217,7 @@ export function ReportsConsole({ initialCategory }: { initialCategory?: ReportCa
}}
>
<span className="font-medium">{item.draw_no}</span>
<span className="text-xs text-muted-foreground">{item.status}</span>
<DrawStatusBadge status={item.status} label={drawStatusLabel(item.status, t)} />
</button>
))
) : null}
@@ -1363,7 +1366,9 @@ export function ReportsConsole({ initialCategory }: { initialCategory?: ReportCa
<>
<TableRow>
<TableCell className="font-medium">{summary.draw_no}</TableCell>
<TableCell>{summary.draw_status}</TableCell>
<TableCell>
<DrawStatusBadge status={summary.draw_status} label={drawStatusLabel(summary.draw_status, t)} />
</TableCell>
<TableCell className="text-center">{summary.order_count}</TableCell>
<TableCell className="text-center">{summary.ticket_item_count}</TableCell>
<TableCell className="text-center">{formatPlainMoney(summary.total_bet_minor, summary.currency_code)}</TableCell>
@@ -1376,7 +1381,9 @@ export function ReportsConsole({ initialCategory }: { initialCategory?: ReportCa
{summary.settlement_batches.map((batch) => (
<TableRow key={batch.id} className="bg-muted/15">
<TableCell>#{batch.id}</TableCell>
<TableCell>{batch.status}</TableCell>
<TableCell>
<AdminStatusBadge status={batch.status}>{batch.status}</AdminStatusBadge>
</TableCell>
<TableCell className="text-center">{batch.total_ticket_count}</TableCell>
<TableCell className="text-center">{batch.total_win_count}</TableCell>
<TableCell className="text-center">-</TableCell>
@@ -1395,7 +1402,9 @@ export function ReportsConsole({ initialCategory }: { initialCategory?: ReportCa
<TableCell className="font-mono text-xs">{item.transfer_no}</TableCell>
<TableCell>{optionText(item.username, item.nickname) || item.player_id}</TableCell>
<TableCell>{item.direction}</TableCell>
<TableCell>{item.status}</TableCell>
<TableCell>
<AdminStatusBadge status={item.status}>{item.status}</AdminStatusBadge>
</TableCell>
<TableCell className="text-center">{item.currency_code} {item.amount}</TableCell>
<TableCell>{item.external_ref_no || "-"}</TableCell>
<TableCell>{item.fail_reason || "-"}</TableCell>