diff --git a/src/containers/Dialogs/UserFormDialog/UserForm.schema.js b/src/containers/Dialogs/UserFormDialog/UserForm.schema.js
index c7d245827..11f56c4a0 100644
--- a/src/containers/Dialogs/UserFormDialog/UserForm.schema.js
+++ b/src/containers/Dialogs/UserFormDialog/UserForm.schema.js
@@ -2,20 +2,14 @@ import * as Yup from 'yup';
import intl from 'react-intl-universal';
const Schema = Yup.object().shape({
- email: Yup.string()
- .email()
- .required()
- .label(intl.get('email')),
- first_name: Yup.string()
- .required()
- .label(intl.get('first_name_')),
- last_name: Yup.string()
- .required()
- .label(intl.get('last_name_')),
+ email: Yup.string().email().required().label(intl.get('email')),
+ first_name: Yup.string().required().label(intl.get('first_name_')),
+ last_name: Yup.string().required().label(intl.get('last_name_')),
phone_number: Yup.string()
.matches()
.required()
.label(intl.get('phone_number_')),
+ role_name: Yup.string().required().label(intl.get('roles.label.role_name_')),
});
export const UserFormSchema = Schema;
diff --git a/src/containers/Dialogs/UserFormDialog/UserFormContent.js b/src/containers/Dialogs/UserFormDialog/UserFormContent.js
index 46d168d97..51f70ff15 100644
--- a/src/containers/Dialogs/UserFormDialog/UserFormContent.js
+++ b/src/containers/Dialogs/UserFormDialog/UserFormContent.js
@@ -11,7 +11,7 @@ import { FormattedMessage as T } from 'components';
import { CLASSES } from 'common/classes';
import classNames from 'classnames';
import { inputIntent } from 'utils';
-import { FieldRequiredHint } from 'components';
+import { ListSelect, FieldRequiredHint } from 'components';
import { useUserFormContext } from './UserFormProvider';
import withDialogActions from 'containers/Dialog/withDialogActions';
import { compose } from 'utils';
@@ -88,6 +88,29 @@ function UserFormContent({
)}
+ {/* ----------- Role name ----------- */}
+
+ {({ form, field: { value }, meta: { error, touched } }) => (
+ }
+ labelInfo={}
+ className={classNames('form-group--role_name', CLASSES.FILL)}
+ intent={inputIntent({ error, touched })}
+ >
+ {
+ // form.setFieldValue('role_name', item.role_id);
+ // }}
+ selectedItem={value}
+ selectedItemProp={'role_id '}
+ // textProp={'role_name'}
+ // labelProp={'role_id '}
+ popoverProps={{ minimal: true }}
+ />
+
+ )}
+
diff --git a/src/containers/Preferences/Users/Roles/RolesForm/RolesForm.schema.js b/src/containers/Preferences/Users/Roles/RolesForm/RolesForm.schema.js
index ab1012778..b2f40ecdb 100644
--- a/src/containers/Preferences/Users/Roles/RolesForm/RolesForm.schema.js
+++ b/src/containers/Preferences/Users/Roles/RolesForm/RolesForm.schema.js
@@ -3,7 +3,7 @@ import intl from 'react-intl-universal';
import { DATATYPES_LENGTH } from 'common/dataTypes';
const Schema = Yup.object().shape({
- role_name: Yup.string().required().label(intl.get('roles.label.role_name')),
+ role_name: Yup.string().required().label(intl.get('roles.label.role_name_')),
role_description: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
permissions: Yup.object().shape({
diff --git a/src/lang/en/index.json b/src/lang/en/index.json
index e083506be..f7062edce 100644
--- a/src/lang/en/index.json
+++ b/src/lang/en/index.json
@@ -1473,7 +1473,8 @@
"roles.column.description":"description",
"roles.edit_roles":"Edit Roles",
"roles.delete_roles":"Delete Roles",
- "roles.label.role_name":"Role name",
+ "roles.label.role_name":"Role Name",
+ "roles.label.role_name_":"Role name",
"sidebar.transactions_locaking":"Transactions Locaking",
"transactions_locking.dialog.label":"Transactions locking",
"roles.permission_schema.success_message":"The role has been created successfully.",
From 2630e0235d921abcd5936ac5dd0175d25c17d13d Mon Sep 17 00:00:00 2001
From: elforjani13 <39470382+elforjani13@users.noreply.github.com>
Date: Thu, 25 Nov 2021 13:02:09 +0200
Subject: [PATCH 17/38] feat: add cashflow & vendor ability.
---
.../AccountTransactions/components.js | 32 ++++---
.../CashFlowAccountsActionsBar.js | 49 ++++++----
.../CashFlowAccounts/CashflowAccountsGrid.js | 92 +++++++++++--------
.../CashflowTransactionDrawerActionBar.js | 31 ++++---
.../VendorsLanding/VendorActionsBar.js | 13 ++-
5 files changed, 127 insertions(+), 90 deletions(-)
diff --git a/src/containers/CashFlow/AccountTransactions/components.js b/src/containers/CashFlow/AccountTransactions/components.js
index 528d6afe2..78dae22d5 100644
--- a/src/containers/CashFlow/AccountTransactions/components.js
+++ b/src/containers/CashFlow/AccountTransactions/components.js
@@ -4,9 +4,13 @@ import intl from 'react-intl-universal';
import { Intent, Menu, MenuItem, MenuDivider } from '@blueprintjs/core';
import { MaterialProgressBar } from 'components';
-import { FormatDateCell, If, Icon } from 'components';
+import { Can, FormatDateCell, If, Icon } from 'components';
import { useAccountTransactionsContext } from './AccountTransactionsProvider';
import { TRANSACRIONS_TYPE } from 'common/cashflowOptions';
+import {
+ AbilitySubject,
+ Cashflow_Abilities,
+} from '../../../common/abilityOption';
import { safeCallback } from 'utils';
export function ActionsMenu({
@@ -20,15 +24,17 @@ export function ActionsMenu({
text={intl.get('view_details')}
onClick={safeCallback(onViewDetails, original)}
/>
-
-
- }
- />
-
+
+
+
+ }
+ />
+
+
);
}
@@ -83,7 +89,7 @@ export function useAccountTransactionsColumns() {
className: 'deposit',
textOverview: true,
align: 'right',
- clickable: true
+ clickable: true,
},
{
id: 'withdrawal',
@@ -93,7 +99,7 @@ export function useAccountTransactionsColumns() {
width: 150,
textOverview: true,
align: 'right',
- clickable: true
+ clickable: true,
},
{
id: 'running_balance',
@@ -103,7 +109,7 @@ export function useAccountTransactionsColumns() {
width: 150,
textOverview: true,
align: 'right',
- clickable: true
+ clickable: true,
},
{
id: 'balance',
diff --git a/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js b/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js
index cb9e86b84..68420cfb4 100644
--- a/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js
+++ b/src/containers/CashFlow/CashFlowAccounts/CashFlowAccountsActionsBar.js
@@ -7,8 +7,12 @@ import {
Alignment,
Switch,
} from '@blueprintjs/core';
-import { Icon, FormattedMessage as T } from 'components';
+import { Can, Icon, FormattedMessage as T } from 'components';
import { useRefreshCashflowAccounts } from 'hooks/query';
+import {
+ Cashflow_Abilities,
+ AbilitySubject,
+} from '../../../common/abilityOption';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
@@ -56,19 +60,22 @@ function CashFlowAccountsActionsBar({
return (
- }
- text={}
- onClick={handleAddBankAccount}
- />
- }
- text={}
- onClick={handleAddCashAccount}
- />
-
+
+ }
+ text={}
+ onClick={handleAddBankAccount}
+ />
+
+ }
+ text={}
+ onClick={handleAddCashAccount}
+ />
+
+
}
@@ -85,13 +92,15 @@ function CashFlowAccountsActionsBar({
text={}
/>
-
- }
- defaultChecked={false}
- onChange={handleInactiveSwitchChange}
- />
+
+ }
+ defaultChecked={false}
+ onChange={handleInactiveSwitchChange}
+ />
+
+
-
- }
- icon={}
- >
-
-
-
- }
- icon={}
- >
-
-
-
-
- }
- text={intl.get('edit_account')}
- onClick={safeCallback(onEditClick)}
- />
-
-
+
+
}
- onClick={safeCallback(onInactivateClick)}
- />
-
-
+ text={}
+ icon={}
+ >
+
+
+
}
- onClick={safeCallback(onActivateClick)}
+ text={}
+ icon={}
+ >
+
+
+
+
+
+
+ }
+ text={intl.get('edit_account')}
+ onClick={safeCallback(onEditClick)}
/>
-
- }
- intent={Intent.DANGER}
- onClick={safeCallback(onDeleteClick)}
- />
+
+
+
+
+ }
+ onClick={safeCallback(onInactivateClick)}
+ />
+
+
+ }
+ onClick={safeCallback(onActivateClick)}
+ />
+
+
+
+ }
+ intent={Intent.DANGER}
+ onClick={safeCallback(onDeleteClick)}
+ />
+
);
}
diff --git a/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerActionBar.js b/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerActionBar.js
index 2099f063e..ea5902ec9 100644
--- a/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerActionBar.js
+++ b/src/containers/Drawers/CashflowTransactionDetailDrawer/CashflowTransactionDrawerActionBar.js
@@ -1,12 +1,15 @@
import React from 'react';
import Icon from 'components/Icon';
import { Button, Classes, NavbarGroup, Intent } from '@blueprintjs/core';
-import { FormattedMessage as T } from 'components';
+import { Can, FormattedMessage as T } from 'components';
import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar';
import { useCashflowTransactionDrawerContext } from './CashflowTransactionDrawerProvider';
import withAlertsActions from 'containers/Alert/withAlertActions';
-
+import {
+ AbilitySubject,
+ Cashflow_Abilities,
+} from '../../../common/abilityOption';
import { compose } from 'utils';
/**
@@ -24,17 +27,19 @@ function CashflowTransactionDrawerActionBar({
};
return (
-
-
- }
- text={}
- intent={Intent.DANGER}
- onClick={handleDeleteCashflowTransaction}
- />
-
-
+
+
+
+ }
+ text={}
+ intent={Intent.DANGER}
+ onClick={handleDeleteCashflowTransaction}
+ />
+
+
+
);
}
export default compose(withAlertsActions)(CashflowTransactionDrawerActionBar);
diff --git a/src/containers/Vendors/VendorsLanding/VendorActionsBar.js b/src/containers/Vendors/VendorsLanding/VendorActionsBar.js
index e5e5b2d6f..bcd20c9ab 100644
--- a/src/containers/Vendors/VendorsLanding/VendorActionsBar.js
+++ b/src/containers/Vendors/VendorsLanding/VendorActionsBar.js
@@ -142,12 +142,15 @@ function VendorActionsBar({
onChange={handleTableRowSizeChange}
/>
- }
- defaultChecked={vendorsInactiveMode}
- onChange={handleInactiveSwitchChange}
- />
+
+ }
+ defaultChecked={vendorsInactiveMode}
+ onChange={handleInactiveSwitchChange}
+ />
+
+