feat(i18n): 更新英文、尼泊尔语与中文的注单状态翻译

修改多语言配置文件,将 success 统一替换为 placed,并新增 partial_failed 与 refunded 状态,以提升注单管理中的状态表达清晰度。
增强国际化支持,确保多语言间术语一致性,进一步优化后台管理界面的用户体验。
This commit is contained in:
2026-05-27 09:57:56 +08:00
parent 0bd9d8d3d8
commit e87229c1b7
6 changed files with 260 additions and 287 deletions

View File

@@ -33,12 +33,14 @@
"all": "All", "all": "All",
"pending_confirm": "Pending confirmation", "pending_confirm": "Pending confirmation",
"partial_pending_confirm": "Partially pending confirmation", "partial_pending_confirm": "Partially pending confirmation",
"success": "Bet placed", "placed": "Placed",
"pending_draw": "Awaiting draw", "pending_draw": "Awaiting draw",
"partial_failed": "Partially failed",
"failed": "Bet failed", "failed": "Bet failed",
"pending_payout": "Pending payout", "pending_payout": "Pending payout",
"settled_win": "Settled win", "settled_win": "Settled win",
"settled_lose": "Settled loss" "settled_lose": "Settled loss",
"refunded": "Refunded"
}, },
"allTickets": "All tickets" "allTickets": "All tickets"
} }

View File

@@ -32,12 +32,14 @@
"all": "सबै", "all": "सबै",
"pending_confirm": "पुष्टि बाँकी", "pending_confirm": "पुष्टि बाँकी",
"partial_pending_confirm": "आंशिक पुष्टि बाँकी", "partial_pending_confirm": "आंशिक पुष्टि बाँकी",
"success": "बेट सफल", "placed": "बेट राखियो",
"pending_draw": "ड्र पर्खँदै", "pending_draw": "ड्र पर्खँदै",
"partial_failed": "आंशिक असफल",
"failed": "बेट असफल", "failed": "बेट असफल",
"pending_payout": "भुक्तानी बाँकी", "pending_payout": "भुक्तानी बाँकी",
"settled_win": "जित सेटल भयो", "settled_win": "जित सेटल भयो",
"settled_lose": "हार सेटल भयो" "settled_lose": "हार सेटल भयो",
"refunded": "फिर्ता भयो"
}, },
"allTickets": "सबै टिकट" "allTickets": "सबै टिकट"
} }

View File

@@ -33,12 +33,14 @@
"all": "全部", "all": "全部",
"pending_confirm": "待确认", "pending_confirm": "待确认",
"partial_pending_confirm": "部分待确认", "partial_pending_confirm": "部分待确认",
"success": "已投注成功", "placed": "已下单",
"pending_draw": "待开奖", "pending_draw": "待开奖",
"partial_failed": "部分失败",
"failed": "投注失败", "failed": "投注失败",
"pending_payout": "待派奖", "pending_payout": "待派奖",
"settled_win": "已中奖结算", "settled_win": "已中奖结算",
"settled_lose": "已未中奖结算" "settled_lose": "已未中奖结算",
"refunded": "已退款"
}, },
"allTickets": "全部注单" "allTickets": "全部注单"
} }

View File

