Skip to content

Instantly share code, notes, and snippets.

@thesandlord
Created July 18, 2024 16:59
Show Gist options
  • Save thesandlord/d4c23768957f15193597c2e20109c69e to your computer and use it in GitHub Desktop.
Save thesandlord/d4c23768957f15193597c2e20109c69e to your computer and use it in GitHub Desktop.
Fluz Table Example
function InvoicesTable(){
const [selectedStatus, setSelectedStatus] = useState<MercoaApi.InvoiceStatus[]>([MercoaApi.InvoiceStatus.Draft])
return (
<div>
<Tabs onClick={key => {
if(key === 'drafts'){
setSelectedStatus([MercoaApi.InvoiceStatus.Draft])
} else if (key === 'in-progress'){
setSelectedStatus([
MercoaApi.InvoiceStatus.New,
MercoaApi.InvoiceStatus.Approved,
MercoaApi.InvoiceStatus.Scheduled,
])
} else if (key === 'history'){
setSelectedStatus([
MercoaApi.InvoiceStatus.Paid,
MercoaApi.InvoiceStatus.Canceled,
MercoaApi.InvoiceStatus.Archived,
])
}
}}
tabs={[{
label: 'Drafts',
key: 'drafts',
},
{
label: 'In progress',
key: 'in-progress',
},
{
label: 'History',
key: 'history',
}]}
/>
<PayablesTable statuses={selectedStatus} >
{({invoices, dataLoaded, hasNext, hasPrevious, count,}) => <Table
data={invoices.map(xyz)}
onRowClick={invoice => {
Router.push(PATH + invoice.id)
}}
pagination={true}
/>}
</PayablesTable>
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment