Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix-front into dev
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-04-17 16:34:06 +02:00
commit ebd02987b9
1 changed files with 21 additions and 44 deletions

View File

@ -1,10 +1,9 @@
<script setup>
import { onMounted, ref, computed, onUpdated } from 'vue';
import { ref, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { getUrl } from 'src/composables/getUrl';
import { useRole } from 'src/composables/useRole';
import { dashIfEmpty } from 'src/filters';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
@ -28,12 +27,6 @@ const entityId = computed(() => $props.id || route.params.id);
const summaryRef = ref();
const supplier = ref();
const supplierUrl = ref();
onMounted(async () => {
await roleState.fetch();
supplierUrl.value = (await getUrl('supplier/')) + entityId.value;
});
async function setData(data) {
if (data) {
@ -44,6 +37,10 @@ async function setData(data) {
const isAdministrative = computed(() => {
return roleState.hasAny(['administrative']);
});
function getUrl(section) {
return isAdministrative.value && `#/supplier/${entityId.value}/${section}`;
}
</script>
<template>
@ -58,15 +55,10 @@ const isAdministrative = computed(() => {
<template #body>
<QCard class="vn-one">
<router-link
v-if="isAdministrative"
class="header link"
:to="{ name: 'SupplierBasicData', params: { id: entityId } }"
>
{{ t('globals.summary.basicData') }}
<QIcon name="open_in_new" />
</router-link>
<span v-else> {{ t('globals.summary.basicData') }}</span>
<VnTitle
:url="getUrl('basic-data')"
:text="t('globals.summary.basicData')"
/>
<VnLv label="Id" :value="supplier.id" />
<VnLv label="Alias" :value="supplier.nickname" />
<VnLv :label="t('supplier.summary.responsible')">
@ -94,15 +86,10 @@ const isAdministrative = computed(() => {
/>
</QCard>
<QCard class="vn-one">
<router-link
v-if="isAdministrative"
class="header link"
:to="{ name: 'SupplierBillingData', params: { id: entityId } }"
>
{{ t('supplier.summary.billingData') }}
<QIcon name="open_in_new" />
</router-link>
<span v-else> {{ t('supplier.summary.billingData') }}</span>
<VnTitle
:url="getUrl('billing-data')"
:text="t('supplier.summary.billingData')"
/>
<VnLv
:label="t('supplier.summary.payMethod')"
:value="supplier.payMethod?.name"
@ -117,15 +104,10 @@ const isAdministrative = computed(() => {
<VnLv :label="t('supplier.summary.account')" :value="supplier.account" />
</QCard>
<QCard class="vn-one">
<router-link
v-if="isAdministrative"
class="header link"
:to="{ name: 'SupplierFiscalData', params: { id: entityId } }"
>
{{ t('supplier.summary.fiscalData') }}
<QIcon name="open_in_new" />
</router-link>
<span v-else> {{ t('supplier.summary.fiscalData') }}</span>
<VnTitle
:url="getUrl('fiscal-data')"
:text="t('supplier.summary.fiscalData')"
/>
<VnLv
:label="t('supplier.summary.sageTaxType')"
:value="supplier.sageTaxType?.vat"
@ -152,15 +134,10 @@ const isAdministrative = computed(() => {
/>
</QCard>
<QCard class="vn-one">
<router-link
v-if="isAdministrative"
class="header link"
:to="{ name: 'SupplierFiscalData', params: { id: entityId } }"
>
{{ t('supplier.summary.fiscalAddress') }}
<QIcon name="open_in_new" />
</router-link>
<span v-else> {{ t('supplier.summary.fiscalAddress') }}</span>
<VnTitle
:url="getUrl('fiscal-data')"
:text="t('supplier.summary.fiscalAddress')"
/>
<VnLv :label="t('supplier.summary.socialName')" :value="supplier.name" />
<VnLv :label="t('supplier.summary.taxNumber')" :value="supplier.nif" />
<VnLv :label="t('supplier.summary.street')" :value="supplier.street" />