PayablesTable component

Overview

A table that displays the list of payable invoices that are available to the entity user with the access token. The component supports filtering and pagination between these payables. The UI for each table row depends on the payable status on that row. For example, payables in the waiting_to_be_paid status have a customizable “Pay” button to pay the payable. To pay a payable via the “Pay” button, use the onPay prop on the PayablesTable component. For more information, see Props.

Permissions

To access this component, the entity user must have read permissions for the payable object. For more information, see List of permissions.

Preview

PayablesTable component preview
PayablesTable component preview
You can move and organize the columns of the table the way you prefer.

Usage

Use in the PayablesTable component in your application as shown:

1import { PayablesTable } from "@monite/sdk-react";
2
3// This component must be rendered within the MoniteProvider wrapper
4const PayablesTablePage = () => {
5 return <PayablesTable />;
6};

Props

PropTypeDescription
onChangeFilterfunctionThis callback is triggered when the filtering options are changed.
onRowClickfunctionThis callback takes the identifier of the clicked row as a parameter and is triggered when a payable table row is clicked.
onPayfunctionThis callback is the event handler for the “Pay” action. It accepts the UUID of the payable table row to perform the action on.
onChangeSortfunctionThis callback is called when the current sorting order for any column is changed. It returns the newly sorted field and order.

The onChangeSort takes one argument whose value is an object with the following fields:

  • sort - the field name of the column whose sort order was changed. For example, created_at.
  • order - the new sort order, either asc or desc
1(
2 "sort": "created_at",
3 "order": "asc" | "desc" | null
4) => void

Customization

Set required columns

The payables.requiredColumns setting defines a list of columns that must always be visible in the UI. Columns listed here cannot be hidden by users. The example below shows all possible values:

1const componentSettings = {
2 payables: {
3 requiredColumns: ["document_id", "counterpart_id", "created_at", "due_date", "status", "amount", "amount_paid", "pay"],
4 },
5};

Add tabs with filters

You can select additional tabs to be added to the payables table, which will display the results of specific filters. See an example with tabs/filters for unpaid, scheduled, and paid payables:

Additional tabs with filters
Additional tabs with filters

The required fields must be informed in the payables.summaryCardFilters field . Here is an example:

1const componentSettings = {
2 payables: {
3 summaryCardFilters: {
4 Unpaid: {
5 status__in: ['draft', 'new', 'approve_in_progress', 'rejected'],
6 },
7 Scheduled: {
8 status__in: [
9 'draft',
10 'new',
11 'approve_in_progress',
12 'waiting_to_be_paid',
13 'partially_paid',
14 ],
15 },
16 Paid: {
17 status__in: ['paid'],
18 },
19 },
20 },
21},

Some fields of the code explained:

  • Unpaid, Scheduled, Paid - The labels of the tab.
  • status__in - The filters of the tab.

See the GET /payables endpoint for all possible filters.