fix: refs #8120 ticket descriptor & summary
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-01-23 16:40:22 +01:00
parent 4c7a730d08
commit 3453e1007b
2 changed files with 21 additions and 16 deletions

View File

@ -16,6 +16,10 @@ const $props = defineProps({
required: false,
default: null,
},
summary: {
type: Object,
default: null,
},
});
const route = useRoute();
@ -116,7 +120,9 @@ const setData = (entity) => {
:title="data.title"
:subtitle="data.subtitle"
@on-fetch="setData"
:summary="$props.summary"
data-key="ticketData"
width="lg-width"
>
<template #menu="{ entity }">
<TicketDescriptorMenu :ticket="entity" />
@ -162,7 +168,7 @@ const setData = (entity) => {
<VnLv :label="t('globals.alias')" :value="entity.nickname" />
</template>
<template #icons="{ entity }">
<QCardActions class="q-gutter-x-xs">
<QCardActions class="q-gutter-x-md">
<QIcon
v-if="entity.client.isActive == false"
name="vn:disabled"
@ -206,7 +212,7 @@ const setData = (entity) => {
</QCardActions>
</template>
<template #actions="{ entity }">
<QCardActions>
<QCardActions class="flex justify-center" style="padding-inline: 0">
<QBtn
size="md"
icon="vn:client"

View File

@ -6,7 +6,6 @@ import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { dashIfEmpty, toDate, toCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue';
import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue';
@ -29,15 +28,14 @@ const { t } = useI18n();
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const entityId = computed(() => $props.id || route.params.id);
const summaryRef = ref();
const ticket = computed(() => summaryRef.value?.entity);
const summary = ref();
const ticket = computed(() => summary.value?.entity);
const editableStates = ref([]);
const ticketUrl = ref();
const grafanaUrl = 'https://grafana.verdnatura.es';
@ -76,26 +74,27 @@ async function changeState(value) {
};
await axios.post(`Tickets/state`, formData);
notify('globals.dataSaved', 'positive');
summaryRef.value?.fetch();
summary.value?.fetch();
descriptorData.fetch({});
}
function toTicketUrl(section) {
return '#/ticket/' + entityId.value + '/' + section;
}
onMounted(async () => {
const filter = { fields: ['code', 'name', 'id', 'alertLevel'] };
const params = { filter: JSON.stringify(filter) };
editableStates.value = (await axios.get('States/editableStates', { params }))?.data;
});
</script>
<template>
<FetchData
url="States/editableStates"
:filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }"
auto-load
@on-fetch="(data) => (editableStates = data)"
/>
<CardSummary
ref="summaryRef"
ref="summary"
:url="`Tickets/${entityId}/summary`"
data-key="TicketSummary"
v-bind="$attrs.width"
>
<template #header-left>
<VnToSummary
@ -207,7 +206,7 @@ function toTicketUrl(section) {
</VnLv>
<VnLv :label="t('globals.weight')" :value="dashIfEmpty(entity.weight)" />
</QCard>
<QCard class="vn-one" style="flex: 2 1">
<QCard class="vn-one">
<VnTitle
:url="toTicketUrl('basic-data')"
:text="t('globals.summary.basicData')"
@ -454,7 +453,7 @@ function toTicketUrl(section) {
toCurrency(
props.row.quantity *
props.row.price *
((100 - props.row.discount) / 100)
((100 - props.row.discount) / 100),
)
}}
</QTd>