From 9988c4586f47a991f2af7b785fcf001eccc51c34 Mon Sep 17 00:00:00 2001 From: uzun0ff Date: Sat, 11 Apr 2026 13:01:30 +0300 Subject: [PATCH] [feat]: Adds selfservice dialog. --- messages/bg.json | 4 ++++ messages/en.json | 4 ++++ src/app/order/page.tsx | 23 +++++++++++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/messages/bg.json b/messages/bg.json index c8f4de5..be939a7 100644 --- a/messages/bg.json +++ b/messages/bg.json @@ -58,6 +58,10 @@ "title": "Сигурни ли сте, че искате да платите?", "description": "Изберете вашата банка, за да платите" }, + "selfServicePayment": { + "title": "Плащане", + "description": "Може да заплатите брой/карта на бара" + }, "splitAndPay": "Раздели и плати", "ratingDialog": { "title": "Хареса ли ви {productName}?", diff --git a/messages/en.json b/messages/en.json index d3ee3d4..59091b8 100644 --- a/messages/en.json +++ b/messages/en.json @@ -58,6 +58,10 @@ "title": "Are you sure you want to pay?", "description": "Select your bank to pay" }, + "selfServicePayment": { + "title": "Payment", + "description": "You can pay cash/card at the bar" + }, "splitAndPay": "Split and Pay", "ratingDialog": { "title": "How did you like {productName}?", diff --git a/src/app/order/page.tsx b/src/app/order/page.tsx index c371d1a..98bc8e3 100644 --- a/src/app/order/page.tsx +++ b/src/app/order/page.tsx @@ -13,6 +13,7 @@ import { useSockJS } from "@/hooks/use-sockjs" import { Product } from "@/models/product" import { WSSendMessageItems, WSSendMessagePayload } from "@/models/websocket" +import { useRestaurantStore } from "@/store/restaurant" import { useTranslations } from "next-intl" import { useCallback, useEffect, useMemo, useRef, useState } from "react" import { v4 as uuidv4 } from "uuid" @@ -40,7 +41,10 @@ export default function OrderPage() { const [splitBill, setSplitBill] = useState(false) const [tipDialogOpen, setTipDialogOpen] = useState(false) const [confirmDialogOpen, setConfirmDialogOpen] = useState(false) + const [selfServiceDialogOpen, setSelfServiceDialogOpen] = useState(false) const { tableOrder } = useTableOrderContext() + const { restaurantData } = useRestaurantStore() + const isSelfService = !!restaurantData?.selfService const [topic, setTopic] = useState(order ? `/topic/orders/${order.orderId}` : null) @@ -175,7 +179,13 @@ export default function OrderPage() { { + if (isSelfService && tip === 0) { + setSelfServiceDialogOpen(true) + } else { + handleConfirmTip() + } + }} tip={tip} setTip={setTip} setInputTip={setInputTip} @@ -193,6 +203,13 @@ export default function OrderPage() { cancelTitle={tCommon("no")} shouldConfirm /> + setSelfServiceDialogOpen(false)} + title={tOrder("selfServicePayment.title")} + description={tOrder("selfServicePayment.description")} + defaultTitle={tCommon("ok")} + />