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

View File

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

View File

@ -114,13 +114,22 @@ const config = {
] ]
}, },
{ {
title: _('Settings'), title: _('Setup'),
icon: getIcon('settings'), icon: getIcon('settings'),
items: [
{
label: _('Chart of Accounts'),
route: '/chart-of-accounts'
},
{
label: _('Settings'),
action() { action() {
openSettings(); openSettings();
} }
} }
] ]
}
]
}; };
function getIcon(name, size = '18', height = null) { function getIcon(name, size = '18', height = null) {