Dashboard Recessi: promemoria rimborso 14gg (Art. 56) + colonna 'Rimborsa entro' (trasmissione + 14gg)
Il promemoria non e' piu' solo nella notifica email: visibile anche dove il merchant gestisce le richieste (funziona pure con notifiche off). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mv83a29B4eFv5ixoj6PoE1
This commit is contained in:
@@ -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() {
|
||||
<Text as="h2" variant="headingMd">
|
||||
Registro recessi ({rows.length})
|
||||
</Text>
|
||||
<Banner tone="warning">
|
||||
Ricorda: disponi il rimborso entro 14 giorni dalla richiesta
|
||||
(art. 56). Puoi trattenere fino alla riconsegna della merce o
|
||||
alla prova di spedizione.
|
||||
</Banner>
|
||||
<DataTable
|
||||
columnContentTypes={[
|
||||
"text",
|
||||
@@ -76,12 +96,14 @@ export default function WithdrawalsPage() {
|
||||
"text",
|
||||
"text",
|
||||
"text",
|
||||
"text",
|
||||
]}
|
||||
headings={[
|
||||
"Ordine",
|
||||
"Cliente",
|
||||
"Email",
|
||||
"Trasmesso",
|
||||
"Rimborsa entro",
|
||||
"Ricevuta",
|
||||
"Reso",
|
||||
]}
|
||||
|
||||
Reference in New Issue
Block a user