diff --git a/app/components/ui/alert-dialog.tsx b/app/components/ui/alert-dialog.tsx new file mode 100644 index 00000000..c99e42db --- /dev/null +++ b/app/components/ui/alert-dialog.tsx @@ -0,0 +1,139 @@ +import * as React from "react" +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" + +import { cn } from "~/lib/utils" +import { buttonVariants } from "~/components/ui/button" + +const AlertDialog = AlertDialogPrimitive.Root + +const AlertDialogTrigger = AlertDialogPrimitive.Trigger + +const AlertDialogPortal = AlertDialogPrimitive.Portal + +const AlertDialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName + +const AlertDialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + +)) +AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName + +const AlertDialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogHeader.displayName = "AlertDialogHeader" + +const AlertDialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogFooter.displayName = "AlertDialogFooter" + +const AlertDialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName + +const AlertDialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogDescription.displayName = + AlertDialogPrimitive.Description.displayName + +const AlertDialogAction = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName + +const AlertDialogCancel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName + +export { + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/app/routes/casher.tsx b/app/routes/casher.tsx new file mode 100644 index 00000000..f3246494 --- /dev/null +++ b/app/routes/casher.tsx @@ -0,0 +1,90 @@ +import { AlertDialogCancel } from "@radix-ui/react-alert-dialog"; +import { useState } from "react"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "~/components/ui/alert-dialog"; +import { Button } from "~/components/ui/button"; +import { Input } from "~/components/ui/input"; +import { Order } from "~/models/order"; + +const mockOrder: Order = { + orderId: 1, + createdAt: new Date(), + servedAt: null, + items: [ + { + type: "ice", + name: "珈琲・俺ブレンド", + price: 300, + }, + { + type: "ice", + name: "珈琲・俺ブレンド", + price: 400, + }, + ], + assignee: "1st", + total: 700, + orderReady: false, +}; + +export default function Casher() { + // const total = mockOrder.items.reduce((acc, cur) => acc + cur.price, 0); + const [recieved, setText] = useState(""); + const recieved_int = parseInt(recieved); + + console.log(mockOrder); + return ( +
+

珈琲・俺POS

+
    +

    +

    合計金額:

    + {/*

    {total}

    */} +

    {mockOrder.total}

    +

    +

    +

    受領金額:

    +
    + setText(event.target.value)} + /> + + + + + + + 金額を確認してください + +

    {"合計金額:" + String(mockOrder.total)}

    +

    {"受領額:" + recieved}

    +

    + {"お釣り:" + + String(recieved_int - mockOrder.total) + + " 円"} +

    +
    +
    + + 戻る + 送信 + +
    +
    +
    +

    +
+
+ ); +} diff --git a/bun.lockb b/bun.lockb index d38082d7..80033de1 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index b7dcdac7..283ee243 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dependencies": { "@conform-to/react": "^1.1.5", "@conform-to/zod": "^1.1.5", + "@radix-ui/react-alert-dialog": "^1.1.1", "@radix-ui/react-label": "^2.1.0", "@radix-ui/react-radio-group": "^1.2.0", "@radix-ui/react-slot": "^1.1.0",