import React, { useState } from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' import HeaderTrx from '../Components/HeaderTrx' const EmptyHere = () => { return (
Transaksi kosong
Yuk, checkout keranjang mu sekarang!
) } export default function Index({ query: { data, next_page_url } }) { const [sales, setSales] = useState(data) const handleNextPage = () => { router.get( next_page_url, {}, { replace: true, preserveState: true, only: ['query'], onSuccess: (res) => { setSales(sales.concat(res.props.query.data)) }, } ) } return (
{sales.length <= 0 && }
{sales.map((sale) => (
router.get( route('transactions.sale.show', sale.id) ) } >
{sale.format_human_created_at}
Invoice{' '} #{sale.code}
{sale.display_amount}
))} {next_page_url !== null && (
Load more
)}
) }