- {headerGroup.headers.map(column => (
+ {headerGroup.headers.map((column, index) => (
+ {(expandable && (index + 1) === expandToggleColumn) && (
+
+
+ )}
+
{column.render('Header')}
diff --git a/client/src/components/MenuItem.js b/client/src/components/MenuItem.js
index 97921f8d2..5e9ef659f 100644
--- a/client/src/components/MenuItem.js
+++ b/client/src/components/MenuItem.js
@@ -122,7 +122,7 @@ export default class MenuItem extends AbstractPureComponent2 {
constructor(props) {
super(props);
this.state = {
- isCollapseActive: false,
+ isCollapseActive: this.props.callapseActive || false,
};
}
@@ -193,6 +193,13 @@ export default class MenuItem extends AbstractPureComponent2 {
};
}
+ componentWillReceiveProps(nextProps){
+ if(nextProps.callapseActive!==this.props.callapseActive){
+ //Perform some operation
+ this.setState({ isCollapseActive: nextProps.callapseActive });
+ }
+ }
+
maybeRenderLabel(labelElement) {
const { label, labelClassName } = this.props;
if (label == null && labelElement == null) {
diff --git a/client/src/components/Sidebar/SidebarMenu.js b/client/src/components/Sidebar/SidebarMenu.js
index 9d78bc8fb..260e2886f 100644
--- a/client/src/components/Sidebar/SidebarMenu.js
+++ b/client/src/components/Sidebar/SidebarMenu.js
@@ -1,22 +1,29 @@
import React, { useState } from 'react';
import {Menu, MenuDivider, Collapse} from "@blueprintjs/core";
-import {useHistory} from 'react-router-dom';
+import {useHistory, useLocation} from 'react-router-dom';
import sidebarMenuList from 'config/sidebarMenu';
import Icon from 'components/Icon';
import MenuItem from 'components/MenuItem';
+import classNames from 'classnames';
export default function SidebarMenu() {
- let history = useHistory();
+ const history = useHistory();
+ const location = useLocation();
const menuItemsMapper = (list) => {
return list.map((item, index) => {
const children = Array.isArray(item.children) ? menuItemsMapper(item.children) : null;
+ const isActive = (item.href && item.href === location.pathname) ||
+ (item.children && item.children.some((c) => c.href === location.pathname));
+ const handleItemClick = () => {
+ if (item.href) { history.push(item.href); }
+ };
return (
(item.divider) ?
- :
+ :
}
text={item.text}
label={item.label}
@@ -24,11 +31,9 @@ export default function SidebarMenu() {
children={children}
dropdownType={item.dropdownType || 'collapse'}
caretIconSize={15}
- onClick={() => {
- if (item.href) {
- history.push(item.href);
- }
- }} />
+ onClick={handleItemClick}
+ callapseActive={!!isActive}
+ className={classNames({ 'is-active': isActive })} />
);
});
};
diff --git a/client/src/config/sidebarMenu.js b/client/src/config/sidebarMenu.js
index e47ddb21d..a3a4ae156 100644
--- a/client/src/config/sidebarMenu.js
+++ b/client/src/config/sidebarMenu.js
@@ -129,6 +129,6 @@ export default [
},
{
text: 'Auditing System',
- href: '/dashboard/accounts'
+ href: '/dashboard/auditing/list'
}
];
diff --git a/client/src/containers/Dashboard/Items/ItemsCategoryList.js b/client/src/containers/Dashboard/Items/ItemsCategoryList.js
index 705495c81..b4161629c 100644
--- a/client/src/containers/Dashboard/Items/ItemsCategoryList.js
+++ b/client/src/containers/Dashboard/Items/ItemsCategoryList.js
@@ -15,7 +15,8 @@ const ItemCategoriesList = ({
changePageTitle,
views,
requestFetchItemCategories,
- requestEditItemCategory
+ requestEditItemCategory,
+ requestDeleteItemCategory,
}) => {
const { id } = useParams();
const [deleteCategory, setDeleteCategory] = useState(false);
@@ -40,7 +41,7 @@ const ItemCategoriesList = ({
};
const handelConfirmCategoryDelete = useCallback(() => {
- requestEditItemCategory(deleteCategory.id).then(() => {
+ requestDeleteItemCategory(deleteCategory.id).then(() => {
setDeleteCategory(false);
AppToaster.show({
message: 'the_category_has_been_delete'
diff --git a/client/src/style/components/data-table.scss b/client/src/style/components/data-table.scss
index 4d9310a4f..f67b26e1d 100644
--- a/client/src/style/components/data-table.scss
+++ b/client/src/style/components/data-table.scss
@@ -144,40 +144,36 @@
}
}
- .tr .th.expander,
- .tr .td.expander{
- padding: 0;
-
- .toggle{
+ .tr .th,
+ .tr .td{
+ .expand-toggle{
cursor: pointer;
- display: block;
- padding: 14px 8px;
+ display: inline-block;
+ padding: 0 8px 0 0;
padding-left: 0;
+ margin: auto 0;
margin-left: 4px;
+
+ .arrow-right{
+ width: 0;
+ height: 0;
+ border-top: 5px solid transparent;
+ border-bottom: 5px solid transparent;
+ border-left: 8px solid #acacac;
+ display: block;
+ }
+
+ .arrow-down{
+ width: 0;
+ height: 0;
+ border-left: 5px solid transparent;
+ border-right: 5px solid transparent;
+ border-top: 8px solid #acacac;
+ display: block;
+ }
}
- .arrow-right{
- width: 0;
- height: 0;
- border-top: 5px solid transparent;
- border-bottom: 5px solid transparent;
- border-left: 8px solid #acacac;
- display: block;
- }
-
- .arrow-down{
- width: 0;
- height: 0;
- border-left: 5px solid transparent;
- border-right: 5px solid transparent;
- border-top: 8px solid #acacac;
- display: block;
- }
-
- + .td,
- + .th{
- padding-left: 0;
- }
+
}
}
@@ -202,14 +198,16 @@
&--financial-report{
- .thead{
- .tr .th{
- background: transparent;
- border-top: 1px solid #666;
- border-bottom: 1px solid #666;
-
- padding: 10px 0.4rem;
- color: #222;
+ .table {
+ .thead{
+ .tr .th{
+ background: transparent;
+ border-top: 1px solid #666;
+ border-bottom: 1px solid #666;
+
+ padding: 10px 0.4rem;
+ color: #222;
+ }
}
}
}
diff --git a/client/src/style/views/Sidebar.scss b/client/src/style/views/Sidebar.scss
index f5cee8be0..974829987 100644
--- a/client/src/style/views/Sidebar.scss
+++ b/client/src/style/views/Sidebar.scss
@@ -52,9 +52,10 @@ $sidebar-popover-submenu-bg: rgb(1, 20, 62);
font-size: 15px;
font-weight: 400;
- &:hover{
+ &:hover,
+ &.bp3-active{
background: #012470;
- color: #b2bbd0;
+ color: #c1c9dd;
}
&:focus,
&:active{
@@ -89,7 +90,8 @@ $sidebar-popover-submenu-bg: rgb(1, 20, 62);
font-size: 15px;
color: #8a95b6;
- &:hover{
+ &:hover,
+ &.bp3-active{
background: transparent;
color: #C5CBE3;
}
diff --git a/client/src/utils.js b/client/src/utils.js
index 2aac703cb..a1f2074ea 100644
--- a/client/src/utils.js
+++ b/client/src/utils.js
@@ -136,10 +136,12 @@ export const defaultExpanderReducer = (tableRows, level) => {
return expended;
}
-
export function formattedAmount(cents, currency) {
const { symbol, decimal_digits: precision } = Currency[currency];
const amount = cents / Math.pow(10, precision);
return accounting.formatMoney(amount, { symbol, precision });
-}
\ No newline at end of file
+}
+
+export const ConditionalWrapper = ({ condition, wrapper, children }) =>
+ condition ? wrapper(children) : children;
\ No newline at end of file