forked from bigcapitalhq/bigcapital
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into add-pdf-templates-package
- Loading branch information
Showing
24 changed files
with
318 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
...c/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceMailReceiptPreviewConnected..tsx
This file was deleted.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...rc/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceMailReceiptPreviewConnected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { useMemo, ComponentType } from 'react'; | ||
import { css } from '@emotion/css'; | ||
import { Box } from '@/components'; | ||
import { | ||
InvoiceMailReceiptPreview, | ||
InvoiceMailReceiptPreviewProps, | ||
} from '../InvoiceCustomize/InvoiceMailReceiptPreview'; | ||
import { useInvoiceSendMailBoot } from './InvoiceSendMailContentBoot'; | ||
import { InvoiceSendMailPreviewWithHeader } from './InvoiceSendMailHeaderPreview'; | ||
import { useSendInvoiceMailMessage } from './_hooks'; | ||
|
||
export function InvoiceMailReceiptPreviewConnected() { | ||
return ( | ||
<InvoiceSendMailPreviewWithHeader> | ||
<Box px={4} pt={8} pb={16}> | ||
<InvoiceMailReceiptPreviewWithProps | ||
className={css` | ||
margin: 0 auto; | ||
`} | ||
/> | ||
</Box> | ||
</InvoiceSendMailPreviewWithHeader> | ||
); | ||
} | ||
|
||
/** | ||
* Injects props from invoice mail state into the InvoiceMailReceiptPreview component. | ||
*/ | ||
const withInvoiceMailReceiptPreviewProps = < | ||
P extends InvoiceMailReceiptPreviewProps, | ||
>( | ||
WrappedComponent: ComponentType<P & InvoiceMailReceiptPreviewProps>, | ||
) => { | ||
return function WithInvoiceMailReceiptPreviewProps(props: P) { | ||
const message = useSendInvoiceMailMessage(); | ||
const { invoiceMailState } = useInvoiceSendMailBoot(); | ||
|
||
const items = useMemo( | ||
() => | ||
invoiceMailState?.entries?.map((entry: any) => ({ | ||
quantity: entry.quantity, | ||
total: entry.totalFormatted, | ||
label: entry.name, | ||
})), | ||
[invoiceMailState?.entries], | ||
); | ||
|
||
const mailReceiptPreviewProps = { | ||
companyName: invoiceMailState?.companyName, | ||
companyLogoUri: invoiceMailState?.companyLogoUri, | ||
primaryColor: invoiceMailState?.primaryColor, | ||
total: invoiceMailState?.totalFormatted, | ||
dueDate: invoiceMailState?.dueDateFormatted, | ||
dueAmount: invoiceMailState?.dueAmountFormatted, | ||
invoiceNumber: invoiceMailState?.invoiceNo, | ||
items, | ||
message, | ||
}; | ||
return <WrappedComponent {...mailReceiptPreviewProps} {...props} />; | ||
}; | ||
}; | ||
|
||
export const InvoiceMailReceiptPreviewWithProps = | ||
withInvoiceMailReceiptPreviewProps(InvoiceMailReceiptPreview); |
1 change: 0 additions & 1 deletion
1
...webapp/src/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceSendMailContentBoot.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.