import { Form, Image, Radio, Space } from "antd"; import { Group } from "antd/es/radio"; import ArabicPrice from "components/ArabicPrice"; // import DifferentCardIcon from "components/Icons/paymentMethods/DifferentCardIcon"; import ProText from "components/ProText"; import { selectCart, selectGrandTotal, updatePaymentMethod, } from "features/order/orderSlice"; import { useTranslation } from "react-i18next"; import { useAppDispatch, useAppSelector } from "redux/hooks"; import { colors, ProGray1 } from "../../ThemeConstants"; import ProInputCard from "../ProInputCard/ProInputCard"; import styles from "./PaymentMethods.module.css"; import { OrderType } from "pages/checkout/hooks/types.ts"; import { formatPriceUi } from "utils/helpers"; const PaymentMethods = () => { const { t } = useTranslation(); const { paymentMethod, orderType } = useAppSelector(selectCart); const dispatch = useAppDispatch(); const grandTotal = useAppSelector(selectGrandTotal); const { restaurant } = useAppSelector((state) => state.order); // const { isRTL } = useAppSelector((state) => state.locale); const options: { label: React.ReactNode; value: string; price?: string; icon?: React.ReactNode; style?: React.CSSProperties; hideCurrency?: boolean; }[] = [ ...(orderType !== OrderType.Gift ? [ { label: ( <> {/* $ */} {t("checkout.cash")} ), value: "cash", price: formatPriceUi(grandTotal, restaurant.currency_decimals ?? 3), style: { color: colors.primary, }, }, ] : []), // { // label: t("checkout.creditDebitCard"), // value: "creditDebitCard", // price: t("checkout.expiresIn") + ":12/26", // hideCurrency: true, // }, { label: ( <> {/* */} {t("checkout.thawani")} ), value: "thawani", icon: (
thawani
), hideCurrency: true, }, // { // label: t("checkout.fascanoWallet"), // value: "fascanoWallet", // price: "7.50", // style: { // color: colors.primary, // }, // }, ]; const onPaymentSelect = (value: string) => { dispatch(updatePaymentMethod(value)); }; return ( {options.map((option) => (
onPaymentSelect(option.value)} className={styles.circleCheckbox} style={{ height: 48, borderRadius: 888, border: "1px solid #DDD", padding: 16, }} >
{option.label} {!option.icon ? ( ) : ( <>{option.icon} )}
))}
); }; export default PaymentMethods;