@@ -40,7 +40,6 @@ import {
TableHeader, TableHeader,
TableRow, TableRow,
} from "@/components/ui/table"; } from "@/components/ui/table";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { AdminStatusBadge } from "@/components/admin/admin-status-badge"; import { AdminStatusBadge } from "@/components/admin/admin-status-badge";
import { ConfigReadonlyValue } from "@/modules/config/config-readonly-value"; import { ConfigReadonlyValue } from "@/modules/config/config-readonly-value";
import { ConfigVersionActions } from "@/modules/config/config-version-actions"; import { ConfigVersionActions } from "@/modules/config/config-version-actions";
@@ -156,12 +155,6 @@ export function PlayConfigDocScreen() {
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const detailRequestSeq = useRef(0); const detailRequestSeq = useRef(0);
const [ruleDialogOpen, setRuleDialogOpen] = useState(false);
const [rulePlayCode, setRulePlayCode] = useState<string | null>(null);
const [ruleDraftZh, setRuleDraftZh] = useState("");
const [ruleDraftEn, setRuleDraftEn] = useState("");
const [ruleDraftNe, setRuleDraftNe] = useState("");
const refreshList = useCallback(async () => { const refreshList = useCallback(async () => {
setLoadingList(true); setLoadingList(true);
setError(null); setError(null);
@@ -361,29 +354,6 @@ export function PlayConfigDocScreen() {
} }
} }
function openRuleEditor(play_code: string) {
const item = draftRows.find((row) => row.play_code === play_code);
setRulePlayCode(play_code);
setRuleDraftZh(item?.rule_text_zh ?? "");
setRuleDraftEn(item?.rule_text_en ?? "");
setRuleDraftNe(item?.rule_text_ne ?? "");
setRuleDialogOpen(true);
}
function saveRuleDraft() {
if (!rulePlayCode) {
return;
}
updateConfigRow(rulePlayCode, {
rule_text_zh: ruleDraftZh.trim() || null,
rule_text_en: ruleDraftEn.trim() || null,
rule_text_ne: ruleDraftNe.trim() || null,
});
setRuleDialogOpen(false);
setRulePlayCode(null);
toast.message(t("play.ruleSavedLocal", { ns: "config" }));
}
function renderDisplayNameReadonly(row: PlayConfigItemRow) { function renderDisplayNameReadonly(row: PlayConfigItemRow) {
const name = row.display_name?.trim(); const name = row.display_name?.trim();
return <span>{name || row.play_code}</span>; return <span>{name || row.play_code}</span>;
@@ -580,7 +550,6 @@ export function PlayConfigDocScreen() {
<TableHead className="w-24 text-center">{t("play.table.order", { ns: "config" })}</TableHead> <TableHead className="w-24 text-center">{t("play.table.order", { ns: "config" })}</TableHead>
<TableHead className="w-[110px] text-center">{t("play.table.minBet", { ns: "config" })}</TableHead> <TableHead className="w-[110px] text-center">{t("play.table.minBet", { ns: "config" })}</TableHead>
<TableHead className="w-[110px] text-center">{t("play.table.maxBet", { ns: "config" })}</TableHead> <TableHead className="w-[110px] text-center">{t("play.table.maxBet", { ns: "config" })}</TableHead>
<TableHead className="w-[140px] text-center">{t("play.table.actions", { ns: "config" })}</TableHead>
</TableRow> </TableRow>
</TableHeader> </TableHeader>
<TableBody> <TableBody>
@@ -712,78 +681,12 @@ export function PlayConfigDocScreen() {
</ConfigReadonlyValue> </ConfigReadonlyValue>
)} )}
</TableCell> </TableCell>
<TableCell className="text-center">
{isDraft ? (
<Button
type="button"
variant="outline"
disabled={saving}
onClick={() => openRuleEditor(row.play_code)}
>
{t("play.actions.ruleText", { ns: "config" })}
</Button>
) : (
<AdminStatusBadge status="disabled" className="mx-auto w-fit">
{t("play.states.readOnly", { ns: "config" })}
</AdminStatusBadge>
)}
</TableCell>
</TableRow> </TableRow>
))} ))}
</TableBody> </TableBody>
</Table> </Table>
)} )}
<Dialog open={ruleDialogOpen} onOpenChange={setRuleDialogOpen}>
<DialogContent showCloseButton className="sm:max-w-lg">
<DialogHeader>
<DialogTitle>{t("play.ruleDialog.title", { ns: "config" })}</DialogTitle>
<DialogDescription>
{t("play.ruleDialog.description", { ns: "config", playCode: rulePlayCode ?? "—" })}
</DialogDescription>
</DialogHeader>
<Tabs defaultValue="zh" className="w-full">
<TabsList className="w-full">
<TabsTrigger value="zh">{t("play.locales.zh", { ns: "config" })}</TabsTrigger>
<TabsTrigger value="en">{t("play.locales.en", { ns: "config" })}</TabsTrigger>
<TabsTrigger value="ne">{t("play.locales.ne", { ns: "config" })}</TabsTrigger>
</TabsList>
<TabsContent value="zh" className="mt-3">
<textarea
id="rule-zh"
className="border-input bg-background ring-ring/24 focus-visible:ring-[3px] min-h-[140px] w-full rounded-lg border px-3 py-2 text-sm outline-none"
value={ruleDraftZh}
onChange={(e) => setRuleDraftZh(e.target.value)}
/>
</TabsContent>
<TabsContent value="en" className="mt-3">
<textarea
id="rule-en"
className="border-input bg-background ring-ring/24 focus-visible:ring-[3px] min-h-[140px] w-full rounded-lg border px-3 py-2 text-sm outline-none"
value={ruleDraftEn}
onChange={(e) => setRuleDraftEn(e.target.value)}
/>
</TabsContent>
<TabsContent value="ne" className="mt-3">
<textarea
id="rule-ne"
className="border-input bg-background ring-ring/24 focus-visible:ring-[3px] min-h-[140px] w-full rounded-lg border px-3 py-2 text-sm outline-none"
value={ruleDraftNe}
onChange={(e) => setRuleDraftNe(e.target.value)}
/>
</TabsContent>
</Tabs>
<DialogFooter>
<Button type="button" variant="outline" onClick={() => setRuleDialogOpen(false)}>
{t("actions.cancel", { ns: "adminUsers" })}
</Button>
<Button type="button" onClick={saveRuleDraft}>
{t("play.ruleDialog.apply", { ns: "config" })}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
<Dialog open={rollbackOpen} onOpenChange={setRollbackOpen}> <Dialog open={rollbackOpen} onOpenChange={setRollbackOpen}>
<DialogContent showCloseButton className="sm:max-w-md"> <DialogContent showCloseButton className="sm:max-w-md">
<DialogHeader> <DialogHeader>

