import Alert from '@/Components/Alert' import BottomSheet from '@/Customer/Components/BottomSheet' import { useModalState } from '@/hooks' import { formatIDR } from '@/utils' import { router } from '@inertiajs/react' const Voucher = ({ voucher, onClick }) => { return (
{voucher.location_profile.location.name}
{voucher.location_profile.display_note}
Rp {formatIDR(voucher.validate_price)}
{+voucher.discount !== 0 && (
{voucher.discount}%
{formatIDR(voucher.validate_display_price)}
)}
{voucher.location_profile.quota}
{voucher.location_profile.diplay_expired}
) } const ModalChoose = (props) => { const { state, voucher } = props const onDirectBuy = () => { router.post(route('cart.store', voucher), { direct: 1 }) state.toggle() } const addToCarts = () => { router.post(route('cart.store', voucher)) state.toggle() } return ( state.toggle()}> {voucher.location_profile.display_note !== null && (
{voucher.location_profile.display_note}
)}
Beli Langsung
+ Keranjang
) } export default function VoucherCard({ voucher }) { const chooseModalState = useModalState() const onVoucherChoose = () => { chooseModalState.toggle() } return ( <>
onVoucherChoose()}>
) }