mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
Merge branch 'develop' into rename-payment-receives-to-payment-received
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
import { useFormikContext } from 'formik';
|
||||||
import { createNewItemFromQuery, createNewItemRenderer } from './utils';
|
import { createNewItemFromQuery, createNewItemRenderer } from './utils';
|
||||||
import { FSelect } from '../Forms';
|
import { FSelect } from '../Forms';
|
||||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||||
|
import { useCreateAutofillListener } from '@/hooks/state/autofill';
|
||||||
import { DRAWERS } from '@/constants/drawers';
|
import { DRAWERS } from '@/constants/drawers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,6 +19,7 @@ function CustomerSelectRoot({
|
|||||||
// #ownProps
|
// #ownProps
|
||||||
items,
|
items,
|
||||||
allowCreate,
|
allowCreate,
|
||||||
|
name,
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
// Maybe inject create new item props to suggest component.
|
// Maybe inject create new item props to suggest component.
|
||||||
@@ -24,14 +27,21 @@ function CustomerSelectRoot({
|
|||||||
const maybeCreateNewItemFromQuery = allowCreate
|
const maybeCreateNewItemFromQuery = allowCreate
|
||||||
? createNewItemFromQuery
|
? createNewItemFromQuery
|
||||||
: null;
|
: null;
|
||||||
|
const { setFieldValue } = useFormikContext();
|
||||||
|
|
||||||
|
// Creates autofill listener once the quick customer drawer submit the form.
|
||||||
|
const autofillRef = useCreateAutofillListener((payload: any) => {
|
||||||
|
setFieldValue(name, payload.customerId);
|
||||||
|
});
|
||||||
// Handles the create item click.
|
// Handles the create item click.
|
||||||
const handleCreateItemClick = () => {
|
const handleCreateItemClick = (item) => {
|
||||||
openDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
|
const displayName = item.name;
|
||||||
|
openDrawer(DRAWERS.QUICK_CREATE_CUSTOMER, { autofillRef, displayName });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FSelect
|
<FSelect
|
||||||
|
name={name}
|
||||||
items={items}
|
items={items}
|
||||||
textAccessor={'display_name'}
|
textAccessor={'display_name'}
|
||||||
labelAccessor={'formatted_balance'}
|
labelAccessor={'formatted_balance'}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
import { useFormikContext } from 'formik';
|
||||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||||
import { createNewItemFromQuery, createNewItemRenderer } from './utils';
|
import { createNewItemFromQuery, createNewItemRenderer } from './utils';
|
||||||
import { FSelect } from '../Forms';
|
import { FSelect } from '../Forms';
|
||||||
|
import { useCreateAutofillListener } from '@/hooks/state/autofill';
|
||||||
import { DRAWERS } from '@/constants/drawers';
|
import { DRAWERS } from '@/constants/drawers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,6 +17,7 @@ function VendorsSelectRoot({
|
|||||||
openDrawer,
|
openDrawer,
|
||||||
|
|
||||||
// #ownProps
|
// #ownProps
|
||||||
|
name,
|
||||||
items,
|
items,
|
||||||
allowCreate,
|
allowCreate,
|
||||||
|
|
||||||
@@ -25,14 +28,24 @@ function VendorsSelectRoot({
|
|||||||
const maybeCreateNewItemFromQuery = allowCreate
|
const maybeCreateNewItemFromQuery = allowCreate
|
||||||
? createNewItemFromQuery
|
? createNewItemFromQuery
|
||||||
: null;
|
: null;
|
||||||
|
const { setFieldValue } = useFormikContext();
|
||||||
|
|
||||||
|
// Creates a new autofill listener once the quick vendor drawer submits the form.
|
||||||
|
const autofillRef = useCreateAutofillListener((payload: any) => {
|
||||||
|
setFieldValue(name, payload.vendorId);
|
||||||
|
});
|
||||||
|
|
||||||
// Handles the create item click.
|
// Handles the create item click.
|
||||||
const handleCreateItemClick = () => {
|
const handleCreateItemClick = (item) => {
|
||||||
openDrawer(DRAWERS.QUICK_WRITE_VENDOR);
|
openDrawer(DRAWERS.QUICK_WRITE_VENDOR, {
|
||||||
|
autofillRef,
|
||||||
|
displayName: item.name,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FSelect
|
<FSelect
|
||||||
|
name={name}
|
||||||
items={items}
|
items={items}
|
||||||
textAccessor={'display_name'}
|
textAccessor={'display_name'}
|
||||||
labelAccessor={'formatted_balance'}
|
labelAccessor={'formatted_balance'}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export const accountsPayable = [
|
|||||||
{
|
{
|
||||||
title: <T id={'vendors_payments'} />,
|
title: <T id={'vendors_payments'} />,
|
||||||
description: <T id={'manage_payments_transactions_to_your_vendors'} />,
|
description: <T id={'manage_payments_transactions_to_your_vendors'} />,
|
||||||
link: '/payment-mades',
|
link: '/payments-made',
|
||||||
subject: AbilitySubject.PaymentMade,
|
subject: AbilitySubject.PaymentMade,
|
||||||
ability: PaymentMadeAction.View,
|
ability: PaymentMadeAction.View,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export const SidebarMenu = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: <T id={'category_list'} />,
|
text: <T id={'categories_list'} />,
|
||||||
href: '/items/categories',
|
href: '/items/categories',
|
||||||
type: ISidebarMenuItemType.Link,
|
type: ISidebarMenuItemType.Link,
|
||||||
permission: {
|
permission: {
|
||||||
@@ -265,8 +265,8 @@ export const SidebarMenu = [
|
|||||||
type: ISidebarMenuItemType.Link,
|
type: ISidebarMenuItemType.Link,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: <T id={'payment_mades'} />,
|
text: <T id={'payments_made'} />,
|
||||||
href: '/payment-mades',
|
href: '/payments-made',
|
||||||
type: ISidebarMenuItemType.Link,
|
type: ISidebarMenuItemType.Link,
|
||||||
permission: {
|
permission: {
|
||||||
subject: AbilitySubject.PaymentMade,
|
subject: AbilitySubject.PaymentMade,
|
||||||
@@ -299,7 +299,7 @@ export const SidebarMenu = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: <T id={'sidebar.new_payment_made'} />,
|
text: <T id={'sidebar.new_payment_made'} />,
|
||||||
href: '/payment-mades/new',
|
href: '/payments-made/new',
|
||||||
type: ISidebarMenuItemType.Link,
|
type: ISidebarMenuItemType.Link,
|
||||||
permission: {
|
permission: {
|
||||||
subject: AbilitySubject.PaymentMade,
|
subject: AbilitySubject.PaymentMade,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import InvoicesAlerts from '@/containers/Sales/Invoices/InvoicesAlerts';
|
|||||||
import ReceiptsAlerts from '@/containers/Sales/Receipts/ReceiptsAlerts';
|
import ReceiptsAlerts from '@/containers/Sales/Receipts/ReceiptsAlerts';
|
||||||
import PaymentsReceivedAlerts from '@/containers/Sales/PaymentsReceived/PaymentsReceivedAlerts';
|
import PaymentsReceivedAlerts from '@/containers/Sales/PaymentsReceived/PaymentsReceivedAlerts';
|
||||||
import BillsAlerts from '@/containers/Purchases/Bills/BillsLanding/BillsAlerts';
|
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 CustomersAlerts from '@/containers/Customers/CustomersAlerts';
|
||||||
import VendorsAlerts from '@/containers/Vendors/VendorsAlerts';
|
import VendorsAlerts from '@/containers/Vendors/VendorsAlerts';
|
||||||
import ManualJournalsAlerts from '@/containers/Accounting/JournalsLanding/ManualJournalsAlerts';
|
import ManualJournalsAlerts from '@/containers/Accounting/JournalsLanding/ManualJournalsAlerts';
|
||||||
@@ -40,7 +40,7 @@ export default [
|
|||||||
...ReceiptsAlerts,
|
...ReceiptsAlerts,
|
||||||
...PaymentsReceivedAlerts,
|
...PaymentsReceivedAlerts,
|
||||||
...BillsAlerts,
|
...BillsAlerts,
|
||||||
...PaymentMadesAlerts,
|
...PaymentsMadeAlerts,
|
||||||
...CustomersAlerts,
|
...CustomersAlerts,
|
||||||
...VendorsAlerts,
|
...VendorsAlerts,
|
||||||
...ManualJournalsAlerts,
|
...ManualJournalsAlerts,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function CustomerFormFormik({
|
|||||||
...defaultInitialValues,
|
...defaultInitialValues,
|
||||||
currency_code: base_currency,
|
currency_code: base_currency,
|
||||||
...transformToForm(contactDuplicate || customer, defaultInitialValues),
|
...transformToForm(contactDuplicate || customer, defaultInitialValues),
|
||||||
...initialCustomerValues,
|
...transformToForm(initialCustomerValues, defaultInitialValues),
|
||||||
}),
|
}),
|
||||||
[customer, contactDuplicate, base_currency, initialCustomerValues],
|
[customer, contactDuplicate, base_currency, initialCustomerValues],
|
||||||
);
|
);
|
||||||
@@ -62,7 +62,7 @@ function CustomerFormFormik({
|
|||||||
const { setSubmitting, resetForm } = formArgs;
|
const { setSubmitting, resetForm } = formArgs;
|
||||||
const formValues = { ...values };
|
const formValues = { ...values };
|
||||||
|
|
||||||
const onSuccess = () => {
|
const onSuccess = (res) => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: intl.get(
|
message: intl.get(
|
||||||
isNewMode
|
isNewMode
|
||||||
@@ -73,8 +73,7 @@ function CustomerFormFormik({
|
|||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
resetForm();
|
resetForm();
|
||||||
|
saveInvoke(onSubmitSuccess, values, formArgs, submitPayload, res.data);
|
||||||
saveInvoke(onSubmitSuccess, values, formArgs, submitPayload);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onError = () => {
|
const onError = () => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { useFormikContext } from 'formik';
|
|||||||
import { Intent } from '@blueprintjs/core';
|
import { Intent } from '@blueprintjs/core';
|
||||||
import { AppToaster } from '@/components';
|
import { AppToaster } from '@/components';
|
||||||
import { useQuickPaymentMadeContext } from './QuickPaymentMadeFormProvider';
|
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.
|
// Default initial values of payment made.
|
||||||
export const defaultPaymentMade = {
|
export const defaultPaymentMade = {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ function BillPaymentTransactionTable({
|
|||||||
|
|
||||||
// Handles edit bill payment transactions.
|
// Handles edit bill payment transactions.
|
||||||
const handleEditBillPaymentTransactions = ({ bill_payment_id }) => {
|
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);
|
closeDrawer(DRAWERS.BILL_DETAILS);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function PaymentMadeDetailActionsBar({
|
|||||||
|
|
||||||
// Handle edit payment made.
|
// Handle edit payment made.
|
||||||
const handleEditPaymentMade = () => {
|
const handleEditPaymentMade = () => {
|
||||||
history.push(`/payment-mades/${paymentMadeId}/edit`);
|
history.push(`/payments-made/${paymentMadeId}/edit`);
|
||||||
closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
|
closeDrawer(DRAWERS.PAYMENT_MADE_DETAILS);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,16 @@ import {
|
|||||||
DrawerBody,
|
DrawerBody,
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
|
|
||||||
import QuickCustomerFormDrawer from './QuickCustomerFormDrawer';
|
import QuickCustomerFormDrawer from './QuickCustomerFormDrawer';
|
||||||
import { DRAWERS } from '@/constants/drawers';
|
import { DRAWERS } from '@/constants/drawers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick create/edit customer drawer.
|
* Quick create/edit customer drawer.
|
||||||
*/
|
*/
|
||||||
export default function QuickCreateCustomerDrawerContent({ displayName }) {
|
export default function QuickCreateCustomerDrawerContent({
|
||||||
|
displayName,
|
||||||
|
autofillRef,
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<DrawerHeaderContent
|
<DrawerHeaderContent
|
||||||
@@ -20,7 +22,10 @@ export default function QuickCreateCustomerDrawerContent({ displayName }) {
|
|||||||
title={<T id={'create_a_new_customer'} />}
|
title={<T id={'create_a_new_customer'} />}
|
||||||
/>
|
/>
|
||||||
<DrawerBody>
|
<DrawerBody>
|
||||||
<QuickCustomerFormDrawer displayName={displayName} />
|
<QuickCustomerFormDrawer
|
||||||
|
displayName={displayName}
|
||||||
|
autofillRef={autofillRef}
|
||||||
|
/>
|
||||||
</DrawerBody>
|
</DrawerBody>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import CustomerFormFormik, {
|
|||||||
|
|
||||||
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
||||||
import { DRAWERS } from '@/constants/drawers';
|
import { DRAWERS } from '@/constants/drawers';
|
||||||
|
import { useAddAutofillRef } from '@/hooks/state/autofill';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drawer customer form loading wrapper.
|
* Drawer customer form loading wrapper.
|
||||||
@@ -28,9 +29,22 @@ function DrawerCustomerFormLoading({ children }) {
|
|||||||
/**
|
/**
|
||||||
* Quick customer form of the drawer.
|
* 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.
|
// 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);
|
closeDrawer(DRAWERS.QUICK_CREATE_CUSTOMER);
|
||||||
};
|
};
|
||||||
// Handle the form cancel action.
|
// Handle the form cancel action.
|
||||||
@@ -43,7 +57,7 @@ function QuickCustomerFormDrawer({ displayName, closeDrawer, customerId }) {
|
|||||||
<DrawerCustomerFormLoading>
|
<DrawerCustomerFormLoading>
|
||||||
<CustomerFormCard>
|
<CustomerFormCard>
|
||||||
<CustomerFormFormik
|
<CustomerFormFormik
|
||||||
initialValues={{ display_name: displayName }}
|
initialValues={{ first_name: displayName }}
|
||||||
onSubmitSuccess={handleSubmitSuccess}
|
onSubmitSuccess={handleSubmitSuccess}
|
||||||
onCancel={handleCancelForm}
|
onCancel={handleCancelForm}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Drawer, DrawerSuspense } from '@/components';
|
import { Drawer, DrawerSuspense } from '@/components';
|
||||||
import withDrawers from '@/containers/Drawer/withDrawers';
|
import withDrawers from '@/containers/Drawer/withDrawers';
|
||||||
|
|
||||||
import { compose } from '@/utils';
|
import { compose } from '@/utils';
|
||||||
|
|
||||||
const QuickCreateCustomerDrawerContent = React.lazy(() =>
|
const QuickCreateCustomerDrawerContent = React.lazy(
|
||||||
import('./QuickCreateCustomerDrawerContent'),
|
() => import('./QuickCreateCustomerDrawerContent'),
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +16,7 @@ function QuickCreateCustomerDrawer({
|
|||||||
|
|
||||||
// #withDrawer
|
// #withDrawer
|
||||||
isOpen,
|
isOpen,
|
||||||
payload,
|
payload: { autofillRef, displayName },
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
@@ -27,7 +26,10 @@ function QuickCreateCustomerDrawer({
|
|||||||
size={'80%'}
|
size={'80%'}
|
||||||
>
|
>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<QuickCreateCustomerDrawerContent displayName={payload.displayName} />
|
<QuickCreateCustomerDrawerContent
|
||||||
|
displayName={displayName}
|
||||||
|
autofillRef={autofillRef}
|
||||||
|
/>
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
|||||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||||
|
|
||||||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
import { useDrawerContext } from '@/components/Drawer/DrawerProvider';
|
||||||
|
import { useAddAutofillRef } from '@/hooks/state/autofill';
|
||||||
import { DRAWERS } from '@/constants/drawers';
|
import { DRAWERS } from '@/constants/drawers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,17 +37,20 @@ function QuickVendorFormDrawer({
|
|||||||
closeDrawer,
|
closeDrawer,
|
||||||
vendorId,
|
vendorId,
|
||||||
addQuickActionEvent,
|
addQuickActionEvent,
|
||||||
|
autofillRef,
|
||||||
}) {
|
}) {
|
||||||
const { payload } = useDrawerContext();
|
const { payload } = useDrawerContext();
|
||||||
|
const addAutofillRef = useAddAutofillRef();
|
||||||
|
|
||||||
// Handle the form submit request success.
|
// Handle the form submit request success.
|
||||||
const handleSubmitSuccess = (values, form, submitPayload, response) => {
|
const handleSubmitSuccess = (values, form, submitPayload, res) => {
|
||||||
if (!submitPayload.noRedirect) {
|
if (!submitPayload.noRedirect) {
|
||||||
closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
|
closeDrawer(DRAWERS.QUICK_WRITE_VENDOR);
|
||||||
}
|
}
|
||||||
if (payload.quickActionEvent) {
|
if (autofillRef) {
|
||||||
addQuickActionEvent(payload.quickActionEvent, {
|
addAutofillRef(autofillRef, {
|
||||||
vendorId: response.data.id,
|
displayName: values.display_name,
|
||||||
|
vendorId: res.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -60,7 +64,7 @@ function QuickVendorFormDrawer({
|
|||||||
<DrawerVendorFormLoading>
|
<DrawerVendorFormLoading>
|
||||||
<VendorFormCard>
|
<VendorFormCard>
|
||||||
<VendorFormFormik
|
<VendorFormFormik
|
||||||
initialValues={{ display_name: displayName }}
|
initialValues={{ first_name: displayName }}
|
||||||
onSubmitSuccess={handleSubmitSuccess}
|
onSubmitSuccess={handleSubmitSuccess}
|
||||||
onCancel={handleCancelForm}
|
onCancel={handleCancelForm}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { DRAWERS } from '@/constants/drawers';
|
|||||||
/**
|
/**
|
||||||
* Quick create/edit vendor drawer.
|
* Quick create/edit vendor drawer.
|
||||||
*/
|
*/
|
||||||
export default function QuickWriteVendorDrawerContent({ displayName }) {
|
export default function QuickWriteVendorDrawerContent({ displayName, autofillRef }) {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<DrawerHeaderContent
|
<DrawerHeaderContent
|
||||||
@@ -21,7 +21,7 @@ export default function QuickWriteVendorDrawerContent({ displayName }) {
|
|||||||
|
|
||||||
/>
|
/>
|
||||||
<DrawerBody>
|
<DrawerBody>
|
||||||
<QuickVendorFormDrawer displayName={displayName} />
|
<QuickVendorFormDrawer displayName={displayName} autofillRef={autofillRef} />
|
||||||
</DrawerBody>
|
</DrawerBody>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function QuickWriteVendorDrawer({
|
|||||||
|
|
||||||
// #withDrawer
|
// #withDrawer
|
||||||
isOpen,
|
isOpen,
|
||||||
payload,
|
payload: { displayName, autofillRef },
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
@@ -25,10 +25,9 @@ function QuickWriteVendorDrawer({
|
|||||||
name={name}
|
name={name}
|
||||||
style={{ minWidth: '700px', maxWidth: '900px' }}
|
style={{ minWidth: '700px', maxWidth: '900px' }}
|
||||||
size={'80%'}
|
size={'80%'}
|
||||||
payload={payload}
|
|
||||||
>
|
>
|
||||||
<DrawerSuspense>
|
<DrawerSuspense>
|
||||||
<QuickWriteVendorDrawerContent displayName={payload.displayName} />
|
<QuickWriteVendorDrawerContent displayName={displayName} autofillRef={autofillRef} />
|
||||||
</DrawerSuspense>
|
</DrawerSuspense>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ function VendorDetailsActionsBar({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNewPaymentClick = () => {
|
const handleNewPaymentClick = () => {
|
||||||
history.push('/payment-mades/new');
|
history.push('/payments-made/new');
|
||||||
closeDrawer(DRAWERS.VENDOR_DETAILS);
|
closeDrawer(DRAWERS.VENDOR_DETAILS);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ function PaymentMadeForm({
|
|||||||
});
|
});
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
|
||||||
submitPayload.redirect && history.push('/payment-mades');
|
submitPayload.redirect && history.push('/payments-made');
|
||||||
submitPayload.resetForm && resetForm();
|
submitPayload.resetForm && resetForm();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ function PaymentMadeActionsBar({
|
|||||||
|
|
||||||
// Handle new payment made button click.
|
// Handle new payment made button click.
|
||||||
const handleClickNewPaymentMade = () => {
|
const handleClickNewPaymentMade = () => {
|
||||||
history.push('/payment-mades/new');
|
history.push('/payments-made/new');
|
||||||
};
|
};
|
||||||
// Handle tab changing.
|
// Handle tab changing.
|
||||||
const handleTabChange = (viewSlug) => {
|
const handleTabChange = (viewSlug) => {
|
||||||
@@ -84,7 +84,7 @@ function PaymentMadeActionsBar({
|
|||||||
};
|
};
|
||||||
// Handle the import button click.
|
// Handle the import button click.
|
||||||
const handleImportBtnClick = () => {
|
const handleImportBtnClick = () => {
|
||||||
history.push('/payment-mades/import');
|
history.push('/payments-made/import');
|
||||||
};
|
};
|
||||||
// Handle the export button click.
|
// Handle the export button click.
|
||||||
const handleExportBtnClick = () => {
|
const handleExportBtnClick = () => {
|
||||||
@@ -37,7 +37,7 @@ function PaymentMadeViewTabs({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleClickNewView = () => {
|
const handleClickNewView = () => {
|
||||||
history.push('/custom_views/payment-mades/new');
|
history.push('/custom_views/payments-made/new');
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -23,7 +23,7 @@ export default function PaymentMadesEmptyStatus() {
|
|||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
large={true}
|
large={true}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.push('/payment-mades/new');
|
history.push('/payments-made/new');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<T id={'new_bill_payment'} />
|
<T id={'new_bill_payment'} />
|
||||||
@@ -61,7 +61,7 @@ function PaymentMadesTable({
|
|||||||
|
|
||||||
// Handles the edit payment made action.
|
// Handles the edit payment made action.
|
||||||
const handleEditPaymentMade = (paymentMade) => {
|
const handleEditPaymentMade = (paymentMade) => {
|
||||||
history.push(`/payment-mades/${paymentMade.id}/edit`);
|
history.push(`/payments-made/${paymentMade.id}/edit`);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handles the delete payment made action.
|
// Handles the delete payment made action.
|
||||||
@@ -20,7 +20,7 @@ function PaymentMadesViewPage({
|
|||||||
<Switch>
|
<Switch>
|
||||||
<Route
|
<Route
|
||||||
exact={true}
|
exact={true}
|
||||||
path={['/payment-mades/:custom_view_id/custom_view', '/payment-mades']}
|
path={['/payments-made/:custom_view_id/custom_view', '/payments-made']}
|
||||||
>
|
>
|
||||||
|
|
||||||
{/* <PaymentMadeDataTable
|
{/* <PaymentMadeDataTable
|
||||||
@@ -3,14 +3,14 @@ import { useHistory } from 'react-router-dom';
|
|||||||
import { DashboardInsider } from '@/components';
|
import { DashboardInsider } from '@/components';
|
||||||
import { ImportView } from '@/containers/Import';
|
import { ImportView } from '@/containers/Import';
|
||||||
|
|
||||||
export default function PaymentMadesImport() {
|
export default function PaymentsMadeImport() {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
const handleCancelBtnClick = () => {
|
const handleCancelBtnClick = () => {
|
||||||
history.push('/payment-mades');
|
history.push('/payments-made');
|
||||||
};
|
};
|
||||||
const handleImportSuccess = () => {
|
const handleImportSuccess = () => {
|
||||||
history.push('/payment-mades');
|
history.push('/payments-made');
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -13,7 +13,7 @@ import withDrawerActions from '@/containers/Drawer/withDrawerActions';
|
|||||||
/**
|
/**
|
||||||
* Universal search bill item select action.
|
* Universal search bill item select action.
|
||||||
*/
|
*/
|
||||||
function PaymentMadeUniversalSearchSelectComponent({
|
function PaymentsMadeUniversalSearchSelectComponent({
|
||||||
// #ownProps
|
// #ownProps
|
||||||
resourceType,
|
resourceType,
|
||||||
resourceId,
|
resourceId,
|
||||||
@@ -27,14 +27,14 @@ function PaymentMadeUniversalSearchSelectComponent({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PaymentMadeUniversalSearchSelect = withDrawerActions(
|
export const PaymentsMadeUniversalSearchSelect = withDrawerActions(
|
||||||
PaymentMadeUniversalSearchSelectComponent,
|
PaymentsMadeUniversalSearchSelectComponent,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Payment made universal search item.
|
* Payment made universal search item.
|
||||||
*/
|
*/
|
||||||
export function PaymentMadeUniversalSearchItem(
|
export function PaymentsMadeUniversalSearchItem(
|
||||||
{ text, label, reference },
|
{ text, label, reference },
|
||||||
{ handleClick, modifiers, query },
|
{ handleClick, modifiers, query },
|
||||||
) {
|
) {
|
||||||
@@ -78,9 +78,9 @@ const paymentMadeToSearch = (payment) => ({
|
|||||||
*/
|
*/
|
||||||
export const universalSearchPaymentMadeBind = () => ({
|
export const universalSearchPaymentMadeBind = () => ({
|
||||||
resourceType: RESOURCES_TYPES.PAYMENT_MADE,
|
resourceType: RESOURCES_TYPES.PAYMENT_MADE,
|
||||||
optionItemLabel: intl.get('payment_mades'),
|
optionItemLabel: intl.get('payments_made'),
|
||||||
selectItemAction: PaymentMadeUniversalSearchSelect,
|
selectItemAction: PaymentsMadeUniversalSearchSelect,
|
||||||
itemRenderer: PaymentMadeUniversalSearchItem,
|
itemRenderer: PaymentsMadeUniversalSearchItem,
|
||||||
itemSelect: paymentMadeToSearch,
|
itemSelect: paymentMadeToSearch,
|
||||||
permission: {
|
permission: {
|
||||||
ability: PaymentMadeAction.View,
|
ability: PaymentMadeAction.View,
|
||||||
@@ -5,7 +5,6 @@ import { DashboardPageContent } from '@/components';
|
|||||||
import '@/style/pages/SaleReceipt/List.scss';
|
import '@/style/pages/SaleReceipt/List.scss';
|
||||||
|
|
||||||
import ReceiptActionsBar from './ReceiptActionsBar';
|
import ReceiptActionsBar from './ReceiptActionsBar';
|
||||||
import ReceiptViewTabs from './ReceiptViewTabs';
|
|
||||||
import ReceiptsTable from './ReceiptsTable';
|
import ReceiptsTable from './ReceiptsTable';
|
||||||
|
|
||||||
import withReceipts from './withReceipts';
|
import withReceipts from './withReceipts';
|
||||||
@@ -42,7 +41,6 @@ function ReceiptsList({
|
|||||||
<ReceiptActionsBar />
|
<ReceiptActionsBar />
|
||||||
|
|
||||||
<DashboardPageContent>
|
<DashboardPageContent>
|
||||||
<ReceiptViewTabs />
|
|
||||||
<ReceiptsTable />
|
<ReceiptsTable />
|
||||||
</DashboardPageContent>
|
</DashboardPageContent>
|
||||||
</DashboardPageContent>
|
</DashboardPageContent>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { universalSearchReceiptBind } from '../Sales/Receipts/ReceiptUniversalSe
|
|||||||
import { universalSearchBillBind } from '../Purchases/Bills/BillUniversalSearch';
|
import { universalSearchBillBind } from '../Purchases/Bills/BillUniversalSearch';
|
||||||
import { universalSearchEstimateBind } from '../Sales/Estimates/EstimatesLanding/EstimateUniversalSearch';
|
import { universalSearchEstimateBind } from '../Sales/Estimates/EstimatesLanding/EstimateUniversalSearch';
|
||||||
import { universalSearchPaymentReceiveBind } from '../Sales/PaymentsReceived/PaymentReceiveUniversalSearch';
|
import { universalSearchPaymentReceiveBind } from '../Sales/PaymentsReceived/PaymentReceiveUniversalSearch';
|
||||||
import { universalSearchPaymentMadeBind } from '../Purchases/PaymentMades/PaymentMadeUniversalSearch';
|
import { universalSearchPaymentMadeBind } from '../Purchases/PaymentsMade/PaymentsMadeUniversalSearch';
|
||||||
import { universalSearchItemBind } from '../Items/ItemsUniversalSearch';
|
import { universalSearchItemBind } from '../Items/ItemsUniversalSearch';
|
||||||
import { universalSearchCustomerBind } from '../Customers/CustomersUniversalSearch';
|
import { universalSearchCustomerBind } from '../Customers/CustomersUniversalSearch';
|
||||||
import { universalSearchJournalBind } from '../Accounting/ManualJournalUniversalSearch';
|
import { universalSearchJournalBind } from '../Accounting/ManualJournalUniversalSearch';
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ function VendorFormFormik({
|
|||||||
organization: { base_currency },
|
organization: { base_currency },
|
||||||
|
|
||||||
// #ownProps
|
// #ownProps
|
||||||
|
initialValues,
|
||||||
onSubmitSuccess,
|
onSubmitSuccess,
|
||||||
onSubmitError,
|
onSubmitError,
|
||||||
onCancel,
|
onCancel,
|
||||||
@@ -54,14 +55,15 @@ function VendorFormFormik({
|
|||||||
/**
|
/**
|
||||||
* Initial values in create and edit mode.
|
* Initial values in create and edit mode.
|
||||||
*/
|
*/
|
||||||
const initialValues = useMemo(
|
const initialFormValues = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
...defaultInitialValues,
|
...defaultInitialValues,
|
||||||
|
...transformToForm(initialValues, defaultInitialValues),
|
||||||
currency_code: base_currency,
|
currency_code: base_currency,
|
||||||
...transformToForm(vendor, defaultInitialValues),
|
...transformToForm(vendor, defaultInitialValues),
|
||||||
...transformToForm(contactDuplicate, defaultInitialValues),
|
...transformToForm(contactDuplicate, defaultInitialValues),
|
||||||
}),
|
}),
|
||||||
[vendor, contactDuplicate, base_currency],
|
[vendor, contactDuplicate, base_currency, initialValues],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Handles the form submit.
|
// Handles the form submit.
|
||||||
@@ -84,7 +86,7 @@ function VendorFormFormik({
|
|||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
resetForm();
|
resetForm();
|
||||||
|
|
||||||
safeInvoke(onSubmitSuccess, values, form, submitPayload, response);
|
safeInvoke(onSubmitSuccess, values, form, submitPayload, response.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onError = () => {
|
const onError = () => {
|
||||||
@@ -112,7 +114,7 @@ function VendorFormFormik({
|
|||||||
validationSchema={
|
validationSchema={
|
||||||
isNewMode ? CreateVendorFormSchema : EditVendorFormSchema
|
isNewMode ? CreateVendorFormSchema : EditVendorFormSchema
|
||||||
}
|
}
|
||||||
initialValues={initialValues}
|
initialValues={initialFormValues}
|
||||||
onSubmit={handleFormSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
>
|
>
|
||||||
<Form>
|
<Form>
|
||||||
|
|||||||
94
packages/webapp/src/hooks/state/autofill.ts
Normal file
94
packages/webapp/src/hooks/state/autofill.ts
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import {
|
||||||
|
addAutofill,
|
||||||
|
removeAutofill,
|
||||||
|
resetAutofill,
|
||||||
|
} from '@/store/dashboard/dashboard.actions';
|
||||||
|
|
||||||
|
const getAutofillPayload = (state, autofillRef) => {
|
||||||
|
return typeof state.dashboard.autofill[autofillRef + ''] !== 'undefined'
|
||||||
|
? state.dashboard.autofill[autofillRef]
|
||||||
|
: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getAutofillPayloadSelectorFactory = () =>
|
||||||
|
createSelector(getAutofillPayload, (payload) => payload);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {number} autofillRef
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
const useGetAutofillPayload = (autofillRef: number) => {
|
||||||
|
const getAutofillPayloadSelector = getAutofillPayloadSelectorFactory();
|
||||||
|
|
||||||
|
return useSelector((state) => getAutofillPayloadSelector(state, autofillRef));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const useAddAutofillRef = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
return useCallback(
|
||||||
|
(autofillRef: number, payload: any) => {
|
||||||
|
return dispatch(addAutofill(autofillRef, payload));
|
||||||
|
},
|
||||||
|
[dispatch],
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const useRemoveAutofillRef = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
return useCallback(
|
||||||
|
(autofillRef: number) => {
|
||||||
|
return dispatch(removeAutofill(autofillRef));
|
||||||
|
},
|
||||||
|
[dispatch],
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const useResetAutofillRefs = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
return dispatch(resetAutofill());
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {(payload: any, ref: number) => void} callback
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
export const useCreateAutofillListener = (
|
||||||
|
callback: (payload: any, ref: number) => void,
|
||||||
|
): number => {
|
||||||
|
const ref = useRef<number>(Date.now());
|
||||||
|
const autofillPayload = useGetAutofillPayload(ref.current);
|
||||||
|
const removeAutofill = useRemoveAutofillRef();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (autofillPayload) {
|
||||||
|
callback(autofillPayload, ref.current);
|
||||||
|
removeAutofill(ref.current);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [autofillPayload, removeAutofill]);
|
||||||
|
|
||||||
|
return ref.current;
|
||||||
|
};
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
"edit_expense_details": "تعديل المصروف",
|
"edit_expense_details": "تعديل المصروف",
|
||||||
"expenses_list": "قائمة المصروفات",
|
"expenses_list": "قائمة المصروفات",
|
||||||
"edit_category_details": "تعديل التصنيف",
|
"edit_category_details": "تعديل التصنيف",
|
||||||
"category_list": "قائمة التصنيفات",
|
"categories_list": "قائمة التصنيفات",
|
||||||
"edit_item_details": "تعديل المنتج",
|
"edit_item_details": "تعديل المنتج",
|
||||||
"items_list": "قائمة المنتجات",
|
"items_list": "قائمة المنتجات",
|
||||||
"edit_custom_view": "تعديل العرض المخصص",
|
"edit_custom_view": "تعديل العرض المخصص",
|
||||||
@@ -618,7 +618,7 @@
|
|||||||
"bill_amount": "مبلغ الفاتورة",
|
"bill_amount": "مبلغ الفاتورة",
|
||||||
"payment_no_": "رقم سند الدفع",
|
"payment_no_": "رقم سند الدفع",
|
||||||
"new_payment_made": "سند موردين جديد",
|
"new_payment_made": "سند موردين جديد",
|
||||||
"payment_made_list": "قائمة سندات الموردين",
|
"payments_made_list": "قائمة سندات الموردين",
|
||||||
"select_vender_account": "اختار حساب المورد",
|
"select_vender_account": "اختار حساب المورد",
|
||||||
"the_payment_made_has_been_edited_successfully": "تم تعديل سند المورد التي تم إجراؤه بنجاح.",
|
"the_payment_made_has_been_edited_successfully": "تم تعديل سند المورد التي تم إجراؤه بنجاح.",
|
||||||
"the_payment_made_has_been_created_successfully": "تم إنشاء سند مورد بنجاح.",
|
"the_payment_made_has_been_created_successfully": "تم إنشاء سند مورد بنجاح.",
|
||||||
|
|||||||
@@ -157,7 +157,7 @@
|
|||||||
"manual_journals": "Manual Journals",
|
"manual_journals": "Manual Journals",
|
||||||
"edit_expense_details": "Edit Expense Details",
|
"edit_expense_details": "Edit Expense Details",
|
||||||
"edit_category_details": "Edit Category Details",
|
"edit_category_details": "Edit Category Details",
|
||||||
"category_list": "Category List",
|
"categories_list": "Categories List",
|
||||||
"edit_item_details": "Edit Item Details",
|
"edit_item_details": "Edit Item Details",
|
||||||
"items_list": "Items List",
|
"items_list": "Items List",
|
||||||
"edit_custom_view": "Edit Custom View",
|
"edit_custom_view": "Edit Custom View",
|
||||||
@@ -586,7 +586,7 @@
|
|||||||
"the_payment_received_transaction_has_been_edited": "The payment received transaction has been edited successfully.",
|
"the_payment_received_transaction_has_been_edited": "The payment received transaction has been edited successfully.",
|
||||||
"once_delete_this_payment_received_you_will_able_to_restore_it": "Once you delete this payment received, you won't be able to restore it later. Are you sure you want to delete this payment transaction?",
|
"once_delete_this_payment_received_you_will_able_to_restore_it": "Once you delete this payment received, you won't be able to restore it later. Are you sure you want to delete this payment transaction?",
|
||||||
"select_invoice": "Select Invoice",
|
"select_invoice": "Select Invoice",
|
||||||
"payment_mades": "Payment Mades",
|
"payments_made": "Payments Made",
|
||||||
"subscription": "Subscription",
|
"subscription": "Subscription",
|
||||||
"plan_slug": "Plan slug",
|
"plan_slug": "Plan slug",
|
||||||
"billing": "Billing",
|
"billing": "Billing",
|
||||||
@@ -615,14 +615,14 @@
|
|||||||
"bill_amount": "Bill Amount",
|
"bill_amount": "Bill Amount",
|
||||||
"payment_no_": "Payment number",
|
"payment_no_": "Payment number",
|
||||||
"new_payment_made": "New Payment Made",
|
"new_payment_made": "New Payment Made",
|
||||||
"payment_made_list": "Payment Made List",
|
"payments_made_list": "Payments Made List",
|
||||||
"payment_account": "Payment Account",
|
"payment_account": "Payment Account",
|
||||||
"select_vender_account": "Select Vender Account...",
|
"select_vender_account": "Select Vender Account...",
|
||||||
"select_payment_account": "Select Payment Account...",
|
"select_payment_account": "Select Payment Account...",
|
||||||
"the_payment_made_has_been_edited_successfully": "The payment made has been edited successfully.",
|
"the_payment_made_has_been_edited_successfully": "The payment made has been edited successfully.",
|
||||||
"the_payment_made_has_been_created_successfully": "The payment made has been created successfully.",
|
"the_payment_made_has_been_created_successfully": "The payment made has been created successfully.",
|
||||||
"the_payment_made_has_been_deleted_successfully": "The payment made has been deleted successfully.",
|
"the_payment_made_has_been_deleted_successfully": "The payment made has been deleted successfully.",
|
||||||
"once_delete_this_payment_made_you_will_able_to_restore_it": "Once you delete this payment made, you won't be able to restore it later. Are you sure you want to delete this payment made?",
|
"once_delete_this_payment_made_you_will_able_to_restore_it": "Once you delete this payment transaction, you won't be able to restore it later. Are you sure you want to delete this payment made?",
|
||||||
"sellable": "Sellable",
|
"sellable": "Sellable",
|
||||||
"purchasable": "Purchasable",
|
"purchasable": "Purchasable",
|
||||||
"sell_account": "Sell Account",
|
"sell_account": "Sell Account",
|
||||||
@@ -941,7 +941,7 @@
|
|||||||
"new_sale_invoice": " New sale invoice",
|
"new_sale_invoice": " New sale invoice",
|
||||||
"there_is_no_payable_bills_for_this_vendor_that_can_be_applied_for_this_payment": "There is no payable bills for this vendor that can be applied for this payment",
|
"there_is_no_payable_bills_for_this_vendor_that_can_be_applied_for_this_payment": "There is no payable bills for this vendor that can be applied for this payment",
|
||||||
"please_select_a_vendor_to_display_all_open_bills_for_it": "Please select a vendor to display all open bills for it.",
|
"please_select_a_vendor_to_display_all_open_bills_for_it": "Please select a vendor to display all open bills for it.",
|
||||||
"payment_made_details": "Payment made details",
|
"payment_made_details": "Payment Made Details",
|
||||||
"there_is_no_inventory_adjustments_transactions_yet": "There is no inventory adjustments transactions yet.",
|
"there_is_no_inventory_adjustments_transactions_yet": "There is no inventory adjustments transactions yet.",
|
||||||
"create_and_manage_your_organization_s_customers": "Create and manage your organization's customers.",
|
"create_and_manage_your_organization_s_customers": "Create and manage your organization's customers.",
|
||||||
"salutation": "Salutation",
|
"salutation": "Salutation",
|
||||||
@@ -1741,7 +1741,7 @@
|
|||||||
"credit_note.drawer.subtitle": "Branch: {value}",
|
"credit_note.drawer.subtitle": "Branch: {value}",
|
||||||
"payment_received.drawer.title": "Payment Received Details ({number})",
|
"payment_received.drawer.title": "Payment Received Details ({number})",
|
||||||
"payment_received.drawer.subtitle": "Branch: {value}",
|
"payment_received.drawer.subtitle": "Branch: {value}",
|
||||||
"payment_made.drawer.title": "Payment made details {number}",
|
"payment_made.drawer.title": "Payment Made Details {number}",
|
||||||
"payment_made.drawer.subtitle": "Branch: {value}",
|
"payment_made.drawer.subtitle": "Branch: {value}",
|
||||||
"manual_journal.drawer.title": "Manual journal details ({number})",
|
"manual_journal.drawer.title": "Manual journal details ({number})",
|
||||||
"expense.drawer.title": "Expense details",
|
"expense.drawer.title": "Expense details",
|
||||||
@@ -2197,7 +2197,7 @@
|
|||||||
"sidebar.purchases": "Purchases",
|
"sidebar.purchases": "Purchases",
|
||||||
"sidebar.bills": "Bills",
|
"sidebar.bills": "Bills",
|
||||||
"sidebar.vendor_credits": "Vendor Credits",
|
"sidebar.vendor_credits": "Vendor Credits",
|
||||||
"sidebar.payment_mades": "Payment Mades",
|
"sidebar.payments_made": "Payments Made",
|
||||||
"sidebar.new_purchase_invoice": "New Purchase Invoice",
|
"sidebar.new_purchase_invoice": "New Purchase Invoice",
|
||||||
"sidebar.new_vendor_credit": "New Vendor Credit",
|
"sidebar.new_vendor_credit": "New Vendor Credit",
|
||||||
"sidebar.new_payment_made": "New Payment Made",
|
"sidebar.new_payment_made": "New Payment Made",
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export const getDashboardRoutes = () => [
|
|||||||
() => import('@/containers/ItemsCategories/ItemCategoriesList'),
|
() => import('@/containers/ItemsCategories/ItemCategoriesList'),
|
||||||
),
|
),
|
||||||
breadcrumb: intl.get('categories'),
|
breadcrumb: intl.get('categories'),
|
||||||
pageTitle: intl.get('category_list'),
|
pageTitle: intl.get('categories_list'),
|
||||||
defaultSearchResource: RESOURCES_TYPES.ITEM,
|
defaultSearchResource: RESOURCES_TYPES.ITEM,
|
||||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
||||||
},
|
},
|
||||||
@@ -1095,9 +1095,9 @@ export const getDashboardRoutes = () => [
|
|||||||
|
|
||||||
// Payment modes.
|
// Payment modes.
|
||||||
{
|
{
|
||||||
path: `/payment-mades/import`,
|
path: `/payments-made/import`,
|
||||||
component: lazy(
|
component: lazy(
|
||||||
() => import('@/containers/Purchases/PaymentMades/PaymentMadesImport'),
|
() => import('@/containers/Purchases/PaymentsMade/PaymentsMadeImport'),
|
||||||
),
|
),
|
||||||
name: 'payment-made-edit',
|
name: 'payment-made-edit',
|
||||||
breadcrumb: intl.get('edit'),
|
breadcrumb: intl.get('edit'),
|
||||||
@@ -1107,11 +1107,11 @@ export const getDashboardRoutes = () => [
|
|||||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `/payment-mades/:id/edit`,
|
path: `/payments-made/:id/edit`,
|
||||||
component: lazy(
|
component: lazy(
|
||||||
() =>
|
() =>
|
||||||
import(
|
import(
|
||||||
'@/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeFormPage'
|
'@/containers/Purchases/PaymentsMade/PaymentForm/PaymentMadeFormPage'
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
name: 'payment-made-edit',
|
name: 'payment-made-edit',
|
||||||
@@ -1123,11 +1123,11 @@ export const getDashboardRoutes = () => [
|
|||||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `/payment-mades/new`,
|
path: `/payments-made/new`,
|
||||||
component: lazy(
|
component: lazy(
|
||||||
() =>
|
() =>
|
||||||
import(
|
import(
|
||||||
'@/containers/Purchases/PaymentMades/PaymentForm/PaymentMadeFormPage'
|
'@/containers/Purchases/PaymentsMade/PaymentForm/PaymentMadeFormPage'
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
name: 'payment-made-new',
|
name: 'payment-made-new',
|
||||||
@@ -1139,15 +1139,15 @@ export const getDashboardRoutes = () => [
|
|||||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `/payment-mades`,
|
path: `/payments-made`,
|
||||||
component: lazy(
|
component: lazy(
|
||||||
() =>
|
() =>
|
||||||
import(
|
import(
|
||||||
'@/containers/Purchases/PaymentMades/PaymentsLanding/PaymentMadeList'
|
'@/containers/Purchases/PaymentsMade/PaymentsLanding/PaymentMadeList'
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
breadcrumb: intl.get('payment_made_list'),
|
breadcrumb: intl.get('payments_made_list'),
|
||||||
pageTitle: intl.get('payment_made_list'),
|
pageTitle: intl.get('payments_made_list'),
|
||||||
defaultSearchResource: RESOURCES_TYPES.PAYMENT_MADE,
|
defaultSearchResource: RESOURCES_TYPES.PAYMENT_MADE,
|
||||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -125,3 +125,23 @@ export function closeSidebarSubmenu() {
|
|||||||
type: t.SIDEBAR_SUBMENU_CLOSE,
|
type: t.SIDEBAR_SUBMENU_CLOSE,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addAutofill(autofillRef: number, payload: any) {
|
||||||
|
return {
|
||||||
|
type: t.ADD_AUTOFILL_REF,
|
||||||
|
payload: { ref: autofillRef, payload }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeAutofill(autofillRef: number) {
|
||||||
|
return {
|
||||||
|
type: t.REMOVE_AUTOFILL_REF,
|
||||||
|
payload: { ref: autofillRef}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resetAutofill() {
|
||||||
|
return {
|
||||||
|
type: t.RESET_AUTOFILL_REF,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { createReducer } from '@reduxjs/toolkit';
|
import { createReducer } from '@reduxjs/toolkit';
|
||||||
import { isUndefined, isNumber } from 'lodash';
|
import { isUndefined, isNumber, omit } from 'lodash';
|
||||||
import t from '@/store/types';
|
import t from '@/store/types';
|
||||||
import { persistReducer, purgeStoredState } from 'redux-persist';
|
import { persistReducer, purgeStoredState } from 'redux-persist';
|
||||||
import storage from 'redux-persist/lib/storage';
|
import storage from 'redux-persist/lib/storage';
|
||||||
|
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
pageTitle: '',
|
pageTitle: '',
|
||||||
pageSubtitle: '',
|
pageSubtitle: '',
|
||||||
@@ -23,6 +22,7 @@ const initialState = {
|
|||||||
appIntlIsLoading: true,
|
appIntlIsLoading: true,
|
||||||
sidebarSubmenu: { isOpen: false, submenuId: null },
|
sidebarSubmenu: { isOpen: false, submenuId: null },
|
||||||
features: {},
|
features: {},
|
||||||
|
autofill: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const STORAGE_KEY = 'bigcapital:dashboard';
|
const STORAGE_KEY = 'bigcapital:dashboard';
|
||||||
@@ -143,6 +143,18 @@ const reducerInstance = createReducer(initialState, {
|
|||||||
[t.RESET]: () => {
|
[t.RESET]: () => {
|
||||||
purgeStoredState(CONFIG);
|
purgeStoredState(CONFIG);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[t.ADD_AUTOFILL_REF]: (state, action) => {
|
||||||
|
state.autofill[action.payload.ref] = action.payload.payload || null;
|
||||||
|
},
|
||||||
|
|
||||||
|
[t.REMOVE_AUTOFILL_REF]: (state, action) => {
|
||||||
|
state.autofill = omit(state.autofill, [action.payload.ref]);
|
||||||
|
},
|
||||||
|
|
||||||
|
[t.RESET_AUTOFILL_REF]: (state, action) => {
|
||||||
|
state.autofill = {};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default persistReducer(CONFIG, reducerInstance);
|
export default persistReducer(CONFIG, reducerInstance);
|
||||||
|
|||||||
@@ -21,4 +21,7 @@ export default {
|
|||||||
SPLASH_START_LOADING: 'SPLASH_START_LOADING',
|
SPLASH_START_LOADING: 'SPLASH_START_LOADING',
|
||||||
SPLASH_STOP_LOADING: 'SPLASH_STOP_LOADING',
|
SPLASH_STOP_LOADING: 'SPLASH_STOP_LOADING',
|
||||||
SET_FEATURE_DASHBOARD_META: 'SET_FEATURE_DASHBOARD_META',
|
SET_FEATURE_DASHBOARD_META: 'SET_FEATURE_DASHBOARD_META',
|
||||||
|
ADD_AUTOFILL_REF: 'ADD_AUTOFILL_REF',
|
||||||
|
REMOVE_AUTOFILL_REF: 'REMOVE_AUTOFILL_REF',
|
||||||
|
RESET_AUTOFILL_REF: 'RESET_AUTOFILL_REF'
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user