diff --git a/src/components/Dashboard/GlobalHotkeys.js b/src/components/Dashboard/GlobalHotkeys.js index 3ca7a2b0b..2bf734b9e 100644 --- a/src/components/Dashboard/GlobalHotkeys.js +++ b/src/components/Dashboard/GlobalHotkeys.js @@ -3,11 +3,16 @@ import { useHotkeys } from 'react-hotkeys-hook'; import { useHistory } from 'react-router-dom'; import { getDashboardRoutes } from 'routes/dashboard'; import withDashboardActions from 'containers/Dashboard/withDashboardActions'; +import withDialogActions from 'containers/Dialog/withDialogActions'; + import { compose } from 'utils'; function GlobalHotkeys({ // #withDashboardActions toggleSidebarExpend, + + // #withDialogActions + openDialog, }) { const history = useHistory(); const routes = getDashboardRoutes(); @@ -16,8 +21,8 @@ function GlobalHotkeys({ .filter(({ hotkey }) => hotkey) .map(({ hotkey }) => hotkey) .toString(); - - const handleSidebarToggleBtn = () => { + + const handleSidebarToggleBtn = () => { toggleSidebarExpend(); }; useHotkeys( @@ -32,7 +37,9 @@ function GlobalHotkeys({ [history], ); useHotkeys('ctrl+/', (event, handle) => handleSidebarToggleBtn()); + useHotkeys('shift+q', (event, handle) => openDialog('money-in', {})); + useHotkeys('shift+d', (event, handle) => openDialog('money-out', {})); return
; } -export default compose(withDashboardActions)(GlobalHotkeys); +export default compose(withDashboardActions, withDialogActions)(GlobalHotkeys); diff --git a/src/containers/Dialogs/MoneyInDialog/MoneyInFormFields.js b/src/containers/Dialogs/MoneyInDialog/MoneyInFormFields.js index 1900e2479..08fcab957 100644 --- a/src/containers/Dialogs/MoneyInDialog/MoneyInFormFields.js +++ b/src/containers/Dialogs/MoneyInDialog/MoneyInFormFields.js @@ -1,4 +1,5 @@ import React from 'react'; +import { useFormikContext } from 'formik'; import { Classes } from '@blueprintjs/core'; import { If } from 'components'; @@ -11,15 +12,17 @@ import { useMoneyInDailogContext } from './MoneyInDialogProvider'; * Money in form fields. */ function MoneyInFormFields() { + const { values } = useFormikContext(); + // Money in dialog context. - const { accountId, accountType } = useMoneyInDailogContext(); + const { accountId } = useMoneyInDailogContext(); return (
- +
); } diff --git a/src/containers/Dialogs/MoneyInDialog/TransactionTypeFields.js b/src/containers/Dialogs/MoneyInDialog/TransactionTypeFields.js index 1a62527b3..ecc3b0bb0 100644 --- a/src/containers/Dialogs/MoneyInDialog/TransactionTypeFields.js +++ b/src/containers/Dialogs/MoneyInDialog/TransactionTypeFields.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FastField, ErrorMessage } from 'formik'; +import { FastField, Field, ErrorMessage } from 'formik'; import { Classes, FormGroup } from '@blueprintjs/core'; import classNames from 'classnames'; import { @@ -32,7 +32,7 @@ export default function TransactionTypeFields() { {({ form, field: { value }, meta: { error, touched } }) => ( } labelInfo={} intent={inputIntent({ error, touched })} helperText={} @@ -57,7 +57,7 @@ export default function TransactionTypeFields() { {/*------------ Transaction type -----------*/} - + {({ form: { values, setFieldValue }, field: { value }, @@ -86,7 +86,7 @@ export default function TransactionTypeFields() { /> )} - + diff --git a/src/containers/Dialogs/MoneyInDialog/index.js b/src/containers/Dialogs/MoneyInDialog/index.js index e44241225..d5098a413 100644 --- a/src/containers/Dialogs/MoneyInDialog/index.js +++ b/src/containers/Dialogs/MoneyInDialog/index.js @@ -2,6 +2,7 @@ import React from 'react'; import intl from 'react-intl-universal'; import { Dialog, DialogSuspense } from 'components'; import withDialogRedux from 'components/DialogReduxConnect'; + import { compose } from 'redux'; const MoneyInDialogContent = React.lazy(() => import('./MoneyInDialogContent')); @@ -14,6 +15,7 @@ function MoneyInDialog({ payload = { account_type: null, account_id: null }, isOpen, }) { + return ( - + ); } diff --git a/src/containers/Dialogs/MoneyOutDialog/TransactionTypeFields.js b/src/containers/Dialogs/MoneyOutDialog/TransactionTypeFields.js index d18c9abab..e00d7e512 100644 --- a/src/containers/Dialogs/MoneyOutDialog/TransactionTypeFields.js +++ b/src/containers/Dialogs/MoneyOutDialog/TransactionTypeFields.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FastField, ErrorMessage } from 'formik'; +import { FastField, Field, ErrorMessage } from 'formik'; import { FormGroup } from '@blueprintjs/core'; import classNames from 'classnames'; import { @@ -32,7 +32,7 @@ function TransactionTypeFields() { {({ form, field: { value }, meta: { error, touched } }) => ( } labelInfo={} intent={inputIntent({ error, touched })} helperText={} @@ -57,7 +57,7 @@ function TransactionTypeFields() { {/*------------ Transaction type -----------*/} - + {({ form: { values, setFieldValue }, field: { value }, @@ -86,7 +86,7 @@ function TransactionTypeFields() { /> )} - + diff --git a/src/lang/en/index.json b/src/lang/en/index.json index 2fd1e385a..41a8cc2b6 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1388,7 +1388,8 @@ "cash_flow_transaction.other_expense_account":"Other expense account", "save_and_publish": "Save & Publish", "cash_flow_transaction.label_transfer_from_account":"Transfer from account", - "cash_flow_transaction.label_transfer_to_account":"Transfer to account" + "cash_flow_transaction.label_transfer_to_account":"Transfer to account", + "cash_flow_transaction.label_current_account":"Current account" }