import React, { useState } from 'react'
import { Head, router } from '@inertiajs/react'
import { formatIDR } from '@/utils'
import CustomerLayout from '@/Layouts/CustomerLayout'
import VoucherCard from './VoucherCard'
import EmptyHere from './IndexPartials/EmptyHere'
import { useModalState } from '@/hooks'
import Payment from './IndexPartials/Payment'
export default function Index({ carts: items, total, allow_process }) {
const [carts, setCarts] = useState(items)
const paymentModal = useModalState()
const removeCart = (cart) => {
setCarts(carts.filter((c) => c.id !== cart.id))
}
console.log(carts)
const changeQty = (cart, qty) => {
setCarts(
carts.map((c) => {
if (c.id === cart.id) {
return {
...c,
quantity: qty,
}
}
return c
})
)
}
const handlePayment = () => {
paymentModal.toggle()
}
const handleTopUp = () => {
router.get(route('transactions.deposit.topup'))
}
return (