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,
|
DataTable,
|
||||||
Text,
|
Text,
|
||||||
Badge,
|
Badge,
|
||||||
|
Banner,
|
||||||
BlockStack,
|
BlockStack,
|
||||||
} from "@shopify/polaris";
|
} from "@shopify/polaris";
|
||||||
import { TitleBar } from "@shopify/app-bridge-react";
|
import { TitleBar } from "@shopify/app-bridge-react";
|
||||||
@@ -15,6 +16,18 @@ import { authenticate } from "../shopify.server";
|
|||||||
import db from "../db.server";
|
import db from "../db.server";
|
||||||
import { formatTransmittedAt } from "../lib/recesso.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) => {
|
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||||
const { session } = await authenticate.admin(request);
|
const { session } = await authenticate.admin(request);
|
||||||
const items = await db.withdrawalRequest.findMany({
|
const items = await db.withdrawalRequest.findMany({
|
||||||
@@ -29,6 +42,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|||||||
customerName: w.customerName,
|
customerName: w.customerName,
|
||||||
email: w.email,
|
email: w.email,
|
||||||
transmittedAt: formatTransmittedAt(w.transmittedAt),
|
transmittedAt: formatTransmittedAt(w.transmittedAt),
|
||||||
|
refundBy: refundBy(w.transmittedAt),
|
||||||
receiptSent: !!w.receiptSentAt,
|
receiptSent: !!w.receiptSentAt,
|
||||||
hasReturn: !!w.shopifyReturnId,
|
hasReturn: !!w.shopifyReturnId,
|
||||||
})),
|
})),
|
||||||
@@ -43,6 +57,7 @@ export default function WithdrawalsPage() {
|
|||||||
r.customerName,
|
r.customerName,
|
||||||
r.email,
|
r.email,
|
||||||
r.transmittedAt,
|
r.transmittedAt,
|
||||||
|
r.refundBy,
|
||||||
r.receiptSent ? "Inviata" : "-",
|
r.receiptSent ? "Inviata" : "-",
|
||||||
r.hasReturn ? "Sì" : "-",
|
r.hasReturn ? "Sì" : "-",
|
||||||
]);
|
]);
|
||||||
@@ -68,6 +83,11 @@ export default function WithdrawalsPage() {
|
|||||||
<Text as="h2" variant="headingMd">
|
<Text as="h2" variant="headingMd">
|
||||||
Registro recessi ({rows.length})
|
Registro recessi ({rows.length})
|
||||||
</Text>
|
</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
|
<DataTable
|
||||||
columnContentTypes={[
|
columnContentTypes={[
|
||||||
"text",
|
"text",
|
||||||
@@ -76,12 +96,14 @@ export default function WithdrawalsPage() {
|
|||||||
"text",
|
"text",
|
||||||
"text",
|
"text",
|
||||||
"text",
|
"text",
|
||||||
|
"text",
|
||||||
]}
|
]}
|
||||||
headings={[
|
headings={[
|
||||||
"Ordine",
|
"Ordine",
|
||||||
"Cliente",
|
"Cliente",
|
||||||
"Email",
|
"Email",
|
||||||
"Trasmesso",
|
"Trasmesso",
|
||||||
|
"Rimborsa entro",
|
||||||
"Ricevuta",
|
"Ricevuta",
|
||||||
"Reso",
|
"Reso",
|
||||||
]}
|
]}
|
||||||
|
|||||||
Reference in New Issue
Block a user