diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue
index 03fe11a857..79dbf90873 100644
--- a/src/components/LeftMenu.vue
+++ b/src/components/LeftMenu.vue
@@ -1,6 +1,6 @@
{
+ const isRectificative = !!(
+ await axios.get('InvoiceInCorrections', {
+ params: { filter: { where: { correctingFk: to.params.id } } },
+ })
+ ).data.length;
+ return !isRectificative;
+ },
+ },
+};
const state = useState();
const session = useSession();
const { t, te } = i18n.global;
@@ -66,6 +79,35 @@ export default route(function (/* { store, ssrContext } */) {
return true;
});
+ for await (const [mainKey, mainValue] of Object.entries(HIDDEN_SECTIONS)) {
+ console.log(mainKey, mainValue);
+ if (to.matched.find((route) => route.name === mainKey)) {
+ for await (const [childKey, childValue] of Object.entries(
+ HIDDEN_SECTIONS[mainKey]
+ )) {
+ const res = await childValue(to);
+ if (res) {
+ state.setHiddenSections(childKey);
+ } else {
+ state.popHiddenSections(childKey);
+ }
+ }
+ }
+ }
+ //FIXME: es una implementacion ad-hoc. Si vale, considerar la opción dinámica
+ // if (to.matched.find((route) => route.name === 'InvoiceInCard')) {
+ // const isRectificative = !!(
+ // await axios.get('InvoiceInCorrections', {
+ // params: { filter: { where: { correctingFk: to.params.id } } },
+ // })
+ // ).data.length;
+ // if (!isRectificative) {
+ // state.setHiddenSections('InvoiceInCorrective');
+ // } else state.popHiddenSections('InvoiceInCorrective');
+ // // console.log(to.matched[1].meta.hidden);
+ // // to.matched[1].meta.hidden = !isRectificative;
+ // // console.log(to.matched[1].meta.hidden);
+ // }
if (!hasRequiredRoles) {
return next({ path: '/' });
}
@@ -74,12 +116,23 @@ export default route(function (/* { store, ssrContext } */) {
next();
});
- Router.afterEach((to) => {
+ Router.afterEach(async (to) => {
let title = t(`login.title`);
const matches = to.matched;
+
if (matches && matches.length > 1) {
const module = matches[1];
+ // if (to.matched.find((route) => route.name === 'InvoiceInCard')) {
+ // const isRectificative = !!(
+ // await axios.get('InvoiceInCorrections', {
+ // params: { filter: { where: { correctingFk: to.params.id } } },
+ // })
+ // ).data.length;
+ // module.meta.hidden = !isRectificative;
+ // // stateStore.leftDrawer = isRectificative;
+ // }
+ // console.error(module.meta);
const moduleTitle = module.meta && module.meta.title;
if (moduleTitle) {
title = t(`globals.pageTitles.${moduleTitle}`);
diff --git a/src/router/modules/invoiceIn.js b/src/router/modules/invoiceIn.js
index d2091f2303..090e6a982f 100644
--- a/src/router/modules/invoiceIn.js
+++ b/src/router/modules/invoiceIn.js
@@ -64,22 +64,22 @@ export default {
path: ':id',
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
redirect: { name: 'InvoiceInSummary' },
- beforeEnter: async (to, from, next) => {
- const isRectificative = !!(
- await axios.get('InvoiceInCorrections', {
- params: { filter: { where: { correctingFk: to.params.id } } },
- })
- ).data.length;
+ // beforeEnter: async (to, from, next) => {
+ // const isRectificative = !!(
+ // await axios.get('InvoiceInCorrections', {
+ // params: { filter: { where: { correctingFk: to.params.id } } },
+ // })
+ // ).data.length;
- const card = to.matched.find((route) => route.name === 'InvoiceInCard');
- const corrective = card.children.find(
- (route) => route.name === 'InvoiceInCorrective'
- );
+ // const card = to.matched.find((route) => route.name === 'InvoiceInCard');
+ // const corrective = card.children.find(
+ // (route) => route.name === 'InvoiceInCorrective'
+ // );
- corrective.meta.hidden = !isRectificative;
+ // corrective.meta.hidden = !isRectificative;
- next();
- },
+ // next();
+ // },
children: [
{
name: 'InvoiceInSummary',