mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
Merge branch 'develop' into rename-payment-receives-to-payment-received
This commit is contained in:
@@ -8,7 +8,7 @@ import InvoicesAlerts from '@/containers/Sales/Invoices/InvoicesAlerts';
|
||||
import ReceiptsAlerts from '@/containers/Sales/Receipts/ReceiptsAlerts';
|
||||
import PaymentsReceivedAlerts from '@/containers/Sales/PaymentsReceived/PaymentsReceivedAlerts';
|
||||
import BillsAlerts from '@/containers/Purchases/Bills/BillsLanding/BillsAlerts';
|
||||
import PaymentMadesAlerts from '@/containers/Purchases/PaymentMades/PaymentMadesAlerts';
|
||||
import PaymentsMadeAlerts from '@/containers/Purchases/PaymentsMade/PaymentsMadeAlerts';
|
||||
import CustomersAlerts from '@/containers/Customers/CustomersAlerts';
|
||||
import VendorsAlerts from '@/containers/Vendors/VendorsAlerts';
|
||||
import ManualJournalsAlerts from '@/containers/Accounting/JournalsLanding/ManualJournalsAlerts';
|
||||
@@ -40,7 +40,7 @@ export default [
|
||||
...ReceiptsAlerts,
|
||||
...PaymentsReceivedAlerts,
|
||||
...BillsAlerts,
|
||||
...PaymentMadesAlerts,
|
||||
...PaymentsMadeAlerts,
|
||||
...CustomersAlerts,
|
||||
...VendorsAlerts,
|
||||
...ManualJournalsAlerts,
|
||||
|
||||
@@ -52,7 +52,7 @@ function CustomerFormFormik({
|
||||
...defaultInitialValues,
|
||||
currency_code: base_currency,
|
||||
...transformToForm(contactDuplicate || customer, defaultInitialValues),
|
||||
...initialCustomerValues,
|
||||
...transformToForm(initialCustomerValues, defaultInitialValues),
|
||||
}),
|
||||
[customer, contactDuplicate, base_currency, initialCustomerValues],
|
||||
);
|
||||
@@ -62,7 +62,7 @@ function CustomerFormFormik({
|
||||
const { setSubmitting, resetForm } = formArgs;
|
||||
const formValues = { ...values };
|
||||
|
||||
const onSuccess = () => {
|
||||
const onSuccess = (res) => {
|
||||
AppToaster.show({
|
||||
message: intl.get(
|
||||
isNewMode
|
||||
@@ -73,8 +73,7 @@ function CustomerFormFormik({
|
||||
});
|
||||
setSubmitting(false);
|
||||
resetForm();
|
||||
|
||||
saveInvoke(onSubmitSuccess, values, formArgs, submitPayload);
|
||||
saveInvoke(onSubmitSuccess, values, formArgs, submitPayload, res.data);
|
||||
};
|
||||
|
||||
const onError = () => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useFormikContext } from 'formik';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import { AppToaster } from '@/components';
|
||||
import { useQuickPaymentMadeContext } from './QuickPaymentMadeFormProvider';
|
||||
import { PAYMENT_MADE_ERRORS } from '@/containers/Purchases/PaymentMades/constants';
|
||||
import { PAYMENT_MADE_ERRORS } from '@/containers/Purchases/PaymentsMade/constants';
|
||||
|
||||
// Default initial values of payment made.
|
||||
export const defaultPaymentMade = {
|
||||
|
||||
@@ -48,7 +48,7 @@ function BillPaymentTransactionTable({
|
||||
|
||||
// Handles edit bill payment transactions.
|
||||
const handleEditBillPaymentTransactions = ({ bill_payment_id }) => {
|
||||
history.push(`/payment-mades/${bill_payment_id}/edit`);
|
||||
history.push(`/payments-made/${bill_payment_id}/edit`);
|
||||
closeDrawer(DRAWERS.BILL_DETAILS);
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ function PaymentMadeDetailActionsBar({
|
||||
|
||||
// Handle edit payment made.
|
||||
const handleEditPaymentMade = () => {
|
||||
history.push(`/payment-mades/${paymentMadeId}/edit`);
|
||||
history.push(`/payments-made/${paymentMadeId}/edit`);
|
||||
closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
|
||||
};
|
||||
|
||||
|
||||
@@ -5,14 +5,16 @@ import {
|
||||
DrawerBody,
|
||||
FormattedMessage as T,
|
||||
} from '@/components';
|
||||
|
||||
import QuickCustomerFormDrawer from './QuickCustomerFormDrawer';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
* Quick create/edit customer drawer.
|
||||
*/
|
||||
export default function QuickCreateCustomerDrawerContent({ displayName }) {
|
||||
export default function QuickCreateCustomerDrawerContent({
|
||||
displayName,
|
||||
autofillRef,
|
||||
}) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<DrawerHeaderContent
|
||||
@@ -20,7 +22,10 @@ export default function QuickCreateCustomerDrawerContent({ displayName }) {
|
||||
title={<T id={'create_a_new_customer'} />}
|
||||
/>
|
||||
<DrawerBody>
|
||||
<QuickCustomerFormDrawer displayName={displayName} />
|
||||
<QuickCustomerFormDrawer
|
||||
displayName={displayName}
|
||||
autofillRef={autofillRef}
|
||||
/>
|
||||
</DrawerBody>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
@@ -14,6 +14,7 @@ import CustomerFormFormik, {
|
||||
|
||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
import { useAddAutofillRef } from '@/hooks/state/autofill';
|
||||
|
||||
/**
|
||||
* Drawer customer form loading wrapper.
|
||||
@@ -28,9 +29,22 @@ function DrawerCustomerFormLoading({ children }) {
|
||||
/**
|
||||
* Quick customer form of the drawer.
|
||||
*/
|
||||
function QuickCustomerFormDrawer({ displayName, closeDrawer, customerId }) {
|
||||
function QuickCustomerFormDrawer({
|
||||
displayName,
|
||||
autofillRef,
|
||||
closeDrawer,
|
||||
customerId,
|
||||
}) {
|
||||
const addAutofillRef = useAddAutofillRef();
|
||||
|
||||
// Handle the form submit request success.
|
||||
const handleSubmitSuccess = () => {
|
||||
const handleSubmitSuccess = (values, formArgs, submitPayload, res) => {
|
||||
if (autofillRef) {
|
||||
addAutofillRef(autofillRef, {
|
||||
displayName: values.display_name,
|
||||
customerId: res.id,
|
||||
});
|
||||
}
|
||||
closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
|
||||
};
|
||||
// Handle the form cancel action.
|
||||
@@ -43,7 +57,7 @@ function QuickCustomerFormDrawer({ displayName, closeDrawer, customerId }) {
|
||||
<DrawerCustomerFormLoading>
|
||||
<CustomerFormCard>
|
||||
<CustomerFormFormik
|
||||
initialValues={{ display_name: displayName }}
|
||||
initialValues={{ first_name: displayName }}
|
||||
onSubmitSuccess={handleSubmitSuccess}
|
||||
onCancel={handleCancelForm}
|
||||
/>
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
import React from 'react';
|
||||
import { Drawer, DrawerSuspense } from '@/components';
|
||||
import withDrawers from '@/containers/Drawer/withDrawers';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
|
||||
const QuickCreateCustomerDrawerContent = React.lazy(() =>
|
||||
import('./QuickCreateCustomerDrawerContent'),
|
||||
const QuickCreateCustomerDrawerContent = React.lazy(
|
||||
() => import('./QuickCreateCustomerDrawerContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -17,7 +16,7 @@ function QuickCreateCustomerDrawer({
|
||||
|
||||
// #withDrawer
|
||||
isOpen,
|
||||
payload,
|
||||
payload: { autofillRef, displayName },
|
||||
}) {
|
||||
return (
|
||||
<Drawer
|
||||
@@ -27,7 +26,10 @@ function QuickCreateCustomerDrawer({
|
||||
size={'80%'}
|
||||
>
|
||||
<DrawerSuspense>
|
||||
<QuickCreateCustomerDrawerContent displayName={payload.displayName} />
|
||||
<QuickCreateCustomerDrawerContent
|
||||
displayName={displayName}
|
||||
autofillRef={autofillRef}
|
||||
/>
|
||||
</DrawerSuspense>
|
||||
</Drawer>
|
||||
);
|
||||
|
||||
@@ -16,6 +16,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||
|
||||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
||||
import { useAddAutofillRef } from '@/hooks/state/autofill';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
/**
|
||||
@@ -36,17 +37,20 @@ function QuickVendorFormDrawer({
|
||||
closeDrawer,
|
||||
vendorId,
|
||||
addQuickActionEvent,
|
||||
autofillRef,
|
||||
}) {
|
||||
const { payload } = useDrawerContext();
|
||||
const addAutofillRef = useAddAutofillRef();
|
||||
|
||||
// Handle the form submit request success.
|
||||
const handleSubmitSuccess = (values, form, submitPayload, response) => {
|
||||
const handleSubmitSuccess = (values, form, submitPayload, res) => {
|
||||
if (!submitPayload.noRedirect) {
|
||||
closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
|
||||
}
|
||||
if (payload.quickActionEvent) {
|
||||
addQuickActionEvent(payload.quickActionEvent, {
|
||||
vendorId: response.data.id,
|
||||
if (autofillRef) {
|
||||
addAutofillRef(autofillRef, {
|
||||
displayName: values.display_name,
|
||||
vendorId: res.id,
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -60,7 +64,7 @@ function QuickVendorFormDrawer({
|
||||
<DrawerVendorFormLoading>
|
||||
<VendorFormCard>
|
||||
<VendorFormFormik
|
||||
initialValues={{ display_name: displayName }}
|
||||
initialValues={{ first_name: displayName }}
|
||||
onSubmitSuccess={handleSubmitSuccess}
|
||||
onCancel={handleCancelForm}
|
||||
/>
|
||||
|
||||
@@ -12,7 +12,7 @@ import { DRAWERS } from '@/constants/drawers';
|
||||
/**
|
||||
* Quick create/edit vendor drawer.
|
||||
*/
|
||||
export default function QuickWriteVendorDrawerContent({ displayName }) {
|
||||
export default function QuickWriteVendorDrawerContent({ displayName, autofillRef }) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<DrawerHeaderContent
|
||||
@@ -21,7 +21,7 @@ export default function QuickWriteVendorDrawerContent({ displayName }) {
|
||||
|
||||
/>
|
||||
<DrawerBody>
|
||||
<QuickVendorFormDrawer displayName={displayName} />
|
||||
<QuickVendorFormDrawer displayName={displayName} autofillRef={autofillRef} />
|
||||
</DrawerBody>
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
@@ -17,7 +17,7 @@ function QuickWriteVendorDrawer({
|
||||
|
||||
// #withDrawer
|
||||
isOpen,
|
||||
payload,
|
||||
payload: { displayName, autofillRef },
|
||||
}) {
|
||||
return (
|
||||
<Drawer
|
||||
@@ -25,10 +25,9 @@ function QuickWriteVendorDrawer({
|
||||
name={name}
|
||||
style={{ minWidth: '700px', maxWidth: '900px' }}
|
||||
size={'80%'}
|
||||
payload={payload}
|
||||
>
|
||||
<DrawerSuspense>
|
||||
<QuickWriteVendorDrawerContent displayName={payload.displayName} />
|
||||
<QuickWriteVendorDrawerContent displayName={displayName} autofillRef={autofillRef} />
|
||||
</DrawerSuspense>
|
||||
</Drawer>
|
||||
);
|
||||
|
||||
@@ -71,7 +71,7 @@ function VendorDetailsActionsBar({
|
||||
};
|
||||
|
||||
const handleNewPaymentClick = () => {
|
||||
history.push('/payment-mades/new');
|
||||
history.push('/payments-made/new');
|
||||
closeDrawer(DRAWERS.VENDOR_DETAILS);
|
||||
};
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ function PaymentMadeForm({
|
||||
});
|
||||
setSubmitting(false);
|
||||
|
||||
submitPayload.redirect && history.push('/payment-mades');
|
||||
submitPayload.redirect && history.push('/payments-made');
|
||||
submitPayload.resetForm && resetForm();
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ function PaymentMadeActionsBar({
|
||||
|
||||
// Handle new payment made button click.
|
||||
const handleClickNewPaymentMade = () => {
|
||||
history.push('/payment-mades/new');
|
||||
history.push('/payments-made/new');
|
||||
};
|
||||
// Handle tab changing.
|
||||
const handleTabChange = (viewSlug) => {
|
||||
@@ -84,7 +84,7 @@ function PaymentMadeActionsBar({
|
||||
};
|
||||
// Handle the import button click.
|
||||
const handleImportBtnClick = () => {
|
||||
history.push('/payment-mades/import');
|
||||
history.push('/payments-made/import');
|
||||
};
|
||||
// Handle the export button click.
|
||||
const handleExportBtnClick = () => {
|
||||
@@ -37,7 +37,7 @@ function PaymentMadeViewTabs({
|
||||
);
|
||||
|
||||
const handleClickNewView = () => {
|
||||
history.push('/custom_views/payment-mades/new');
|
||||
history.push('/custom_views/payments-made/new');
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -23,7 +23,7 @@ export default function PaymentMadesEmptyStatus() {
|
||||
intent={Intent.PRIMARY}
|
||||
large={true}
|
||||
onClick={() => {
|
||||
history.push('/payment-mades/new');
|
||||
history.push('/payments-made/new');
|
||||
}}
|
||||
>
|
||||
<T id={'new_bill_payment'} />
|
||||
@@ -61,7 +61,7 @@ function PaymentMadesTable({
|
||||
|
||||
// Handles the edit payment made action.
|
||||
const handleEditPaymentMade = (paymentMade) => {
|
||||
history.push(`/payment-mades/${paymentMade.id}/edit`);
|
||||
history.push(`/payments-made/${paymentMade.id}/edit`);
|
||||
};
|
||||
|
||||
// Handles the delete payment made action.
|
||||
@@ -20,7 +20,7 @@ function PaymentMadesViewPage({
|
||||
<Switch>
|
||||
<Route
|
||||
exact={true}
|
||||
path={['/payment-mades/:custom_view_id/custom_view', '/payment-mades']}
|
||||
path={['/payments-made/:custom_view_id/custom_view', '/payments-made']}
|
||||
>
|
||||
|
||||
{/* <PaymentMadeDataTable
|
||||
@@ -3,14 +3,14 @@ import { useHistory } from 'react-router-dom';
|
||||
import { DashboardInsider } from '@/components';
|
||||
import { ImportView } from '@/containers/Import';
|
||||
|
||||
export default function PaymentMadesImport() {
|
||||
export default function PaymentsMadeImport() {
|
||||
const history = useHistory();
|
||||
|
||||
const handleCancelBtnClick = () => {
|
||||
history.push('/payment-mades');
|
||||
history.push('/payments-made');
|
||||
};
|
||||
const handleImportSuccess = () => {
|
||||
history.push('/payment-mades');
|
||||
history.push('/payments-made');
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -13,7 +13,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||
/**
|
||||
* Universal search bill item select action.
|
||||
*/
|
||||
function PaymentMadeUniversalSearchSelectComponent({
|
||||
function PaymentsMadeUniversalSearchSelectComponent({
|
||||
// #ownProps
|
||||
resourceType,
|
||||
resourceId,
|
||||
@@ -27,14 +27,14 @@ function PaymentMadeUniversalSearchSelectComponent({
|
||||
return null;
|
||||
}
|
||||
|
||||
export const PaymentMadeUniversalSearchSelect = withDrawerActions(
|
||||
PaymentMadeUniversalSearchSelectComponent,
|
||||
export const PaymentsMadeUniversalSearchSelect = withDrawerActions(
|
||||
PaymentsMadeUniversalSearchSelectComponent,
|
||||
);
|
||||
|
||||
/**
|
||||
* Payment made universal search item.
|
||||
*/
|
||||
export function PaymentMadeUniversalSearchItem(
|
||||
export function PaymentsMadeUniversalSearchItem(
|
||||
{ text, label, reference },
|
||||
{ handleClick, modifiers, query },
|
||||
) {
|
||||
@@ -78,9 +78,9 @@ const paymentMadeToSearch = (payment) => ({
|
||||
*/
|
||||
export const universalSearchPaymentMadeBind = () => ({
|
||||
resourceType: RESOURCES_TYPES.PAYMENT_MADE,
|
||||
optionItemLabel: intl.get('payment_mades'),
|
||||
selectItemAction: PaymentMadeUniversalSearchSelect,
|
||||
itemRenderer: PaymentMadeUniversalSearchItem,
|
||||
optionItemLabel: intl.get('payments_made'),
|
||||
selectItemAction: PaymentsMadeUniversalSearchSelect,
|
||||
itemRenderer: PaymentsMadeUniversalSearchItem,
|
||||
itemSelect: paymentMadeToSearch,
|
||||
permission: {
|
||||
ability: PaymentMadeAction.View,
|
||||
@@ -5,7 +5,6 @@ import { DashboardPageContent } from '@/components';
|
||||
import '@/style/pages/SaleReceipt/List.scss';
|
||||
|
||||
import ReceiptActionsBar from './ReceiptActionsBar';
|
||||
import ReceiptViewTabs from './ReceiptViewTabs';
|
||||
import ReceiptsTable from './ReceiptsTable';
|
||||
|
||||
import withReceipts from './withReceipts';
|
||||
@@ -42,7 +41,6 @@ function ReceiptsList({
|
||||
<ReceiptActionsBar />
|
||||
|
||||
<DashboardPageContent>
|
||||
<ReceiptViewTabs />
|
||||
<ReceiptsTable />
|
||||
</DashboardPageContent>
|
||||
</DashboardPageContent>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { universalSearchReceiptBind } from '../Sales/Receipts/ReceiptUniversalSe
|
||||
import { universalSearchBillBind } from '../Purchases/Bills/BillUniversalSearch';
|
||||
import { universalSearchEstimateBind } from '../Sales/Estimates/EstimatesLanding/EstimateUniversalSearch';
|
||||
import { universalSearchPaymentReceiveBind } from '../Sales/PaymentsReceived/PaymentReceiveUniversalSearch';
|
||||
import { universalSearchPaymentMadeBind } from '../Purchases/PaymentMades/PaymentMadeUniversalSearch';
|
||||
import { universalSearchPaymentMadeBind } from '../Purchases/PaymentsMade/PaymentsMadeUniversalSearch';
|
||||
import { universalSearchItemBind } from '../Items/ItemsUniversalSearch';
|
||||
import { universalSearchCustomerBind } from '../Customers/CustomersUniversalSearch';
|
||||
import { universalSearchJournalBind } from '../Accounting/ManualJournalUniversalSearch';
|
||||
|
||||
@@ -34,6 +34,7 @@ function VendorFormFormik({
|
||||
organization: { base_currency },
|
||||
|
||||
// #ownProps
|
||||
initialValues,
|
||||
onSubmitSuccess,
|
||||
onSubmitError,
|
||||
onCancel,
|
||||
@@ -54,14 +55,15 @@ function VendorFormFormik({
|
||||
/**
|
||||
* Initial values in create and edit mode.
|
||||
*/
|
||||
const initialValues = useMemo(
|
||||
const initialFormValues = useMemo(
|
||||
() => ({
|
||||
...defaultInitialValues,
|
||||
...transformToForm(initialValues, defaultInitialValues),
|
||||
currency_code: base_currency,
|
||||
...transformToForm(vendor, defaultInitialValues),
|
||||
...transformToForm(contactDuplicate, defaultInitialValues),
|
||||
}),
|
||||
[vendor, contactDuplicate, base_currency],
|
||||
[vendor, contactDuplicate, base_currency, initialValues],
|
||||
);
|
||||
|
||||
// Handles the form submit.
|
||||
@@ -84,7 +86,7 @@ function VendorFormFormik({
|
||||
setSubmitting(false);
|
||||
resetForm();
|
||||
|
||||
safeInvoke(onSubmitSuccess, values, form, submitPayload, response);
|
||||
safeInvoke(onSubmitSuccess, values, form, submitPayload, response.data);
|
||||
};
|
||||
|
||||
const onError = () => {
|
||||
@@ -112,7 +114,7 @@ function VendorFormFormik({
|
||||
validationSchema={
|
||||
isNewMode ? CreateVendorFormSchema : EditVendorFormSchema
|
||||
}
|
||||
initialValues={initialValues}
|
||||
initialValues={initialFormValues}
|
||||
onSubmit={handleFormSubmit}
|
||||
>
|
||||
<Form>
|
||||
|
||||
Reference in New Issue
Block a user