Compare commits
2 Commits
6bf4cb6399
...
179bca3e9f
| Author | SHA1 | Date | |
|---|---|---|---|
| 179bca3e9f | |||
| e87c3e0783 |
@@ -115,14 +115,15 @@ export default function useOrder() {
|
||||
? `${location?.lat},${location?.lng}`
|
||||
: "",
|
||||
delivery_address: location?.address,
|
||||
vatvalue: restaurant?.vat || 0,
|
||||
vatvalue: ((restaurant?.vat || 0) / 100) * (subtotal - discountAmount),
|
||||
taxes:
|
||||
restaurant?.taxes?.map((t) => ({
|
||||
restaurant?.taxes
|
||||
?.filter((t) => t.is_active === 1)
|
||||
.map((t) => ({
|
||||
tax_id: t.id,
|
||||
percentage: t.percentage,
|
||||
amount:
|
||||
((typeof t.percentage === "number" ? t.percentage : 0) as number) *
|
||||
Number(subtotal - discountAmount),
|
||||
((Number(t.percentage) || 0) / 100) * (subtotal - discountAmount),
|
||||
})) || [],
|
||||
...(orderType === OrderType.Gift
|
||||
? {
|
||||
|
||||
@@ -49,7 +49,10 @@ export default function OrderPage() {
|
||||
const hasRefetchedRef = useRef(false);
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [isRateOrderOpen, setIsRateOrderOpen] = useState(false);
|
||||
const [isSplitBillParticipantsBottomSheetOpen, setIsSplitBillParticipantsBottomSheetOpen] = useState(false);
|
||||
const [
|
||||
isSplitBillParticipantsBottomSheetOpen,
|
||||
setIsSplitBillParticipantsBottomSheetOpen,
|
||||
] = useState(false);
|
||||
const { data: orderDetails } = useGetOrderDetailsQuery(
|
||||
{
|
||||
orderID: orderId || "",
|
||||
@@ -75,6 +78,10 @@ export default function OrderPage() {
|
||||
(status) => status?.alias === "closed",
|
||||
);
|
||||
|
||||
const hasCanceledByCustomerStatus = orderDetails?.status?.some(
|
||||
(status) => status?.alias === "canceled_by_customer",
|
||||
);
|
||||
|
||||
// Reset refetch flag when orderId changes
|
||||
useEffect(() => {
|
||||
hasRefetchedRef.current = false;
|
||||
@@ -539,8 +546,10 @@ export default function OrderPage() {
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className={styles.inviteToBill}
|
||||
onClick={() => setIsSplitBillParticipantsBottomSheetOpen(true)}>
|
||||
<div
|
||||
className={styles.inviteToBill}
|
||||
onClick={() => setIsSplitBillParticipantsBottomSheetOpen(true)}
|
||||
>
|
||||
<Button
|
||||
shape="circle"
|
||||
iconPlacement="start"
|
||||
@@ -662,9 +671,12 @@ export default function OrderPage() {
|
||||
onClose={() => setIsRateOrderOpen(false)}
|
||||
/>
|
||||
|
||||
{!hasClosedStatus && <CancelOrderBottomSheet />}
|
||||
{!hasClosedStatus ||
|
||||
(hasCanceledByCustomerStatus && <CancelOrderBottomSheet />)}
|
||||
</Layout.Content>
|
||||
{hasClosedStatus && (
|
||||
|
||||
{hasClosedStatus ||
|
||||
(hasCanceledByCustomerStatus && (
|
||||
<Layout.Footer className={styles.checkoutButtonContainer}>
|
||||
<Button
|
||||
type="primary"
|
||||
@@ -677,9 +689,12 @@ export default function OrderPage() {
|
||||
{t("order.newOrder")}
|
||||
</Button>
|
||||
</Layout.Footer>
|
||||
)}
|
||||
))}
|
||||
</Layout>
|
||||
<SplitBillParticipantsBottomSheet isOpen={isSplitBillParticipantsBottomSheetOpen} onClose={() => setIsSplitBillParticipantsBottomSheetOpen(false)} />
|
||||
<SplitBillParticipantsBottomSheet
|
||||
isOpen={isSplitBillParticipantsBottomSheetOpen}
|
||||
onClose={() => setIsSplitBillParticipantsBottomSheetOpen(false)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user