#7897 - Merge master into test #668

Merged
carlosap merged 21 commits from master into test 2024-09-04 14:28:55 +00:00
3 changed files with 18 additions and 29 deletions
Showing only changes of commit 763cf2e345 - Show all commits

View File

@ -3,8 +3,8 @@ import VnCard from 'components/common/VnCard.vue';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import InvoiceInFilter from '../InvoiceInFilter.vue';
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
import axios from 'axios';
import { onBeforeRouteUpdate } from 'vue-router';
import { setRectificative } from '../composables/setRectificative';
const filter = {
include: [
@ -23,19 +23,7 @@ const filter = {
],
};
onBeforeRouteUpdate(async (to) => {
const card = to.matched.find((route) => route.name === 'InvoiceInCard');
const corrective = card.children.find(
(route) => route.name === 'InvoiceInCorrective'
);
const isRectificative = !!(
await axios.get('InvoiceInCorrections', {
params: { filter: { where: { correctingFk: to.params.id } } },
})
).data.length;
corrective.meta.hidden = !isRectificative;
});
onBeforeRouteUpdate(async (to) => await setRectificative(to));
</script>
<template>
<VnCard

View File

@ -0,0 +1,14 @@
import axios from 'axios';
export async function setRectificative(route) {
const card = route.matched.find((route) => route.name === 'InvoiceInCard');
const corrective = card.children.find(
(route) => route.name === 'InvoiceInCorrective'
);
corrective.meta.hidden = !(
await axios.get('InvoiceInCorrections', {
params: { filter: { where: { correctingFk: route.params.id } } },
})
).data.length;
}

View File

@ -1,6 +1,5 @@
import { RouterView } from 'vue-router';
import axios from 'axios';
import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
export default {
path: '/invoice-in',
name: 'InvoiceIn',
@ -65,19 +64,7 @@ export default {
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;
const card = to.matched.find((route) => route.name === 'InvoiceInCard');
const corrective = card.children.find(
(route) => route.name === 'InvoiceInCorrective'
);
corrective.meta.hidden = !isRectificative;
await setRectificative(to);
next();
},
children: [