-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
379 additions
and
30 deletions.
There are no files selected for viewing
5 changes: 4 additions & 1 deletion
5
.../webapp/src/containers/Sales/Estimates/EstimateSendMailDrawer/EstimateSendMailReceipt.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
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
1 change: 0 additions & 1 deletion
1
...pp/src/containers/Sales/Invoices/InvoiceSendMailDrawer/InvoiceSendPdfPreviewConnected.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
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
71 changes: 69 additions & 2 deletions
71
.../webapp/src/containers/Sales/Receipts/ReceiptSendMailDrawer/ReceiptSendMailFormFields.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 |
---|---|---|
@@ -1,6 +1,73 @@ | ||
import { FCheckbox, FFormGroup, FInputGroup, Group, Stack } from "@/components"; | ||
import { SendMailViewToAddressField } from "../../Estimates/SendMailViewDrawer/SendMailViewToAddressField"; | ||
import { SendMailViewMessageField } from "../../Estimates/SendMailViewDrawer/SendMailViewMessageField"; | ||
import { Button, Intent } from "@blueprintjs/core"; | ||
import { useDrawerActions } from "@/hooks/state"; | ||
import { useDrawerContext } from "@/components/Drawer/DrawerProvider"; | ||
import { useFormikContext } from "formik"; | ||
|
||
|
||
const items: Array<any> = []; | ||
const argsOptions: Array<any> = []; | ||
|
||
export function ReceiptSendMailFormFields() { | ||
return null; | ||
return ( | ||
<Stack> | ||
<Stack spacing={0} overflow="auto" flex="1" p={'30px'}> | ||
<SendMailViewToAddressField | ||
toMultiSelectProps={{ items }} | ||
ccMultiSelectProps={{ items }} | ||
bccMultiSelectProps={{ items }} | ||
/> | ||
<FFormGroup label={'Submit'} name={'subject'}> | ||
<FInputGroup name={'subject'} large fastField /> | ||
</FFormGroup> | ||
|
||
<SendMailViewMessageField argsOptions={argsOptions} /> | ||
|
||
<Group> | ||
<FCheckbox name={'attachPdf'} label={'Attach PDF'} /> | ||
</Group> | ||
</Stack> | ||
|
||
<ReceiptSendMailFooter /> | ||
</Stack> | ||
); | ||
} | ||
|
||
function ReceiptSendMailFooter() { | ||
const { isSubmitting } = useFormikContext(); | ||
const { name } = useDrawerContext(); | ||
const { closeDrawer } = useDrawerActions(); | ||
|
||
const handleClose = () => { | ||
closeDrawer(name); | ||
}; | ||
|
||
return ( | ||
<Group | ||
py={'12px'} | ||
px={'16px'} | ||
borderTop="1px solid #d8d8d9" | ||
position={'apart'} | ||
> | ||
<Group spacing={10} ml={'auto'}> | ||
<Button | ||
disabled={isSubmitting} | ||
onClick={handleClose} | ||
style={{ minWidth: '65px' }} | ||
> | ||
Close | ||
</Button> | ||
|
||
<Button | ||
intent={Intent.PRIMARY} | ||
loading={isSubmitting} | ||
style={{ minWidth: '85px' }} | ||
type="submit" | ||
> | ||
Send Mail | ||
</Button> | ||
</Group> | ||
</Group> | ||
); | ||
} |
32 changes: 32 additions & 0 deletions
32
.../webapp/src/containers/Sales/Receipts/ReceiptSendMailDrawer/ReceiptSendMailPdfPreview.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,32 @@ | ||
import { Stack } from '@/components'; | ||
import { ReceiptSendMailPreviewHeader } from './ReceiptSendMailPreviewHeader'; | ||
import { useDrawerContext } from '@/components/Drawer/DrawerProvider'; | ||
import { useGetSaleReceiptHtml } from '@/hooks/query'; | ||
import { Spinner } from '@blueprintjs/core'; | ||
import { SendMailViewPreviewPdfIframe } from '../../Estimates/SendMailViewDrawer/SendMailViewPreviewPdfIframe'; | ||
|
||
export function ReceiptSendMailPdfPreview() { | ||
return ( | ||
<Stack> | ||
<ReceiptSendMailPreviewHeader /> | ||
|
||
<Stack px={4} py={6}> | ||
<ReceiptSendPdfPreviewIframe /> | ||
</Stack> | ||
</Stack> | ||
); | ||
} | ||
|
||
function ReceiptSendPdfPreviewIframe() { | ||
const { payload } = useDrawerContext(); | ||
const { data, isLoading } = useGetSaleReceiptHtml(payload?.receiptId); | ||
|
||
if (isLoading && data) { | ||
return <Spinner size={20} />; | ||
} | ||
const iframeSrcDoc = data?.htmlContent; | ||
|
||
console.log(data, 'data'); | ||
|
||
return <SendMailViewPreviewPdfIframe srcDoc={iframeSrcDoc} />; | ||
} |
40 changes: 40 additions & 0 deletions
40
...ges/webapp/src/containers/Sales/Receipts/ReceiptSendMailDrawer/ReceiptSendMailPreview.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,40 @@ | ||
import { Stack } from '@/components'; | ||
import { ReceiptSendMailPreviewHeader } from './ReceiptSendMailPreviewHeader'; | ||
import { ReceiptSendMailReceipt } from './ReceiptSendMailReceipt'; | ||
import { css } from '@emotion/css'; | ||
|
||
const defaultReceiptMailProps = { | ||
companyLogoUri: 'https://via.placeholder.com/150', | ||
companyName: 'Company Name', | ||
receiptNumber: '1234', | ||
total: '1000', | ||
message: 'Thank you for your business!', | ||
items: [ | ||
{ label: 'Item 1', quantity: 1, total: '500' }, | ||
{ label: 'Item 2', quantity: 2, total: '500' }, | ||
], | ||
subtotal: '1000', | ||
showViewReceiptButton: true, | ||
viewReceiptButtonLabel: 'View Receipt', | ||
}; | ||
|
||
export function ReceiptSendMailPreview() { | ||
return ( | ||
<Stack> | ||
<ReceiptSendMailPreviewHeader /> | ||
|
||
<Stack px={4} py={6}> | ||
<ReceiptSendMailReceipt | ||
{...defaultReceiptMailProps} | ||
className={css` | ||
margin: 0 auto; | ||
border-radius: 5px !important; | ||
transform: scale(0.9); | ||
transform-origin: top; | ||
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05) !important; | ||
`} | ||
/> | ||
</Stack> | ||
</Stack> | ||
); | ||
} |
13 changes: 13 additions & 0 deletions
13
...bapp/src/containers/Sales/Receipts/ReceiptSendMailDrawer/ReceiptSendMailPreviewHeader.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,13 @@ | ||
import { SendViewPreviewHeader } from '../../Estimates/SendMailViewDrawer/SendMailViewPreviewHeader'; | ||
|
||
export function ReceiptSendMailPreviewHeader() { | ||
return ( | ||
<SendViewPreviewHeader | ||
companyName="A" | ||
customerName="A" | ||
subject={'adsfsdf'} | ||
from={['[email protected]']} | ||
to={['[email protected]']} | ||
/> | ||
); | ||
} |
29 changes: 28 additions & 1 deletion
29
...webapp/src/containers/Sales/Receipts/ReceiptSendMailDrawer/ReceiptSendMailPreviewTabs.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 |
---|---|---|
@@ -1,3 +1,30 @@ | ||
import { Suspense } from 'react'; | ||
import { Tab } from '@blueprintjs/core'; | ||
import { SendMailViewPreviewTabs } from '../../Estimates/SendMailViewDrawer/SendMailViewPreviewTabs'; | ||
import { ReceiptSendMailPreview } from './ReceiptSendMailPreview'; | ||
import { ReceiptSendMailPdfPreview } from './ReceiptSendMailPdfPreview'; | ||
|
||
export function ReceiptSendMailPreviewTabs() { | ||
return null; | ||
return ( | ||
<SendMailViewPreviewTabs> | ||
<Tab | ||
id={'payment-page'} | ||
title={'Payment page'} | ||
panel={ | ||
<Suspense> | ||
<ReceiptSendMailPreview /> | ||
</Suspense> | ||
} | ||
/> | ||
<Tab | ||
id="pdf-document" | ||
title={'PDF document'} | ||
panel={ | ||
<Suspense> | ||
<ReceiptSendMailPdfPreview /> | ||
</Suspense> | ||
} | ||
/> | ||
</SendMailViewPreviewTabs> | ||
); | ||
} |
Oops, something went wrong.