From 32b378e74e25806143b598c8f7d1c2896563d7c5 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Mon, 8 Mar 2021 14:17:08 +0200 Subject: [PATCH] feat:(*): add currency code. --- .../containers/Customers/CustomersLanding/components.js | 4 ++-- .../src/containers/Drawers/PaperTemplate/PaperTemplate.js | 5 ++++- .../Drawers/PaperTemplate/PaperTemplateHeader.js | 3 ++- .../Drawers/PaperTemplate/PaperTemplateTable.js | 8 +++++--- .../Drawers/PaymentPaperTemplate/PaymentPaperTemplate.js | 5 ++++- .../PaymentPaperTemplate/PaymentPaperTemplateHeader.js | 3 ++- .../PaymentPaperTemplate/PaymentPaperTemplateTable.js | 6 +++--- client/src/containers/Drawers/components.js | 3 ++- .../src/containers/Expenses/ExpensesLanding/components.js | 2 +- .../containers/Purchases/Bills/BillsLanding/components.js | 2 +- .../Purchases/PaymentMades/PaymentsLanding/components.js | 2 +- .../Sales/Estimates/EstimatesLanding/components.js | 4 ++-- .../Sales/Invoices/InvoicesLanding/components.js | 2 +- .../Sales/PaymentReceives/PaymentsLanding/components.js | 2 +- .../Receipts/ReceiptForm/ReceiptFormFloatingActions.js | 6 +++++- .../Sales/Receipts/ReceiptsLanding/components.js | 2 +- .../src/containers/Vendors/VendorsLanding/components.js | 4 ++-- 17 files changed, 39 insertions(+), 24 deletions(-) diff --git a/client/src/containers/Customers/CustomersLanding/components.js b/client/src/containers/Customers/CustomersLanding/components.js index 1a840f762..7b824dbcf 100644 --- a/client/src/containers/Customers/CustomersLanding/components.js +++ b/client/src/containers/Customers/CustomersLanding/components.js @@ -18,7 +18,7 @@ import { useIntl } from 'react-intl'; */ export function ActionsMenu({ row: { original }, - payload: { onEdit, onDelete ,onDuplicate }, + payload: { onEdit, onDelete, onDuplicate }, }) { const { formatMessage } = useIntl(); @@ -86,7 +86,7 @@ export function PhoneNumberAccessor(row) { * Balance accessor. */ export function BalanceAccessor(row) { - return ; + return ; } /** diff --git a/client/src/containers/Drawers/PaperTemplate/PaperTemplate.js b/client/src/containers/Drawers/PaperTemplate/PaperTemplate.js index 1fabbd95f..cb368f254 100644 --- a/client/src/containers/Drawers/PaperTemplate/PaperTemplate.js +++ b/client/src/containers/Drawers/PaperTemplate/PaperTemplate.js @@ -35,7 +35,10 @@ function PaperTemplate({ labels: propLabels, paperData, entries }) { defaultLabels={labels} headerData={defaultValues} /> - + diff --git a/client/src/containers/Drawers/PaperTemplate/PaperTemplateHeader.js b/client/src/containers/Drawers/PaperTemplate/PaperTemplateHeader.js index 4518e4cac..822e3f61e 100644 --- a/client/src/containers/Drawers/PaperTemplate/PaperTemplateHeader.js +++ b/client/src/containers/Drawers/PaperTemplate/PaperTemplateHeader.js @@ -3,7 +3,7 @@ import { TemplateHeader, TemplateContent } from '../components'; export default function PaperTemplateHeader({ defaultLabels, - headerData: { referenceNo, amount, dueDate, date, billedTo }, + headerData: { referenceNo, amount, dueDate, date, billedTo, currency_code }, }) { return ( <> @@ -16,6 +16,7 @@ export default function PaperTemplateHeader({ amount={amount} billedFrom={''} dueDate={dueDate} + currencyCode={currency_code} /> ); diff --git a/client/src/containers/Drawers/PaperTemplate/PaperTemplateTable.js b/client/src/containers/Drawers/PaperTemplate/PaperTemplateTable.js index 2a88915bc..db7a5cbed 100644 --- a/client/src/containers/Drawers/PaperTemplate/PaperTemplateTable.js +++ b/client/src/containers/Drawers/PaperTemplate/PaperTemplateTable.js @@ -2,7 +2,7 @@ import React, { useMemo } from 'react'; import { formatMessage } from 'services/intl'; import { DataTable, Money } from 'components'; -export default function DrawerTemplateTable({ tableData }) { +export default function DrawerTemplateTable({ tableData, currencyCode }) { const columns = useMemo( () => [ { @@ -14,7 +14,7 @@ export default function DrawerTemplateTable({ tableData }) { { Header: formatMessage({ id: 'rate' }), accessor: 'rate', - accessor: ({ rate }) => , + accessor: ({ rate }) => , disableSortBy: true, width: 50, }, @@ -26,7 +26,9 @@ export default function DrawerTemplateTable({ tableData }) { }, { Header: formatMessage({ id: 'Total' }), - accessor: ({ total }) => , + accessor: ({ total }) => ( + + ), disableSortBy: true, width: 50, }, diff --git a/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplate.js b/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplate.js index 5d06d38ef..fef1b05b5 100644 --- a/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplate.js +++ b/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplate.js @@ -36,7 +36,10 @@ export default function PaymentPaperTemplate({ defaultLabels={labels} headerData={defaultValues} /> - + ))} diff --git a/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateHeader.js b/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateHeader.js index 0d73ac8ec..448bb7dcc 100644 --- a/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateHeader.js +++ b/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateHeader.js @@ -3,7 +3,7 @@ import { TemplateHeader, TemplateContent } from '../components'; export default function PaymentPaperTemplateHeader({ defaultLabels, - headerData: { referenceNo, amount, date, billedTo }, + headerData: { referenceNo, amount, date, billedTo, currency_code }, }) { return ( <> @@ -15,6 +15,7 @@ export default function PaymentPaperTemplateHeader({ referenceNo={referenceNo} amount={amount} billedFrom={''} + currency={currency_code} /> ); diff --git a/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateTable.js b/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateTable.js index f799eb72b..bb45eb1c6 100644 --- a/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateTable.js +++ b/client/src/containers/Drawers/PaymentPaperTemplate/PaymentPaperTemplateTable.js @@ -3,7 +3,7 @@ import moment from 'moment'; import { formatMessage } from 'services/intl'; import { DataTable, Money } from 'components'; -export default function PaymentPaperTemplateTable({ tableData }) { +export default function PaymentPaperTemplateTable({ tableData, currencyCode }) { const columns = React.useMemo( () => [ { @@ -20,14 +20,14 @@ export default function PaymentPaperTemplateTable({ tableData }) { { Header: formatMessage({ id: 'invoice_amount' }), accessor: ({ invoice }) => ( - + ), disableSortBy: true, }, { Header: formatMessage({ id: 'payment_amount' }), accessor: ({ payment_amount }) => ( - + ), disableSortBy: true, }, diff --git a/client/src/containers/Drawers/components.js b/client/src/containers/Drawers/components.js index 83c759a66..1d13e2ff8 100644 --- a/client/src/containers/Drawers/components.js +++ b/client/src/containers/Drawers/components.js @@ -20,6 +20,7 @@ export const TemplateContent = ({ amount, billedFrom, dueDate, + currencyCode, }) => (
@@ -37,7 +38,7 @@ export const TemplateContent = ({
{defaultLabels.amount}

- {} + {}

diff --git a/client/src/containers/Expenses/ExpensesLanding/components.js b/client/src/containers/Expenses/ExpensesLanding/components.js index e60f9f70f..ac751cb09 100644 --- a/client/src/containers/Expenses/ExpensesLanding/components.js +++ b/client/src/containers/Expenses/ExpensesLanding/components.js @@ -89,7 +89,7 @@ export function ActionsCell(props) { * Total amount accessor. */ export function TotalAmountAccessor(row) { - return ; + return ; } /** diff --git a/client/src/containers/Purchases/Bills/BillsLanding/components.js b/client/src/containers/Purchases/Bills/BillsLanding/components.js index 51d04bc78..0aa2d04a0 100644 --- a/client/src/containers/Purchases/Bills/BillsLanding/components.js +++ b/client/src/containers/Purchases/Bills/BillsLanding/components.js @@ -58,7 +58,7 @@ export function ActionsMenu({ */ export function AmountAccessor(bill) { return !isBlank(bill.amount) ? ( - + ) : ( '' ); diff --git a/client/src/containers/Purchases/PaymentMades/PaymentsLanding/components.js b/client/src/containers/Purchases/PaymentMades/PaymentsLanding/components.js index 6db431183..8cc12346e 100644 --- a/client/src/containers/Purchases/PaymentMades/PaymentsLanding/components.js +++ b/client/src/containers/Purchases/PaymentMades/PaymentsLanding/components.js @@ -18,7 +18,7 @@ export function DateCell({ value }) { } export function AmountAccessor(row) { - return + return ; } /** diff --git a/client/src/containers/Sales/Estimates/EstimatesLanding/components.js b/client/src/containers/Sales/Estimates/EstimatesLanding/components.js index e37175482..b8c49f4e6 100644 --- a/client/src/containers/Sales/Estimates/EstimatesLanding/components.js +++ b/client/src/containers/Sales/Estimates/EstimatesLanding/components.js @@ -132,8 +132,8 @@ function DateCell({ value }) { return moment(value).format('YYYY MMM DD'); } -function AmountAccessor(row) { - return ; +function AmountAccessor({ amount, currency_code }) { + return ; } function ActionsCell(props) { diff --git a/client/src/containers/Sales/Invoices/InvoicesLanding/components.js b/client/src/containers/Sales/Invoices/InvoicesLanding/components.js index fb880bca0..470f717ea 100644 --- a/client/src/containers/Sales/Invoices/InvoicesLanding/components.js +++ b/client/src/containers/Sales/Invoices/InvoicesLanding/components.js @@ -180,7 +180,7 @@ export function useInvoicesTableColumns() { { id: 'balance', Header: formatMessage({ id: 'balance' }), - accessor: (r) => , + accessor: (r) => , width: 110, className: 'balance', }, diff --git a/client/src/containers/Sales/PaymentReceives/PaymentsLanding/components.js b/client/src/containers/Sales/PaymentReceives/PaymentsLanding/components.js index 189fb3548..9a09e90f1 100644 --- a/client/src/containers/Sales/PaymentReceives/PaymentsLanding/components.js +++ b/client/src/containers/Sales/PaymentReceives/PaymentsLanding/components.js @@ -53,7 +53,7 @@ export function ActionsMenu({ * Amount accessor. */ export function AmountAccessor(row) { - return ; + return ; } /** diff --git a/client/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormFloatingActions.js b/client/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormFloatingActions.js index b2a36f445..18283bb4e 100644 --- a/client/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormFloatingActions.js +++ b/client/src/containers/Sales/Receipts/ReceiptForm/ReceiptFormFloatingActions.js @@ -11,6 +11,7 @@ import { } from '@blueprintjs/core'; import { FormattedMessage as T } from 'react-intl'; import { useFormikContext } from 'formik'; +import { useHistory } from 'react-router-dom'; import classNames from 'classnames'; import { CLASSES } from 'common/classes'; import { If, Icon } from 'components'; @@ -20,6 +21,9 @@ import { useReceiptFormContext } from './ReceiptFormProvider'; * Receipt floating actions bar. */ export default function ReceiptFormFloatingActions() { + // History context. + const history = useHistory(); + // Formik context. const { resetForm, submitForm, isSubmitting } = useFormikContext(); @@ -63,7 +67,7 @@ export default function ReceiptFormFloatingActions() { // Handle cancel button click. const handleCancelBtnClick = (event) => { - + history.goBack(); }; const handleClearBtnClick = (event) => { diff --git a/client/src/containers/Sales/Receipts/ReceiptsLanding/components.js b/client/src/containers/Sales/Receipts/ReceiptsLanding/components.js index 7527fd9e5..de9aa78d6 100644 --- a/client/src/containers/Sales/Receipts/ReceiptsLanding/components.js +++ b/client/src/containers/Sales/Receipts/ReceiptsLanding/components.js @@ -128,7 +128,7 @@ export function useReceiptsTableColumns() { { id: 'amount', Header: formatMessage({ id: 'amount' }), - accessor: (r) => , + accessor: (r) => , width: 140, className: 'amount', }, diff --git a/client/src/containers/Vendors/VendorsLanding/components.js b/client/src/containers/Vendors/VendorsLanding/components.js index a737ba63c..15ad5dc36 100644 --- a/client/src/containers/Vendors/VendorsLanding/components.js +++ b/client/src/containers/Vendors/VendorsLanding/components.js @@ -84,8 +84,8 @@ export function PhoneNumberAccessor(row) { /** * Balance accessor. */ -export function BalanceAccessor(row) { - return ; +export function BalanceAccessor({ closing_balance, currency_code }) { + return ; } /**