Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pos /cashier-v2 割引入力時に前回の注文内容を表示する #236

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions app/components/organisms/DiscountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
useState,
} from "react";
import type { WithId } from "~/lib/typeguard";
import { cn } from "~/lib/utils";
import { OrderEntity } from "~/models/order";
import { useFocusRef } from "../functional/useFocusRef";
import { ThreeDigitsInput } from "../molecules/ThreeDigitsInput";
Expand Down Expand Up @@ -74,7 +75,7 @@ const DiscountInput = ({
/>
</div>
</div>
<p>
<div className="flex flex-col items-center gap-5">
{!isComplete && (
<div className="flex items-center">
{/* <ExclamationTriangleIcon className="mr-1 stroke-stone-400" /> */}
Expand All @@ -83,20 +84,36 @@ const DiscountInput = ({
)}
{isComplete &&
(discountOrder instanceof OrderEntity ? (
<div className="flex items-center">
<CheckCircledIcon className="mr-1 h-5 w-5 stroke-green-700" />
<p className="flex items-center">
<span className="mr-1 text-lg">{lastPurchasedCups}</span>
杯分
</p>
</div>
<>
<div className="flex items-center">
<CheckCircledIcon className="mr-1 h-5 w-5 stroke-green-700" />
<p className="flex items-center">
<span className="mr-1 text-lg">{lastPurchasedCups}</span>
杯分
</p>
</div>
<ul className="list-disc pl-4">
{discountOrder.items.map((item, idx) => (
<li
key={`${idx}-${item.id}`}
className={cn(
"text-sm text-stone-600",
(item.type === "milk" || item.type === "others") &&
"text-stone-400",
)}
>
{item.name}
</li>
))}
</ul>
</>
) : (
<div className="flex items-center">
<CrossCircledIcon className="mr-1 h-5 w-5 stroke-red-700" />
<p className="flex items-center">無効な番号</p>
</div>
))}
</p>
</div>
</div>
);
};
Expand Down