Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
58 lines
2.3 KiB
TypeScript
58 lines
2.3 KiB
TypeScript
"use client";
|
|
|
|
import type { ReactNode } from "react";
|
|
import { Check } from "lucide-react";
|
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/app/components/ui/dialog";
|
|
import { Button } from "@/app/components/ui/button";
|
|
import { useMoney } from "@/app/pos/currency";
|
|
import { useT } from "@/app/lib/i18n/MessagesProvider";
|
|
|
|
// After a POS sale (redesign-pos-sale-flow, BABYBOO-38): "Payment complete", the receipt (children, built
|
|
// by the page), how the buyer gets the goods, and Start new sale — the only way out, so the operator
|
|
// never loses the receipt by a stray tap.
|
|
|
|
interface ReceiptDialogProps {
|
|
open: boolean;
|
|
documentNo: string;
|
|
total: number;
|
|
/** "Taken in store", "Pick up at …" or "Delivery to …". */
|
|
collection: string;
|
|
onNewSale: () => void;
|
|
children: ReactNode;
|
|
}
|
|
|
|
export function ReceiptDialog({ open, documentNo, total, collection, onNewSale, children }: ReceiptDialogProps) {
|
|
const money = useMoney();
|
|
const t = useT();
|
|
const [collectionPre, collectionPost] = t("PosCollectionLabel").split("{collection}");
|
|
return (
|
|
<Dialog open={open}>
|
|
<DialogContent
|
|
showCloseButton={false}
|
|
onEscapeKeyDown={(e) => e.preventDefault()}
|
|
onInteractOutside={(e) => e.preventDefault()}
|
|
className="max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-3xl [&>*]:min-w-0"
|
|
>
|
|
<div className="flex flex-col items-center gap-2 text-center">
|
|
<span className="flex size-14 items-center justify-center rounded-full bg-positive/10 text-positive">
|
|
<Check aria-hidden="true" className="size-7" />
|
|
</span>
|
|
<DialogTitle className="text-2xl">{t("PosPaymentComplete")}</DialogTitle>
|
|
<DialogDescription className="[overflow-wrap:anywhere]">
|
|
{t("PosSaleSummary", { documentNo, total: money(total) })}
|
|
</DialogDescription>
|
|
</div>
|
|
<p data-testid="receipt-collection" className="rounded-md border px-3 py-2 text-sm">
|
|
<span className="text-muted-foreground">{collectionPre}</span>
|
|
{collection}
|
|
{collectionPost}
|
|
</p>
|
|
<div>{children}</div>
|
|
<Button type="button" className="h-12 w-full text-base" onClick={onNewSale}>
|
|
{t("PosStartNewSale")}
|
|
</Button>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|