mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
fix: resources table issues.
This commit is contained in:
@@ -9,6 +9,7 @@ import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
||||
|
||||
import BillsEmptyStatus from './BillsEmptyStatus';
|
||||
|
||||
import withBills from './withBills';
|
||||
import withBillActions from './withBillsActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||
@@ -22,6 +23,9 @@ function BillsDataTable({
|
||||
// #withBillsActions
|
||||
setBillsTableState,
|
||||
|
||||
// #withBills
|
||||
billsTableState,
|
||||
|
||||
// #withAlerts
|
||||
openAlert,
|
||||
}) {
|
||||
@@ -73,6 +77,7 @@ function BillsDataTable({
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={bills}
|
||||
initialState={billsTableState}
|
||||
loading={isBillsLoading}
|
||||
headerLoading={isBillsLoading}
|
||||
progressBarLoading={isBillsFetching}
|
||||
@@ -96,6 +101,7 @@ function BillsDataTable({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withBills(({ billsTableState }) => ({ billsTableState })),
|
||||
withBillActions,
|
||||
withAlertsActions,
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
|
||||
@@ -101,7 +101,9 @@ function PaymentMadeForm() {
|
||||
|
||||
const onError = ({
|
||||
response: {
|
||||
error: { data: errors },
|
||||
error: {
|
||||
data: { errors },
|
||||
},
|
||||
},
|
||||
}) => {
|
||||
const getError = (errorType) => errors.find((e) => e.type === errorType);
|
||||
@@ -116,9 +118,7 @@ function PaymentMadeForm() {
|
||||
};
|
||||
|
||||
if (!isNewMode) {
|
||||
editPaymentMadeMutate([paymentMadeId, form])
|
||||
.then(onSaved)
|
||||
.catch(onError);
|
||||
editPaymentMadeMutate([paymentMadeId, form]).then(onSaved).catch(onError);
|
||||
} else {
|
||||
createPaymentMadeMutate(form).then(onSaved).catch(onError);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ const PaymentMadesListContext = createContext();
|
||||
/**
|
||||
* Accounts chart data provider.
|
||||
*/
|
||||
function PaymentMadesListProvider({ accountsTableQuery, ...props }) {
|
||||
function PaymentMadesListProvider({ query, ...props }) {
|
||||
// Fetch accounts resource views and fields.
|
||||
const {
|
||||
data: paymentMadesViews,
|
||||
@@ -30,7 +30,7 @@ function PaymentMadesListProvider({ accountsTableQuery, ...props }) {
|
||||
data: { paymentMades, pagination, filterMeta },
|
||||
isLoading: isPaymentsLoading,
|
||||
isFetching: isPaymentsFetching,
|
||||
} = usePaymentMades(accountsTableQuery, { keepPreviousData: true });
|
||||
} = usePaymentMades(query, { keepPreviousData: true });
|
||||
|
||||
// Detarmines the datatable empty status.
|
||||
const isEmptyStatus =
|
||||
|
||||
@@ -9,6 +9,7 @@ import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
|
||||
import TableSkeletonHeader from 'components/Datatable/TableHeaderSkeleton';
|
||||
|
||||
import withPaymentMadeActions from './withPaymentMadeActions';
|
||||
import withPaymentMade from './withPaymentMade';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withAlertsActions from 'containers/Alert/withAlertActions';
|
||||
import { usePaymentMadesTableColumns, ActionsMenu } from './components';
|
||||
@@ -19,7 +20,10 @@ import { usePaymentMadesListContext } from './PaymentMadesListProvider';
|
||||
*/
|
||||
function PaymentMadesTable({
|
||||
// #withPaymentMadeActions
|
||||
addPaymentMadesTableQueries,
|
||||
setPaymentMadesTableState,
|
||||
|
||||
// #withPaymentMade
|
||||
paymentMadesTableState,
|
||||
|
||||
// #withAlerts
|
||||
openAlert,
|
||||
@@ -52,9 +56,9 @@ function PaymentMadesTable({
|
||||
// Handle datatable fetch data once the table state change.
|
||||
const handleDataTableFetchData = useCallback(
|
||||
({ pageIndex, pageSize, sortBy }) => {
|
||||
addPaymentMadesTableQueries({ pageIndex, pageSize, sortBy });
|
||||
setPaymentMadesTableState({ pageIndex, pageSize, sortBy });
|
||||
},
|
||||
[addPaymentMadesTableQueries],
|
||||
[setPaymentMadesTableState],
|
||||
);
|
||||
|
||||
// Display empty status instead of the table.
|
||||
@@ -66,6 +70,7 @@ function PaymentMadesTable({
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={paymentMades}
|
||||
initialState={paymentMadesTableState}
|
||||
onFetchData={handleDataTableFetchData}
|
||||
loading={isPaymentsLoading}
|
||||
headerLoading={isPaymentsLoading}
|
||||
@@ -91,6 +96,7 @@ function PaymentMadesTable({
|
||||
|
||||
export default compose(
|
||||
withPaymentMadeActions,
|
||||
withPaymentMade(({ paymentMadesTableState }) => ({ paymentMadesTableState })),
|
||||
withAlertsActions,
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
|
||||
Reference in New Issue
Block a user