mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
fix(account drawer): acconut drawer.
This commit is contained in:
@@ -64,8 +64,8 @@ function AccountsDataTable({
|
||||
};
|
||||
|
||||
// Handle view detail account.
|
||||
const handleViewDetailAccount = ({ id, name, code }) => {
|
||||
openDrawer('account-drawer', { accountId: id, title: `${name} ${code}` });
|
||||
const handleViewDetailAccount = ({ id }) => {
|
||||
openDrawer('account-drawer', { accountId: id });
|
||||
};
|
||||
|
||||
// Handle new child button click.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { useAccount, useAccountTransactions } from 'hooks/query';
|
||||
import DashboardInsider from 'components/Dashboard/DashboardInsider';
|
||||
import { DrawerHeaderContent, DashboardInsider } from 'components';
|
||||
|
||||
const AccountDrawerContext = React.createContext();
|
||||
|
||||
@@ -20,6 +20,7 @@ function AccountDrawerProvider({ accountId, ...props }) {
|
||||
} = useAccountTransactions(accountId, {
|
||||
enabled: !!accountId,
|
||||
});
|
||||
const name = `${account.name} ${account.code}`;
|
||||
|
||||
// provider.
|
||||
const provider = {
|
||||
@@ -30,6 +31,7 @@ function AccountDrawerProvider({ accountId, ...props }) {
|
||||
|
||||
return (
|
||||
<DashboardInsider loading={isAccountLoading || isAccountsLoading}>
|
||||
<DrawerHeaderContent name={'account-drawer'} title={name} />
|
||||
<AccountDrawerContext.Provider value={provider} {...props} />
|
||||
</DashboardInsider>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { lazy } from 'react';
|
||||
import { Drawer, DrawerSuspense } from 'components';
|
||||
import withDrawers from 'containers/Drawer/withDrawers';
|
||||
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
@@ -14,17 +13,11 @@ function AccountDrawer({
|
||||
name,
|
||||
//#withDrawer
|
||||
isOpen,
|
||||
payload: { accountId, title },
|
||||
|
||||
closeDrawer,
|
||||
payload: { accountId },
|
||||
}) {
|
||||
// Handle close drawer.
|
||||
const handleDrawerClose = () => {
|
||||
closeDrawer(name);
|
||||
};
|
||||
|
||||
return (
|
||||
<Drawer isOpen={isOpen} title={title} isClose={handleDrawerClose}>
|
||||
<Drawer isOpen={isOpen} name={name}>
|
||||
<DrawerSuspense>
|
||||
<AccountDrawerContent accountId={accountId} />
|
||||
</DrawerSuspense>
|
||||
@@ -32,4 +25,4 @@ function AccountDrawer({
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDrawers(), withDrawerActions)(AccountDrawer);
|
||||
export default compose(withDrawers())(AccountDrawer);
|
||||
|
||||
@@ -11,6 +11,7 @@ const transformAccount = (response) => {
|
||||
const commonInvalidateQueries = (query) => {
|
||||
// Invalidate accounts.
|
||||
query.invalidateQueries(t.ACCOUNTS);
|
||||
query.invalidateQueries(t.ACCOUNT);
|
||||
|
||||
// Invalidate financial reports.
|
||||
query.invalidateQueries(t.FINANCIAL_REPORT);
|
||||
@@ -149,7 +150,6 @@ export function useInactivateAccount(props) {
|
||||
* Retrieve account transactions.
|
||||
*/
|
||||
export function useAccountTransactions(id, props) {
|
||||
console.log(id, 'FF');
|
||||
return useRequestQuery(
|
||||
[t.ACCOUNT_TRANSACTION, id],
|
||||
{ method: 'get', url: `accounts/transactions?account_id=${id}` },
|
||||
|
||||
Reference in New Issue
Block a user