-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #775 from alexstotsky/pdf-export4tax
(feature) Export to PDF for ledgers and tax reports
- Loading branch information
Showing
12 changed files
with
149 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import config from 'config' | ||
import queryConstants from 'state/query/constants' | ||
|
||
const { showFrameworkMode } = config | ||
|
||
const EXPORT_TO_PDF_WHITELIST = [ | ||
queryConstants.MENU_LEDGERS, | ||
queryConstants.MENU_TAX_REPORT, | ||
] | ||
|
||
export const getShowPdfSwitcher = (targets) => ( | ||
showFrameworkMode && EXPORT_TO_PDF_WHITELIST.some(target => targets.includes(target)) | ||
) |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { useCallback } from 'react' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
import { Checkbox } from '@blueprintjs/core' | ||
|
||
import { tracker } from 'utils/trackers' | ||
import { setIsPdfRequired } from 'state/query/actions' | ||
import { getIsPdfExportRequired } from 'state/query/selectors' | ||
|
||
const ExportToPdf = () => { | ||
const dispatch = useDispatch() | ||
const isPdfExportRequired = useSelector(getIsPdfExportRequired) | ||
|
||
const handleChange = useCallback(() => { | ||
tracker.trackEvent('Export as PDF') | ||
dispatch(setIsPdfRequired(!isPdfExportRequired)) | ||
}, [dispatch, tracker, isPdfExportRequired]) | ||
|
||
return ( | ||
<Checkbox | ||
large | ||
onChange={handleChange} | ||
checked={isPdfExportRequired} | ||
/> | ||
) | ||
} | ||
|
||
export default ExportToPdf |
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 @@ | ||
export { default } from './ExportToPdf' |