chore: renmame payment receive term to payment received

This commit is contained in:
Ahmed Bouhuolia
2024-08-13 15:15:07 +02:00
parent 961e4b99e8
commit 038d4dd5a7
67 changed files with 181 additions and 184 deletions

View File

@@ -1,13 +0,0 @@
// @ts-nocheck
import React from 'react';
const PaymentReceiveDeleteAlert = React.lazy(
() => import('@/containers/Alerts/PaymentReceives/PaymentReceiveDeleteAlert'),
);
/**
* PaymentReceives alert.
*/
export default [
{ name: 'payment-receive-delete', component: PaymentReceiveDeleteAlert },
];

View File

@@ -58,7 +58,7 @@ export function PaymentMailDialogFormRoot({
// Redirects to payments list if the option is enabled.
if (redirectToPaymentsList) {
history.push('/payment-receives');
history.push('/payments-received');
}
})
.catch(() => {

View File

@@ -13,7 +13,7 @@ const Schema = Yup.object().shape({
payment_receive_no: Yup.string()
.nullable()
.max(DATATYPES_LENGTH.STRING)
.label(intl.get('payment_receive_no_')),
.label(intl.get('payment_received_no_')),
reference_no: Yup.string().min(1).max(DATATYPES_LENGTH.STRING).nullable(),
// statement: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
branch_id: Yup.string(),

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import React, { useMemo, useRef } from 'react';
import { sumBy, isEmpty, defaultTo } from 'lodash';
import React, { useMemo } from 'react';
import { isEmpty, defaultTo } from 'lodash';
import intl from 'react-intl-universal';
import classNames from 'classnames';
import { Formik, Form } from 'formik';
@@ -133,14 +133,14 @@ function PaymentReceiveForm({
AppToaster.show({
message: intl.get(
paymentReceiveId
? 'the_payment_receive_transaction_has_been_edited'
: 'the_payment_receive_transaction_has_been_created',
? 'the_payment_received_transaction_has_been_edited'
: 'the_payment_received_transaction_has_been_created',
),
intent: Intent.SUCCESS,
});
if (submitPayload.redirect) {
history.push('/payment-receives');
history.push('/payments-received');
}
if (submitPayload.resetForm) {
resetFormState({ resetForm, initialValues, values });

View File

@@ -1,7 +1,7 @@
// @ts-nocheck
import React from 'react';
import { useFormikContext } from 'formik';
import ClearingAllLinesAlert from '@/containers/Alerts/PaymentReceives/ClearingAllLinesAlert';
import ClearingAllLinesAlert from '@/containers/Alerts/PaymentReceived/ClearingAllLinesAlert';
import { clearAllPaymentEntries } from './utils';
/**

View File

@@ -64,7 +64,7 @@ export const PaymentReceivePaymentNoField = R.compose(
return (
<FFormGroup
name={'payment_receive_no'}
label={<T id={'payment_receive_no'} />}
label={<T id={'payment_received_no'} />}
inline={true}
labelInfo={<FieldRequiredHint />}
>

View File

@@ -204,7 +204,7 @@ export const transformErrors = (errors, { setFieldError }) => {
if (getError('PAYMENT_RECEIVE_NO_REQUIRED')) {
setFieldError(
'payment_receive_no',
intl.get('payment_receive.field.error.payment_receive_no_required'),
intl.get('payment_received.field.error.payment_receive_no_required'),
);
}
if (getError('PAYMENT_ACCOUNT_CURRENCY_INVALID')) {

View File

@@ -8,9 +8,9 @@ import {
AbilitySubject,
PaymentReceiveAction,
} from '@/constants/abilityOption';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { highlightText } from '@/utils';
import { Icon } from '@/components';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import { DRAWERS } from '@/constants/drawers';
/**
@@ -25,7 +25,7 @@ function PaymentReceiveUniversalSearchSelectComponent({
openDrawer,
}) {
if (resourceType === RESOURCES_TYPES.PAYMENT_RECEIVE) {
openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
openDrawer(DRAWERS.PAYMENT_RECEIVED_DETAILS, {
paymentReceiveId: resourceId,
});
}
@@ -80,7 +80,7 @@ const paymentReceivesToSearch = (payment) => ({
*/
export const universalSearchPaymentReceiveBind = () => ({
resourceType: RESOURCES_TYPES.PAYMENT_RECEIVE,
optionItemLabel: intl.get('payment_receives'),
optionItemLabel: intl.get('payment_received'),
selectItemAction: PaymentReceiveUniversalSearchSelect,
itemRenderer: PaymentReceiveUniversalSearchItem,
itemSelect: paymentReceivesToSearch,

View File

@@ -10,12 +10,12 @@ import {
} from '@/hooks/query';
import { getFieldsFromResourceMeta } from '@/utils';
const PaymentReceivesListContext = createContext();
const PaymentsReceivedListContext = createContext();
/**
* Payment receives data provider.
*/
function PaymentReceivesListProvider({ query, tableStateChanged, ...props }) {
function PaymentsReceivedListProvider({ query, tableStateChanged, ...props }) {
// Fetch accounts resource views and fields.
const { data: paymentReceivesViews, isFetching: isViewsLoading } =
useResourceViews('payment_receives');
@@ -60,12 +60,12 @@ function PaymentReceivesListProvider({ query, tableStateChanged, ...props }) {
loading={isViewsLoading || isResourceLoading}
name={'payment_receives'}
>
<PaymentReceivesListContext.Provider value={provider} {...props} />
<PaymentsReceivedListContext.Provider value={provider} {...props} />
</DashboardInsider>
);
}
const usePaymentReceivesListContext = () =>
React.useContext(PaymentReceivesListContext);
const usePaymentsReceivedListContext = () =>
React.useContext(PaymentsReceivedListContext);
export { PaymentReceivesListProvider, usePaymentReceivesListContext };
export { PaymentsReceivedListProvider, usePaymentsReceivedListContext };

View File

@@ -22,8 +22,8 @@ import {
DashboardActionsBar,
} from '@/components';
import withPaymentReceives from './withPaymentReceives';
import withPaymentReceivesActions from './withPaymentReceivesActions';
import withPaymentsReceived from './withPaymentsReceived';
import withPaymentsReceivedActions from './withPaymentsReceivedActions';
import withSettings from '@/containers/Settings/withSettings';
import withSettingsActions from '@/containers/Settings/withSettingsActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
@@ -32,7 +32,7 @@ import {
AbilitySubject,
} from '@/constants/abilityOption';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
import { usePaymentsReceivedListContext } from './PaymentsReceivedListProvider';
import { useRefreshPaymentReceive } from '@/hooks/query/paymentReceives';
import { useDownloadExportPdf } from '@/hooks/query/FinancialReports/use-export-pdf';
@@ -42,11 +42,11 @@ import { DialogsName } from '@/constants/dialogs';
/**
* Payment receives actions bar.
*/
function PaymentReceiveActionsBar({
// #withPaymentReceivesActions
function PaymentsReceivedActionsBar({
// #withPaymentsReceivedActions
setPaymentReceivesTableState,
// #withPaymentReceives
// #withPaymentsReceived
paymentFilterConditions,
// #withSettings
@@ -62,14 +62,14 @@ function PaymentReceiveActionsBar({
const history = useHistory();
// Payment receives list context.
const { paymentReceivesViews, fields } = usePaymentReceivesListContext();
const { paymentReceivesViews, fields } = usePaymentsReceivedListContext();
// Exports pdf document.
const { downloadAsync: downloadExportPdf } = useDownloadExportPdf();
// Handle new payment button click.
const handleClickNewPaymentReceive = () => {
history.push('/payment-receives/new');
history.push('/payment-received/new');
};
// Payment receive refresh action.
@@ -91,7 +91,7 @@ function PaymentReceiveActionsBar({
};
// Handle the import button click.
const handleImportBtnClick = () => {
history.push('/payment-receives/import');
history.push('/payments-received/import');
};
// Handle the export button click.
const handleExportBtnClick = () => {
@@ -115,7 +115,7 @@ function PaymentReceiveActionsBar({
<Button
className={Classes.MINIMAL}
icon={<Icon icon={'plus'} />}
text={<T id={'new_payment_receive'} />}
text={<T id={'new_payment_received'} />}
onClick={handleClickNewPaymentReceive}
/>
</Can>
@@ -181,9 +181,9 @@ function PaymentReceiveActionsBar({
}
export default compose(
withPaymentReceivesActions,
withPaymentsReceivedActions,
withSettingsActions,
withPaymentReceives(({ paymentReceivesTableState }) => ({
withPaymentsReceived(({ paymentReceivesTableState }) => ({
paymentReceivesTableState,
paymentFilterConditions: paymentReceivesTableState.filterRoles,
})),
@@ -191,4 +191,4 @@ export default compose(
paymentReceivesTableSize: paymentReceiveSettings?.tableSize,
})),
withDialogActions,
)(PaymentReceiveActionsBar);
)(PaymentsReceivedActionsBar);

View File

@@ -6,7 +6,7 @@ import { EmptyStatus } from '@/components';
import { Can, FormattedMessage as T } from '@/components';
import { PaymentReceiveAction, AbilitySubject } from '@/constants/abilityOption';
export default function PaymentReceivesEmptyStatus() {
export default function PaymentsReceivedEmptyStatus() {
const history = useHistory();
return (
@@ -29,10 +29,10 @@ export default function PaymentReceivesEmptyStatus() {
intent={Intent.PRIMARY}
large={true}
onClick={() => {
history.push('/payment-receives/new');
history.push('/payment-received/new');
}}
>
<T id={'new_payment_receive'} />
<T id={'new_payment_received'} />
</Button>
<Button intent={Intent.NONE} large={true}>

View File

@@ -4,24 +4,21 @@ import React from 'react';
import '@/style/pages/PaymentReceive/List.scss';
import { DashboardPageContent } from '@/components';
import { PaymentReceivesListProvider } from './PaymentReceiptsListProvider';
import PaymentReceivesTable from './PaymentReceivesTable';
import PaymentReceiveActionsBar from './PaymentReceiveActionsBar';
import { PaymentsReceivedListProvider } from './PaymentsReceivedListProvider';
import PaymentReceivesTable from './PaymentsReceivedTable';
import PaymentsReceivedActionsBar from './PaymentsReceivedActionsBar';
import withPaymentReceives from './withPaymentReceives';
import withPaymentReceivesActions from './withPaymentReceivesActions';
import withPaymentsReceived from './withPaymentsReceived';
import withPaymentsReceivedActions from './withPaymentsReceivedActions';
import { compose, transformTableStateToQuery } from '@/utils';
/**
* Payment receives list.
*/
function PaymentReceiveList({
// #withPaymentReceives
function PaymentsReceivedList({
// #withPaymentsReceived
paymentReceivesTableState,
paymentsTableStateChanged,
// #withPaymentReceivesActions
// #withPaymentsReceivedActions
resetPaymentReceivesTableState,
}) {
// Resets the payment receives table state once the page unmount.
@@ -33,25 +30,25 @@ function PaymentReceiveList({
);
return (
<PaymentReceivesListProvider
<PaymentsReceivedListProvider
query={transformTableStateToQuery(paymentReceivesTableState)}
tableStateChanged={paymentsTableStateChanged}
>
<PaymentReceiveActionsBar />
<PaymentsReceivedActionsBar />
<DashboardPageContent>
<PaymentReceivesTable />
</DashboardPageContent>
</PaymentReceivesListProvider>
</PaymentsReceivedListProvider>
);
}
export default compose(
withPaymentReceives(
withPaymentsReceived(
({ paymentReceivesTableState, paymentsTableStateChanged }) => ({
paymentReceivesTableState,
paymentsTableStateChanged,
}),
),
withPaymentReceivesActions,
)(PaymentReceiveList);
withPaymentsReceivedActions,
)(PaymentsReceivedList);

View File

@@ -10,12 +10,12 @@ import {
} from '@/hooks/query';
import { getFieldsFromResourceMeta } from '@/utils';
const PaymentReceivesListContext = createContext();
const PaymentsReceivedListContext = createContext();
/**
* Payment receives list data provider.
*/
function PaymentReceivesListProvider({ query, tableStateChanged, ...props }) {
function PaymentsReceivedListProvider({ query, tableStateChanged, ...props }) {
// Fetch payment receives resource views and fields.
const { data: paymentReceivesViews, isLoading: isViewsLoading } =
useResourceViews('payment_receives');
@@ -61,12 +61,12 @@ function PaymentReceivesListProvider({ query, tableStateChanged, ...props }) {
loading={isViewsLoading || isResourceLoading}
name={'payment-receives-list'}
>
<PaymentReceivesListContext.Provider value={state} {...props} />
<PaymentsReceivedListContext.Provider value={state} {...props} />
</DashboardInsider>
);
}
const usePaymentReceivesListContext = () =>
useContext(PaymentReceivesListContext);
const usePaymentsReceivedListContext = () =>
useContext(PaymentsReceivedListContext);
export { PaymentReceivesListProvider, usePaymentReceivesListContext };
export { PaymentsReceivedListProvider, usePaymentsReceivedListContext };

View File

@@ -11,17 +11,17 @@ import {
TableSkeletonHeader,
} from '@/components';
import PaymentReceivesEmptyStatus from './PaymentReceivesEmptyStatus';
import PaymentReceivesEmptyStatus from './PaymentsReceivedEmptyStatus';
import withPaymentReceives from './withPaymentReceives';
import withPaymentReceivesActions from './withPaymentReceivesActions';
import withPaymentsReceived from './withPaymentsReceived';
import withPaymentsReceivedActions from './withPaymentsReceivedActions';
import withAlertsActions from '@/containers/Alert/withAlertActions';
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withSettings from '@/containers/Settings/withSettings';
import { usePaymentReceivesColumns, ActionsMenu } from './components';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
import { usePaymentsReceivedListContext } from './PaymentsReceivedListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
import { DRAWERS } from '@/constants/drawers';
import { DialogsName } from '@/constants/dialogs';
@@ -29,8 +29,8 @@ import { DialogsName } from '@/constants/dialogs';
/**
* Payment receives datatable.
*/
function PaymentReceivesDataTable({
// #withPaymentReceivesActions
function PaymentsReceivedDataTable({
// #withPaymentsReceivedActions
setPaymentReceivesTableState,
// #withAlertsActions
@@ -55,24 +55,24 @@ function PaymentReceivesDataTable({
isPaymentReceivesLoading,
isPaymentReceivesFetching,
isEmptyStatus,
} = usePaymentReceivesListContext();
} = usePaymentsReceivedListContext();
// Payment receives columns.
const columns = usePaymentReceivesColumns();
// Handles edit payment receive.
const handleEditPaymentReceive = ({ id }) => {
history.push(`/payment-receives/${id}/edit`);
history.push(`/payments-received/${id}/edit`);
};
// Handles delete payment receive.
const handleDeletePaymentReceive = ({ id }) => {
openAlert('payment-receive-delete', { paymentReceiveId: id });
openAlert('payment-received-delete', { paymentReceiveId: id });
};
// Handle view detail payment receive..
const handleViewDetailPaymentReceive = ({ id }) => {
openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, { paymentReceiveId: id });
openDrawer(DRAWERS.PAYMENT_RECEIVED_DETAILS, { paymentReceiveId: id });
};
// Handle mail send payment receive.
@@ -82,7 +82,7 @@ function PaymentReceivesDataTable({
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer(DRAWERS.PAYMENT_RECEIVE_DETAILS, {
openDrawer(DRAWERS.PAYMENT_RECEIVED_DETAILS, {
paymentReceiveId: cell.row.original.id,
});
};
@@ -144,14 +144,14 @@ function PaymentReceivesDataTable({
}
export default compose(
withPaymentReceivesActions,
withPaymentsReceivedActions,
withAlertsActions,
withDrawerActions,
withDialogActions,
withPaymentReceives(({ paymentReceivesTableState }) => ({
withPaymentsReceived(({ paymentReceivesTableState }) => ({
paymentReceivesTableState,
})),
withSettings(({ paymentReceiveSettings }) => ({
paymentReceivesTableSize: paymentReceiveSettings?.tableSize,
})),
)(PaymentReceivesDataTable);
)(PaymentsReceivedDataTable);

View File

@@ -5,24 +5,24 @@ import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
import { FormattedMessage as T, DashboardViewsTabs } from '@/components';
import { pick } from 'lodash';
import withPaymentReceives from './withPaymentReceives';
import withPaymentReceivesActions from './withPaymentReceivesActions';
import { usePaymentReceivesListContext } from './PaymentReceiptsListProvider';
import withPaymentsReceived from './withPaymentsReceived';
import withPaymentsReceivedActions from './withPaymentsReceivedActions';
import { usePaymentsReceivedListContext } from './PaymentsReceivedListProvider';
import { compose } from '@/utils';
/**
* Payment receive view tabs.
*/
function PaymentReceiveViewTabs({
// #withPaymentReceivesActions
function PaymentsReceivedViewTabs({
// #withPaymentsReceivedActions
addPaymentReceivesTableQueries,
// #withPaymentReceives
// #withPaymentsReceived
paymentReceivesTableState,
}) {
const history = useHistory();
const { paymentReceivesViews, ...res } = usePaymentReceivesListContext();
const { paymentReceivesViews, ...res } = usePaymentsReceivedListContext();
const tabs = paymentReceivesViews.map((view) => ({
...pick(view, ['name', 'id']),
@@ -30,7 +30,7 @@ function PaymentReceiveViewTabs({
// Handles click a new view tab.
const handleClickNewView = () => {
history.push('/custom_views/payment-receives/new');
history.push('/custom_views/payment-received/new');
};
// Handles the active tab chaing.
@@ -56,8 +56,8 @@ function PaymentReceiveViewTabs({
}
export default compose(
withPaymentReceivesActions,
withPaymentReceives(({ paymentReceivesTableState }) => ({
withPaymentsReceivedActions,
withPaymentsReceived(({ paymentReceivesTableState }) => ({
paymentReceivesTableState,
})),
)(PaymentReceiveViewTabs);
)(PaymentsReceivedViewTabs);

View File

@@ -12,7 +12,7 @@ import {
Position,
} from '@blueprintjs/core';
import { FormatDateCell, Money, Icon, Can } from '@/components';
import { Money, Icon, Can } from '@/components';
import { safeCallback } from '@/utils';
import { CLASSES } from '@/constants/classes';
import {
@@ -43,14 +43,14 @@ export function ActionsMenu({
<MenuDivider />
<MenuItem
icon={<Icon icon="pen-18" />}
text={intl.get('edit_payment_receive')}
text={intl.get('edit_payment_received')}
onClick={safeCallback(onEdit, paymentReceive)}
/>
</Can>
<Can I={PaymentReceiveAction.Delete} a={AbilitySubject.PaymentReceive}>
<MenuDivider />
<MenuItem
text={intl.get('delete_payment_receive')}
text={intl.get('delete_payment_received')}
intent={Intent.DANGER}
onClick={safeCallback(onDelete, paymentReceive)}
icon={<Icon icon="trash-16" iconSize={16} />}
@@ -117,7 +117,7 @@ export function usePaymentReceivesColumns() {
},
{
id: 'payment_receive_no',
Header: intl.get('payment_receive_no'),
Header: intl.get('payment_received_no'),
accessor: (row) =>
row.payment_receive_no ? `${row.payment_receive_no}` : null,
width: 140,

View File

@@ -0,0 +1,13 @@
// @ts-nocheck
import React from 'react';
const PaymentReceivedDeleteAlert = React.lazy(
() => import('@/containers/Alerts/PaymentReceived/PaymentReceivedDeleteAlert'),
);
/**
* PaymentReceives alert.
*/
export default [
{ name: 'payment-received-delete', component: PaymentReceivedDeleteAlert },
];

View File

@@ -7,10 +7,10 @@ export default function PaymentsReceiveImport() {
const history = useHistory();
const handleCancelBtnClick = () => {
history.push('/payment-receives');
history.push('/payments-received');
};
const handleImportSuccess = () => {
history.push('/payment-receives');
history.push('/payments-received');
};
return (