Skip to content

Commit

Permalink
動作を確認
Browse files Browse the repository at this point in the history
  • Loading branch information
Astalum committed Nov 2, 2024
1 parent 826d51d commit 38f9de5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pos/app/routes/cashier-mini.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function CasherMini() {
documentSub({ converter: cashierStateConverter }),
);
const order = orderState?.edittingOrder;
const [charge, setCharge] = useState(0);
const submittedOrderId = orderState?.submittedOrderId;

const { data: preOrder } = useSWRSubscription(
Expand All @@ -41,6 +42,10 @@ export default function CasherMini() {
videoRef.current?.play();
}, [thanksShowing]);

useEffect(() => {
setCharge(order?.received - order?.billingAmount);
}, [order?.received, order?.billingAmount]);

return (
<>
<div
Expand All @@ -59,7 +64,7 @@ export default function CasherMini() {
className="h-3/5 w-full object-contain"
/>
</div>
<div className="wrap flex h-full flex-col bg-theme px-[50px] pt-[40px]">
<div className="wrap flex h-screen flex-col bg-theme px-[50px] pt-[40px]">
<p className="pb-[50px] font-serif text-5xl text-white">
No. <span className="text-6xl">{orderId}</span>
</p>
Expand All @@ -74,7 +79,7 @@ export default function CasherMini() {
合計: {order?.billingAmount ?? 0}
</p>
<p className="font-serif text-4xl text-white">
お釣り: {order?.getCharge()}
お釣り: {charge > 0 ? charge : 0}
</p>
</div>
</div>
Expand Down

0 comments on commit 38f9de5

Please sign in to comment.