2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

fix: Focus first item on sidebar group click

This commit is contained in:
Faris Ansari 2019-10-24 17:19:22 +05:30
parent 03c1badd24
commit 0cf5440e48
2 changed files with 19 additions and 13 deletions

View File

@ -9,20 +9,20 @@
<h6 class="text-sm font-semibold" @click="$router.push('/')">{{ companyName }}</h6>
</div>
<div class="mt-5">
<div
class="mt-1 first:mt-0"
v-for="group in groups"
:key="group.title"
@click="onGroupClick(group)"
>
<div class="px-3 py-2 flex items-center rounded cursor-pointer hover:bg-white">
<component :is="group.icon" class="w-5 h-5" :active="isActiveGroup(group) && !group.items" />
<div class="mt-1 first:mt-0" v-for="group in groups" :key="group.title">
<div
class="px-3 py-2 flex items-center rounded cursor-pointer hover:bg-white"
@click="onGroupClick(group)"
>
<component
:is="group.icon"
class="w-5 h-5"
:active="isActiveGroup(group) && !group.items"
/>
<div
class="ml-2 text-sm text-gray-900"
:class="isActiveGroup(group) && !group.items && 'text-blue-500'"
>
{{ group.title }}
</div>
>{{ group.title }}</div>
</div>
<div v-if="group.items && isActiveGroup(group)">
<div
@ -86,9 +86,8 @@ export default {
this.activeGroup = group;
},
routeTo(route) {
this.activeGroup = null;
this.$router.push(route);
},
}
}
};
</script>

View File

@ -7,6 +7,7 @@ import PurchasesIcon from './components/Icons/Purchases';
import ReportsIcon from './components/Icons/Reports';
import SettingsIcon from './components/Icons/Settings';
import theme from '@/theme';
import router from './router';
const config = {
getTitle: async () => {
@ -40,6 +41,9 @@ const config = {
{
title: _('Sales'),
icon: SalesIcon,
action() {
router.push('/list/SalesInvoice')
},
items: [
{
label: _('Invoice'),
@ -62,6 +66,9 @@ const config = {
{
title: _('Purchases'),
icon: PurchasesIcon,
action() {
router.push('/list/PurchaseInvoice')
},
items: [
{
label: _('Bill'),