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

Added ability to hide and show side bar items

This commit is contained in:
Piyush Singhania 2021-12-13 19:18:49 +05:30 committed by Alan
parent b44b651695
commit 4efe6552f9
2 changed files with 25 additions and 11 deletions

View File

@ -52,6 +52,7 @@
<div v-if="group.items && isActiveGroup(group)">
<div
v-for="item in group.items"
v-show="item.visible"
:key="item.label"
class="
mt-1
@ -114,7 +115,6 @@ export default {
},
async mounted() {
this.companyName = await sidebarConfig.getTitle();
const { country } = await frappe.getSingle('AccountingSettings');
this.groups = sidebarConfig.groups.filter((group) => {
if (
group.route === '/get-started' &&
@ -125,16 +125,6 @@ export default {
return true;
});
if (country !== 'India') {
this.groups.forEach((group) => {
if (group.title === 'Reports') {
group.items = group.items.filter(
(item) => !item.label.toLowerCase().includes('gst')
);
}
});
}
this.setActiveGroup();
router.afterEach(() => {
this.setActiveGroup();

View File

@ -27,11 +27,13 @@ const config = {
label: _('Invoices'),
route: '/list/SalesInvoice',
doctype: 'SalesInvoice',
visible: 1,
},
{
label: _('Customers'),
route: '/list/Customer',
doctype: 'Customer',
visible: 1,
},
],
},
@ -44,11 +46,13 @@ const config = {
label: _('Bills'),
route: '/list/PurchaseInvoice',
doctype: 'PurchaseInvoice',
visible: 1,
},
{
label: _('Suppliers'),
route: '/list/Supplier',
doctype: 'Supplier',
visible: 1,
},
],
},
@ -61,16 +65,19 @@ const config = {
label: _('Items'),
route: '/list/Item',
doctype: 'Item',
visible: 1,
},
{
label: _('Payments'),
route: '/list/Payment',
doctype: 'Payment',
visible: 1,
},
{
label: _('Journal Entry'),
route: '/list/JournalEntry',
doctype: 'JournalEntry',
visible: 1,
},
],
},
@ -82,26 +89,40 @@ const config = {
{
label: _('General Ledger'),
route: '/report/general-ledger',
visible: 1,
},
{
label: _('Profit And Loss'),
route: '/report/profit-and-loss',
visible: 1,
},
{
label: _('Balance Sheet'),
route: '/report/balance-sheet',
visible: 1,
},
{
label: _('Trial Balance'),
route: '/report/trial-balance',
visible: 1,
},
{
label: _('GSTR1'),
route: '/report/gstr-1',
visible: async () => {
const { country } = await frappe.getSingle('AccountingSettings');
if (country === 'India') return 1;
return 0;
},
},
{
label: _('GSTR2'),
route: '/report/gstr-2',
visible: async () => {
const { country } = await frappe.getSingle('AccountingSettings');
if (country === 'India') return 1;
return 0;
},
},
],
},
@ -113,15 +134,18 @@ const config = {
{
label: _('Chart of Accounts'),
route: '/chart-of-accounts',
visible: 1,
},
{
label: _('Taxes'),
route: '/list/Tax',
doctype: 'Tax',
visible: 1,
},
{
label: _('Settings'),
route: '/settings',
visible: 1,
},
],
},