fix(ManualJournal): manual journal drawer.

This commit is contained in:
elforjani3
2021-04-28 20:35:51 +02:00
parent c11e3f97bd
commit 8b7b800834
3 changed files with 10 additions and 13 deletions

View File

@@ -67,10 +67,9 @@ function ManualJournalsDataTable({
};
// Handle view detail journal.
const handleViewDetailJournal = ({ id, journal_number }) => {
const handleViewDetailJournal = ({ id }) => {
openDrawer('journal-drawer', {
manualJournalId: id,
title: `Manual Journal ${journal_number}`,
});
};

View File

@@ -1,6 +1,7 @@
import React from 'react';
import { useJournal } from 'hooks/query';
import { DashboardInsider } from 'components';
import { DashboardInsider, DrawerHeaderContent } from 'components';
const ManualJournalDrawerContext = React.createContext();
/**
@@ -22,6 +23,10 @@ function ManualJournalDrawerProvider({ manualJournalId, ...props }) {
return (
<DashboardInsider loading={isJournalLoading}>
<DrawerHeaderContent
name={'journal-drawer'}
title={`Manual Journal ${manualJournal?.journal_number}`}
/>
<ManualJournalDrawerContext.Provider value={provider} {...props} />
</DashboardInsider>
);

View File

@@ -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';
@@ -17,16 +16,10 @@ function ManualJournalDrawer({
//#withDrawer
isOpen,
payload: { manualJournalId, title },
closeDrawer,
payload: { manualJournalId },
}) {
// Handle close drawer.
const handleDrawerClose = () => {
closeDrawer(name);
};
return (
<Drawer isOpen={isOpen} title={title} isClose={handleDrawerClose}>
<Drawer isOpen={isOpen} name={name}>
<DrawerSuspense>
<ManualJournalDrawerContent manualJournalId={manualJournalId} />
</DrawerSuspense>
@@ -34,4 +27,4 @@ function ManualJournalDrawer({
);
}
export default compose(withDrawers(), withDrawerActions)(ManualJournalDrawer);
export default compose(withDrawers())(ManualJournalDrawer);