2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00

fix: Add Chart of Accounts to sidebar

This commit is contained in:
Faris Ansari 2019-12-23 13:56:41 +05:30
parent 6e69b20ad6
commit 54616ef926
3 changed files with 25 additions and 8 deletions

View File

@ -35,7 +35,7 @@
:key="item.label"
class="mt-1 first:mt-0 text-base text-gray-800 py-1 pl-10 rounded cursor-pointer hover:bg-white"
:class="itemActiveClass(item)"
@click="routeTo(item.route)"
@click="onItemClick(item)"
>
{{ item.label }}
</div>
@ -91,9 +91,9 @@ export default {
},
methods: {
itemActiveClass(item) {
let currentRoute = this.$route.path;
let { path: currentRoute, params } = this.$route;
let routeMatch = currentRoute === item.route;
let doctypeMatch = this.$route.params.doctype === item.doctype;
let doctypeMatch = item.doctype && params.doctype === item.doctype;
return routeMatch || doctypeMatch ? 'bg-white text-blue-500' : '';
},
isActiveGroup(group) {
@ -108,6 +108,14 @@ export default {
}
this.activeGroup = group;
},
onItemClick(item) {
if (item.action) {
item.action();
}
if (item.route) {
this.routeTo(item.route);
}
},
routeTo(route) {
this.$router.push(route);
}

View File

@ -87,7 +87,7 @@ const routes = [
props: true
},
{
path: '/chartOfAccounts',
path: '/chart-of-accounts',
name: 'Chart Of Accounts',
components: {
default: ChartOfAccounts,

View File

@ -114,11 +114,20 @@ const config = {
]
},
{
title: _('Settings'),
title: _('Setup'),
icon: getIcon('settings'),
action() {
openSettings();
}
items: [
{
label: _('Chart of Accounts'),
route: '/chart-of-accounts'
},
{
label: _('Settings'),
action() {
openSettings();
}
}
]
}
]
};