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