Compare commits

...

3 Commits

Author SHA1 Message Date
elforjani13
802f7cc442 fix: add note to customer & vendor details. 2021-11-23 13:13:23 +02:00
a.bouhuolia
5f0700b5e5 fix: hotbug account dialog edit payload transformation. 2021-11-20 18:52:45 +02:00
a.bouhuolia
48348da663 fix: invite user auth route. 2021-11-20 15:49:28 +02:00
6 changed files with 32 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import intl from 'react-intl-universal'; import intl from 'react-intl-universal';
import * as R from 'ramda'; import * as R from 'ramda';
import { isEmpty } from 'lodash';
export const transformApiErrors = (errors) => { export const transformApiErrors = (errors) => {
const fields = {}; const fields = {};
@@ -42,12 +43,18 @@ const mergeWithAccount = R.curry((transformed, account) => {
}; };
}); });
/**
* Default account payload transformer.
*/
const defaultPayloadTransform = () => ({});
/** /**
* Defined payload transformers. * Defined payload transformers.
*/ */
function getConditions() { function getConditions() {
return [ return [
['edit', transformEditMode], ['edit'],
['new_child', transformEditMode],
['NEW_ACCOUNT_DEFINED_TYPE', transformNewAccountDefinedType], ['NEW_ACCOUNT_DEFINED_TYPE', transformNewAccountDefinedType],
]; ];
} }
@@ -59,9 +66,13 @@ export const transformAccountToForm = (account, payload) => {
const conditions = getConditions(); const conditions = getConditions();
const results = conditions.map((condition) => { const results = conditions.map((condition) => {
const transformer = !isEmpty(condition[1])
? condition[1]
: defaultPayloadTransform;
return [ return [
condition[0] === payload.action ? R.T : R.F, condition[0] === payload.action ? R.T : R.F,
mergeWithAccount(condition[1](payload)), mergeWithAccount(transformer(payload)),
]; ];
}); });
return R.cond(results)(account); return R.cond(results)(account);

View File

@@ -73,6 +73,10 @@ export default function CustomerDetailsHeader() {
label={<T id={'customer.drawer.label.currency'} />} label={<T id={'customer.drawer.label.currency'} />}
children={customer?.currency_code} children={customer?.currency_code}
/> />
<DetailItem
label={<T id={'customer.drawer.label.note'} />}
children={defaultTo(customer?.note, '--')}
/>
</DetailsMenu> </DetailsMenu>
</div> </div>
); );

View File

@@ -68,6 +68,11 @@ export default function VendorDetailsHeader() {
label={<T id={'vendor.drawer.label.currency'} />} label={<T id={'vendor.drawer.label.currency'} />}
children={vendor?.currency_code} children={vendor?.currency_code}
/> />
<DetailItem
label={<T id={'vendor.drawer.label.note'} />}
children={defaultTo(vendor?.note, '--')}
/>
</DetailsMenu> </DetailsMenu>
</div> </div>
); );

View File

@@ -1322,6 +1322,7 @@
"customer.drawer.label.opening_balance": "الرصيد الافتتاحي", "customer.drawer.label.opening_balance": "الرصيد الافتتاحي",
"customer.drawer.label.opening_balance_at": "الرصيد الافتتاحي في", "customer.drawer.label.opening_balance_at": "الرصيد الافتتاحي في",
"customer.drawer.label.currency": "العملة", "customer.drawer.label.currency": "العملة",
"customer.drawer.label.note": "ملاحظة",
"vendor.drawer.label.outstanding_payable": "مستحف الدفع", "vendor.drawer.label.outstanding_payable": "مستحف الدفع",
"vendor.drawer.label.vendor": "اسم المورد", "vendor.drawer.label.vendor": "اسم المورد",
"vendor.drawer.label.unused_credits": "الرصيد الدائن", "vendor.drawer.label.unused_credits": "الرصيد الدائن",
@@ -1331,6 +1332,7 @@
"vendor.drawer.label.opening_balance": "الرصيد الافتتاحي", "vendor.drawer.label.opening_balance": "الرصيد الافتتاحي",
"vendor.drawer.label.opening_balance_at": "الرصيد الافتتاحي في", "vendor.drawer.label.opening_balance_at": "الرصيد الافتتاحي في",
"vendor.drawer.label.currency": "العملة", "vendor.drawer.label.currency": "العملة",
"vendor.drawer.label.note": "ملاحظة",
"vendor.drawer.action.edit_vendor": "تعديل المورد", "vendor.drawer.action.edit_vendor": "تعديل المورد",
"vendor.drawer.action.delete": "حذف", "vendor.drawer.action.delete": "حذف",
"vendor.drawer.action.new_transaction": "معاملة جديدة", "vendor.drawer.action.new_transaction": "معاملة جديدة",

View File

@@ -1295,6 +1295,7 @@
"customer.drawer.label.opening_balance": "Opening balance", "customer.drawer.label.opening_balance": "Opening balance",
"customer.drawer.label.opening_balance_at": "Opening balance at", "customer.drawer.label.opening_balance_at": "Opening balance at",
"customer.drawer.label.currency": "Currency code", "customer.drawer.label.currency": "Currency code",
"customer.drawer.label.note": "Note",
"vendor.drawer.label.outstanding_payable": "Outstanding payable", "vendor.drawer.label.outstanding_payable": "Outstanding payable",
"vendor.drawer.label.vendor": "Vendor name", "vendor.drawer.label.vendor": "Vendor name",
"vendor.drawer.label.unused_credits": "Unused Credits", "vendor.drawer.label.unused_credits": "Unused Credits",
@@ -1304,6 +1305,7 @@
"vendor.drawer.label.opening_balance": "Opening balance", "vendor.drawer.label.opening_balance": "Opening balance",
"vendor.drawer.label.opening_balance_at": "Opening balance at", "vendor.drawer.label.opening_balance_at": "Opening balance at",
"vendor.drawer.label.currency": "Currency", "vendor.drawer.label.currency": "Currency",
"vendor.drawer.label.note": "Note",
"vendor.drawer.action.edit_vendor": "Edit vendor", "vendor.drawer.action.edit_vendor": "Edit vendor",
"vendor.drawer.action.delete": "Delete", "vendor.drawer.action.delete": "Delete",
"vendor.drawer.action.new_transaction": "New transaction", "vendor.drawer.action.new_transaction": "New transaction",

View File

@@ -21,12 +21,12 @@ export default [
loader: () => import('containers/Authentication/ResetPassword'), loader: () => import('containers/Authentication/ResetPassword'),
}), }),
}, },
// { {
// path: `${BASE_URL}/invite/:token/accept`, path: `${BASE_URL}/invite/:token/accept`,
// component: LazyLoader({ component: LazyLoader({
// loader: () => import('containers/Authentication/InviteAccept'), loader: () => import('containers/Authentication/InviteAccept'),
// }), }),
// }, },
{ {
path: `${BASE_URL}/register`, path: `${BASE_URL}/register`,
component: LazyLoader({ component: LazyLoader({