import React, { useState } from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' import { formatIDR } from '@/utils' export default function Index({ auth: { user }, histories: { data, next_page_url }, }) { const [paylaters, setPaylaters] = useState(data) const handleNextPage = () => { router.get( next_page_url, {}, { replace: true, preserveState: true, only: ['histories'], onSuccess: (res) => { setPaylaters(paylaters.concat(res.props.histories.data)) }, } ) } return (
{user.fullname}
Terpakai
Rp {formatIDR(user.paylater.usage)}
/ {formatIDR(user.paylater.limit)}
router.get(route('customer.deposit.topup')) } > Top Up
Lunasi pinjaman kamu dengan melakukan topup deposit
{paylaters.map((history) => (
router.get( route( 'customer.paylater.show', history.id ) ) } >
{history.format_human_created_at}
{history.description}
{history.amount}
))} {next_page_url !== null && (
Load more
)}
) }