diff --git a/src/common/itemPaymentTranactionsOption.js b/src/common/itemPaymentTranactionsOption.js new file mode 100644 index 000000000..1df2bb456 --- /dev/null +++ b/src/common/itemPaymentTranactionsOption.js @@ -0,0 +1,8 @@ +import intl from 'react-intl-universal'; + +export default [ + { name: 'invoices', label: intl.get('invoices') }, + { name: 'estimates', label: intl.get('estimates') }, + { name: 'receipts', label: intl.get('receipts') }, + { name: 'bills', label: intl.get('bills') }, +]; diff --git a/src/containers/Accounting/MakeJournal/MakeJournalProvider.js b/src/containers/Accounting/MakeJournal/MakeJournalProvider.js index 2241ff28c..e382c1661 100644 --- a/src/containers/Accounting/MakeJournal/MakeJournalProvider.js +++ b/src/containers/Accounting/MakeJournal/MakeJournalProvider.js @@ -7,7 +7,8 @@ import { useJournal, useCreateJournal, useEditJournal, - useSettings + useSettings, + useSettingsManualJournals } from 'hooks/query'; const MakeJournalFormContext = createContext(); @@ -40,7 +41,7 @@ function MakeJournalProvider({ journalId, ...props }) { const { mutateAsync: editJournalMutate } = useEditJournal(); // Loading the journal settings. - const { isLoading: isSettingsLoading } = useSettings(); + const { isLoading: isSettingsLoading } = useSettingsManualJournals(); // Submit form payload. const [submitPayload, setSubmitPayload] = useState({}); diff --git a/src/containers/Drawers/BillDrawer/BillDrawerDetails.js b/src/containers/Drawers/BillDrawer/BillDrawerDetails.js index 0385670a4..987cd77fb 100644 --- a/src/containers/Drawers/BillDrawer/BillDrawerDetails.js +++ b/src/containers/Drawers/BillDrawer/BillDrawerDetails.js @@ -19,12 +19,14 @@ import BillDrawerCls from 'style/components/Drawers/BillDrawer.module.scss'; export default function BillDrawerDetails() { const { data: { transactions }, - billId, } = useBillDrawerContext(); return (
- + } + panel={} /> { + openAlert('bill-delete', { + billId: bill_id, + }); + }; + + // Handles edit bill payment transactions. + const handleEditBillPaymentTransactions = ({ bill_id }) => { + history.push(`/bills/${bill_id}/edit`); + closeDrawer('bill-drawer'); + }; + return ( ); } + +export default compose( + withAlertsActions, + withDrawerActions, +)(BillPaymentTransactionTable); diff --git a/src/containers/Drawers/BillDrawer/BillPaymentTransactions/components.js b/src/containers/Drawers/BillDrawer/BillPaymentTransactions/components.js index cd8ba435e..b62afa494 100644 --- a/src/containers/Drawers/BillDrawer/BillPaymentTransactions/components.js +++ b/src/containers/Drawers/BillDrawer/BillPaymentTransactions/components.js @@ -1,9 +1,34 @@ import React from 'react'; import intl from 'react-intl-universal'; - +import { Intent, Menu, MenuItem } from '@blueprintjs/core'; import clsx from 'classnames'; import { CLASSES } from '../../../../common/classes'; -import { FormatDateCell } from '../../../../components'; +import { FormatDateCell, Icon } from '../../../../components'; +import { safeCallback } from 'utils'; + +/** + * Table actions menu. + */ +export function ActionsMenu({ + row: { original }, + payload: { onEdit, onDelete }, +}) { + return ( + + } + text={intl.get('invoice_transactions.action.edit_transaction')} + onClick={safeCallback(onEdit, original)} + /> + } + /> + + ); +} /** * Retrieve bill payment transactions table columns. diff --git a/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.js b/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.js index 5830a0166..32c01de71 100644 --- a/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.js +++ b/src/containers/Drawers/BillDrawer/LocatedLandedCostTable.js @@ -1,5 +1,5 @@ import React from 'react'; -import { DataTable, Card } from 'components'; +import { DataTable, Card, FormattedMessage as T } from 'components'; import { Button, Classes, NavbarGroup } from '@blueprintjs/core'; import { useLocatedLandedCostColumns, ActionsMenu } from './components'; @@ -31,16 +31,16 @@ function LocatedLandedCostTable({ const columns = useLocatedLandedCostColumns(); const { transactions, billId } = useBillDrawerContext(); - // Handle the transaction delete action. - const handleDeleteTransaction = ({ id }) => { - openAlert('bill-located-cost-delete', { BillId: id }); - }; - // Handle allocate landed cost button click. const handleAllocateCostClick = () => { openDialog('allocate-landed-cost', { billId }); }; + // Handle the transaction delete action. + const handleDeleteTransaction = ({ id }) => { + openAlert('bill-located-cost-delete', { BillId: id }); + }; + // Handle from transaction link click. const handleFromTransactionClick = (original) => { const { from_transaction_type, from_transaction_id } = original; @@ -64,7 +64,7 @@ function LocatedLandedCostTable({