From 0bfed2f062d67c62c2fb3c969422a9cbe43779f3 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Mon, 4 Jan 2021 20:18:36 +0200 Subject: [PATCH 1/5] fix: invoices fully-paid. --- client/src/style/pages/invoice-form.scss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/style/pages/invoice-form.scss b/client/src/style/pages/invoice-form.scss index c7d184d65..37c176938 100644 --- a/client/src/style/pages/invoice-form.scss +++ b/client/src/style/pages/invoice-form.scss @@ -51,11 +51,13 @@ line-height: 1.5; } .fully-paid-status { + height: 19px; + width: 19px; display: inline-block; - border-radius: 50%; background: #2ba01d; - color: #ffffff; + border-radius: 50%; margin-right: 6px; + color: #ffffff; } .bp3-progress-bar { From a2a8e2227032bf1db832a753c62038f5b7ce43e1 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Fri, 8 Jan 2021 17:47:46 +0200 Subject: [PATCH 2/5] fix: close btn in invoice delete. --- client/src/containers/Sales/Invoice/InvoiceList.js | 5 +++-- client/src/lang/en/index.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/containers/Sales/Invoice/InvoiceList.js b/client/src/containers/Sales/Invoice/InvoiceList.js index 7e031be48..261f37163 100644 --- a/client/src/containers/Sales/Invoice/InvoiceList.js +++ b/client/src/containers/Sales/Invoice/InvoiceList.js @@ -97,9 +97,10 @@ function InvoiceList({ const handleConfirmInvoiceDelete = useCallback(() => { requestDeleteInvoice(deleteInvoice.id) .then(() => { + setDeleteInvoice(false); AppToaster.show({ message: formatMessage({ - id: 'the_invocie_has_been_successfully_deleted', + id: 'the_invoice_has_been_successfully_deleted', }), intent: Intent.SUCCESS, }); @@ -109,7 +110,7 @@ function InvoiceList({ setDeleteInvoice(false); }); }, [deleteInvoice, requestDeleteInvoice, formatMessage]); - + // Handle cancel/confirm invoice deliver. const handleDeliverInvoice = useCallback((invoice) => { setDeliverInvoice(invoice); diff --git a/client/src/lang/en/index.js b/client/src/lang/en/index.js index 9e241c1dc..3e9859828 100644 --- a/client/src/lang/en/index.js +++ b/client/src/lang/en/index.js @@ -635,7 +635,7 @@ export default { 'The invoice #{number} has been successfully edited.', the_invocie_has_been_successfully_created: 'The invoice #{number} has been successfully created.', - the_invocie_has_been_successfully_deleted: + the_invoice_has_been_successfully_deleted: 'The invoice has been successfully deleted.', once_delete_this_invoice_you_will_able_to_restore_it: `Once you delete this invoice, you won\'t be able to restore it later. Are you sure you want to delete this invoice?`, receipt_list: 'Receipt List', From 0b70c7ba9fac277ccf7aa3a7b0308e61a4dd0019 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Fri, 8 Jan 2021 23:57:28 +0200 Subject: [PATCH 3/5] fix: add base_currecny in manual journal. --- .../Accounting/MakeJournalEntriesForm.js | 12 +++++++----- .../MakeJournalEntriesHeaderFields.js | 17 ++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/client/src/containers/Accounting/MakeJournalEntriesForm.js b/client/src/containers/Accounting/MakeJournalEntriesForm.js index 307f21cc7..5e0faf875 100644 --- a/client/src/containers/Accounting/MakeJournalEntriesForm.js +++ b/client/src/containers/Accounting/MakeJournalEntriesForm.js @@ -3,7 +3,7 @@ import { Formik, Form } from 'formik'; import moment from 'moment'; import { Intent } from '@blueprintjs/core'; import { useIntl } from 'react-intl'; -import { pick } from 'lodash'; +import { pick, defaultTo } from 'lodash'; import classNames from 'classnames'; import { useHistory } from 'react-router-dom'; @@ -78,7 +78,7 @@ function MakeJournalEntriesForm({ // #withSettings journalNextNumber, journalNumberPrefix, - + baseCurrency, // #ownProps manualJournalId, manualJournal, @@ -126,7 +126,8 @@ function MakeJournalEntriesForm({ } : { ...defaultInitialValues, - journal_number: journalNumber, + journal_number: defaultTo(journalNumber, ''), + currency_code: defaultTo(baseCurrency, ''), entries: orderingLinesIndexes(defaultInitialValues.entries), }), }), @@ -239,7 +240,7 @@ function MakeJournalEntriesForm({ validationSchema={isNewMode ? CreateJournalSchema : EditJournalSchema} onSubmit={handleSubmit} > - {({ isSubmitting}) => ( + {({ isSubmitting }) => (
({ + withSettings(({ manualJournalsSettings, organizationSettings }) => ({ journalNextNumber: parseInt(manualJournalsSettings?.nextNumber, 10), journalNumberPrefix: manualJournalsSettings?.numberPrefix, + baseCurrency: organizationSettings?.baseCurrency, })), withManualJournalsActions, )(MakeJournalEntriesForm); diff --git a/client/src/containers/Accounting/MakeJournalEntriesHeaderFields.js b/client/src/containers/Accounting/MakeJournalEntriesHeaderFields.js index f58927935..ca2ae619b 100644 --- a/client/src/containers/Accounting/MakeJournalEntriesHeaderFields.js +++ b/client/src/containers/Accounting/MakeJournalEntriesHeaderFields.js @@ -48,6 +48,7 @@ function MakeJournalEntriesHeader({ return (
+ {/*------------ Posting date -----------*/} {({ form, field: { value }, meta: { error, touched } }) => ( + {/*------------ Journal number -----------*/} {({ form, field, meta: { error, touched } }) => ( + {/*------------ Reference -----------*/} {({ form, field, meta: { error, touched } }) => ( + {/*------------ Journal type -----------*/} {({ form, field, meta: { error, touched } }) => ( } - className={classNames( - 'form-group--account-type', - CLASSES.FILL, - )} + className={classNames('form-group--account-type', CLASSES.FILL)} inline={true} > - + {/*------------ Currency -----------*/} + {({ form, field: { value }, meta: { error, touched } }) => ( } - className={classNames( - 'form-group--currency', - CLASSES.FILL, - )} + className={classNames('form-group--currency', CLASSES.FILL)} inline={true} > Date: Fri, 8 Jan 2021 23:59:14 +0200 Subject: [PATCH 4/5] fix: add baseCurrency in sale & purchases data table. --- .../Purchases/Bill/BillFormHeader.js | 16 ++++- .../PaymentMades/PaymentMadeDataTable.js | 12 +++- .../PaymentMades/PaymentMadeFormHeader.js | 4 +- .../Sales/Estimate/EstimatesDataTable.js | 9 ++- .../Sales/Invoice/InvoicesDataTable.js | 9 ++- .../PaymentReceivesDataTable.js | 69 ++++++++++--------- .../Sales/Receipt/ReceiptsDataTable.js | 16 ++--- 7 files changed, 88 insertions(+), 47 deletions(-) diff --git a/client/src/containers/Purchases/Bill/BillFormHeader.js b/client/src/containers/Purchases/Bill/BillFormHeader.js index cae61d061..4bfce6343 100644 --- a/client/src/containers/Purchases/Bill/BillFormHeader.js +++ b/client/src/containers/Purchases/Bill/BillFormHeader.js @@ -7,11 +7,18 @@ import { CLASSES } from 'common/classes'; import BillFormHeaderFields from './BillFormHeaderFields'; import { PageFormBigNumber } from 'components'; +import withSettings from 'containers/Settings/withSettings'; +import { compose } from 'redux'; /** * Fill form header. */ -export default function BillFormHeader({ onBillNumberChanged }) { +function BillFormHeader({ + onBillNumberChanged, + + // #withSettings + baseCurrency, +}) { const { values } = useFormikContext(); // Calculate the total due amount of bill entries. @@ -25,8 +32,13 @@ export default function BillFormHeader({ onBillNumberChanged }) {
); } +export default compose( + withSettings(({ organizationSettings }) => ({ + baseCurrency: organizationSettings?.baseCurrency, + })), +)(BillFormHeader); diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js b/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js index 075d3f81c..8aa62e4cd 100644 --- a/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js +++ b/client/src/containers/Purchases/PaymentMades/PaymentMadeDataTable.js @@ -23,6 +23,7 @@ import PaymentMadesEmptyStatus from './PaymentMadesEmptyStatus'; import withPaymentMade from './withPaymentMade'; import withPaymentMadeActions from './withPaymentMadeActions'; import withCurrentView from 'containers/Views/withCurrentView'; +import withSettings from 'containers/Settings/withSettings'; /** * Payment made datatable transactions. @@ -38,6 +39,9 @@ function PaymentMadeDataTable({ // #withPaymentMadeActions addPaymentMadesTableQueries, + // #withSettings + baseCurrency, + // #ownProps onEditPaymentMade, onDeletePaymentMade, @@ -110,7 +114,8 @@ function PaymentMadeDataTable({ { id: 'payment_number', Header: formatMessage({ id: 'payment_number' }), - accessor: (row) => (row.payment_number ? `#${row.payment_number}` : null), + accessor: (row) => + row.payment_number ? `#${row.payment_number}` : null, width: 140, className: 'payment_number', }, @@ -124,7 +129,7 @@ function PaymentMadeDataTable({ { id: 'amount', Header: formatMessage({ id: 'amount' }), - accessor: (r) => , + accessor: (r) => , width: 140, className: 'amount', }, @@ -238,4 +243,7 @@ export default compose( paymentMadesCurrentViewId, }), ), + withSettings(({ organizationSettings }) => ({ + baseCurrency: organizationSettings?.baseCurrency, + })), )(PaymentMadeDataTable); diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js b/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js index a834db171..00f3bce0c 100644 --- a/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js +++ b/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js @@ -170,7 +170,7 @@ function PaymentMadeFormHeader({ className={'receive-full-amount'} > Receive full amount ( - ) + ) @@ -250,7 +250,7 @@ function PaymentMadeFormHeader({
Amount Received

- +

diff --git a/client/src/containers/Sales/Estimate/EstimatesDataTable.js b/client/src/containers/Sales/Estimate/EstimatesDataTable.js index ab7d53b26..f5599f496 100644 --- a/client/src/containers/Sales/Estimate/EstimatesDataTable.js +++ b/client/src/containers/Sales/Estimate/EstimatesDataTable.js @@ -23,6 +23,7 @@ import EstimatesEmptyStatus from './EstimatesEmptyStatus'; import { statusAccessor } from './components'; import withEstimates from './withEstimates'; import withEstimateActions from './withEstimateActions'; +import withSettings from 'containers/Settings/withSettings'; // Estimates transactions datatable. function EstimatesDataTable({ @@ -36,6 +37,9 @@ function EstimatesDataTable({ // #withEstimatesActions addEstimatesTableQueries, + // #withSettings + baseCurrency, + // #ownProps onEditEstimate, onDeleteEstimate, @@ -160,7 +164,7 @@ function EstimatesDataTable({ { id: 'amount', Header: formatMessage({ id: 'amount' }), - accessor: (r) => , + accessor: (r) => , width: 140, className: 'amount', @@ -282,4 +286,7 @@ export default compose( estimatesCurrentViewId, }), ), + withSettings(({ organizationSettings }) => ({ + baseCurrency: organizationSettings?.baseCurrency, + })), )(EstimatesDataTable); diff --git a/client/src/containers/Sales/Invoice/InvoicesDataTable.js b/client/src/containers/Sales/Invoice/InvoicesDataTable.js index 704858eb2..ff0dd4d96 100644 --- a/client/src/containers/Sales/Invoice/InvoicesDataTable.js +++ b/client/src/containers/Sales/Invoice/InvoicesDataTable.js @@ -35,6 +35,7 @@ import withViewDetails from 'containers/Views/withViewDetails'; import withInvoices from './withInvoices'; import withInvoiceActions from './withInvoiceActions'; import withCurrentView from 'containers/Views/withCurrentView'; +import withSettings from 'containers/Settings/withSettings'; // Invoices datatable. function InvoicesDataTable({ @@ -47,6 +48,9 @@ function InvoicesDataTable({ // #withInvoicesActions addInvoiceTableQueries, + // #withSettings + baseCurrency, + // #OwnProps onEditInvoice, onDeleteInvoice, @@ -141,7 +145,7 @@ function InvoicesDataTable({ { id: 'balance', Header: formatMessage({ id: 'balance' }), - accessor: (r) => , + accessor: (r) => , width: 140, className: 'balance', }, @@ -263,5 +267,8 @@ export default compose( invoicesCurrentViewId, }), ), + withSettings(({ organizationSettings }) => ({ + baseCurrency: organizationSettings?.baseCurrency, + })), withViewDetails(), )(InvoicesDataTable); diff --git a/client/src/containers/Sales/PaymentReceive/PaymentReceivesDataTable.js b/client/src/containers/Sales/PaymentReceive/PaymentReceivesDataTable.js index 1c50f6fef..2358e68c0 100644 --- a/client/src/containers/Sales/PaymentReceive/PaymentReceivesDataTable.js +++ b/client/src/containers/Sales/PaymentReceive/PaymentReceivesDataTable.js @@ -28,6 +28,7 @@ import withViewDetails from 'containers/Views/withViewDetails'; import withPaymentReceives from './withPaymentReceives'; import withPaymentReceivesActions from './withPaymentReceivesActions'; import withCurrentView from 'containers/Views/withCurrentView'; +import withSettings from 'containers/Settings/withSettings'; function PaymentReceivesDataTable({ // #withPaymentReceives @@ -40,6 +41,9 @@ function PaymentReceivesDataTable({ // #withPaymentReceivesActions addPaymentReceivesTableQueries, + // #withSettings + baseCurrency, + // #OwnProps onEditPaymentReceive, onDeletePaymentReceive, @@ -146,7 +150,7 @@ function PaymentReceivesDataTable({ { id: 'amount', Header: formatMessage({ id: 'amount' }), - accessor: (r) => , + accessor: (r) => , width: 140, className: 'amount', }, @@ -186,40 +190,40 @@ function PaymentReceivesDataTable({ const showEmptyStatus = [ paymentReceivesCurrentViewId === -1, PaymentReceivesCurrentPage.length === 0, - ].every(condition => condition === true); + ].every((condition) => condition === true); return (
- - - - - + + + + + - - - - - + + + + +
); } @@ -245,5 +249,8 @@ export default compose( paymentReceivesCurrentViewId, }), ), + withSettings(({ organizationSettings }) => ({ + baseCurrency: organizationSettings?.baseCurrency, + })), withViewDetails(), )(PaymentReceivesDataTable); diff --git a/client/src/containers/Sales/Receipt/ReceiptsDataTable.js b/client/src/containers/Sales/Receipt/ReceiptsDataTable.js index 488e4d64a..4baa3f38a 100644 --- a/client/src/containers/Sales/Receipt/ReceiptsDataTable.js +++ b/client/src/containers/Sales/Receipt/ReceiptsDataTable.js @@ -34,6 +34,7 @@ import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import withReceipts from './withReceipts'; import withReceiptActions from './withReceiptActions'; +import withSettings from 'containers/Settings/withSettings'; function ReceiptsDataTable({ // #withReceipts @@ -46,6 +47,9 @@ function ReceiptsDataTable({ // #withReceiptsActions addReceiptsTableQueries, + // #withSettings + baseCurrency, + // #ownProps loading, onEditReceipt, @@ -138,17 +142,10 @@ function ReceiptsDataTable({ width: 140, className: 'deposit_account', }, - // { - // id: 'send_to_email', - // Header: formatMessage({ id: 'email' }), - // accessor: 'send_to_email', - // width: 140, - // className: 'send_to_email', - // }, { id: 'amount', Header: formatMessage({ id: 'amount' }), - accessor: (r) => , + accessor: (r) => , width: 140, className: 'amount', @@ -287,4 +284,7 @@ export default compose( receiptsCurrentViewId, }), ), + withSettings(({ organizationSettings }) => ({ + baseCurrency: organizationSettings?.baseCurrency, + })), )(ReceiptsDataTable); From 43508dad38aed272af4f118c8cc077a6fdab531b Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sat, 9 Jan 2021 19:40:00 +0200 Subject: [PATCH 5/5] fix: continue editing & clear in paymentmade. --- .../PaymentMadeFloatingActions.js | 1 + .../Purchases/PaymentMades/PaymentMadeForm.js | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadeFloatingActions.js b/client/src/containers/Purchases/PaymentMades/PaymentMadeFloatingActions.js index 1fe38e7d2..cc29ef9e1 100644 --- a/client/src/containers/Purchases/PaymentMades/PaymentMadeFloatingActions.js +++ b/client/src/containers/Purchases/PaymentMades/PaymentMadeFloatingActions.js @@ -45,6 +45,7 @@ export default function PaymentMadeFloatingActions({ onSubmitForm(); saveInvoke(onSubmitClick, event, { redirect: false, + resetForm: true, }); }; diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadeForm.js b/client/src/containers/Purchases/PaymentMades/PaymentMadeForm.js index a75a3a778..f1ee4cf88 100644 --- a/client/src/containers/Purchases/PaymentMades/PaymentMadeForm.js +++ b/client/src/containers/Purchases/PaymentMades/PaymentMadeForm.js @@ -156,13 +156,14 @@ function PaymentMadeForm({ intent: Intent.SUCCESS, }); setSubmitting(false); - // resetForm(); - changePageSubtitle(''); + // changePageSubtitle(''); if (submitPayload.redirect) { history.push('/payment-mades'); } - + if (submitPayload.resetForm) { + resetForm(); + } }; const onError = (errors) => { @@ -193,6 +194,7 @@ function PaymentMadeForm({ values, handleSubmit, isSubmitting, + resetForm, submitForm, } = useFormik({ validationSchema, @@ -244,13 +246,13 @@ function PaymentMadeForm({ // Handle cancel button click. const handleCancelClick = useCallback(() => { - history.push('/payment-mades'); + history.goBack(); }, [history]); // Handle clear all lines button click. - const handleClearAllLines = () => { + const handleClearAllLines = useCallback(() => { setClearLinesAlert(true); - }; + },[setClearLinesAlert]); const handleCancelClearLines = useCallback(() => { setClearLinesAlert(false); @@ -284,6 +286,7 @@ function PaymentMadeForm({ : {}), }); setClearFormAlert(false); + resetForm(); }; // Payable full amount. const payableFullAmount = useMemo(() => sumBy(values.entries, 'due_amount'), [ @@ -314,7 +317,6 @@ function PaymentMadeForm({ [setSubmitPayload], ); - return (
} confirmButtonText={} - intent={Intent.DANGER} + intent={Intent.WARNING} isOpen={clearFormAlert} onCancel={handleCancelClearFormAlert} onConfirm={handleConfirmCancelClearFormAlert} > -

Are you sure you want to clear this transaction?

+

+ +