diff --git a/app/app/routes/app.withdrawals.tsx b/app/app/routes/app.withdrawals.tsx index 1b3ccfd..2d72303 100644 --- a/app/app/routes/app.withdrawals.tsx +++ b/app/app/routes/app.withdrawals.tsx @@ -7,6 +7,7 @@ import { DataTable, Text, Badge, + Banner, BlockStack, } from "@shopify/polaris"; import { TitleBar } from "@shopify/app-bridge-react"; @@ -15,6 +16,18 @@ import { authenticate } from "../shopify.server"; import db from "../db.server"; import { formatTransmittedAt } from "../lib/recesso.server"; +// Scadenza rimborso (Art. 56): trasmissione + 14 giorni, data Europe/Rome. +function refundBy(transmittedAt: Date): string { + const d = new Date(transmittedAt); + d.setDate(d.getDate() + 14); + return new Intl.DateTimeFormat("it-IT", { + timeZone: "Europe/Rome", + day: "2-digit", + month: "2-digit", + year: "numeric", + }).format(d); +} + export const loader = async ({ request }: LoaderFunctionArgs) => { const { session } = await authenticate.admin(request); const items = await db.withdrawalRequest.findMany({ @@ -29,6 +42,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => { customerName: w.customerName, email: w.email, transmittedAt: formatTransmittedAt(w.transmittedAt), + refundBy: refundBy(w.transmittedAt), receiptSent: !!w.receiptSentAt, hasReturn: !!w.shopifyReturnId, })), @@ -43,6 +57,7 @@ export default function WithdrawalsPage() { r.customerName, r.email, r.transmittedAt, + r.refundBy, r.receiptSent ? "Inviata" : "-", r.hasReturn ? "Sì" : "-", ]); @@ -68,6 +83,11 @@ export default function WithdrawalsPage() { Registro recessi ({rows.length}) + + Ricorda: disponi il rimborso entro 14 giorni dalla richiesta + (art. 56). Puoi trattenere fino alla riconsegna della merce o + alla prova di spedizione. +