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

Issue/340 #364

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
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
47 changes: 47 additions & 0 deletions pos/app/routes/casher-mini.phone.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { itemSource } from "common/data/items";
import { orderConverter } from "common/firebase-utils/converter";
import { collectionSub } from "common/firebase-utils/subscription";
import useSWRSubscription from "swr/subscription";

export default function CasherMini() {
const items = itemSource;
const { data: orders } = useSWRSubscription(
"orders",
collectionSub({ converter: orderConverter }),
);
const curOrderId =
orders?.reduce((acc, cur) => Math.max(acc, cur.orderId), 0) ?? 0;
const order = orders ? orders[curOrderId - 1] : undefined;

return (
<div className="wrap flex h-full flex-col px-[35px] pt-[25px]">
<div className="pb-[50px]">
<p className="font-serif text-4xl">No. {curOrderId}</p>
</div>
<div className="grid grid-cols-2 items-center justify-items-center">
<div>
<p className="sans-serif text-base">
商品点数: {order ? order.items.length : 0} 点
</p>
<p className="sans-serif text-base">
小計: {order ? order.total : 0} 円
</p>
<p className="sans-serif text-base">
割引: {order ? order.discount : 0} 円
</p>
</div>
<div>
<p className="sans-serif text-base">
合計: {order ? order.billingAmount : 0} 円
</p>
<p className="sans-serif text-base">
お預り: {order ? order.received : 0} 円
</p>
<p className="sans-serif text-base">
お釣り: {(order?.received ?? 0) - (order?.billingAmount ?? 0)} 円
</p>
</div>
</div>
</div>
);
}
30 changes: 30 additions & 0 deletions pos/app/routes/casher-mini_p.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { itemSource } from "common/data/items";
import { orderConverter } from "common/firebase-utils/converter";
import { collectionSub } from "common/firebase-utils/subscription";
import useSWRSubscription from "swr/subscription";

export default function CasherMini() {
const items = itemSource;
const { data: orders } = useSWRSubscription(
"orders",
collectionSub({ converter: orderConverter }),
);
const curOrderId =
orders?.reduce((acc, cur) => Math.max(acc, cur.orderId), 0) ?? 0;
const nextOrderId = curOrderId + 1;
const order = orders ? orders[curOrderId] : undefined;

return (
<div className="flex h-full p-[20px]">
<div>No. {nextOrderId}</div>
<div>商品点数: {order ? order.items.length : 0} 点</div>
<div>小計: {order ? order.total : 0} 円</div>
<div>割引: {order ? order.discount : 0} 円</div>
<div>合計: {order ? order.billingAmount : 0} 円</div>
<div>お預り: {order ? order.received : 0} 円</div>
<div>
お釣り: {(order?.received ?? 0) - (order?.billingAmount ?? 0)} 円
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion pos/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = {
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
theme: "#a196c3",
theme: "#a59aca",
hot: "#f74316",
ice: "#0ebbf0",
ore: "#834f2f",
Expand Down