Created
July 18, 2024 16:59
-
-
Save thesandlord/d4c23768957f15193597c2e20109c69e to your computer and use it in GitHub Desktop.
Fluz Table Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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