From 430ab95dc3cc403bb0865f5078c4c033e9512179 Mon Sep 17 00:00:00 2001 From: elforjani13 <39470382+elforjani13@users.noreply.github.com> Date: Mon, 3 Jan 2022 13:38:22 +0200 Subject: [PATCH 1/5] landed cost localiztion. --- .../Alerts/Bills/BillLocatedLandedCostDeleteAlert.js | 4 +--- .../AllocateLandedCostFloatingActions.js | 2 +- .../AllocateLandedCostForm.js | 12 ++++++++---- src/lang/ar/index.json | 6 ++++-- src/lang/en/index.json | 4 +++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js b/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js index 4dee8f29c..1f72e8cad 100644 --- a/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js +++ b/src/containers/Alerts/Bills/BillLocatedLandedCostDeleteAlert.js @@ -57,9 +57,7 @@ function BillTransactionDeleteAlert({ loading={isLoading} >

- +

); diff --git a/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostFloatingActions.js b/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostFloatingActions.js index 121f86aa5..0f3fee4a8 100644 --- a/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostFloatingActions.js +++ b/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostFloatingActions.js @@ -37,7 +37,7 @@ function AllocateLandedCostFloatingActions({ {costTransactionEntry && ( - Unallocated cost Amount:{' '} + {formattedUnallocatedCostAmount} )} diff --git a/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostForm.js b/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostForm.js index e4ac664cd..12d755051 100644 --- a/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostForm.js +++ b/src/containers/Dialogs/AllocateLandedCostDialog/AllocateLandedCostForm.js @@ -42,7 +42,10 @@ function AllocateLandedCostForm({ .map((entry) => transformToForm(entry, defaultInitialValues.items[0])); if (entries.length <= 0) { - AppToaster.show({ message: 'Something wrong!', intent: Intent.DANGER }); + AppToaster.show({ + message: intl.get('something_wrong'), + intent: Intent.DANGER, + }); return; } const form = { @@ -69,13 +72,14 @@ function AllocateLandedCostForm({ ) ) { AppToaster.show({ - message: - 'The total located cost is bigger than the transaction line.', + message: intl.get( + 'landed_cost.error.the_total_located_cost_is_bigger_than_the_transaction_line', + ), intent: Intent.DANGER, }); } else { AppToaster.show({ - message: 'Something went wrong!', + message: intl.get('something_went_wrong'), intent: Intent.DANGER, }); } diff --git a/src/lang/ar/index.json b/src/lang/ar/index.json index 97c82f290..5f3a31f54 100644 --- a/src/lang/ar/index.json +++ b/src/lang/ar/index.json @@ -1173,7 +1173,6 @@ "From transaction": "من معاملة", "Landed": "Landed", "This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.": "يتيح لك هذا الخيار إمكانية إضافة تكلفة إضافية على سبيل المثال اضافة تكلفة الشحن ومن ثم تخصيص التكلفة لفواتير الشراء.", - "Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?": "بمجرد حذف معاملة تحميل التكلفة ، لن تتمكن من استعادتها لاحقًا ، هل أنت متأكد من أنك تريد حذف هذه المعاملة؟", "journal_entries": "القيود", "contact": "جهة الاتصال", "invoice_details": "تفاصيل الفاتورة", @@ -1384,7 +1383,7 @@ "filter.value": "قيمة", "payment_made.empty_status.title": "المنشأة لم تدفع اي اموال إلي الموردين ، إلي حد الأن!.", "estimate.delete.error.estimate_converted_to_invoice": "لا يمكن حذف عملية عرض اسعار الذي تم تحويلها إلي فاتورة بيع.", - "landed_cost.action.delete.success_message": "The landed cost has been deleted successfully.", + "landed_cost.action.delete.success_message": "تم حذف تكلفة اضافية بنجاح. ", "items.option.only_active": "Only active", "items.option_all_items.hint": "جميع الاصناف ، بما في ذلك تلك الاصناف لديها رصيد صفر.", "items.option_with_transactions": "الاصناف مع معاملات", @@ -1583,6 +1582,9 @@ "refund": "استرجاع", "landed_cost.dialog.label_select_transaction": "حدد المعاملة ", "landed_cost.dialog.label_select_transaction_entry": "حدد سطر المعاملة ", + "landed_cost.dialog.label_unallocated_cost_amount":"قيمة التكلفة غير المحملة:", + "landed_cost.error.the_total_located_cost_is_bigger_than_the_transaction_line":"إجمالي قيمة التكلفة المحملة أكبر من قيمة سطر المعاملة.", + "landed_cost.once_your_delete_this_located_landed_cost": "بمجرد حذف معاملة تحميل التكلفة ، لن تتمكن من استعادتها لاحقًا ، هل أنت متأكد من أنك تريد حذف هذه المعاملة؟", "refund_credit_note.dialog.label": "استرجاع اموال", "refund_credit_note.dialog.success_message": "تم انشاء معاملة استرجاع الاموال لإشعار الدائن بنجاح.", "refund_credit_note.dialog.refund_date": "تاريخ الاسترجاع", diff --git a/src/lang/en/index.json b/src/lang/en/index.json index 14a6cca5b..61895a2be 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1145,7 +1145,6 @@ "From transaction": "From transaction", "landed": "Landed", "This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.": "This options allows you to be able to add additional cost eg. freight then allocate cost to the items in your bills.", - "Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?": "Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?", "journal_entries": "Journal Entries", "contact": "Contact", "invoice_details": "Invoice details", @@ -1568,6 +1567,9 @@ "refund": "Refund", "landed_cost.dialog.label_select_transaction": "Select transaction", "landed_cost.dialog.label_select_transaction_entry": "Select transaction entry", + "landed_cost.dialog.label_unallocated_cost_amount": "Unallocated cost Amount:", + "landed_cost.error.the_total_located_cost_is_bigger_than_the_transaction_line": "The total located cost is bigger than the transaction line.", + "landed_cost.once_your_delete_this_located_landed_cost": "Once your delete this located landed cost, you won't be able to restore it later, Are your sure you want to delete this transaction?", "refund_credit_note.dialog.label": "Refund Credit Note", "refund_credit_note.dialog.success_message": "The customer credit note refund has been created successfully.", "refund_credit_note.dialog.refund_date": "Refund date", From c31e9dcd29a7580111e28299643e91c80fa56373 Mon Sep 17 00:00:00 2001 From: elforjani13 <39470382+elforjani13@users.noreply.github.com> Date: Mon, 3 Jan 2022 14:35:50 +0200 Subject: [PATCH 2/5] fix: inventory adjustment & contacts drawer. --- .../CashFlow/AccountTransactions/utils.js | 4 ++++ src/lang/en/index.json | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/containers/CashFlow/AccountTransactions/utils.js b/src/containers/CashFlow/AccountTransactions/utils.js index 567422ea6..94a830925 100644 --- a/src/containers/CashFlow/AccountTransactions/utils.js +++ b/src/containers/CashFlow/AccountTransactions/utils.js @@ -79,6 +79,10 @@ export const handleCashFlowTransactionType = (reference, openDrawer) => { return openDrawer('refund-vendor-detail-drawer', { refundTransactionId: reference.reference_id, }); + case 'InventoryAdjustment': + return openDrawer('inventory-adjustment-drawer', { + inventoryId: reference.reference_id, + }); default: return openDrawer('cashflow-transaction-drawer', { diff --git a/src/lang/en/index.json b/src/lang/en/index.json index 61895a2be..769032578 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1287,11 +1287,11 @@ "inventory_adjustment.details_drawer.title": "Inventory adjustment details", "setup.organization.location": "Location", "preferences.general.success_message": "The general preferences has been saved.", - "customer.drawer.action.new_invoice": "New invoice", - "customer.drawer.action.new_estimate": "New estimate", - "customer.drawer.action.new_payment": "New payment", - "customer.drawer.action.new_receipt": "New receipt", - "customer.drawer.action.new_transaction": "New transaction", + "customer.drawer.action.new_invoice": "New Invoice", + "customer.drawer.action.new_estimate": "New Estimate", + "customer.drawer.action.new_payment": "New Payment", + "customer.drawer.action.new_receipt": "New Receipt", + "customer.drawer.action.new_transaction": "New Transaction", "customer.drawer.action.edit": "Edit", "customer.drawer.label.outstanding_receivable": "Outstanding receivable", "customer.drawer.label.customer_name": "Customer name", @@ -1317,9 +1317,9 @@ "vendor.drawer.label.note": "Note", "vendor.drawer.action.edit_vendor": "Edit vendor", "vendor.drawer.action.delete": "Delete", - "vendor.drawer.action.new_transaction": "New transaction", - "vendor.drawer.action.new_payment": "New payment", - "vendor.drawer.action.new_invoice": "New purchase invoice", + "vendor.drawer.action.new_transaction": "New Transaction", + "vendor.drawer.action.new_payment": "New Payment", + "vendor.drawer.action.new_invoice": "New Purchase Invoice", "vendor.drawer.action.edit": "Edit", "manual_journals.empty_status.description": "Manual journals can be used to record financial transactions manually, used by accountants to work with the ledger.", "manual_journals.empty_status.title": "Create your first journal entries on accounts chart.", From 21779007be023436b85e60bce01a18fc3eb600cc Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 3 Jan 2022 23:14:11 +0200 Subject: [PATCH 3/5] fix: application version. --- config/env.js | 3 +++ config/paths.js | 3 +++ src/components/Sidebar/Sidebar.js | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config/env.js b/config/env.js index 09ec03c5b..24a907f0d 100644 --- a/config/env.js +++ b/config/env.js @@ -85,6 +85,9 @@ function getClientEnvironment(publicUrl) { WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST, WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH, WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT, + + // Application version. + VERSION: paths.appVersion } ); // Stringify all values so we can feed into webpack DefinePlugin diff --git a/config/paths.js b/config/paths.js index b3fd764ae..d9a21bc72 100644 --- a/config/paths.js +++ b/config/paths.js @@ -48,6 +48,8 @@ const resolveModule = (resolveFn, filePath) => { return resolveFn(`${filePath}.js`); }; +const appVersion = require(resolveApp('package.json')).version; + // config after eject: we're in ./config/ module.exports = { dotenv: resolveApp('.env'), @@ -65,6 +67,7 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), publicUrlOrPath, + appVersion }; diff --git a/src/components/Sidebar/Sidebar.js b/src/components/Sidebar/Sidebar.js index dee5b7d12..92f97cc95 100644 --- a/src/components/Sidebar/Sidebar.js +++ b/src/components/Sidebar/Sidebar.js @@ -28,7 +28,7 @@ export default function Sidebar({ dashboardContentRef }) { * @returns {React.JSX} */ function SidebarFooterVersion() { - const { REACT_APP_VERSION: VERSION } = process.env; + const { VERSION } = process.env; if (!VERSION) { return null; From 5c601fcf2dc8acc2b11fc5378b13a89013f7c18f Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Mon, 28 Mar 2022 11:58:12 +0200 Subject: [PATCH 4/5] fix(Account): `BIG-296` Issue when creating a new child account from chart of accounts list. --- src/common/index.js | 1 + src/containers/Accounts/AccountsDataTable.js | 9 +++-- .../CashFlowAccountsActionsBar.js | 11 +++--- .../AccountDialog/AccountDialogContent.js | 16 ++------- .../AccountDialog/AccountDialogForm.js | 13 ++----- .../AccountDialog/AccountDialogFormContent.js | 11 +++--- .../AccountDialog/AccountDialogProvider.js | 36 ++++++++++--------- src/containers/Dialogs/AccountDialog/index.js | 20 ++++------- src/containers/Dialogs/AccountDialog/utils.js | 36 +++++++++++++++---- .../AccountDrawer/AccountDrawerActionBar.js | 17 ++++----- src/lang/ar/index.json | 4 +-- 11 files changed, 90 insertions(+), 84 deletions(-) diff --git a/src/common/index.js b/src/common/index.js index ffd40825e..c2922a515 100644 --- a/src/common/index.js +++ b/src/common/index.js @@ -1,3 +1,4 @@ +export * from './accountTypes'; export * from './TableStyle'; export * from './features'; export * from './cellTypes'; diff --git a/src/containers/Accounts/AccountsDataTable.js b/src/containers/Accounts/AccountsDataTable.js index 8d12404ee..ab45025eb 100644 --- a/src/containers/Accounts/AccountsDataTable.js +++ b/src/containers/Accounts/AccountsDataTable.js @@ -15,6 +15,8 @@ import withSettings from '../Settings/withSettings'; import { useAccountsChartContext } from './AccountsChartProvider'; import { useMemorizedColumnsWidths } from '../../hooks'; +import { AccountDialogAction } from '../Dialogs/AccountDialog/utils'; + import withAlertsActions from 'containers/Alert/withAlertActions'; import withDialogActions from 'containers/Dialog/withDialogActions'; import withDrawerActions from 'containers/Drawer/withDrawerActions'; @@ -58,7 +60,10 @@ function AccountsDataTable({ // Handle edit account action. const handleEditAccount = (account) => { - openDialog('account-form', { action: 'edit', id: account.id }); + openDialog('account-form', { + action: AccountDialogAction.Edit, + id: account.id, + }); }; // Handle view detail account. @@ -69,7 +74,7 @@ function AccountsDataTable({ // Handle new child button click. const handleNewChildAccount = (account) => { openDialog('account-form', { - action: 'new_child', + action: AccountDialogAction.NewChild, parentAccountId: account.id, accountType: account.account_type, }); diff --git a/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js b/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js index f21b9f463..f4947ee68 100644 --- a/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js +++ b/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js @@ -16,6 +16,9 @@ import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import withDialogActions from 'containers/Dialog/withDialogActions'; import withCashflowAccountsTableActions from '../AccountTransactions/withCashflowAccountsTableActions'; +import { AccountDialogAction } from '../../Dialogs/AccountDialog/utils'; +import { ACCOUNT_TYPE } from '../../../common'; + import { compose } from 'utils'; /** @@ -37,15 +40,15 @@ function CashFlowAccountsActionsBar({ // Handle add bank account. const handleAddBankAccount = () => { openDialog('account-form', { - action: 'NEW_ACCOUNT_DEFINED_TYPE', - accountType: 'cash', + action: AccountDialogAction.NewDefinedType, + accountType: ACCOUNT_TYPE.CASH, }); }; // Handle add cash account. const handleAddCashAccount = () => { openDialog('account-form', { - action: 'NEW_ACCOUNT_DEFINED_TYPE', - accountType: 'bank', + action: AccountDialogAction.NewDefinedType, + accountType: ACCOUNT_TYPE.BANK, }); }; // Handle inactive switch changing. diff --git a/src/containers/Dialogs/AccountDialog/AccountDialogContent.js b/src/containers/Dialogs/AccountDialog/AccountDialogContent.js index 2c9856cba..cf373474e 100644 --- a/src/containers/Dialogs/AccountDialog/AccountDialogContent.js +++ b/src/containers/Dialogs/AccountDialog/AccountDialogContent.js @@ -5,21 +5,9 @@ import AccountDialogForm from './AccountDialogForm'; /** * Account dialog content. */ -export default function AccountDialogContent({ - dialogName, - accountId, - action, - parentAccountId, - accountType, -}) { +export default function AccountDialogContent({ dialogName, payload }) { return ( - + ); diff --git a/src/containers/Dialogs/AccountDialog/AccountDialogForm.js b/src/containers/Dialogs/AccountDialog/AccountDialogForm.js index 809ae6ea6..30c9e210f 100644 --- a/src/containers/Dialogs/AccountDialog/AccountDialogForm.js +++ b/src/containers/Dialogs/AccountDialog/AccountDialogForm.js @@ -43,9 +43,7 @@ function AccountFormDialogContent({ account, accountId, - action, - parentAccountId, - accountType, + payload, isNewMode, dialogName, } = useAccountDialogContext(); @@ -101,7 +99,6 @@ function AccountFormDialogContent({ .catch(handleError); } }; - // Form initial values in create and edit mode. const initialValues = { ...defaultInitialValues, @@ -111,11 +108,7 @@ function AccountFormDialogContent({ * as well. */ ...transformToForm( - transformAccountToForm(account, { - action, - parentAccountId, - accountType, - }), + transformAccountToForm(account, payload), defaultInitialValues, ), }; @@ -133,7 +126,7 @@ function AccountFormDialogContent({ > diff --git a/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js b/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js index 2350b0f4e..4de48166e 100644 --- a/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js +++ b/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js @@ -39,7 +39,8 @@ function AccountFormDialogFields({ const accountNameFieldRef = useAutofocus(); // Account form context. - const { accounts, accountsTypes, currencies } = useAccountDialogContext(); + const { fieldsDisabled, accounts, accountsTypes, currencies } = + useAccountDialogContext(); return (
@@ -62,11 +63,7 @@ function AccountFormDialogFields({ form.setFieldValue('account_type', accountType.key); form.setFieldValue('currency_code', ''); }} - disabled={ - action === 'edit' || - action === 'new_child' || - action === 'NEW_ACCOUNT_DEFINED_TYPE' - } + disabled={fieldsDisabled.accountType} popoverProps={{ minimal: true }} popoverFill={true} /> @@ -209,7 +206,7 @@ function AccountFormDialogFields({