BIG-19 fix: scrollable area on details drawer.

This commit is contained in:
a.bouhuolia
2021-09-12 10:16:34 +02:00
parent e710edb0a1
commit d446300a71
38 changed files with 153 additions and 95 deletions

View File

@@ -7,5 +7,6 @@ export const DRAWERS = {
ACCOUNT_DRAWER: 'account-drawer', ACCOUNT_DRAWER: 'account-drawer',
JOURNAL_DRAWER: 'journal-drawer', JOURNAL_DRAWER: 'journal-drawer',
EXPENSE_DRAWER: 'expense-drawer', EXPENSE_DRAWER: 'expense-drawer',
BILL_DRAWER: 'bill-drawer',
INVENTORY_ADJUSTMENT_DRAWER: 'inventory-adjustment-drawer', INVENTORY_ADJUSTMENT_DRAWER: 'inventory-adjustment-drawer',
}; };

View File

@@ -1,12 +1,11 @@
import React, { Suspense } from 'react'; import React, { Suspense } from 'react';
import { Spinner, Classes } from '@blueprintjs/core'; import { DrawerLoading } from 'components';
/**
* Loading content.
*/
function LoadingContent() { function LoadingContent() {
return ( return <DrawerLoading loading={true} />;
<div className={Classes.DRAWER_BODY}>
<Spinner size={30} />
</div>
);
} }
export default function DrawerSuspense({ children }) { export default function DrawerSuspense({ children }) {

View File

@@ -0,0 +1,15 @@
import React from 'react';
import { Classes } from '@blueprintjs/core';
import LoadingIndicator from 'components/LoadingIndicator';
export function DrawerLoading({ loading, mount = false, children }) {
return (
<LoadingIndicator loading={loading} mount={mount}>
{children}
</LoadingIndicator>
);
}
export function DrawerBody({ children }) {
return <div className={Classes.DRAWER_BODY}>{children}</div>;
}

View File

@@ -25,7 +25,7 @@ export default function DrawersContainer() {
<AccountDrawer name={DRAWERS.ACCOUNT_DRAWER} /> <AccountDrawer name={DRAWERS.ACCOUNT_DRAWER} />
<ManualJournalDrawer name={DRAWERS.JOURNAL_DRAWER} /> <ManualJournalDrawer name={DRAWERS.JOURNAL_DRAWER} />
<ExpenseDrawer name={DRAWERS.EXPENSE_DRAWER} /> <ExpenseDrawer name={DRAWERS.EXPENSE_DRAWER} />
<BillDrawer name={'bill-drawer'} /> <BillDrawer name={DRAWERS.BILL_DRAWER} />
<InvoiceDetailDrawer name={'invoice-detail-drawer'} /> <InvoiceDetailDrawer name={'invoice-detail-drawer'} />
<EstimateDetailDrawer name={'estimate-detail-drawer'} /> <EstimateDetailDrawer name={'estimate-detail-drawer'} />
<ReceiptDetailDrawer name={'receipt-detail-drawer'} /> <ReceiptDetailDrawer name={'receipt-detail-drawer'} />

View File

@@ -75,6 +75,7 @@ export * from './TotalLines/index'
export * from './Alert'; export * from './Alert';
export * from './Subscriptions'; export * from './Subscriptions';
export * from './Dashboard'; export * from './Dashboard';
export * from './Drawer';
const Hint = FieldHint; const Hint = FieldHint;

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import 'style/components/Drawers/AccountDrawer.scss'; import 'style/components/Drawers/AccountDrawer.scss';
@@ -11,11 +12,13 @@ import AccountDrawerDetails from './AccountDrawerDetails';
export default function AccountDrawerContent({ export default function AccountDrawerContent({
// #ownProp // #ownProp
accountId, accountId,
name name,
}) { }) {
return ( return (
<AccountDrawerProvider name={name} accountId={accountId}> <AccountDrawerProvider name={name} accountId={accountId}>
<DrawerBody>
<AccountDrawerDetails /> <AccountDrawerDetails />
</DrawerBody>
</AccountDrawerProvider> </AccountDrawerProvider>
); );
} }

View File

@@ -13,9 +13,11 @@ export default function AccountDrawerDetails() {
return ( return (
<div className={'account-drawer'}> <div className={'account-drawer'}>
<AccountDrawerActionBar /> <AccountDrawerActionBar />
<Card className={'card-header'}> <Card className={'card-header'}>
<AccountDrawerHeader /> <AccountDrawerHeader />
</Card> </Card>
<AccountDrawerTable /> <AccountDrawerTable />
</div> </div>
); );

View File

@@ -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 { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
const AccountDrawerContext = React.createContext(); const AccountDrawerContext = React.createContext();
@@ -22,7 +22,7 @@ function AccountDrawerProvider({ accountId, name, ...props }) {
// Drawer title. // Drawer title.
const drawerTitle = `${account.name} ${account.code}`; const drawerTitle = `${account.name} ${account.code}`;
// provider. // Provider.
const provider = { const provider = {
accountId, accountId,
account, account,
@@ -31,10 +31,10 @@ function AccountDrawerProvider({ accountId, name, ...props }) {
}; };
return ( return (
<DashboardInsider loading={isAccountLoading || isAccountsLoading}> <DrawerLoading loading={isAccountLoading || isAccountsLoading}>
<DrawerHeaderContent name={'account-drawer'} title={drawerTitle} /> <DrawerHeaderContent name={'account-drawer'} title={drawerTitle} />
<AccountDrawerContext.Provider value={provider} {...props} /> <AccountDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -19,10 +19,7 @@ function AccountDrawer({
<Drawer <Drawer
isOpen={isOpen} isOpen={isOpen}
name={name} name={name}
style={{ style={{ minWidth: '700px', maxWidth: '900px' }}
minWidth: '700px',
maxWidth: '900px',
}}
size={'65%'} size={'65%'}
> >
<DrawerSuspense> <DrawerSuspense>

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import 'style/components/Drawers/ViewDetail/ViewDetail.scss'; import 'style/components/Drawers/ViewDetail/ViewDetail.scss';
@@ -15,8 +16,9 @@ export default function BillDrawerContent({
}) { }) {
return ( return (
<BillDrawerProvider billId={billId}> <BillDrawerProvider billId={billId}>
<DrawerBody>
<BillDrawerDetails /> <BillDrawerDetails />
{/* <BillDrawerAlerts /> */} </DrawerBody>
</BillDrawerProvider> </BillDrawerProvider>
); );
} }

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { import {
useBill, useBill,
useTransactionsByReference, useTransactionsByReference,
@@ -41,16 +41,16 @@ function BillDrawerProvider({ billId, ...props }) {
bill, bill,
}; };
const loading = isLandedCostLoading || isTransactionLoading || isBillLoading;
return ( return (
<DashboardInsider <DrawerLoading loading={loading}>
loading={isLandedCostLoading || isTransactionLoading || isBillLoading}
>
<DrawerHeaderContent <DrawerHeaderContent
name="bill-drawer" name="bill-drawer"
title={intl.get('bill_details')} title={intl.get('bill_details')}
/> />
<BillDrawerContext.Provider value={provider} {...props} /> <BillDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import CustomerDetails from './CustomerDetails'; import CustomerDetails from './CustomerDetails';
import { CustomerDetailsDrawerProvider } from './CustomerDetailsDrawerProvider'; import { CustomerDetailsDrawerProvider } from './CustomerDetailsDrawerProvider';
@@ -12,7 +13,9 @@ export default function CustomerDetailsDrawerContent({
}) { }) {
return ( return (
<CustomerDetailsDrawerProvider customerId={customerId}> <CustomerDetailsDrawerProvider customerId={customerId}>
<DrawerBody>
<CustomerDetails /> <CustomerDetails />
</DrawerBody>
</CustomerDetailsDrawerProvider> </CustomerDetailsDrawerProvider>
); );
} }

View File

@@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useCustomer } from 'hooks/query'; import { useCustomer } from 'hooks/query';
const ContactDetailDrawerContext = React.createContext(); const ContactDetailDrawerContext = React.createContext();
@@ -23,13 +23,13 @@ function CustomerDetailsDrawerProvider({ customerId, ...props }) {
}; };
return ( return (
<DashboardInsider loading={isCustomerLoading}> <DrawerLoading loading={isCustomerLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="customer-details-drawer" name="customer-details-drawer"
title={customer?.display_name} title={customer?.display_name}
/> />
<ContactDetailDrawerContext.Provider value={provider} {...props} /> <ContactDetailDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import EstimateDetail from './EstimateDetail'; import EstimateDetail from './EstimateDetail';
import { EstimateDetailDrawerProvider } from './EstimateDetailDrawerProvider'; import { EstimateDetailDrawerProvider } from './EstimateDetailDrawerProvider';
@@ -12,7 +13,9 @@ export default function EstimateDetailDrawerContent({
}) { }) {
return ( return (
<EstimateDetailDrawerProvider estimateId={estimateId}> <EstimateDetailDrawerProvider estimateId={estimateId}>
<DrawerBody>
<EstimateDetail /> <EstimateDetail />
</DrawerBody>
</EstimateDetailDrawerProvider> </EstimateDetailDrawerProvider>
); );
} }

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { useEstimate } from 'hooks/query'; import { useEstimate } from 'hooks/query';
import { DrawerHeaderContent, DrawerInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
const EstimateDetailDrawerContext = React.createContext(); const EstimateDetailDrawerContext = React.createContext();
@@ -21,13 +21,13 @@ function EstimateDetailDrawerProvider({ estimateId, ...props }) {
}; };
return ( return (
<DrawerInsider loading={isEstimateLoading}> <DrawerLoading loading={isEstimateLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="estimate-detail-drawer" name="estimate-detail-drawer"
title={intl.get('estimate_details')} title={intl.get('estimate_details')}
/> />
<EstimateDetailDrawerContext.Provider value={provider} {...props} /> <EstimateDetailDrawerContext.Provider value={provider} {...props} />
</DrawerInsider> </DrawerLoading>
); );
} }

View File

@@ -1,5 +1,7 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import 'style/components/Drawers/ExpenseDrawer.scss'; import 'style/components/Drawers/ExpenseDrawer.scss';
import { ExpenseDrawerProvider } from './ExpenseDrawerProvider'; import { ExpenseDrawerProvider } from './ExpenseDrawerProvider';
@@ -14,7 +16,9 @@ export default function ExpenseDrawerContent({
}) { }) {
return ( return (
<ExpenseDrawerProvider expenseId={expenseId}> <ExpenseDrawerProvider expenseId={expenseId}>
<DrawerBody>
<ExpenseDrawerDetails /> <ExpenseDrawerDetails />
</DrawerBody>
</ExpenseDrawerProvider> </ExpenseDrawerProvider>
); );
} }

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { useExpense } from 'hooks/query'; import { useExpense } from 'hooks/query';
import { DashboardInsider } from 'components'; import { DrawerLoading } from 'components';
const ExpenseDrawerDrawerContext = React.createContext(); const ExpenseDrawerDrawerContext = React.createContext();
@@ -25,10 +25,11 @@ function ExpenseDrawerProvider({ expenseId, ...props }) {
isExpenseFetching, isExpenseFetching,
isExpenseLoading, isExpenseLoading,
}; };
return ( return (
<DashboardInsider loading={isExpenseLoading}> <DrawerLoading loading={isExpenseLoading}>
<ExpenseDrawerDrawerContext.Provider value={provider} {...props} /> <ExpenseDrawerDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }
const useExpenseDrawerContext = () => const useExpenseDrawerContext = () =>

View File

@@ -1,7 +1,8 @@
import React, { lazy } from 'react'; import React, { lazy } from 'react';
import intl from 'react-intl-universal';
import { Drawer, DrawerSuspense } from 'components'; import { Drawer, DrawerSuspense } from 'components';
import withDrawers from 'containers/Drawer/withDrawers'; import withDrawers from 'containers/Drawer/withDrawers';
import intl from 'react-intl-universal';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -13,7 +14,7 @@ const ExpenseDrawerContent = lazy(() => import('./ExpenseDrawerContent'));
function ExpenseDrawer({ function ExpenseDrawer({
name, name,
//#withDrawer // #withDrawer
isOpen, isOpen,
payload: { expenseId }, payload: { expenseId },
}) { }) {
@@ -23,10 +24,7 @@ function ExpenseDrawer({
name={name} name={name}
title={intl.get('expense')} title={intl.get('expense')}
size={'65%'} size={'65%'}
style={{ style={{ minWidth: '700px', maxWidth: '900px' }}
minWidth: '700px',
maxWidth: '900px',
}}
> >
<DrawerSuspense> <DrawerSuspense>
<ExpenseDrawerContent expenseId={expenseId} /> <ExpenseDrawerContent expenseId={expenseId} />

View File

@@ -16,6 +16,7 @@ export default function InventoryAdjustmentDetail() {
return ( return (
<div className={clsx(InventoryAdjustmentDrawerCls.detail_panel)}> <div className={clsx(InventoryAdjustmentDrawerCls.detail_panel)}>
<InventoryAdjustmentDetailActionsBar /> <InventoryAdjustmentDetailActionsBar />
<Card> <Card>
<InventoryAdjustmentDetailHeader /> <InventoryAdjustmentDetailHeader />
<InventoryAdjustmentDetailTable /> <InventoryAdjustmentDetailTable />

View File

@@ -26,9 +26,7 @@ function InventoryAdjustmentDetailActionsBar({
// Handle delete inventory adjustment. // Handle delete inventory adjustment.
const handleDeleteInventoryAdjustment = () => { const handleDeleteInventoryAdjustment = () => {
openAlert('inventory-adjustment-delete', { openAlert('inventory-adjustment-delete', { inventoryId });
inventoryId,
});
closeDrawer('inventory-adjustment-drawer'); closeDrawer('inventory-adjustment-drawer');
}; };

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import InventoryAdjustmentDetail from './InventoryAdjustmentDetail'; import InventoryAdjustmentDetail from './InventoryAdjustmentDetail';
import { InventoryAdjustmentDrawerProvider } from './InventoryAdjustmentDrawerProvider'; import { InventoryAdjustmentDrawerProvider } from './InventoryAdjustmentDrawerProvider';
@@ -9,7 +10,9 @@ import { InventoryAdjustmentDrawerProvider } from './InventoryAdjustmentDrawerPr
export default function InventoryAdjustmentDrawerContent({ inventoryId }) { export default function InventoryAdjustmentDrawerContent({ inventoryId }) {
return ( return (
<InventoryAdjustmentDrawerProvider inventoryId={inventoryId}> <InventoryAdjustmentDrawerProvider inventoryId={inventoryId}>
<DrawerBody>
<InventoryAdjustmentDetail /> <InventoryAdjustmentDetail />
</DrawerBody>
</InventoryAdjustmentDrawerProvider> </InventoryAdjustmentDrawerProvider>
); );
} }

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useInventoryAdjustment } from 'hooks/query'; import { useInventoryAdjustment } from 'hooks/query';
const InventoryAdjustmentDrawerContext = React.createContext(); const InventoryAdjustmentDrawerContext = React.createContext();
@@ -22,14 +22,13 @@ function InventoryAdjustmentDrawerProvider({ inventoryId, ...props }) {
}; };
return ( return (
<DashboardInsider loading={isAdjustmentsLoading}> <DrawerLoading loading={isAdjustmentsLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="inventory-adjustment-drawer" name="inventory-adjustment-drawer"
title={intl.get('inventory_adjustment.details_drawer.title')} title={intl.get('inventory_adjustment.details_drawer.title')}
/> />
<InventoryAdjustmentDrawerContext.Provider value={provider} {...props} /> <InventoryAdjustmentDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import 'style/components/Drawers/ViewDetail/ViewDetail.scss'; import 'style/components/Drawers/ViewDetail/ViewDetail.scss';
@@ -14,7 +15,9 @@ export default function InvoiceDetailDrawerContent({
}) { }) {
return ( return (
<InvoiceDetailDrawerProvider invoiceId={invoiceId}> <InvoiceDetailDrawerProvider invoiceId={invoiceId}>
<DrawerBody>
<InvoiceDetail /> <InvoiceDetail />
</DrawerBody>
</InvoiceDetailDrawerProvider> </InvoiceDetailDrawerProvider>
); );
} }

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useTransactionsByReference, useInvoice } from 'hooks/query'; import { useTransactionsByReference, useInvoice } from 'hooks/query';
const InvoiceDetailDrawerContext = React.createContext(); const InvoiceDetailDrawerContext = React.createContext();
@@ -32,13 +32,13 @@ function InvoiceDetailDrawerProvider({ invoiceId, ...props }) {
invoice, invoice,
}; };
return ( return (
<DashboardInsider loading={isTransactionLoading || isInvoiceLoading}> <DrawerLoading loading={isTransactionLoading || isInvoiceLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="invoice-detail-drawer" name="invoice-detail-drawer"
title={intl.get('invoice_details')} title={intl.get('invoice_details')}
/> />
<InvoiceDetailDrawerContext.Provider value={provider} {...props} /> <InvoiceDetailDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -2,6 +2,7 @@ import React from 'react';
import 'style/components/Drawers/ItemDrawer.scss'; import 'style/components/Drawers/ItemDrawer.scss';
import { DrawerBody } from 'components';
import ItemContentDetails from './ItemContentDetails'; import ItemContentDetails from './ItemContentDetails';
import { ItemDetailDrawerProvider } from './ItemDetailDrawerProvider'; import { ItemDetailDrawerProvider } from './ItemDetailDrawerProvider';
@@ -14,7 +15,9 @@ export default function ItemDetailDrawerContent({
}) { }) {
return ( return (
<ItemDetailDrawerProvider itemId={itemId}> <ItemDetailDrawerProvider itemId={itemId}>
<DrawerBody>
<ItemContentDetails /> <ItemContentDetails />
</DrawerBody>
</ItemDetailDrawerProvider> </ItemDetailDrawerProvider>
); );
} }

View File

@@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useItem } from 'hooks/query'; import { useItem } from 'hooks/query';
const ItemDetailDrawerContext = React.createContext(); const ItemDetailDrawerContext = React.createContext();
@@ -21,10 +21,10 @@ function ItemDetailDrawerProvider({ itemId, ...props }) {
}; };
return ( return (
<DashboardInsider loading={isItemLoading}> <DrawerLoading loading={isItemLoading}>
<DrawerHeaderContent name="item-detail-drawer" title={item?.name} /> <DrawerHeaderContent name="item-detail-drawer" title={item?.name} />
<ItemDetailDrawerContext.Provider value={provider} {...props} /> <ItemDetailDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }
const useItemDetailDrawerContext = () => const useItemDetailDrawerContext = () =>

View File

@@ -1,5 +1,7 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import 'style/components/Drawers/ViewDetails.scss'; import 'style/components/Drawers/ViewDetails.scss';
import { ManualJournalDrawerProvider } from './ManualJournalDrawerProvider'; import { ManualJournalDrawerProvider } from './ManualJournalDrawerProvider';
@@ -14,7 +16,9 @@ export default function ManualJournalDrawerContent({
}) { }) {
return ( return (
<ManualJournalDrawerProvider manualJournalId={manualJournalId}> <ManualJournalDrawerProvider manualJournalId={manualJournalId}>
<DrawerBody>
<ManualJournalDrawerDetails /> <ManualJournalDrawerDetails />
</DrawerBody>
</ManualJournalDrawerProvider> </ManualJournalDrawerProvider>
); );
} }

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { useJournal } from 'hooks/query'; import { useJournal } from 'hooks/query';
import { DashboardInsider, DrawerHeaderContent } from 'components'; import { DrawerLoading, DrawerHeaderContent } from 'components';
const ManualJournalDrawerContext = React.createContext(); const ManualJournalDrawerContext = React.createContext();
@@ -28,7 +28,7 @@ function ManualJournalDrawerProvider({ manualJournalId, ...props }) {
}; };
return ( return (
<DashboardInsider loading={isJournalLoading}> <DrawerLoading loading={isJournalLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name={'journal-drawer'} name={'journal-drawer'}
title={intl.get('manual_journal_number', { title={intl.get('manual_journal_number', {
@@ -36,7 +36,7 @@ function ManualJournalDrawerProvider({ manualJournalId, ...props }) {
})} })}
/> />
<ManualJournalDrawerContext.Provider value={provider} {...props} /> <ManualJournalDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -14,7 +14,7 @@ const ManualJournalDrawerContent = lazy(() =>
function ManualJournalDrawer({ function ManualJournalDrawer({
name, name,
//#withDrawer // #withDrawer
isOpen, isOpen,
payload: { manualJournalId }, payload: { manualJournalId },
}) { }) {
@@ -23,10 +23,7 @@ function ManualJournalDrawer({
isOpen={isOpen} isOpen={isOpen}
name={name} name={name}
size={'65%'} size={'65%'}
style={{ style={{ minWidth: '700px', maxWidth: '900px' }}
minWidth: '700px',
maxWidth: '900px',
}}
> >
<DrawerSuspense> <DrawerSuspense>
<ManualJournalDrawerContent manualJournalId={manualJournalId} /> <ManualJournalDrawerContent manualJournalId={manualJournalId} />

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import 'style/components/Drawers/ViewDetail/ViewDetail.scss'; import 'style/components/Drawers/ViewDetail/ViewDetail.scss';
@@ -14,7 +15,9 @@ export default function PaymentMadeDetailContent({
}) { }) {
return ( return (
<PaymentMadeDetailProvider paymentMadeId={paymentMadeId}> <PaymentMadeDetailProvider paymentMadeId={paymentMadeId}>
<DrawerBody>
<PaymentMadeDetails /> <PaymentMadeDetails />
</DrawerBody>
</PaymentMadeDetailProvider> </PaymentMadeDetailProvider>
); );
} }

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { import {
useTransactionsByReference, useTransactionsByReference,
usePaymentMade, usePaymentMade,
@@ -46,16 +46,18 @@ function PaymentMadeDetailProvider({ paymentMadeId, ...props }) {
paymentMade, paymentMade,
paymentEntries, paymentEntries,
}; };
const loading =
isTransactionLoading || isPaymentMadeLoading || isPaymentLoading;
return ( return (
<DashboardInsider <DrawerLoading loading={loading}>
loading={isTransactionLoading || isPaymentMadeLoading || isPaymentLoading}
>
<DrawerHeaderContent <DrawerHeaderContent
name="payment-made-detail-drawer" name="payment-made-detail-drawer"
title={intl.get('payment_made_details')} title={intl.get('payment_made_details')}
/> />
<PaymentMadeDetailContext.Provider value={provider} {...props} /> <PaymentMadeDetailContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -20,6 +20,9 @@ import { Icon, FormattedMessage as T } from 'components';
import { compose } from 'utils'; import { compose } from 'utils';
/**
* Payment receive actions bar.
*/
function PaymentReceiveActionsBar({ function PaymentReceiveActionsBar({
// #withAlertsActions // #withAlertsActions
openAlert, openAlert,

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import PaymentReceiveDetail from './PaymentReceiveDetail'; import PaymentReceiveDetail from './PaymentReceiveDetail';
import { PaymentReceiveDetailProvider } from './PaymentReceiveDetailProvider'; import { PaymentReceiveDetailProvider } from './PaymentReceiveDetailProvider';
@@ -12,7 +13,9 @@ export default function PaymentReceiveDetailContent({
}) { }) {
return ( return (
<PaymentReceiveDetailProvider paymentReceiveId={paymentReceiveId}> <PaymentReceiveDetailProvider paymentReceiveId={paymentReceiveId}>
<DrawerBody>
<PaymentReceiveDetail /> <PaymentReceiveDetail />
</DrawerBody>
</PaymentReceiveDetailProvider> </PaymentReceiveDetailProvider>
); );
} }

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useTransactionsByReference, usePaymentReceive } from 'hooks/query'; import { useTransactionsByReference, usePaymentReceive } from 'hooks/query';
const PaymentReceiveDetailContext = React.createContext(); const PaymentReceiveDetailContext = React.createContext();
@@ -30,16 +30,21 @@ function PaymentReceiveDetailProvider({ paymentReceiveId, ...props }) {
); );
// Provider. // Provider.
const provider = { transactions, paymentReceive, paymentReceiveId }; const provider = {
isPaymentFetching,
transactions,
paymentReceive,
paymentReceiveId,
};
return ( return (
<DashboardInsider loading={isTransactionLoading || isPaymentLoading}> <DrawerLoading loading={isTransactionLoading || isPaymentLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="payment-receive-detail-drawer" name="payment-receive-detail-drawer"
title={intl.get('payment_receive_details')} title={intl.get('payment_receive_details')}
/> />
<PaymentReceiveDetailContext.Provider value={provider} {...props} /> <PaymentReceiveDetailContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import 'style/components/Drawers/ViewDetail/ViewDetail.scss'; import 'style/components/Drawers/ViewDetail/ViewDetail.scss';
@@ -14,7 +15,9 @@ export default function ReceiptDetailDrawerContent({
}) { }) {
return ( return (
<ReceiptDetailDrawerProvider receiptId={receiptId}> <ReceiptDetailDrawerProvider receiptId={receiptId}>
<DrawerBody>
<ReceiptDetail /> <ReceiptDetail />
</DrawerBody>
</ReceiptDetailDrawerProvider> </ReceiptDetailDrawerProvider>
); );
} }

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useTransactionsByReference, useReceipt } from 'hooks/query'; import { useTransactionsByReference, useReceipt } from 'hooks/query';
// useTransactionsByReference // useTransactionsByReference
@@ -30,21 +30,23 @@ function ReceiptDetailDrawerProvider({ receiptId, ...props }) {
{ enabled: !!receiptId }, { enabled: !!receiptId },
); );
//provider. // Provider.
const provider = { const provider = {
transactions, transactions,
receiptId, receiptId,
receipt, receipt,
}; };
const loading = isTransactionLoading || isReceiptLoading;
return ( return (
<DashboardInsider loading={isTransactionLoading || isReceiptLoading}> <DrawerLoading loading={loading}>
<DrawerHeaderContent <DrawerHeaderContent
name="receipt-detail-drawer" name="receipt-detail-drawer"
title={intl.get('receipt_details')} title={intl.get('receipt_details')}
/> />
<ReceiptDetailDrawerContext.Provider value={provider} {...props} /> <ReceiptDetailDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }
const useReceiptDetailDrawerContext = () => const useReceiptDetailDrawerContext = () =>

View File

@@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { DrawerBody } from 'components';
import VendorDetails from './VendorDetails'; import VendorDetails from './VendorDetails';
import { VendorDetailsDrawerProvider } from './VendorDetailsDrawerProvider'; import { VendorDetailsDrawerProvider } from './VendorDetailsDrawerProvider';
@@ -12,7 +13,9 @@ export default function VendorDetailsDrawerContent({
}) { }) {
return ( return (
<VendorDetailsDrawerProvider vendorId={vendorId}> <VendorDetailsDrawerProvider vendorId={vendorId}>
<DrawerBody>
<VendorDetails /> <VendorDetails />
</DrawerBody>
</VendorDetailsDrawerProvider> </VendorDetailsDrawerProvider>
); );
} }

View File

@@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { DrawerHeaderContent, DashboardInsider } from 'components'; import { DrawerHeaderContent, DrawerLoading } from 'components';
import { useVendor } from 'hooks/query'; import { useVendor } from 'hooks/query';
const VendorDetailDrawerContext = React.createContext(); const VendorDetailDrawerContext = React.createContext();
@@ -9,12 +9,9 @@ const VendorDetailDrawerContext = React.createContext();
*/ */
function VendorDetailsDrawerProvider({ vendorId, ...props }) { function VendorDetailsDrawerProvider({ vendorId, ...props }) {
// Handle fetch vendor details. // Handle fetch vendor details.
const { data: vendor, isLoading: isVendorLoading } = useVendor( const { data: vendor, isLoading: isVendorLoading } = useVendor(vendorId, {
vendorId,
{
enabled: !!vendorId, enabled: !!vendorId,
}, });
);
// Provider. // Provider.
const provider = { const provider = {
vendor, vendor,
@@ -23,13 +20,13 @@ function VendorDetailsDrawerProvider({ vendorId, ...props }) {
}; };
return ( return (
<DashboardInsider loading={isVendorLoading}> <DrawerLoading loading={isVendorLoading}>
<DrawerHeaderContent <DrawerHeaderContent
name="vendor-details-drawer" name="vendor-details-drawer"
title={vendor?.display_name} title={vendor?.display_name}
/> />
<VendorDetailDrawerContext.Provider value={provider} {...props} /> <VendorDetailDrawerContext.Provider value={provider} {...props} />
</DashboardInsider> </DrawerLoading>
); );
} }