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)}
{+user.paylater.usage !== 0 && (
router.get( route('customer.paylater.repay') ) } > Bayar Tagihan
)}
{user.paylater.paylater_description}
{paylaters.map((history) => (
router.get( route( 'customer.paylater.show', history.id ) ) } >
{history.format_human_created_at}
{history.description}
{history.amount}
{history.status !== '' && (
{history.status}
)}
))} {next_page_url !== null && (
Load more
)}
) }