View File

@@ -237,209 +237,270 @@ export function JackpotPoolsConsole({ embedded = false }: JackpotPoolsConsolePro
const d = drafts[p.id] ?? toDraft(p); const d = drafts[p.id] ?? toDraft(p);
const adj = adjustmentDrafts[p.id] ?? { direction: "increase", amount: "", reason: "" }; const adj = adjustmentDrafts[p.id] ?? { direction: "increase", amount: "", reason: "" };
const ledger = adjustmentRows[p.id] ?? []; const ledger = adjustmentRows[p.id] ?? [];
const currentAmount = formatAdminMinorDecimal(p.current_amount, p.currency_code);
const triggerThreshold = formatAdminMinorDecimal(p.trigger_threshold, p.currency_code);
const minBetAmount = formatAdminMinorDecimal(p.min_bet_amount, p.currency_code);
const statusOn = d.status === "1";
return ( return (
<div <div
key={p.id} key={p.id}
className="space-y-4 rounded-xl border border-border/60 bg-muted/10 p-4" className="space-y-3 rounded-xl border border-border/60 bg-background p-3 shadow-sm"
> >
<div className="flex flex-wrap items-baseline justify-between gap-2"> <div className="flex flex-wrap items-center justify-between gap-2">
<h3 className="font-mono text-sm font-semibold">{p.currency_code}</h3> <div>
<p className="text-muted-foreground font-mono text-xs"> <h3 className="font-mono text-sm font-semibold">{p.currency_code}</h3>
{t("displayBalance", { <p className="text-muted-foreground text-xs">{t("configTitle")}</p>
amount: formatAdminMinorDecimal(p.current_amount, p.currency_code), </div>
})} <p className="text-muted-foreground font-mono text-xs">{t("displayBalance", { amount: currentAmount })}</p>
</p>
</div> </div>
{canManageJackpot ? (
<div className="space-y-3 rounded-lg border border-border/60 bg-background/60 p-4"> <div className="grid gap-2 sm:grid-cols-2 xl:grid-cols-4">
<p className="text-sm font-medium">{t("balanceAdjustmentTitle")}</p> <div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
<p className="text-muted-foreground text-xs">{t("balanceAdjustmentHint")}</p> <p className="text-muted-foreground text-xs">{t("currentAmount")}</p>
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-4"> <p className="mt-0.5 font-mono text-base font-semibold">{currentAmount}</p>
<div className="space-y-1.5"> </div>
<Label>{t("adjustmentDirection")}</Label> <div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
<Select <p className="text-muted-foreground text-xs">{t("status")}</p>
value={adj.direction} <p className="mt-0.5 text-base font-semibold">
onValueChange={(value: "increase" | "decrease") => {statusOn ? t("enabled") : t("disabled")}
updateAdjustmentDraft(p.id, { direction: value }) </p>
} </div>
> <div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
<SelectTrigger className="font-mono"> <p className="text-muted-foreground text-xs">{t("payoutRate")}</p>
<SelectValue /> <p className="mt-0.5 font-mono text-base font-semibold">{d.payout_rate}</p>
</SelectTrigger> </div>
<SelectContent> <div className="rounded-lg border border-border/60 bg-muted/20 p-2.5">
<SelectItem value="increase">{t("adjustmentIncrease")}</SelectItem> <p className="text-muted-foreground text-xs">{t("forceTriggerGap")}</p>
<SelectItem value="decrease">{t("adjustmentDecrease")}</SelectItem> <p className="mt-0.5 font-mono text-base font-semibold">{d.force_trigger_draw_gap}</p>
</SelectContent> </div>
</Select> </div>
<div className="grid gap-3 xl:grid-cols-12">
<div className="space-y-3 xl:col-span-8">
{canManageJackpot ? (
<div className="space-y-2 rounded-lg border border-border/60 bg-background p-3">
<p className="text-sm font-medium">{t("balanceAdjustmentTitle")}</p>
<p className="text-muted-foreground text-xs">{t("balanceAdjustmentHint")}</p>
<div className="grid gap-2 sm:grid-cols-2">
<div className="space-y-1.5">
<Label>{t("adjustmentDirection")}</Label>
<Select
value={adj.direction}
onValueChange={(value: "increase" | "decrease") =>
updateAdjustmentDraft(p.id, { direction: value })
}
>
<SelectTrigger className="w-full min-w-0 sm:max-w-[12rem]">
<SelectValue>
{(value) =>
value === "increase"
? t("adjustmentIncrease")
: value === "decrease"
? t("adjustmentDecrease")
: value != null
? String(value)
: t("adjustmentIncrease")
}
</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem value="increase">{t("adjustmentIncrease")}</SelectItem>
<SelectItem value="decrease">{t("adjustmentDecrease")}</SelectItem>
</SelectContent>
</Select>
</div>
<div className="space-y-1.5">
<Label htmlFor={`adj-amt-${p.id}`}>{t("adjustmentAmount")}</Label>
<Input
id={`adj-amt-${p.id}`}
className="font-mono"
value={adj.amount}
onChange={(e) => updateAdjustmentDraft(p.id, { amount: e.target.value })}
/>
</div>
<div className="space-y-1.5 sm:col-span-2">
<Label htmlFor={`adj-reason-${p.id}`}>{t("adjustmentReason")}</Label>
<Textarea
id={`adj-reason-${p.id}`}
rows={1}
value={adj.reason}
onChange={(e) => updateAdjustmentDraft(p.id, { reason: e.target.value })}
/>
</div>
</div>
<div className="flex justify-end">
<Button
type="button"
variant="secondary"
disabled={adjustingId === p.id}
onClick={() =>
requestConfirm({
title: t("confirmAdjustmentTitle"),
description: t("confirmAdjustmentDescription"),
confirmLabel: t("confirm.confirmSave", { ns: "common" }),
onConfirm: () => submitAdjustment(p),
})
}
>
{adjustingId === p.id ? t("processing") : t("submitAdjustment")}
</Button>
</div>
</div> </div>
) : null}
<fieldset
disabled={!canManageJackpot}
className="grid gap-2 rounded-lg border border-border/60 bg-background p-3 sm:grid-cols-2"
>
<div className="space-y-1.5"> <div className="space-y-1.5">
<Label htmlFor={`adj-amt-${p.id}`}>{t("adjustmentAmount")}</Label> <Label htmlFor={`th-${p.id}`}>{t("triggerThreshold")}</Label>
<Input <Input
id={`adj-amt-${p.id}`} id={`th-${p.id}`}
className="font-mono" className="font-mono"
value={adj.amount} value={d.trigger_threshold}
onChange={(e) => updateAdjustmentDraft(p.id, { amount: e.target.value })} onChange={(e) => updateDraft(p.id, { trigger_threshold: e.target.value })}
/> />
</div> </div>
<div className="space-y-1.5 sm:col-span-2 xl:col-span-2"> <div className="space-y-1.5">
<Label htmlFor={`adj-reason-${p.id}`}>{t("adjustmentReason")}</Label> <Label htmlFor={`min-${p.id}`}>{t("minBetAmount")}</Label>
<Textarea <Input
id={`adj-reason-${p.id}`} id={`min-${p.id}`}
rows={2} className="font-mono"
value={adj.reason} value={d.min_bet_amount}
onChange={(e) => updateAdjustmentDraft(p.id, { reason: e.target.value })} onChange={(e) => updateDraft(p.id, { min_bet_amount: e.target.value })}
/> />
</div> </div>
</div> <div className="space-y-1.5">
<div className="flex justify-end"> <Label htmlFor={`pr-${p.id}`}>{t("payoutRate")}</Label>
<Button <Input
type="button" id={`pr-${p.id}`}
variant="secondary" className="font-mono"
disabled={adjustingId === p.id} value={d.payout_rate}
onClick={() => onChange={(e) => updateDraft(p.id, { payout_rate: e.target.value })}
requestConfirm({ />
title: t("confirmAdjustmentTitle"), </div>
description: t("confirmAdjustmentDescription"), <div className="space-y-1.5">
confirmLabel: t("confirm.confirmSave", { ns: "common" }), <Label htmlFor={`gap-${p.id}`}>{t("forceTriggerGap")}</Label>
onConfirm: () => submitAdjustment(p), <Input
}) id={`gap-${p.id}`}
} className="font-mono"
> value={d.force_trigger_draw_gap}
{adjustingId === p.id ? t("processing") : t("submitAdjustment")} onChange={(e) => updateDraft(p.id, { force_trigger_draw_gap: e.target.value })}
</Button> />
</div> </div>
{ledger.length > 0 ? ( <div className="space-y-1.5">
<div className="space-y-2 border-t border-border/60 pt-3"> <Label htmlFor={`cr-${p.id}`}>{t("contributionRate")}</Label>
<p className="text-xs font-medium">{t("recentAdjustments")}</p> <Input
<ul className="text-muted-foreground space-y-1 font-mono text-xs"> id={`cr-${p.id}`}
className="font-mono"
value={d.contribution_rate}
onChange={(e) => updateDraft(p.id, { contribution_rate: e.target.value })}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor={`combo-${p.id}`}>{t("comboTriggerPlays")}</Label>
<Input
id={`combo-${p.id}`}
className="font-mono"
value={d.combo_trigger_play_codes}
placeholder="straight,ibox"
onChange={(e) => updateDraft(p.id, { combo_trigger_play_codes: e.target.value })}
/>
</div>
<div className="flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2 sm:col-span-2">
<Label htmlFor={`status-${p.id}`} className="text-sm font-medium">
{t("status")}
</Label>
<Switch
id={`status-${p.id}`}
checked={statusOn}
disabled={!canManageJackpot}
aria-label={t("status")}
onCheckedChange={(checked) =>
updateDraft(p.id, { status: checked ? "1" : "0" })
}
/>
</div>
{canManageJackpot ? (
<div className="flex justify-end sm:col-span-2">
<Button
type="button"
disabled={savingId === p.id}
onClick={() =>
requestConfirm({
title: t("confirmSavePoolTitle"),
description: t("confirmSavePoolDescription"),
confirmLabel: t("confirm.confirmSave", { ns: "common" }),
onConfirm: () => save(p),
})
}
>
{savingId === p.id ? t("saving") : t("save")}
</Button>
</div>
) : null}
</fieldset>
</div>
<div className="space-y-3 xl:col-span-4">
<div className="rounded-lg border border-border/60 bg-background p-3">
<div className="mb-2 flex items-center justify-between gap-2">
<p className="text-sm font-medium">{t("recentAdjustments")}</p>
<span className="text-muted-foreground text-xs">{ledger.length}</span>
</div>
{ledger.length > 0 ? (
<ul className="max-h-60 space-y-2 overflow-y-auto pr-1">
{ledger.map((row) => ( {ledger.map((row) => (
<li key={row.id}> <li key={row.id} className="rounded-md border border-border/60 bg-muted/20 p-2">
{row.adjustment_no} · {row.amount_delta > 0 ? "+" : ""} <div className="flex items-center justify-between gap-2">
{formatAdminMinorDecimal(row.amount_delta, p.currency_code)} ·{" "} <span className="font-mono text-xs">{row.adjustment_no}</span>
{row.reason} <span className="font-mono text-xs">
{row.amount_delta > 0 ? "+" : ""}
{formatAdminMinorDecimal(row.amount_delta, p.currency_code)}
</span>
</div>
<p className="text-muted-foreground mt-1 line-clamp-2 text-xs">{row.reason}</p>
</li> </li>
))} ))}
</ul> </ul>
</div> ) : (
) : null} <p className="text-muted-foreground text-xs"></p>
</div> )}
) : null} </div>
<fieldset disabled={!canManageJackpot} className="grid gap-4 border-0 p-0 sm:grid-cols-2 xl:grid-cols-4">
<div className="space-y-1.5"> <div className="rounded-lg border border-border/60 bg-background p-3">
<Label htmlFor={`cr-${p.id}`}>{t("contributionRate")}</Label> <p className="text-muted-foreground text-xs">{t("triggerThreshold")}</p>
<Input <p className="mt-0.5 font-mono text-sm">{triggerThreshold}</p>
id={`cr-${p.id}`} <p className="text-muted-foreground mt-2 text-xs">{t("minBetAmount")}</p>
className="font-mono" <p className="mt-0.5 font-mono text-sm">{minBetAmount}</p>
value={d.contribution_rate}
onChange={(e) => updateDraft(p.id, { contribution_rate: e.target.value })}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor={`th-${p.id}`}>{t("triggerThreshold")}</Label>
<Input
id={`th-${p.id}`}
className="font-mono"
value={d.trigger_threshold}
onChange={(e) => updateDraft(p.id, { trigger_threshold: e.target.value })}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor={`pr-${p.id}`}>{t("payoutRate")}</Label>
<Input
id={`pr-${p.id}`}
className="font-mono"
value={d.payout_rate}
onChange={(e) => updateDraft(p.id, { payout_rate: e.target.value })}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor={`gap-${p.id}`}>{t("forceTriggerGap")}</Label>
<Input
id={`gap-${p.id}`}
className="font-mono"
value={d.force_trigger_draw_gap}
onChange={(e) => updateDraft(p.id, { force_trigger_draw_gap: e.target.value })}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor={`min-${p.id}`}>{t("minBetAmount")}</Label>
<Input
id={`min-${p.id}`}
className="font-mono"
value={d.min_bet_amount}
onChange={(e) => updateDraft(p.id, { min_bet_amount: e.target.value })}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor={`combo-${p.id}`}>{t("comboTriggerPlays")}</Label>
<Input
id={`combo-${p.id}`}
className="font-mono"
value={d.combo_trigger_play_codes}
placeholder="straight,ibox"
onChange={(e) => updateDraft(p.id, { combo_trigger_play_codes: e.target.value })}
/>
</div>
<div className="flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5">
<Label htmlFor={`status-${p.id}`} className="text-sm font-medium">
{t("status")}
</Label>
<Switch
id={`status-${p.id}`}
checked={d.status === "1"}
disabled={!canManageJackpot}
aria-label={t("status")}
onCheckedChange={(checked) =>
updateDraft(p.id, { status: checked ? "1" : "0" })
}
/>
</div>
</fieldset>
{canManageJackpot ? (
<div className="flex justify-end border-t border-border/60 pt-3">
<Button
type="button"
disabled={savingId === p.id}
onClick={() =>
requestConfirm({
title: t("confirmSavePoolTitle"),
description: t("confirmSavePoolDescription"),
confirmLabel: t("confirm.confirmSave", { ns: "common" }),
onConfirm: () => save(p),
})
}
>
{savingId === p.id ? t("saving") : t("save")}
</Button>
</div>
) : null}
{canManualBurst ? (
<div className="rounded-lg border border-amber-200/80 bg-amber-50/80 p-4 dark:border-amber-900/50 dark:bg-amber-950/30">
<p className="mb-1 text-xs font-medium text-amber-900 dark:text-amber-200">
{t("manualBurst")}
</p>
<p className="mb-3 text-xs text-amber-800/90 dark:text-amber-300/90">{t("manualBurstHint")}</p>
<div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end">
<div className="min-w-0 flex-1 space-y-1.5 sm:max-w-xs">
<Label htmlFor={`burst-draw-${p.id}`}>{t("manualBurstDrawId")}</Label>
<Input
id={`burst-draw-${p.id}`}
className="font-mono"
value={d.manual_burst_draw_id}
onChange={(e) => updateDraft(p.id, { manual_burst_draw_id: e.target.value })}
/>
</div> </div>
<Button
type="button"
variant="destructive"
className="shrink-0 sm:ml-auto"
disabled={burstingId === p.id}
onClick={() => setConfirmBurstPoolId(p.id)}
>
{burstingId === p.id ? t("processing") : t("manualBurst")}
</Button>
</div> </div>
</div> </div>
{canManualBurst ? (
<div className="rounded-lg border border-destructive/30 bg-destructive/5 p-3">
<p className="mb-1 text-sm font-medium text-destructive">{t("manualBurst")}</p>
<p className="mb-2 text-xs text-muted-foreground">{t("manualBurstHint")}</p>
<div className="flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-end">
<div className="min-w-0 flex-1 space-y-1.5 sm:max-w-xs">
<Label htmlFor={`burst-draw-${p.id}`}>{t("manualBurstDrawId")}</Label>
<Input
id={`burst-draw-${p.id}`}
className="font-mono"
value={d.manual_burst_draw_id}
onChange={(e) => updateDraft(p.id, { manual_burst_draw_id: e.target.value })}
/>
</div>
<Button
type="button"
variant="destructive"
className="shrink-0 sm:ml-auto"
disabled={burstingId === p.id}
onClick={() => setConfirmBurstPoolId(p.id)}
>
{burstingId === p.id ? t("processing") : t("manualBurst")}
</Button>
</div>
</div>
) : null} ) : null}
</div> </div>
); );

View File

@@ -33,15 +33,18 @@ import { LotteryApiBizError } from "@/types/api/errors";
import type { AdminTicketItemsData } from "@/types/api/admin-tickets"; import type { AdminTicketItemsData } from "@/types/api/admin-tickets";
import { ChevronDown } from "lucide-react"; import { ChevronDown } from "lucide-react";
/** 与玩家端、注项表 status 字段对齐(不含无效的 success */
const TICKET_STATUS_OPTIONS = [ const TICKET_STATUS_OPTIONS = [
"pending_confirm", "pending_confirm",
"partial_pending_confirm", "partial_pending_confirm",
"placed",
"pending_draw", "pending_draw",
"success", "partial_failed",
"failed", "failed",
"pending_payout", "pending_payout",
"settled_win", "settled_win",
"settled_lose", "settled_lose",
"refunded",
] as const; ] as const;
type TicketFilters = { type TicketFilters = {