Merge pull request '#8120: Compact summaryPopup' (!1200) from 8120-CompactSummaryPopup into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1200
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Jon Elias 2025-01-27 08:54:07 +00:00
commit 2027c365fa
11 changed files with 61 additions and 22 deletions

View File

@ -10,6 +10,10 @@ defineProps({
type: Object, type: Object,
required: true, required: true,
}, },
width: {
type: String,
default: 'md-width',
},
}); });
defineEmits([...useDialogPluginComponent.emits]); defineEmits([...useDialogPluginComponent.emits]);
@ -17,7 +21,19 @@ defineEmits([...useDialogPluginComponent.emits]);
const { dialogRef, onDialogHide } = useDialogPluginComponent(); const { dialogRef, onDialogHide } = useDialogPluginComponent();
</script> </script>
<template> <template>
<QDialog ref="dialogRef" @hide="onDialogHide" full-width> <QDialog ref="dialogRef" @hide="onDialogHide">
<component :is="summary" :id="id" /> <component :is="summary" :id="id" :class="width" />
</QDialog> </QDialog>
</template> </template>
<style lang="scss" scoped>
.md-width {
max-width: $width-md;
}
.lg-width {
max-width: $width-lg;
}
.xlg-width {
max-width: $width-xl;
}
</style>

View File

@ -37,6 +37,10 @@ const $props = defineProps({
type: Object, type: Object,
default: null, default: null,
}, },
width: {
type: String,
default: 'md-width',
},
}); });
const state = useState(); const state = useState();
@ -128,9 +132,8 @@ const toModule = computed(() =>
</QTooltip> </QTooltip>
</QBtn></slot </QBtn></slot
> >
<QBtn <QBtn
@click.stop="viewSummary(entity.id, $props.summary)" @click.stop="viewSummary(entity.id, $props.summary, $props.width)"
round round
flat flat
dense dense

View File

@ -4,10 +4,10 @@ import { useQuasar } from 'quasar';
export function useSummaryDialog() { export function useSummaryDialog() {
const quasar = useQuasar(); const quasar = useQuasar();
function viewSummary(id, summary) { function viewSummary(id, summary, width) {
quasar.dialog({ quasar.dialog({
component: VnSummaryDialog, component: VnSummaryDialog,
componentProps: { id, summary }, componentProps: { id, summary, width },
}); });
} }

View File

@ -33,6 +33,11 @@ $dark-shadow-color: black;
$layout-shadow-dark: 0 0 10px 2px #00000033, 0 0px 10px #0000003d; $layout-shadow-dark: 0 0 10px 2px #00000033, 0 0px 10px #0000003d;
$spacing-md: 16px; $spacing-md: 16px;
$color-font-secondary: #777; $color-font-secondary: #777;
$width-xs: 400px;
$width-sm: 544px;
$width-md: 800px;
$width-lg: 1280px;
$width-xl: 1600px;
.bg-success { .bg-success {
background-color: $positive; background-color: $positive;
} }

View File

@ -53,6 +53,7 @@ const debtWarning = computed(() => {
@on-fetch="setData" @on-fetch="setData"
:summary="$props.summary" :summary="$props.summary"
data-key="customer" data-key="customer"
width="lg-width"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<CustomerDescriptorMenu :customer="entity" /> <CustomerDescriptorMenu :customer="entity" />

View File

@ -61,6 +61,7 @@ const getEntryRedirectionFilter = (entry) => {
:filter="filter" :filter="filter"
title="supplier.nickname" title="supplier.nickname"
data-key="Entry" data-key="Entry"
width="lg-width"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<EntryDescriptorMenu :id="entity.id" /> <EntryDescriptorMenu :id="entity.id" />

View File

@ -117,6 +117,7 @@ async function setInvoiceCorrection(id) {
:url="`InvoiceIns/${entityId}`" :url="`InvoiceIns/${entityId}`"
:filter="filter" :filter="filter"
title="supplierRef" title="supplierRef"
width="xlg-width"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<InvoiceInDescriptorMenu :invoice="entity" /> <InvoiceInDescriptorMenu :invoice="entity" />

View File

@ -62,6 +62,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
:subtitle="data.subtitle" :subtitle="data.subtitle"
@on-fetch="setData" @on-fetch="setData"
data-key="invoiceOutData" data-key="invoiceOutData"
width="lg-width"
> >
<template #menu="{ entity, menuRef }"> <template #menu="{ entity, menuRef }">
<InvoiceOutDescriptorMenu :invoice-out-data="entity" :menu-ref="menuRef" /> <InvoiceOutDescriptorMenu :invoice-out-data="entity" :menu-ref="menuRef" />

View File

@ -76,6 +76,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
:subtitle="data.subtitle" :subtitle="data.subtitle"
data-key="routeData" data-key="routeData"
@on-fetch="setData" @on-fetch="setData"
width="lg-width"
> >
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('Date')" :value="toDate(entity?.dated)" /> <VnLv :label="t('Date')" :value="toDate(entity?.dated)" />

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();
@ -102,6 +106,10 @@ const data = ref(useCardDescription());
function ticketFilter(ticket) { function ticketFilter(ticket) {
return JSON.stringify({ clientFk: ticket.clientFk }); return JSON.stringify({ clientFk: ticket.clientFk });
} }
const setData = (entity) => {
data.value = useCardDescription(entity.ref, entity.id);
};
</script> </script>
<template> <template>
@ -111,7 +119,10 @@ function ticketFilter(ticket) {
:filter="filter" :filter="filter"
:title="data.title" :title="data.title"
:subtitle="data.subtitle" :subtitle="data.subtitle"
@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" />
@ -157,7 +168,7 @@ function ticketFilter(ticket) {
<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"
@ -201,7 +212,7 @@ function ticketFilter(ticket) {
</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>