split bill: reorder flow
This commit is contained in:
@@ -12,7 +12,6 @@ import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||
import ProText from "components/ProText";
|
||||
import ArabicPrice from "components/ArabicPrice";
|
||||
import styles from "./SplitBill.module.css";
|
||||
import { QRBottomSheet } from "./QRBottomSheet";
|
||||
|
||||
interface SplitBillChoiceBottomSheetProps {
|
||||
isOpen: boolean;
|
||||
@@ -32,7 +31,6 @@ export function CustomAmountChoiceBottomSheet({
|
||||
const [amount, setAmount] = useState<string>(
|
||||
splitBillAmount > 0 ? splitBillAmount.toString() : "",
|
||||
);
|
||||
const [isQROpen, setIsQROpen] = useState(false);
|
||||
useEffect(() => {
|
||||
if (isOpen && splitBillAmount > 0) {
|
||||
setAmount(splitBillAmount.toString());
|
||||
@@ -42,7 +40,6 @@ export function CustomAmountChoiceBottomSheet({
|
||||
const handleSave = () => {
|
||||
const numAmount = parseFloat(amount) || 0;
|
||||
dispatch(updateSplitBillAmount(numAmount));
|
||||
setIsQROpen(true);
|
||||
onClose();
|
||||
};
|
||||
|
||||
@@ -62,7 +59,6 @@ export function CustomAmountChoiceBottomSheet({
|
||||
const previewRemaining = originalTotalBill - currentAmount;
|
||||
|
||||
return (
|
||||
<>
|
||||
<ProBottomSheet
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
@@ -193,7 +189,5 @@ export function CustomAmountChoiceBottomSheet({
|
||||
</Button>
|
||||
</div>
|
||||
</ProBottomSheet>
|
||||
<QRBottomSheet isOpen={isQROpen} onClose={() => setIsQROpen(false)} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import { ProGray1 } from "ThemeConstants";
|
||||
import PayForActions from "../../../split-bill/components/PayForActions";
|
||||
import TotalPeopleActions from "../../../split-bill/components/TotalPeopleActions";
|
||||
import styles from "./SplitBill.module.css";
|
||||
import { QRBottomSheet } from "./QRBottomSheet";
|
||||
|
||||
interface SplitBillChoiceBottomSheetProps {
|
||||
isOpen: boolean;
|
||||
@@ -38,7 +37,6 @@ export function EqualltyChoiceBottomSheet({
|
||||
const dispatch = useAppDispatch();
|
||||
const { tmp, splitBillAmount } = useAppSelector(selectCart);
|
||||
const grandTotal = useAppSelector(selectGrandTotal);
|
||||
const [isQROpen, setIsQROpen] = useState(false);
|
||||
const splitBillTmp = tmp as SplitBillTmp;
|
||||
const totalPeople = splitBillTmp?.totalPeople || 2;
|
||||
const payFor = splitBillTmp?.payFor || 1;
|
||||
@@ -56,7 +54,6 @@ export function EqualltyChoiceBottomSheet({
|
||||
|
||||
const handleSave = () => {
|
||||
dispatch(updateSplitBillAmount(splitAmount));
|
||||
setIsQROpen(true);
|
||||
onClose();
|
||||
};
|
||||
|
||||
@@ -67,284 +64,281 @@ export function EqualltyChoiceBottomSheet({
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ProBottomSheet
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
title={t("splitBill.divideTheBillEqually")}
|
||||
showCloseButton={true}
|
||||
initialSnap={1}
|
||||
height={630}
|
||||
snapPoints={[630]}
|
||||
contentStyle={{
|
||||
padding: 0,
|
||||
<ProBottomSheet
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
title={t("splitBill.divideTheBillEqually")}
|
||||
showCloseButton={true}
|
||||
initialSnap={1}
|
||||
height={630}
|
||||
snapPoints={[630]}
|
||||
contentStyle={{
|
||||
padding: 0,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
marginTop: 20,
|
||||
}}
|
||||
>
|
||||
{/* Spinner Visualization - Blank Spin Wheel */}
|
||||
{totalPeople > 0 && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 12,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
position: "relative",
|
||||
width: 200,
|
||||
height: 200,
|
||||
margin: "0 auto",
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
width="200"
|
||||
height="200"
|
||||
viewBox="0 0 200 200"
|
||||
style={{
|
||||
transform: "rotate(-90deg)",
|
||||
}}
|
||||
>
|
||||
{Array.from({ length: totalPeople }).map((_, index) => {
|
||||
const anglePerSlice = 360 / totalPeople;
|
||||
const startAngle = index * anglePerSlice;
|
||||
const endAngle = (index + 1) * anglePerSlice;
|
||||
const isSelected = index < payFor;
|
||||
|
||||
// Convert angles to radians
|
||||
const startAngleRad = (startAngle * Math.PI) / 180;
|
||||
const endAngleRad = (endAngle * Math.PI) / 180;
|
||||
|
||||
// Calculate path for pie slice (fit 200x200 viewBox)
|
||||
const radius = 90;
|
||||
const centerX = 100;
|
||||
const centerY = 100;
|
||||
|
||||
const x1 = centerX + radius * Math.cos(startAngleRad);
|
||||
const y1 = centerY + radius * Math.sin(startAngleRad);
|
||||
const x2 = centerX + radius * Math.cos(endAngleRad);
|
||||
const y2 = centerY + radius * Math.sin(endAngleRad);
|
||||
|
||||
const largeArcFlag = anglePerSlice > 180 ? 1 : 0;
|
||||
|
||||
const pathData = [
|
||||
`M ${centerX} ${centerY}`,
|
||||
`L ${x1} ${y1}`,
|
||||
`A ${radius} ${radius} 0 ${largeArcFlag} 1 ${x2} ${y2}`,
|
||||
"Z",
|
||||
].join(" ");
|
||||
|
||||
return (
|
||||
<path
|
||||
key={index}
|
||||
d={pathData}
|
||||
fill={
|
||||
isSelected ? "var(--primary)" : "rgba(0, 0, 0, 0.1)"
|
||||
}
|
||||
stroke="#fff"
|
||||
strokeWidth="5"
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</svg>
|
||||
{/* Center circle with total bill amount */}
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%, -50%)",
|
||||
// Keep the SVG at 200x200, but make the center content smaller
|
||||
// so the wheel remains visible around it.
|
||||
width: 160,
|
||||
height: 160,
|
||||
borderRadius: "50%",
|
||||
backgroundColor: "var(--secondary-background)",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
zIndex: 10,
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: 600,
|
||||
color: "var(--primary)",
|
||||
lineHeight: 1.1,
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
<ArabicPrice
|
||||
price={originalTotalBill}
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: 600,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<ProText
|
||||
style={{
|
||||
fontSize: 11,
|
||||
color: ProGray1,
|
||||
marginTop: 6,
|
||||
textAlign: "center",
|
||||
lineHeight: 1.2,
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.totalBill")}
|
||||
</ProText>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
marginTop: 20,
|
||||
gap: "1rem",
|
||||
padding: 20,
|
||||
}}
|
||||
>
|
||||
{/* Spinner Visualization - Blank Spin Wheel */}
|
||||
{totalPeople > 0 && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 12,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
position: "relative",
|
||||
width: 200,
|
||||
height: 200,
|
||||
margin: "0 auto",
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
width="200"
|
||||
height="200"
|
||||
viewBox="0 0 200 200"
|
||||
style={{
|
||||
transform: "rotate(-90deg)",
|
||||
}}
|
||||
>
|
||||
{Array.from({ length: totalPeople }).map((_, index) => {
|
||||
const anglePerSlice = 360 / totalPeople;
|
||||
const startAngle = index * anglePerSlice;
|
||||
const endAngle = (index + 1) * anglePerSlice;
|
||||
const isSelected = index < payFor;
|
||||
|
||||
// Convert angles to radians
|
||||
const startAngleRad = (startAngle * Math.PI) / 180;
|
||||
const endAngleRad = (endAngle * Math.PI) / 180;
|
||||
|
||||
// Calculate path for pie slice (fit 200x200 viewBox)
|
||||
const radius = 90;
|
||||
const centerX = 100;
|
||||
const centerY = 100;
|
||||
|
||||
const x1 = centerX + radius * Math.cos(startAngleRad);
|
||||
const y1 = centerY + radius * Math.sin(startAngleRad);
|
||||
const x2 = centerX + radius * Math.cos(endAngleRad);
|
||||
const y2 = centerY + radius * Math.sin(endAngleRad);
|
||||
|
||||
const largeArcFlag = anglePerSlice > 180 ? 1 : 0;
|
||||
|
||||
const pathData = [
|
||||
`M ${centerX} ${centerY}`,
|
||||
`L ${x1} ${y1}`,
|
||||
`A ${radius} ${radius} 0 ${largeArcFlag} 1 ${x2} ${y2}`,
|
||||
"Z",
|
||||
].join(" ");
|
||||
|
||||
return (
|
||||
<path
|
||||
key={index}
|
||||
d={pathData}
|
||||
fill={
|
||||
isSelected ? "var(--primary)" : "rgba(0, 0, 0, 0.1)"
|
||||
}
|
||||
stroke="#fff"
|
||||
strokeWidth="5"
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</svg>
|
||||
{/* Center circle with total bill amount */}
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%, -50%)",
|
||||
// Keep the SVG at 200x200, but make the center content smaller
|
||||
// so the wheel remains visible around it.
|
||||
width: 160,
|
||||
height: 160,
|
||||
borderRadius: "50%",
|
||||
backgroundColor: "var(--secondary-background)",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
zIndex: 10,
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: 600,
|
||||
color: "var(--primary)",
|
||||
lineHeight: 1.1,
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
<ArabicPrice
|
||||
price={originalTotalBill}
|
||||
style={{
|
||||
fontSize: 20,
|
||||
fontWeight: 600,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<ProText
|
||||
style={{
|
||||
fontSize: 11,
|
||||
color: ProGray1,
|
||||
marginTop: 6,
|
||||
textAlign: "center",
|
||||
lineHeight: 1.2,
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.totalBill")}
|
||||
</ProText>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
gap: "1rem",
|
||||
padding: 20,
|
||||
padding: 8,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
<ProText
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
gap: "1rem",
|
||||
padding: 8,
|
||||
fontSize: "1rem",
|
||||
marginTop: 3,
|
||||
color: ProGray1,
|
||||
}}
|
||||
>
|
||||
<ProText
|
||||
style={{
|
||||
fontSize: "1rem",
|
||||
marginTop: 3,
|
||||
color: ProGray1,
|
||||
}}
|
||||
>
|
||||
{t("checkout.totalPeople")}
|
||||
</ProText>
|
||||
{t("checkout.totalPeople")}
|
||||
</ProText>
|
||||
|
||||
<TotalPeopleActions />
|
||||
<TotalPeopleActions />
|
||||
|
||||
<ProText
|
||||
style={{
|
||||
fontSize: "1rem",
|
||||
marginTop: 3,
|
||||
color: ProGray1,
|
||||
}}
|
||||
>
|
||||
{t("checkout.totalPeople")}
|
||||
</ProText>
|
||||
</div>
|
||||
|
||||
<div
|
||||
<ProText
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
gap: "1rem",
|
||||
padding: 8,
|
||||
fontSize: "1rem",
|
||||
marginTop: 3,
|
||||
color: ProGray1,
|
||||
}}
|
||||
>
|
||||
<ProText
|
||||
style={{
|
||||
fontSize: "1rem",
|
||||
marginTop: 2,
|
||||
color: ProGray1,
|
||||
}}
|
||||
>
|
||||
{t("checkout.payFor")}
|
||||
</ProText>
|
||||
|
||||
<PayForActions />
|
||||
|
||||
<ProText
|
||||
style={{
|
||||
fontSize: "1rem",
|
||||
marginTop: 2,
|
||||
color: ProGray1,
|
||||
}}
|
||||
>
|
||||
{t("checkout.payFor")}
|
||||
</ProText>
|
||||
</div>
|
||||
{t("checkout.totalPeople")}
|
||||
</ProText>
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
backgroundColor: "var(--background)",
|
||||
padding: 20,
|
||||
opacity: 1,
|
||||
gap: 8,
|
||||
borderTopLeftRadius: 24,
|
||||
borderTopRightRadius: 24,
|
||||
paddingTop: 12,
|
||||
paddingRight: 24,
|
||||
paddingBottom: 24,
|
||||
paddingLeft: 24,
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
gap: "1rem",
|
||||
padding: 8,
|
||||
}}
|
||||
>
|
||||
<div className={styles.summaryRow}>
|
||||
<ProText
|
||||
style={{
|
||||
fontWeight: 400,
|
||||
fontStyle: "Regular",
|
||||
fontSize: 14,
|
||||
lineHeight: "140%",
|
||||
letterSpacing: "0%",
|
||||
}}
|
||||
>
|
||||
{t("splitBill.yourShare")}
|
||||
</ProText>
|
||||
<ArabicPrice price={splitAmount} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: 12,
|
||||
margin: 20,
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
<ProText
|
||||
style={{
|
||||
flex: 1,
|
||||
backgroundColor: "#FEEDED",
|
||||
color: "#DD4143",
|
||||
boxShadow: "none",
|
||||
border: "none",
|
||||
fontSize: "1rem",
|
||||
marginTop: 2,
|
||||
color: ProGray1,
|
||||
}}
|
||||
onClick={handleRemoveSplitWay}
|
||||
>
|
||||
{t("splitBill.removeSplit")}
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ flex: 1, boxShadow: "none" }}
|
||||
onClick={handleSave}
|
||||
{t("checkout.payFor")}
|
||||
</ProText>
|
||||
|
||||
<PayForActions />
|
||||
|
||||
<ProText
|
||||
style={{
|
||||
fontSize: "1rem",
|
||||
marginTop: 2,
|
||||
color: ProGray1,
|
||||
}}
|
||||
>
|
||||
{t("cart.save")}
|
||||
</Button>
|
||||
{t("checkout.payFor")}
|
||||
</ProText>
|
||||
</div>
|
||||
</div>
|
||||
</ProBottomSheet>
|
||||
<QRBottomSheet isOpen={isQROpen} onClose={() => setIsQROpen(false)} />
|
||||
</>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
backgroundColor: "var(--background)",
|
||||
padding: 20,
|
||||
opacity: 1,
|
||||
gap: 8,
|
||||
borderTopLeftRadius: 24,
|
||||
borderTopRightRadius: 24,
|
||||
paddingTop: 12,
|
||||
paddingRight: 24,
|
||||
paddingBottom: 24,
|
||||
paddingLeft: 24,
|
||||
}}
|
||||
>
|
||||
<div className={styles.summaryRow}>
|
||||
<ProText
|
||||
style={{
|
||||
fontWeight: 400,
|
||||
fontStyle: "Regular",
|
||||
fontSize: 14,
|
||||
lineHeight: "140%",
|
||||
letterSpacing: "0%",
|
||||
}}
|
||||
>
|
||||
{t("splitBill.yourShare")}
|
||||
</ProText>
|
||||
<ArabicPrice price={splitAmount} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: 12,
|
||||
margin: 20,
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
style={{
|
||||
flex: 1,
|
||||
backgroundColor: "#FEEDED",
|
||||
color: "#DD4143",
|
||||
boxShadow: "none",
|
||||
border: "none",
|
||||
}}
|
||||
onClick={handleRemoveSplitWay}
|
||||
>
|
||||
{t("splitBill.removeSplit")}
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ flex: 1, boxShadow: "none" }}
|
||||
onClick={handleSave}
|
||||
>
|
||||
{t("cart.save")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</ProBottomSheet>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import ProText from "components/ProText";
|
||||
import { selectCart, updateSplitBillAmount } from "features/order/orderSlice";
|
||||
import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||
import styles from "./SplitBill.module.css";
|
||||
import { QRBottomSheet } from "./QRBottomSheet";
|
||||
|
||||
interface SplitBillChoiceBottomSheetProps {
|
||||
isOpen: boolean;
|
||||
@@ -26,7 +25,6 @@ export function PayForYourItemsChoiceBottomSheet({
|
||||
const dispatch = useAppDispatch();
|
||||
const { items } = useAppSelector(selectCart);
|
||||
const [selectedItems, setSelectedItems] = useState<Set<string>>(new Set());
|
||||
const [isQROpen, setIsQROpen] = useState(false);
|
||||
// Calculate total for selected items
|
||||
const selectedTotal = items
|
||||
.filter((item) => selectedItems.has(item.uniqueId || item.id.toString()))
|
||||
@@ -57,7 +55,6 @@ export function PayForYourItemsChoiceBottomSheet({
|
||||
|
||||
const handleSave = () => {
|
||||
dispatch(updateSplitBillAmount(selectedTotal));
|
||||
setIsQROpen(true);
|
||||
onClose();
|
||||
};
|
||||
|
||||
@@ -69,162 +66,159 @@ export function PayForYourItemsChoiceBottomSheet({
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ProBottomSheet
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
title={t("splitBill.payForYourItems")}
|
||||
showCloseButton={true}
|
||||
initialSnap={1}
|
||||
height={720}
|
||||
snapPoints={[720]}
|
||||
contentStyle={{ padding: 0 }}
|
||||
<ProBottomSheet
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
title={t("splitBill.payForYourItems")}
|
||||
showCloseButton={true}
|
||||
initialSnap={1}
|
||||
height={720}
|
||||
snapPoints={[720]}
|
||||
contentStyle={{ padding: 0 }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
padding: 20,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 12,
|
||||
maxHeight: "455px",
|
||||
minHeight: "455px",
|
||||
overflowY: "auto",
|
||||
}}
|
||||
>
|
||||
{items.length === 0 ? (
|
||||
<ProText
|
||||
type="secondary"
|
||||
style={{ textAlign: "center", padding: 20 }}
|
||||
>
|
||||
{t("cart.emptyCart")}
|
||||
</ProText>
|
||||
) : (
|
||||
items.map((item) => {
|
||||
const itemId = item.uniqueId || item.id.toString();
|
||||
const isSelected = selectedItems.has(itemId);
|
||||
const itemTotal = item.price * item.quantity;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
key={itemId}
|
||||
style={{
|
||||
border: "none",
|
||||
cursor: "pointer",
|
||||
padding: 0,
|
||||
}}
|
||||
onClick={() => handleItemToggle(itemId)}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
gap: 12,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
src={item.image}
|
||||
alt={item.name}
|
||||
width={60}
|
||||
height={60}
|
||||
preview={false}
|
||||
style={{
|
||||
borderRadius: 8,
|
||||
objectFit: "cover",
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 4,
|
||||
}}
|
||||
>
|
||||
<ProText style={{ fontSize: 14, fontWeight: 500 }}>
|
||||
{item.name}
|
||||
</ProText>
|
||||
<ArabicPrice price={itemTotal} />
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
minWidth: 32,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Checkbox
|
||||
className={styles.circleCheckbox}
|
||||
checked={isSelected}
|
||||
onChange={() => handleItemToggle(itemId)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
{item !== items[items.length - 1] && (
|
||||
<Divider style={{ margin: "0" }} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
padding: 16,
|
||||
backgroundColor: "rgba(255, 183, 0, 0.08)",
|
||||
borderRadius: 8,
|
||||
marginTop: 8,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
padding: 20,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 12,
|
||||
maxHeight: "455px",
|
||||
minHeight: "455px",
|
||||
overflowY: "auto",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{items.length === 0 ? (
|
||||
<ProText
|
||||
type="secondary"
|
||||
style={{ textAlign: "center", padding: 20 }}
|
||||
>
|
||||
{t("cart.emptyCart")}
|
||||
</ProText>
|
||||
) : (
|
||||
items.map((item) => {
|
||||
const itemId = item.uniqueId || item.id.toString();
|
||||
const isSelected = selectedItems.has(itemId);
|
||||
const itemTotal = item.price * item.quantity;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
key={itemId}
|
||||
style={{
|
||||
border: "none",
|
||||
cursor: "pointer",
|
||||
padding: 0,
|
||||
}}
|
||||
onClick={() => handleItemToggle(itemId)}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
gap: 12,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
src={item.image}
|
||||
alt={item.name}
|
||||
width={60}
|
||||
height={60}
|
||||
preview={false}
|
||||
style={{
|
||||
borderRadius: 8,
|
||||
objectFit: "cover",
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 4,
|
||||
}}
|
||||
>
|
||||
<ProText style={{ fontSize: 14, fontWeight: 500 }}>
|
||||
{item.name}
|
||||
</ProText>
|
||||
<ArabicPrice price={itemTotal} />
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
minWidth: 32,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Checkbox
|
||||
className={styles.circleCheckbox}
|
||||
checked={isSelected}
|
||||
onChange={() => handleItemToggle(itemId)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
{item !== items[items.length - 1] && (
|
||||
<Divider style={{ margin: "0" }} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
})
|
||||
)}
|
||||
<ProText style={{ fontSize: 16, fontWeight: 600 }}>
|
||||
{t("splitBill.selectedTotal")}:
|
||||
</ProText>
|
||||
<ArabicPrice price={selectedTotal} />
|
||||
</div>
|
||||
<div
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: 12,
|
||||
margin: 20,
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
style={{
|
||||
padding: 16,
|
||||
backgroundColor: "rgba(255, 183, 0, 0.08)",
|
||||
borderRadius: 8,
|
||||
marginTop: 8,
|
||||
flex: 1,
|
||||
backgroundColor: "#FEEDED",
|
||||
color: "#DD4143",
|
||||
boxShadow: "none",
|
||||
border: "none",
|
||||
}}
|
||||
onClick={handleRemoveSplitWay}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<ProText style={{ fontSize: 16, fontWeight: 600 }}>
|
||||
{t("splitBill.selectedTotal")}:
|
||||
</ProText>
|
||||
<ArabicPrice price={selectedTotal} />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: 12,
|
||||
margin: 20,
|
||||
}}
|
||||
{t("splitBill.removeSplit")}
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ flex: 1, boxShadow: "none" }}
|
||||
onClick={handleSave}
|
||||
disabled={selectedTotal === 0}
|
||||
>
|
||||
<Button
|
||||
style={{
|
||||
flex: 1,
|
||||
backgroundColor: "#FEEDED",
|
||||
color: "#DD4143",
|
||||
boxShadow: "none",
|
||||
border: "none",
|
||||
}}
|
||||
onClick={handleRemoveSplitWay}
|
||||
>
|
||||
{t("splitBill.removeSplit")}
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ flex: 1, boxShadow: "none" }}
|
||||
onClick={handleSave}
|
||||
disabled={selectedTotal === 0}
|
||||
>
|
||||
{t("cart.save")}
|
||||
</Button>
|
||||
</div>
|
||||
</ProBottomSheet>
|
||||
<QRBottomSheet isOpen={isQROpen} onClose={() => setIsQROpen(false)} />
|
||||
</>
|
||||
{t("cart.save")}
|
||||
</Button>
|
||||
</div>
|
||||
</ProBottomSheet>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,126 +55,123 @@ export function SplitBillChoiceBottomSheet({
|
||||
|
||||
return (
|
||||
<>
|
||||
<ProBottomSheet
|
||||
isOpen={isOpen}
|
||||
onClose={handleCancel}
|
||||
title={t("splitBill.title")}
|
||||
showCloseButton={false}
|
||||
initialSnap={1}
|
||||
height={290}
|
||||
snapPoints={[290]}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
marginTop: 20,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 10,
|
||||
}}
|
||||
<ProBottomSheet
|
||||
isOpen={isOpen}
|
||||
onClose={handleCancel}
|
||||
title={t("splitBill.title")}
|
||||
showCloseButton={false}
|
||||
initialSnap={1}
|
||||
height={290}
|
||||
snapPoints={[290]}
|
||||
>
|
||||
<Card
|
||||
className={styles.backToHomePage}
|
||||
onClick={handleCustomAmountClick}
|
||||
<div
|
||||
style={{
|
||||
marginTop: 20,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: 10,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
marginTop: 1,
|
||||
}}
|
||||
<Card
|
||||
className={styles.backToHomePage}
|
||||
onClick={handleCustomAmountClick}
|
||||
>
|
||||
<ProTitle
|
||||
level={5}
|
||||
<div
|
||||
style={{
|
||||
fontSize: 14,
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
marginTop: 1,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.payAsCustomAmount")}
|
||||
</ProTitle>
|
||||
<ProTitle
|
||||
level={5}
|
||||
style={{
|
||||
fontSize: 14,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.payAsCustomAmount")}
|
||||
</ProTitle>
|
||||
|
||||
{isRTL ? (
|
||||
<BackIcon className={styles.serviceIcon} />
|
||||
) : (
|
||||
<NextIcon className={styles.serviceIcon} />
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
{isRTL ? (
|
||||
<BackIcon className={styles.serviceIcon} />
|
||||
) : (
|
||||
<NextIcon className={styles.serviceIcon} />
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
className={styles.backToHomePage}
|
||||
onClick={handleEqualityClick}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
marginTop: 1,
|
||||
}}
|
||||
>
|
||||
<ProTitle
|
||||
level={5}
|
||||
<Card className={styles.backToHomePage} onClick={handleEqualityClick}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: 14,
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
marginTop: 1,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.divideTheBillEqually")}
|
||||
</ProTitle>
|
||||
<ProTitle
|
||||
level={5}
|
||||
style={{
|
||||
fontSize: 14,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.divideTheBillEqually")}
|
||||
</ProTitle>
|
||||
|
||||
{isRTL ? (
|
||||
<BackIcon className={styles.serviceIcon} />
|
||||
) : (
|
||||
<NextIcon className={styles.serviceIcon} />
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
{isRTL ? (
|
||||
<BackIcon className={styles.serviceIcon} />
|
||||
) : (
|
||||
<NextIcon className={styles.serviceIcon} />
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
className={styles.backToHomePage}
|
||||
onClick={handlePayForItemsClick}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
marginTop: 1,
|
||||
}}
|
||||
<Card
|
||||
className={styles.backToHomePage}
|
||||
onClick={handlePayForItemsClick}
|
||||
>
|
||||
<ProTitle
|
||||
level={5}
|
||||
<div
|
||||
style={{
|
||||
fontSize: 14,
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
marginTop: 1,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.payForYourItems")}
|
||||
</ProTitle>
|
||||
<ProTitle
|
||||
level={5}
|
||||
style={{
|
||||
fontSize: 14,
|
||||
}}
|
||||
>
|
||||
{t("splitBill.payForYourItems")}
|
||||
</ProTitle>
|
||||
|
||||
{isRTL ? (
|
||||
<BackIcon className={styles.serviceIcon} />
|
||||
) : (
|
||||
<NextIcon className={styles.serviceIcon} />
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</ProBottomSheet>
|
||||
{isRTL ? (
|
||||
<BackIcon className={styles.serviceIcon} />
|
||||
) : (
|
||||
<NextIcon className={styles.serviceIcon} />
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</ProBottomSheet>
|
||||
|
||||
<CustomAmountChoiceBottomSheet
|
||||
isOpen={isCustomAmountOpen}
|
||||
onClose={() => setIsCustomAmountOpen(false)}
|
||||
/>
|
||||
<CustomAmountChoiceBottomSheet
|
||||
isOpen={isCustomAmountOpen}
|
||||
onClose={() => setIsCustomAmountOpen(false)}
|
||||
/>
|
||||
|
||||
<EqualltyChoiceBottomSheet
|
||||
isOpen={isEqualityOpen}
|
||||
onClose={() => setIsEqualityOpen(false)}
|
||||
/>
|
||||
<EqualltyChoiceBottomSheet
|
||||
isOpen={isEqualityOpen}
|
||||
onClose={() => setIsEqualityOpen(false)}
|
||||
/>
|
||||
|
||||
<PayForYourItemsChoiceBottomSheet
|
||||
isOpen={isPayForItemsOpen}
|
||||
onClose={() => setIsPayForItemsOpen(false)}
|
||||
/>
|
||||
<PayForYourItemsChoiceBottomSheet
|
||||
isOpen={isPayForItemsOpen}
|
||||
onClose={() => setIsPayForItemsOpen(false)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user