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 = ({ item, onClick }) => { return (
{item.location.name}
{item.display_note}
Rp {formatIDR(item.validate_price)}
{+item.validate_discount !== 0 && (
{item.validate_discount}%
{formatIDR(item.validate_display_price)}
)}
{item.quota}
{item.display_expired}
) } const ModalChoose = (props) => { const { state, item } = props const onDirectBuy = () => { router.post(route('cart.store', item), { direct: 1 }) state.toggle() } const addToCarts = () => { router.post(route('cart.store', item)) state.toggle() } return ( state.toggle()}> {item.display_note !== null && (
{item.display_note}
)}
Beli Langsung
+ Keranjang
) } export default function VoucherCard({ item }) { const chooseModalState = useModalState() const onVoucherChoose = () => { chooseModalState.toggle() } return ( <>
onVoucherChoose()}>
) }