diff --git a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js index 3a5aecb96..0db244234 100644 --- a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js +++ b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js @@ -27,6 +27,7 @@ import { PaymentMadeAction, AbilitySubject, } from '../../../common/abilityOption'; +import { BillMenuItem } from './utils'; import { safeCallback, compose } from 'utils'; @@ -50,6 +51,14 @@ function BillDetailActionsBar({ closeDrawer('bill-drawer'); }; + // Handle convert to vendor credit. + const handleConvertToVendorCredit = () => { + history.push(`/vendor-credits/new?from_bill_id=${billId}`, { + billId: billId, + }); + closeDrawer('bill-drawer'); + }; + // Handle delete bill. const onDeleteBill = () => { openAlert('bill-delete', { billId }); @@ -92,6 +101,14 @@ function BillDetailActionsBar({ onClick={safeCallback(onDeleteBill)} /> + + + + ); diff --git a/src/containers/Drawers/BillDrawer/BillDetailFooter.js b/src/containers/Drawers/BillDrawer/BillDetailFooter.js index 43b7bebde..c5d411cb1 100644 --- a/src/containers/Drawers/BillDrawer/BillDetailFooter.js +++ b/src/containers/Drawers/BillDrawer/BillDetailFooter.js @@ -1,51 +1,27 @@ import React from 'react'; -import styled from 'styled-components'; - import { - TotalLineBorderStyle, - TotalLineTextStyle, - FormatNumber, + CommercialDocFooter, T, - TotalLines, - TotalLine, -} from '../../../components'; + If, + DetailsMenu, + DetailItem, +} from 'components'; + import { useBillDrawerContext } from './BillDrawerProvider'; /** - * Bill read-only details footer. + * Bill detail footer. + * @returns {React.JSX} */ -export function BillDetailFooter() { +export default function BillDetailFooter() { const { bill } = useBillDrawerContext(); - return ( - - - } - value={} - borderStyle={TotalLineBorderStyle.SingleDark} - /> - } - value={bill.formatted_amount} - borderStyle={TotalLineBorderStyle.DoubleDark} - textStyle={TotalLineTextStyle.Bold} - /> - } - value={bill.formatted_payment_amount} - /> - } - value={bill.formatted_due_amount} - /> - - + + + + }>{bill.note} + + + ); } - -export const BillDetailsFooterRoot = styled.div``; - -export const BillTotalLines = styled(TotalLines)` - margin-left: auto; -`; diff --git a/src/containers/Drawers/BillDrawer/BillDetailTab.js b/src/containers/Drawers/BillDrawer/BillDetailTab.js index 86fcd6571..fd238d216 100644 --- a/src/containers/Drawers/BillDrawer/BillDetailTab.js +++ b/src/containers/Drawers/BillDrawer/BillDetailTab.js @@ -4,8 +4,8 @@ import { CommercialDocBox } from 'components'; import BillDetailHeader from './BillDetailHeader'; import BillDetailTable from './BillDetailTable'; -import { BillDetailFooter } from './BillDetailFooter'; - +import { BillDetailTableFooter } from './BillDetailTableFooter'; +import BillDetailFooter from './BillDetailFooter'; /** * Bill detail panel tab. @@ -15,6 +15,7 @@ export default function BillDetailTab() { + ); diff --git a/src/containers/Drawers/BillDrawer/BillDetailTableFooter.js b/src/containers/Drawers/BillDrawer/BillDetailTableFooter.js new file mode 100644 index 000000000..d55edc514 --- /dev/null +++ b/src/containers/Drawers/BillDrawer/BillDetailTableFooter.js @@ -0,0 +1,51 @@ +import React from 'react'; +import styled from 'styled-components'; + +import { + TotalLineBorderStyle, + TotalLineTextStyle, + FormatNumber, + T, + TotalLines, + TotalLine, +} from '../../../components'; +import { useBillDrawerContext } from './BillDrawerProvider'; + +/** + * Bill read-only details table footer. + */ +export function BillDetailTableFooter() { + const { bill } = useBillDrawerContext(); + + return ( + + + } + value={} + borderStyle={TotalLineBorderStyle.SingleDark} + /> + } + value={bill.formatted_amount} + borderStyle={TotalLineBorderStyle.DoubleDark} + textStyle={TotalLineTextStyle.Bold} + /> + } + value={bill.formatted_payment_amount} + /> + } + value={bill.formatted_due_amount} + /> + + + ); +} + +export const BillDetailsFooterRoot = styled.div``; + +export const BillTotalLines = styled(TotalLines)` + margin-left: auto; +`; diff --git a/src/containers/Drawers/BillDrawer/utils.js b/src/containers/Drawers/BillDrawer/utils.js index 5f0febb19..1c3be7018 100644 --- a/src/containers/Drawers/BillDrawer/utils.js +++ b/src/containers/Drawers/BillDrawer/utils.js @@ -1,12 +1,21 @@ import React from 'react'; import intl from 'react-intl-universal'; import styled from 'styled-components'; -import { Intent, Tag } from '@blueprintjs/core'; - +import { + Button, + Popover, + PopoverInteractionKind, + Position, + MenuItem, + Menu, + Intent, + Tag, +} from '@blueprintjs/core'; import { FormatNumberCell, FormattedMessage as T, Choose, + Icon, } from '../../../components'; /** @@ -73,7 +82,7 @@ export function BillDetailsStatus({ bill }) { - Overdue + @@ -92,6 +101,29 @@ export function BillDetailsStatus({ bill }) { ); } +export const BillMenuItem = ({ payload: { onConvert } }) => { + return ( + + } + /> + + } + > +