apply restaurant decimails formating & fix tax calcualtions
This commit is contained in:
@@ -13,13 +13,14 @@ import "react-phone-input-2/lib/style.css";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useSendOtpMutation } from "redux/api/auth";
|
||||
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||
import { useAppSelector } from "redux/hooks";
|
||||
import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||
import { colors, DisabledColor, ProGray1 } from "ThemeConstants";
|
||||
import { default_image } from "utils/constants";
|
||||
import styles from "./login.module.css";
|
||||
import { Layout } from "antd";
|
||||
import ProHeader from "components/ProHeader/ProHeader";
|
||||
import useBreakPoint from "hooks/useBreakPoint";
|
||||
import { updateCustomerName } from "features/order/orderSlice";
|
||||
|
||||
export default function LoginPage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -32,7 +33,7 @@ export default function LoginPage() {
|
||||
skip: !subdomain,
|
||||
});
|
||||
const { isTablet } = useBreakPoint();
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
// const [phone, setPhone] = useState<string>("");
|
||||
const [selectedDate, setSelectedDate] = useState<string>("");
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
@@ -113,6 +114,10 @@ export default function LoginPage() {
|
||||
height: 50,
|
||||
fontSize: 14,
|
||||
}}
|
||||
onBlur={(e) => {
|
||||
dispatch(updateCustomerName(e.target.value));
|
||||
}}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
@@ -37,13 +37,14 @@ import NewRateIcon from "components/Icons/order/NewRateIcon";
|
||||
import NoteIcon from "components/Icons/NoteIcon";
|
||||
import SuccessIcon from "components/Icons/SuccessIcon";
|
||||
import { SplitBillParticipantsBottomSheet } from "./components/SplitBillParticipantsBottomSheet";
|
||||
import { OrderType } from "pages/checkout/hooks/types";
|
||||
|
||||
export default function OrderPage() {
|
||||
const { t } = useTranslation();
|
||||
const { orderId } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
const { restaurant } = useAppSelector((state) => state.order);
|
||||
const { restaurant, orderType } = useAppSelector((state) => state.order);
|
||||
const hasRefetchedRef = useRef(false);
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [isRateOrderOpen, setIsRateOrderOpen] = useState(false);
|
||||
@@ -429,7 +430,7 @@ export default function OrderPage() {
|
||||
<Stepper statuses={orderDetails?.status} />
|
||||
</div>
|
||||
|
||||
{!hasClosedStatus && (
|
||||
{!hasClosedStatus && orderType === OrderType.DineIn && (
|
||||
<div className={styles.orderNotes}>
|
||||
<NoteIcon className={styles.noteIcon} />
|
||||
<div
|
||||
@@ -464,7 +465,7 @@ export default function OrderPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{hasClosedStatus && (
|
||||
{hasClosedStatus && orderType === OrderType.DineIn && (
|
||||
<div className={styles.orderNotesClosed}>
|
||||
<SuccessIcon className={styles.noteIcon} />
|
||||
<ProText
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { Extra as ExtraType } from "utils/types/appTypes";
|
||||
import styles from "../product.module.css";
|
||||
import { formatPriceUi } from "utils/helpers";
|
||||
import { useAppSelector } from "redux/hooks";
|
||||
|
||||
export default function Extra({
|
||||
extrasList,
|
||||
@@ -17,7 +18,7 @@ export default function Extra({
|
||||
setSelectedExtras: Dispatch<SetStateAction<ExtraType[]>>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { restaurant } = useAppSelector((state) => state.order);
|
||||
return (
|
||||
<>
|
||||
{extrasList.length > 0 && (
|
||||
@@ -46,7 +47,7 @@ export default function Extra({
|
||||
return {
|
||||
value: value.id.toString(),
|
||||
label: value.name,
|
||||
price: `+${formatPriceUi(value.price, 3)}`,
|
||||
price: `+${formatPriceUi(value.price, restaurant.currency_decimals ?? 3)}`,
|
||||
};
|
||||
})}
|
||||
value={selectedExtras.map((ex) => ex.id.toString())}
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function Variants({
|
||||
const { isRTL } = useAppSelector((state) => state.locale);
|
||||
const { t } = useTranslation();
|
||||
const { isDesktop } = useBreakPoint();
|
||||
|
||||
const { restaurant } = useAppSelector((state) => state.order);
|
||||
// Determine variant levels based on options array length
|
||||
const variantLevels = useMemo(() => {
|
||||
if (!variantsList || variantsList.length === 0) return [];
|
||||
@@ -170,7 +170,7 @@ export default function Variants({
|
||||
value: value,
|
||||
label: value,
|
||||
price: variant
|
||||
? `+${formatPriceUi(variant.price, 3)}`
|
||||
? `+${formatPriceUi(variant.price, restaurant.currency_decimals ?? 3)}`
|
||||
: "",
|
||||
};
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user