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

View File

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