mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
feat: Payment invoice preview drawer
This commit is contained in:
@@ -3,10 +3,17 @@ import clsx from 'classnames';
|
||||
import { Box, Group, Stack } from '@/components';
|
||||
import styles from './PaymentPortal.module.scss';
|
||||
import { usePaymentPortalBoot } from './PaymentPortalBoot';
|
||||
import { useDrawerActions } from '@/hooks/state';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
export function PaymentPortal() {
|
||||
const { openDrawer } = useDrawerActions();
|
||||
const { sharableLinkMeta } = usePaymentPortalBoot();
|
||||
|
||||
const handleInvoicePreviewBtnClick = () => {
|
||||
openDrawer(DRAWERS.PAYMENT_INVOICE_PREVIEW);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box className={styles.root}>
|
||||
<Stack spacing={0} className={styles.body}>
|
||||
@@ -85,6 +92,7 @@ export function PaymentPortal() {
|
||||
Download Invoice
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleInvoicePreviewBtnClick}
|
||||
className={clsx(styles.footerButton, styles.viewInvoiceButton)}
|
||||
>
|
||||
View Invoice
|
||||
|
||||
@@ -3,15 +3,21 @@ import { PaymentPortal } from './PaymentPortal';
|
||||
import { PaymentPortalBoot } from './PaymentPortalBoot';
|
||||
import BodyClassName from 'react-body-classname';
|
||||
import styles from './PaymentPortal.module.scss';
|
||||
import { PaymentInvoicePreviewDrawer } from './drawers/PaymentInvoicePreviewDrawer/PaymentInvoicePreviewDrawer';
|
||||
import { DRAWERS } from '@/constants/drawers';
|
||||
|
||||
export default function PaymentPortalPage() {
|
||||
const { linkId } = useParams<{ linkId: string }>();
|
||||
|
||||
return (
|
||||
<BodyClassName className={styles.rootBodyPage}>
|
||||
<PaymentPortalBoot linkId={linkId}>
|
||||
<PaymentPortal />
|
||||
</PaymentPortalBoot>
|
||||
</BodyClassName>
|
||||
<>
|
||||
<BodyClassName className={styles.rootBodyPage}>
|
||||
<PaymentPortalBoot linkId={linkId}>
|
||||
<PaymentPortal />
|
||||
</PaymentPortalBoot>
|
||||
</BodyClassName>
|
||||
|
||||
<PaymentInvoicePreviewDrawer name={DRAWERS.PAYMENT_INVOICE_PREVIEW} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// @ts-nocheck
|
||||
import { Box, DrawerBody, DrawerHeaderContent } from '@/components';
|
||||
import { InvoicePaperTemplate } from '@/containers/Sales/Invoices/InvoiceCustomize/InvoicePaperTemplate';
|
||||
|
||||
export function PaymentInvoicePreviewContent() {
|
||||
return (
|
||||
<>
|
||||
<DrawerHeaderContent title={'Invoice'} />
|
||||
|
||||
<DrawerBody>
|
||||
<Box style={{ paddingTop: 20, paddingBottom: 20 }}>
|
||||
<InvoicePaperTemplate />
|
||||
</Box>
|
||||
</DrawerBody>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import * as R from 'ramda';
|
||||
import { Drawer, DrawerSuspense } from '@/components';
|
||||
import withDrawers from '@/containers/Drawer/withDrawers';
|
||||
import { PaymentInvoicePreviewContent } from './PaymentInvoicePreviewContent';
|
||||
import { Position } from '@blueprintjs/core';
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {React.ReactNode}
|
||||
*/
|
||||
function PaymentInvoicePreviewDrawerRoot({
|
||||
name,
|
||||
// #withDrawer
|
||||
isOpen,
|
||||
payload,
|
||||
}) {
|
||||
return (
|
||||
<Drawer
|
||||
isOpen={isOpen}
|
||||
name={name}
|
||||
size={'100%'}
|
||||
style={{ background: '#F6F7F9' }}
|
||||
position={Position.TOP}
|
||||
payload={payload}
|
||||
>
|
||||
<DrawerSuspense>
|
||||
<PaymentInvoicePreviewContent />
|
||||
</DrawerSuspense>
|
||||
</Drawer>
|
||||
);
|
||||
}
|
||||
|
||||
export const PaymentInvoicePreviewDrawer = R.compose(withDrawers())(
|
||||
PaymentInvoicePreviewDrawerRoot,
|
||||
);
|
||||
Reference in New Issue
Block a user