Skip to content

Commit 1eab5f2

Browse files
committed
ui update
1 parent 3fcf951 commit 1eab5f2

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

src/app/claim/new/page.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ type UploadItem = {
2727

2828
const currencies: Currency[] = ["CHF", "USD", "EUR", "CNY", "GBP"];
2929

30+
const INVOICE_REQUIRED_TAG_IDS = new Set<string>([
31+
// 在此处填写需要强制上传正规发票的标签 ID,例如 'tag-id-invoice'
32+
]);
33+
3034
function makeObjectKey(file: File): string {
3135
const today = new Date().toISOString().slice(0, 10);
3236
const uuid = (globalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2)) as string;
@@ -60,6 +64,10 @@ export default function NewClaimPage() {
6064
}, []);
6165

6266
const uploadedPhotos = useMemo(() => uploads.filter((u) => u.status === "done" && !!u.photo).map((u) => u.photo as PhotoResponse), [uploads]);
67+
const requiresInvoiceReminder = useMemo(
68+
() => selectedTagIds.some((id) => INVOICE_REQUIRED_TAG_IDS.has(id)),
69+
[selectedTagIds],
70+
);
6371

6472
async function handleFilesChosen(files: FileList | null) {
6573
if (!files || files.length === 0) return;
@@ -259,6 +267,12 @@ export default function NewClaimPage() {
259267
<input type="password" value={password2} onChange={(e) => setPassword2(e.target.value)} className="w-full rounded border px-3 py-2 bg-transparent" placeholder={t('passwordConfirm')} />
260268
</section>
261269

270+
{requiresInvoiceReminder && (
271+
<div className="rounded border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800">
272+
{t("invoiceReminder")}
273+
</div>
274+
)}
275+
262276
{error && <div className="text-sm text-red-600">{error}</div>}
263277

264278
<div className="flex items-center gap-3">

src/components/ClaimFlowchart.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function ClaimFlowchart({ current }: Props) {
2020
PAID: t("status_PAID"),
2121
FINISHED: t("status_FINISHED"),
2222
REJECTED: t("status_REJECTED"),
23+
PAYMENT_FAILED: t("status_PAYMENT_FAILED"),
2324
WITHDRAW: t("status_WITHDRAW"),
2425
}),
2526
[t]
@@ -86,6 +87,7 @@ export function ClaimFlowchart({ current }: Props) {
8687
setNode("PAID");
8788
setNode("FINISHED");
8889
setNode("REJECTED");
90+
setNode("PAYMENT_FAILED");
8991
setNode("WITHDRAW");
9092

9193
// Edges
@@ -105,7 +107,7 @@ export function ClaimFlowchart({ current }: Props) {
105107
edge("PAID", "FINISHED");
106108
edge("SUBMITTED", "WITHDRAW");
107109
edge("SUBMITTED", "REJECTED");
108-
edge("APPROVED", "REJECTED");
110+
edge("APPROVED", "PAYMENT_FAILED");
109111

110112
const svg = d3.select(svgEl);
111113
svg.selectAll("*").remove();

src/lib/i18n.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const dict: Record<Lang, Record<string, string>> = {
3939
payoutBankAddress: "银行地址",
4040
tags: "标签",
4141
attachments: "附件(发票/小票照片)",
42+
invoiceReminder: "请务必在附件中上传正规发票,否则审批可能被驳回。",
4243
password: "访问密码(可选)",
4344
passwordHint: "可为该报销单设置访问密码。设置后,查看或更新需要输入此密码。",
4445
passwordConfirm: "再次输入密码",
@@ -49,7 +50,7 @@ const dict: Record<Lang, Record<string, string>> = {
4950
process: "流程",
5051
actions: "操作",
5152
withdraw: "撤回申请",
52-
confirmFinish: "确认收款,标记为完成",
53+
confirmFinish: "确认收款",
5354
amount: "金额",
5455
expenseAt: "消费时间",
5556
createdAt: "创建时间",
@@ -62,6 +63,7 @@ const dict: Record<Lang, Record<string, string>> = {
6263
status_PAID: "已支付",
6364
status_FINISHED: "已完成",
6465
status_REJECTED: "已拒绝",
66+
status_PAYMENT_FAILED: "付款失败",
6567
status_WITHDRAW: "已撤回",
6668
claimIdNote: "此 ID 类似密码,请妥善保管,不要分享。",
6769
copy: "复制",
@@ -97,6 +99,7 @@ const dict: Record<Lang, Record<string, string>> = {
9799
payoutBankAddress: "Bank Address",
98100
tags: "Tags",
99101
attachments: "Attachments (receipt photos)",
102+
invoiceReminder: "Please upload the official invoice as an attachment before submitting, otherwise the claim may be rejected.",
100103
password: "Password (optional)",
101104
passwordHint: "You can set a password. Viewing or updating later requires it.",
102105
passwordConfirm: "Confirm password",
@@ -107,7 +110,7 @@ const dict: Record<Lang, Record<string, string>> = {
107110
process: "Process",
108111
actions: "Actions",
109112
withdraw: "Withdraw",
110-
confirmFinish: "Confirm received, mark finished",
113+
confirmFinish: "Confirm received",
111114
amount: "Amount",
112115
expenseAt: "Expense Time",
113116
createdAt: "Created At",
@@ -120,6 +123,7 @@ const dict: Record<Lang, Record<string, string>> = {
120123
status_PAID: "Paid",
121124
status_FINISHED: "Finished",
122125
status_REJECTED: "Rejected",
126+
status_PAYMENT_FAILED: "Payment Failed",
123127
status_WITHDRAW: "Withdrawn",
124128
claimIdNote: "Treat this ID like a password. Keep it private.",
125129
copy: "Copy",
@@ -155,6 +159,7 @@ const dict: Record<Lang, Record<string, string>> = {
155159
payoutBankAddress: "Bankadresse",
156160
tags: "Tags",
157161
attachments: "Beilagen (Belege/Fotos)",
162+
invoiceReminder: "Bitte laden Sie vor dem Einreichen die offizielle Rechnung als Anhang hoch, sonst kann die Spesenanfrage abgelehnt werden.",
158163
password: "Passwort (optional)",
159164
passwordHint: "Sie können ein Passwort setzen. Ansicht/Änderung erfordert es.",
160165
passwordConfirm: "Passwort bestätigen",
@@ -165,7 +170,7 @@ const dict: Record<Lang, Record<string, string>> = {
165170
process: "Ablauf",
166171
actions: "Aktionen",
167172
withdraw: "Zurückziehen",
168-
confirmFinish: "Erhalt bestätigen, als abgeschlossen markieren",
173+
confirmFinish: "Erhalt bestätigen",
169174
amount: "Betrag",
170175
expenseAt: "Ausgabedatum",
171176
createdAt: "Erstellt am",
@@ -178,6 +183,7 @@ const dict: Record<Lang, Record<string, string>> = {
178183
status_PAID: "Bezahlt",
179184
status_FINISHED: "Abgeschlossen",
180185
status_REJECTED: "Abgelehnt",
186+
status_PAYMENT_FAILED: "Zahlung fehlgeschlagen",
181187
status_WITHDRAW: "Zurückgezogen",
182188
claimIdNote: "Behandeln Sie diese ID wie ein Passwort. Nicht teilen.",
183189
copy: "Kopieren",
@@ -213,6 +219,7 @@ const dict: Record<Lang, Record<string, string>> = {
213219
payoutBankAddress: "Adresse de la banque",
214220
tags: "Tags",
215221
attachments: "Pièces jointes (reçus)",
222+
invoiceReminder: "Veuillez joindre la facture officielle dans les fichiers avant l'envoi, sans quoi la demande pourrait être refusée.",
216223
password: "Mot de passe (optionnel)",
217224
passwordHint: "Vous pouvez définir un mot de passe. Requis pour consulter/modifier.",
218225
passwordConfirm: "Confirmer le mot de passe",
@@ -223,7 +230,7 @@ const dict: Record<Lang, Record<string, string>> = {
223230
process: "Processus",
224231
actions: "Actions",
225232
withdraw: "Retirer",
226-
confirmFinish: "Confirmer reçu, marquer terminé",
233+
confirmFinish: "Confirmer reçu",
227234
amount: "Montant",
228235
expenseAt: "Date de dépense",
229236
createdAt: "Créé le",
@@ -236,6 +243,7 @@ const dict: Record<Lang, Record<string, string>> = {
236243
status_PAID: "Payé",
237244
status_FINISHED: "Terminé",
238245
status_REJECTED: "Rejeté",
246+
status_PAYMENT_FAILED: "Paiement échoué",
239247
status_WITHDRAW: "Retiré",
240248
claimIdNote: "Considérez cet ID comme un mot de passe. Ne le partagez pas.",
241249
copy: "Copier",
@@ -271,6 +279,7 @@ const dict: Record<Lang, Record<string, string>> = {
271279
payoutBankAddress: "Indirizzo della banca",
272280
tags: "Tag",
273281
attachments: "Allegati (ricevute/foto)",
282+
invoiceReminder: "Ricordati di caricare la fattura ufficiale tra gli allegati prima di inviare, altrimenti la richiesta potrebbe essere rifiutata.",
274283
password: "Password (opzionale)",
275284
passwordHint: "Puoi impostare una password. Sarà richiesta per vedere/modificare in seguito.",
276285
passwordConfirm: "Conferma password",
@@ -281,7 +290,7 @@ const dict: Record<Lang, Record<string, string>> = {
281290
process: "Processo",
282291
actions: "Azioni",
283292
withdraw: "Ritira",
284-
confirmFinish: "Conferma ricevuto, segna come completata",
293+
confirmFinish: "Conferma ricevuto",
285294
amount: "Importo",
286295
expenseAt: "Data della spesa",
287296
createdAt: "Creato il",
@@ -294,6 +303,7 @@ const dict: Record<Lang, Record<string, string>> = {
294303
status_PAID: "Pagata",
295304
status_FINISHED: "Completata",
296305
status_REJECTED: "Rifiutata",
306+
status_PAYMENT_FAILED: "Pagamento fallito",
297307
status_WITHDRAW: "Ritirata",
298308
claimIdNote: "Tratta questo ID come una password. Mantienilo privato.",
299309
copy: "Copia",

src/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type ClaimStatus =
99
| 'PAID'
1010
| 'FINISHED'
1111
| 'REJECTED'
12+
| 'PAYMENT_FAILED'
1213
| 'WITHDRAW';
1314

1415
export interface PayoutInfo {

0 commit comments

Comments
 (0)