mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix(webapp): add validation to aging summary customize form
This commit is contained in:
@@ -36,19 +36,23 @@ export const getAPAgingSummaryQuerySchema = () => {
|
|||||||
.required()
|
.required()
|
||||||
.integer()
|
.integer()
|
||||||
.positive()
|
.positive()
|
||||||
.label('agingBeforeDays'),
|
.label('Aging days before')
|
||||||
|
.min(1)
|
||||||
|
.max(500),
|
||||||
agingPeriods: Yup.number()
|
agingPeriods: Yup.number()
|
||||||
.required()
|
.required()
|
||||||
.integer()
|
.integer()
|
||||||
.positive()
|
.positive()
|
||||||
.label('agingPeriods'),
|
.max(12)
|
||||||
|
.min(1)
|
||||||
|
.label('Aging periods'),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the AP aging summary query state.
|
* Parses the AP aging summary query state.
|
||||||
* @param locationQuery
|
* @param locationQuery
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const parseAPAgingSummaryQuery = (locationQuery) => {
|
const parseAPAgingSummaryQuery = (locationQuery) => {
|
||||||
const defaultQuery = getDefaultAPAgingSummaryQuery();
|
const defaultQuery = getDefaultAPAgingSummaryQuery();
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import intl from 'react-intl-universal';
|
|
||||||
import * as R from 'ramda';
|
|
||||||
|
|
||||||
import { If, FormattedMessage as T } from '@/components';
|
import { If } from '@/components';
|
||||||
import { useAPAgingSummaryContext } from './APAgingSummaryProvider';
|
|
||||||
import FinancialLoadingBar from '../FinancialLoadingBar';
|
import FinancialLoadingBar from '../FinancialLoadingBar';
|
||||||
|
import { useAPAgingSummaryContext } from './APAgingSummaryProvider';
|
||||||
import { agingSummaryDynamicColumns } from '../AgingSummary/dynamicColumns';
|
import { agingSummaryDynamicColumns } from '../AgingSummary/dynamicColumns';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,54 +17,6 @@ export const useAPAgingSummaryColumns = () => {
|
|||||||
return agingSummaryDynamicColumns(table.columns, table.rows);
|
return agingSummaryDynamicColumns(table.columns, table.rows);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve AP aging summary columns.
|
|
||||||
*/
|
|
||||||
// export const useAPAgingSummaryColumns = () => {
|
|
||||||
// const {
|
|
||||||
// APAgingSummary: { tableRows, columns },
|
|
||||||
// } = useAPAgingSummaryContext();
|
|
||||||
|
|
||||||
// const agingColumns = React.useMemo(() => {
|
|
||||||
// return columns.map(
|
|
||||||
// (agingColumn) =>
|
|
||||||
// `${agingColumn.before_days} - ${
|
|
||||||
// agingColumn.to_days || intl.get('and_over')
|
|
||||||
// }`,
|
|
||||||
// );
|
|
||||||
// }, [columns]);
|
|
||||||
|
|
||||||
// return useMemo(
|
|
||||||
// () => [
|
|
||||||
// {
|
|
||||||
// Header: <T id={'vendor_name'} />,
|
|
||||||
// accessor: 'name',
|
|
||||||
// className: 'vendor_name',
|
|
||||||
// width: 240,
|
|
||||||
// sticky: 'left',
|
|
||||||
// textOverview: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// Header: <T id={'current'} />,
|
|
||||||
// accessor: 'current',
|
|
||||||
// className: 'current',
|
|
||||||
// width: getColumnWidth(tableRows, `current`, { minWidth: 120 }),
|
|
||||||
// },
|
|
||||||
// ...agingColumns.map((agingColumn, index) => ({
|
|
||||||
// Header: agingColumn,
|
|
||||||
// accessor: `aging-${index}`,
|
|
||||||
// width: getColumnWidth(tableRows, `aging-${index}`, { minWidth: 120 }),
|
|
||||||
// })),
|
|
||||||
// {
|
|
||||||
// Header: <T id={'total'} />,
|
|
||||||
// accessor: 'total',
|
|
||||||
// width: getColumnWidth(tableRows, 'total', { minWidth: 120 }),
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// [tableRows, agingColumns],
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A/P aging summary sheet loading bar.
|
* A/P aging summary sheet loading bar.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,12 +35,16 @@ export const getARAgingSummaryQuerySchema = () => {
|
|||||||
.required()
|
.required()
|
||||||
.integer()
|
.integer()
|
||||||
.positive()
|
.positive()
|
||||||
.label('agingDaysBefore'),
|
.label('Aging days before')
|
||||||
|
.min(1)
|
||||||
|
.max(500),
|
||||||
agingPeriods: Yup.number()
|
agingPeriods: Yup.number()
|
||||||
.required()
|
.required()
|
||||||
.integer()
|
.integer()
|
||||||
.positive()
|
.positive()
|
||||||
.label('agingPeriods'),
|
.max(12)
|
||||||
|
.min(1)
|
||||||
|
.label('Aging periods'),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user