mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
Fix: PaymentReceive Number Dialog
This commit is contained in:
@@ -19,7 +19,7 @@ export default function DialogsContainer() {
|
|||||||
<AccountFormDialog dialogName={'account-form'} />
|
<AccountFormDialog dialogName={'account-form'} />
|
||||||
<JournalNumberDialog dialogName={'journal-number-form'} />
|
<JournalNumberDialog dialogName={'journal-number-form'} />
|
||||||
{/* <BillNumberDialog dialogName={'bill-number-form'} /> */}
|
{/* <BillNumberDialog dialogName={'bill-number-form'} /> */}
|
||||||
<PaymentReceiveNumberDialog dialogName={'payment-number-form'} />
|
<PaymentReceiveNumberDialog dialogName={'payment-receive-number-form'} />
|
||||||
<EstimateNumberDialog dialogName={'estimate-number-form'} />
|
<EstimateNumberDialog dialogName={'estimate-number-form'} />
|
||||||
<ReceiptNumberDialog dialogName={'receipt-number-form'} />
|
<ReceiptNumberDialog dialogName={'receipt-number-form'} />
|
||||||
<InvoiceNumberDialog dialogName={'invoice-number-form'} />
|
<InvoiceNumberDialog dialogName={'invoice-number-form'} />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { DialogContent } from 'components';
|
import { DialogContent } from 'components';
|
||||||
import { useQuery, queryCache } from 'react-query';
|
import { useQuery, queryCache } from 'react-query';
|
||||||
|
|
||||||
@@ -7,12 +7,12 @@ import ReferenceNumberForm from 'containers/JournalNumber/ReferenceNumberForm';
|
|||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
import withSettingsActions from 'containers/Settings/withSettingsActions';
|
import withSettingsActions from 'containers/Settings/withSettingsActions';
|
||||||
import withSettings from 'containers/Settings/withSettings';
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
import withPaymentMadeActions from 'containers/Purchases/PaymentMades/withPaymentMadeActions';
|
import withPaymentReceivesActions from 'containers/Sales/PaymentReceive/withPaymentReceivesActions';
|
||||||
|
|
||||||
import { compose, optionsMapToArray } from 'utils';
|
import { compose, optionsMapToArray } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* payment number dialog's content.
|
* payment receive number dialog's content.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function PaymentNumberDialogContent({
|
function PaymentNumberDialogContent({
|
||||||
@@ -26,37 +26,39 @@ function PaymentNumberDialogContent({
|
|||||||
|
|
||||||
// #withDialogActions
|
// #withDialogActions
|
||||||
closeDialog,
|
closeDialog,
|
||||||
// #withPaymentMadeActions
|
|
||||||
setPaymentNumberChange,
|
// #withPaymentReceivesActions
|
||||||
|
setPaymentReceiveNumberChanged,
|
||||||
}) {
|
}) {
|
||||||
const fetchSettings = useQuery(['settings'], () => requestFetchOptions({}));
|
const fetchSettings = useQuery(['settings'], () => requestFetchOptions({}));
|
||||||
|
|
||||||
const handleSubmitForm = (values, { setSubmitting }) => {
|
const handleSubmitForm = (values, { setSubmitting }) => {
|
||||||
const options = optionsMapToArray(values).map((option) => {
|
const options = optionsMapToArray(values).map((option) => {
|
||||||
return { key: option.key, ...option, group: 'bill_payments' };
|
return { key: option.key, ...option, group: 'payment_receives' };
|
||||||
});
|
});
|
||||||
|
|
||||||
requestSubmitOptions({ options })
|
requestSubmitOptions({ options })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
closeDialog('payment-number-form');
|
closeDialog('payment-receive-number-form');
|
||||||
setPaymentNumberChange(true);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
queryCache.invalidateQueries('settings');
|
queryCache.invalidateQueries('settings');
|
||||||
|
setPaymentReceiveNumberChanged(true);
|
||||||
}, 250);
|
}, 250);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const handleClose = () => {
|
|
||||||
closeDialog('payment-number-form');
|
const handleClose = useCallback(() => {
|
||||||
};
|
closeDialog('payment-receive-number-form');
|
||||||
|
}, [closeDialog]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogContent
|
<DialogContent isLoading={fetchSettings.isFetching}>
|
||||||
isLoading={fetchSettings.isFetching}
|
|
||||||
>
|
|
||||||
<ReferenceNumberForm
|
<ReferenceNumberForm
|
||||||
initialNumber={nextNumber}
|
initialNumber={nextNumber}
|
||||||
initialPrefix={numberPrefix}
|
initialPrefix={numberPrefix}
|
||||||
@@ -70,9 +72,9 @@ function PaymentNumberDialogContent({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withDialogActions,
|
withDialogActions,
|
||||||
withSettingsActions,
|
withSettingsActions,
|
||||||
withSettings(({ billPaymentSettings }) => ({
|
withSettings(({ paymentReceiveSettings }) => ({
|
||||||
nextNumber: billPaymentSettings?.next_number,
|
nextNumber: paymentReceiveSettings?.nextNumber,
|
||||||
numberPrefix: billPaymentSettings?.number_prefix,
|
numberPrefix: paymentReceiveSettings?.numberPrefix,
|
||||||
})),
|
})),
|
||||||
withPaymentMadeActions,
|
withPaymentReceivesActions,
|
||||||
)(PaymentNumberDialogContent);
|
)(PaymentNumberDialogContent);
|
||||||
@@ -4,25 +4,30 @@ import { Dialog, DialogSuspense } from 'components';
|
|||||||
import withDialogRedux from 'components/DialogReduxConnect';
|
import withDialogRedux from 'components/DialogReduxConnect';
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
const PaymentNumbereDialogConetnet = lazy(() =>
|
const PaymentReceiveNumbereDialogConetnet = lazy(() =>
|
||||||
import('./PaymentNumberDialogContent'),
|
import('./PaymentReceiveNumberDialogContent'),
|
||||||
);
|
);
|
||||||
|
|
||||||
function PaymentNumberDialog({ dialogName, payload = { id: null }, isOpen }) {
|
function PaymentReceiveNumberDialog({
|
||||||
|
dialogName,
|
||||||
|
payload = { id: null },
|
||||||
|
isOpen,
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
name={dialogName}
|
|
||||||
name={dialogName}
|
|
||||||
title={<T id={'payment_number_settings'} />}
|
title={<T id={'payment_number_settings'} />}
|
||||||
|
name={dialogName}
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
canEscapeKeyClose={true}
|
canEscapeKeyClose={true}
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
>
|
>
|
||||||
<DialogSuspense>
|
<DialogSuspense>
|
||||||
<PaymentNumbereDialogConetnet paymentNumberId={payload.id} />
|
<PaymentReceiveNumbereDialogConetnet
|
||||||
|
paymentReceiveNumberId={payload.id}
|
||||||
|
/>
|
||||||
</DialogSuspense>
|
</DialogSuspense>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(withDialogRedux())(PaymentNumberDialog);
|
export default compose(withDialogRedux())(PaymentReceiveNumberDialog);
|
||||||
@@ -23,30 +23,16 @@ import PaymentReceiveFormFooter from './PaymentReceiveFormFooter';
|
|||||||
import withMediaActions from 'containers/Media/withMediaActions';
|
import withMediaActions from 'containers/Media/withMediaActions';
|
||||||
import withPaymentReceivesActions from './withPaymentReceivesActions';
|
import withPaymentReceivesActions from './withPaymentReceivesActions';
|
||||||
import withPaymentReceiveDetail from './withPaymentReceiveDetail';
|
import withPaymentReceiveDetail from './withPaymentReceiveDetail';
|
||||||
|
import withPaymentReceives from './withPaymentReceives';
|
||||||
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
|
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||||
import { AppToaster } from 'components';
|
import { AppToaster } from 'components';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
// Default payment receive entry.
|
/**
|
||||||
const defaultPaymentReceiveEntry = {
|
* Payment Receive form.
|
||||||
id: null,
|
*/
|
||||||
payment_amount: null,
|
|
||||||
invoice_id: null,
|
|
||||||
due_amount: null,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Form initial values.
|
|
||||||
const defaultInitialValues = {
|
|
||||||
customer_id: '',
|
|
||||||
deposit_account_id: '',
|
|
||||||
payment_date: moment(new Date()).format('YYYY-MM-DD'),
|
|
||||||
reference_no: '',
|
|
||||||
payment_receive_no: '',
|
|
||||||
description: '',
|
|
||||||
full_amount: '',
|
|
||||||
entries: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
function PaymentReceiveForm({
|
function PaymentReceiveForm({
|
||||||
// #ownProps
|
// #ownProps
|
||||||
paymentReceiveId,
|
paymentReceiveId,
|
||||||
@@ -55,10 +41,22 @@ function PaymentReceiveForm({
|
|||||||
//#WithPaymentReceiveActions
|
//#WithPaymentReceiveActions
|
||||||
requestSubmitPaymentReceive,
|
requestSubmitPaymentReceive,
|
||||||
requestEditPaymentReceive,
|
requestEditPaymentReceive,
|
||||||
|
setPaymentReceiveNumberChanged,
|
||||||
|
|
||||||
// #withPaymentReceiveDetail
|
// #withPaymentReceiveDetail
|
||||||
paymentReceive,
|
paymentReceive,
|
||||||
paymentReceiveEntries,
|
paymentReceiveEntries,
|
||||||
|
|
||||||
|
// #withSettings
|
||||||
|
paymentReceiveNextNumber,
|
||||||
|
paymentReceiveNumberPrefix,
|
||||||
|
|
||||||
|
// #withPaymentReceives
|
||||||
|
paymentReceiveNumberChanged,
|
||||||
|
|
||||||
|
// #withDashboardAction
|
||||||
|
changePageTitle,
|
||||||
|
changePageSubtitle,
|
||||||
}) {
|
}) {
|
||||||
const [amountChangeAlert, setAmountChangeAlert] = useState(false);
|
const [amountChangeAlert, setAmountChangeAlert] = useState(false);
|
||||||
const [clearLinesAlert, setClearLinesAlert] = useState(false);
|
const [clearLinesAlert, setClearLinesAlert] = useState(false);
|
||||||
@@ -71,6 +69,26 @@ function PaymentReceiveForm({
|
|||||||
paymentReceiveEntries,
|
paymentReceiveEntries,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const paymentReceiveNumber = paymentReceiveNumberPrefix
|
||||||
|
? `${paymentReceiveNumberPrefix}-${paymentReceiveNextNumber}`
|
||||||
|
: paymentReceiveNextNumber;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (paymentReceive && paymentReceiveId) {
|
||||||
|
changePageTitle(formatMessage({ id: 'edit_payment_receive' }));
|
||||||
|
changePageSubtitle(`No. ${paymentReceive.payment_receive_no}`);
|
||||||
|
} else {
|
||||||
|
changePageSubtitle(`No. ${paymentReceiveNumber}`);
|
||||||
|
changePageTitle(formatMessage({ id: 'payment_receive' }));
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
changePageTitle,
|
||||||
|
changePageSubtitle,
|
||||||
|
paymentReceive,
|
||||||
|
paymentReceiveId,
|
||||||
|
formatMessage,
|
||||||
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (localPaymentEntries !== paymentReceiveEntries) {
|
if (localPaymentEntries !== paymentReceiveEntries) {
|
||||||
setLocalPaymentEntries(paymentReceiveEntries);
|
setLocalPaymentEntries(paymentReceiveEntries);
|
||||||
@@ -89,7 +107,7 @@ function PaymentReceiveForm({
|
|||||||
.required()
|
.required()
|
||||||
.label(formatMessage({ id: 'deposit_account_' })),
|
.label(formatMessage({ id: 'deposit_account_' })),
|
||||||
full_amount: Yup.number().nullable(),
|
full_amount: Yup.number().nullable(),
|
||||||
payment_receive_no: Yup.number().label(
|
payment_receive_no: Yup.string().label(
|
||||||
formatMessage({ id: 'payment_receive_no_' }),
|
formatMessage({ id: 'payment_receive_no_' }),
|
||||||
),
|
),
|
||||||
reference_no: Yup.string().min(1).max(255).nullable(),
|
reference_no: Yup.string().min(1).max(255).nullable(),
|
||||||
@@ -109,6 +127,26 @@ function PaymentReceiveForm({
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Default payment receive entry.
|
||||||
|
const defaultPaymentReceiveEntry = {
|
||||||
|
id: null,
|
||||||
|
payment_amount: null,
|
||||||
|
invoice_id: null,
|
||||||
|
due_amount: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Form initial values.
|
||||||
|
const defaultInitialValues = {
|
||||||
|
customer_id: '',
|
||||||
|
deposit_account_id: '',
|
||||||
|
payment_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||||
|
reference_no: '',
|
||||||
|
payment_receive_no: paymentReceiveNumber,
|
||||||
|
description: '',
|
||||||
|
full_amount: '',
|
||||||
|
entries: [],
|
||||||
|
};
|
||||||
|
|
||||||
// Form initial values.
|
// Form initial values.
|
||||||
const initialValues = useMemo(
|
const initialValues = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@@ -303,6 +341,27 @@ function PaymentReceiveForm({
|
|||||||
[values.entries],
|
[values.entries],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (paymentReceiveNumberChanged) {
|
||||||
|
setFieldValue('payment_receive_no', paymentReceiveNumber);
|
||||||
|
changePageSubtitle(`No. ${paymentReceiveNumber}`);
|
||||||
|
setPaymentReceiveNumberChanged(false);
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
paymentReceiveNumber,
|
||||||
|
paymentReceiveNumberChanged,
|
||||||
|
setFieldValue,
|
||||||
|
changePageSubtitle,
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
const handlePaymentReceiveNumberChanged = useCallback(
|
||||||
|
(payment_receive_no) => {
|
||||||
|
changePageSubtitle(`No.${payment_receive_no}`);
|
||||||
|
},
|
||||||
|
[changePageSubtitle],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@@ -322,6 +381,7 @@ function PaymentReceiveForm({
|
|||||||
onFullAmountChanged={handleFullAmountChange}
|
onFullAmountChanged={handleFullAmountChange}
|
||||||
receivableFullAmount={receivableFullAmount}
|
receivableFullAmount={receivableFullAmount}
|
||||||
amountReceived={fullAmountReceived}
|
amountReceived={fullAmountReceived}
|
||||||
|
onPaymentReceiveNumberChanged={handlePaymentReceiveNumberChanged}
|
||||||
/>
|
/>
|
||||||
<PaymentReceiveItemsTable
|
<PaymentReceiveItemsTable
|
||||||
paymentReceiveId={paymentReceiveId}
|
paymentReceiveId={paymentReceiveId}
|
||||||
@@ -388,12 +448,17 @@ function PaymentReceiveForm({
|
|||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withPaymentReceivesActions,
|
withPaymentReceivesActions,
|
||||||
|
withDashboardActions,
|
||||||
withMediaActions,
|
withMediaActions,
|
||||||
// withPaymentReceives(({ paymentReceivesItems }) => ({
|
|
||||||
// paymentReceivesItems,
|
|
||||||
// })),
|
|
||||||
withPaymentReceiveDetail(({ paymentReceive, paymentReceiveEntries }) => ({
|
withPaymentReceiveDetail(({ paymentReceive, paymentReceiveEntries }) => ({
|
||||||
paymentReceive,
|
paymentReceive,
|
||||||
paymentReceiveEntries,
|
paymentReceiveEntries,
|
||||||
})),
|
})),
|
||||||
|
withSettings(({ paymentReceiveSettings }) => ({
|
||||||
|
paymentReceiveNextNumber: paymentReceiveSettings?.nextNumber,
|
||||||
|
paymentReceiveNumberPrefix: paymentReceiveSettings?.numberPrefix,
|
||||||
|
})),
|
||||||
|
withPaymentReceives(({ paymentReceiveNumberChanged }) => ({
|
||||||
|
paymentReceiveNumberChanged,
|
||||||
|
})),
|
||||||
)(PaymentReceiveForm);
|
)(PaymentReceiveForm);
|
||||||
|
|||||||
@@ -13,18 +13,21 @@ import moment from 'moment';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
import { momentFormatter, compose, tansformDateValue } from 'utils';
|
import { momentFormatter, compose, tansformDateValue, saveInvoke } from 'utils';
|
||||||
import {
|
import {
|
||||||
AccountsSelectList,
|
AccountsSelectList,
|
||||||
ContactSelecetList,
|
ContactSelecetList,
|
||||||
ErrorMessage,
|
ErrorMessage,
|
||||||
FieldRequiredHint,
|
FieldRequiredHint,
|
||||||
|
Icon,
|
||||||
|
InputPrependButton,
|
||||||
Hint,
|
Hint,
|
||||||
Money,
|
Money,
|
||||||
} from 'components';
|
} from 'components';
|
||||||
|
|
||||||
import withCustomers from 'containers/Customers/withCustomers';
|
import withCustomers from 'containers/Customers/withCustomers';
|
||||||
import withAccounts from 'containers/Accounts/withAccounts';
|
import withAccounts from 'containers/Accounts/withAccounts';
|
||||||
|
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
function PaymentReceiveFormHeader({
|
function PaymentReceiveFormHeader({
|
||||||
// #useFormik
|
// #useFormik
|
||||||
@@ -46,6 +49,11 @@ function PaymentReceiveFormHeader({
|
|||||||
|
|
||||||
// #withInvoices
|
// #withInvoices
|
||||||
receivableInvoices,
|
receivableInvoices,
|
||||||
|
// #ownProps
|
||||||
|
onPaymentReceiveNumberChanged,
|
||||||
|
|
||||||
|
//#withDialogActions
|
||||||
|
openDialog,
|
||||||
}) {
|
}) {
|
||||||
const handleDateChange = useCallback(
|
const handleDateChange = useCallback(
|
||||||
(date_filed) => (date) => {
|
(date_filed) => (date) => {
|
||||||
@@ -78,6 +86,14 @@ function PaymentReceiveFormHeader({
|
|||||||
triggerFullAmountChanged(receivableFullAmount);
|
triggerFullAmountChanged(receivableFullAmount);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handlePaymentReceiveNumberChange = useCallback(() => {
|
||||||
|
openDialog('payment-receive-number-form', {});
|
||||||
|
}, [openDialog]);
|
||||||
|
|
||||||
|
const handlePaymentReceiveNumberChanged = (event) => {
|
||||||
|
saveInvoke(onPaymentReceiveNumberChanged, event.currentTarget.value);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_HEADER)}>
|
<div className={classNames(CLASSES.PAGE_FORM_HEADER)}>
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_HEADER_PRIMARY)}>
|
<div className={classNames(CLASSES.PAGE_FORM_HEADER_PRIMARY)}>
|
||||||
@@ -177,7 +193,22 @@ function PaymentReceiveFormHeader({
|
|||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
minimal={true}
|
minimal={true}
|
||||||
|
rightElement={
|
||||||
|
<InputPrependButton
|
||||||
|
buttonProps={{
|
||||||
|
onClick: handlePaymentReceiveNumberChange,
|
||||||
|
icon: <Icon icon={'settings-18'} />,
|
||||||
|
}}
|
||||||
|
tooltip={true}
|
||||||
|
tooltipProps={{
|
||||||
|
content:
|
||||||
|
'Setting your auto-generated Payment Receive number',
|
||||||
|
position: Position.BOTTOM_LEFT,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
{...getFieldProps('payment_receive_no')}
|
{...getFieldProps('payment_receive_no')}
|
||||||
|
onBlur={handlePaymentReceiveNumberChanged}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -255,4 +286,5 @@ export default compose(
|
|||||||
withAccounts(({ accountsList }) => ({
|
withAccounts(({ accountsList }) => ({
|
||||||
accountsList,
|
accountsList,
|
||||||
})),
|
})),
|
||||||
|
withDialogActions,
|
||||||
)(PaymentReceiveFormHeader);
|
)(PaymentReceiveFormHeader);
|
||||||
|
|||||||
@@ -35,17 +35,6 @@ function PaymentReceiveFormPage({
|
|||||||
requestFetchCustomers
|
requestFetchCustomers
|
||||||
}) {
|
}) {
|
||||||
const { id: paymentReceiveId } = useParams();
|
const { id: paymentReceiveId } = useParams();
|
||||||
const { formatMessage } = useIntl();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log(paymentReceiveId, 'X');
|
|
||||||
|
|
||||||
if (paymentReceiveId) {
|
|
||||||
changePageTitle(formatMessage({ id: 'edit_payment_receive' }));
|
|
||||||
} else {
|
|
||||||
changePageTitle(formatMessage({ id: 'payment_receive' }));
|
|
||||||
}
|
|
||||||
}, [changePageTitle, paymentReceiveId, formatMessage]);
|
|
||||||
|
|
||||||
// Fetches payment recevie details.
|
// Fetches payment recevie details.
|
||||||
const fetchPaymentReceive = useQuery(
|
const fetchPaymentReceive = useQuery(
|
||||||
@@ -72,7 +61,7 @@ function PaymentReceiveFormPage({
|
|||||||
loading={
|
loading={
|
||||||
fetchPaymentReceive.isFetching ||
|
fetchPaymentReceive.isFetching ||
|
||||||
fetchAccounts.isFetching ||
|
fetchAccounts.isFetching ||
|
||||||
fetchSettings.isFetching ||
|
// fetchSettings.isFetching ||
|
||||||
fetchCustomers.isFetching
|
fetchCustomers.isFetching
|
||||||
}>
|
}>
|
||||||
<PaymentReceiveForm
|
<PaymentReceiveForm
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
getPaymentReceiveTableQuery,
|
getPaymentReceiveTableQuery,
|
||||||
} from 'store/PaymentReceive/paymentReceive.selector';
|
} from 'store/PaymentReceive/paymentReceive.selector';
|
||||||
|
|
||||||
|
|
||||||
export default (mapState) => {
|
export default (mapState) => {
|
||||||
const getPyamentReceivesItems = getPaymentReceiveCurrentPageFactory();
|
const getPyamentReceivesItems = getPaymentReceiveCurrentPageFactory();
|
||||||
const getPyamentReceivesPaginationMeta = getPaymentReceivePaginationMetaFactory();
|
const getPyamentReceivesPaginationMeta = getPaymentReceivePaginationMetaFactory();
|
||||||
@@ -17,8 +16,14 @@ export default (mapState) => {
|
|||||||
paymentReceivesViews: getResourceViews(state, props, 'payment_receives'),
|
paymentReceivesViews: getResourceViews(state, props, 'payment_receives'),
|
||||||
paymentReceivesItems: state.paymentReceives.items,
|
paymentReceivesItems: state.paymentReceives.items,
|
||||||
paymentReceivesTableQuery: query,
|
paymentReceivesTableQuery: query,
|
||||||
paymentReceivesPageination: getPyamentReceivesPaginationMeta(state, props, query),
|
paymentReceivesPageination: getPyamentReceivesPaginationMeta(
|
||||||
|
state,
|
||||||
|
props,
|
||||||
|
query,
|
||||||
|
),
|
||||||
paymentReceivesLoading: state.paymentReceives.loading,
|
paymentReceivesLoading: state.paymentReceives.loading,
|
||||||
|
|
||||||
|
paymentReceiveNumberChanged: state.paymentReceives.journalNumberChanged,
|
||||||
};
|
};
|
||||||
return mapState ? mapState(mapped, state, props) : mapped;
|
return mapState ? mapState(mapped, state, props) : mapped;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
dispatch(submitPaymentReceive({ form })),
|
dispatch(submitPaymentReceive({ form })),
|
||||||
requestFetchPaymentReceive: (id) => dispatch(fetchPaymentReceive({ id })),
|
requestFetchPaymentReceive: (id) => dispatch(fetchPaymentReceive({ id })),
|
||||||
requestEditPaymentReceive: (id, form) =>
|
requestEditPaymentReceive: (id, form) =>
|
||||||
dispatch(editPaymentReceive( id, form )),
|
dispatch(editPaymentReceive(id, form)),
|
||||||
requestDeletePaymentReceive: (id) => dispatch(deletePaymentReceive({ id })),
|
requestDeletePaymentReceive: (id) => dispatch(deletePaymentReceive({ id })),
|
||||||
requestFetchPaymentReceiveTable: (query = {}) =>
|
requestFetchPaymentReceiveTable: (query = {}) =>
|
||||||
dispatch(fetchPaymentReceivesTable({ query: { ...query } })),
|
dispatch(fetchPaymentReceivesTable({ query: { ...query } })),
|
||||||
@@ -29,6 +29,10 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
type: t.PAYMENT_RECEIVE_TABLE_QUERIES_ADD,
|
type: t.PAYMENT_RECEIVE_TABLE_QUERIES_ADD,
|
||||||
queries,
|
queries,
|
||||||
}),
|
}),
|
||||||
|
setPaymentReceiveNumberChanged: (isChanged) =>
|
||||||
|
dispatch({
|
||||||
|
type: t.PAYMENT_RECEIVE_NUMBER_CHANGED,
|
||||||
|
payload: { isChanged },
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps);
|
export default connect(null, mapDispatchToProps);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export default (mapState) => {
|
|||||||
organizationSettings: state.settings.data.organization,
|
organizationSettings: state.settings.data.organization,
|
||||||
manualJournalsSettings: state.settings.data.manualJournals,
|
manualJournalsSettings: state.settings.data.manualJournals,
|
||||||
billsettings: state.settings.data.bills,
|
billsettings: state.settings.data.bills,
|
||||||
billPaymentSettings: state.settings.data.billPayments,
|
paymentReceiveSettings: state.settings.data.paymentReceives,
|
||||||
estimatesSettings: state.settings.data.salesEstimates,
|
estimatesSettings: state.settings.data.salesEstimates,
|
||||||
receiptSettings: state.settings.data.salesReceipts,
|
receiptSettings: state.settings.data.salesReceipts,
|
||||||
invoiceSettings: state.settings.data.salesInvoices,
|
invoiceSettings: state.settings.data.salesInvoices,
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { createReducer } from '@reduxjs/toolkit';
|
import { createReducer } from '@reduxjs/toolkit';
|
||||||
import { createTableQueryReducers } from 'store/queryReducers';
|
import { createTableQueryReducers } from 'store/queryReducers';
|
||||||
import { omit } from 'lodash';
|
import { omit } from 'lodash';
|
||||||
|
import { journalNumberChangedReducer } from 'store/journalNumber.reducer';
|
||||||
|
|
||||||
import t from 'store/types';
|
import t from 'store/types';
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
@@ -105,5 +107,7 @@ const reducer = createReducer(initialState, {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
...journalNumberChangedReducer(t.PAYMENT_RECEIVE_NUMBER_CHANGED),
|
||||||
});
|
});
|
||||||
export default createTableQueryReducers('payment_receives', reducer);
|
export default createTableQueryReducers('payment_receives', reducer);
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ export default {
|
|||||||
PAYMENT_RECEIVES_PAGE_SET: 'PAYMENT_RECEIVES_PAGE_SET',
|
PAYMENT_RECEIVES_PAGE_SET: 'PAYMENT_RECEIVES_PAGE_SET',
|
||||||
PAYMENT_RECEIVES_ITEMS_SET: 'PAYMENT_RECEIVES_ITEMS_SET',
|
PAYMENT_RECEIVES_ITEMS_SET: 'PAYMENT_RECEIVES_ITEMS_SET',
|
||||||
PAYMENT_RECEIVES_PAGINATION_SET: 'PAYMENT_RECEIVES_PAGINATION_SET',
|
PAYMENT_RECEIVES_PAGINATION_SET: 'PAYMENT_RECEIVES_PAGINATION_SET',
|
||||||
|
|
||||||
|
PAYMENT_RECEIVE_NUMBER_CHANGED: 'PAYMENT_RECEIVE_NUMBER_CHANGED',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user