refactor: refs #6919 update model naming and default values in Ticket components

This commit is contained in:
Jorge Penadés 2025-01-07 16:18:59 +01:00
parent 793084eb74
commit 43fc2e2312
3 changed files with 13 additions and 6 deletions

View File

@ -10,7 +10,7 @@ import { useStateStore } from 'stores/useStateStore';
import { toCurrency } from 'filters/index'; import { toCurrency } from 'filters/index';
import { useRole } from 'src/composables/useRole'; import { useRole } from 'src/composables/useRole';
const haveNegatives = defineModel('haveNegatives', { type: Boolean, required: true }); const haveNegatives = defineModel('have-negatives', { type: Boolean, required: true });
const formData = defineModel({ type: Object, required: true }); const formData = defineModel({ type: Object, required: true });
const stateStore = useStateStore(); const stateStore = useStateStore();

View File

@ -18,7 +18,7 @@ const stepperRef = ref(null);
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const step = ref(1); const step = ref(1);
const haveNegatives = ref(false); const haveNegatives = ref(true);
const ticket = computed(() => useArrayData('Ticket').store?.data); const ticket = computed(() => useArrayData('Ticket').store?.data);
@ -105,8 +105,9 @@ const onNextStep = async () => {
} }
}; };
</script> </script>
<template v-if="ticket"> <template>
<QStepper <QStepper
v-if="ticket"
v-model="step" v-model="step"
ref="stepperRef" ref="stepperRef"
color="primary" color="primary"
@ -118,10 +119,10 @@ const onNextStep = async () => {
}" }"
> >
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1"> <QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
<TicketBasicDataForm v-if="ticket" v-model="ticket" /> <TicketBasicDataForm v-model="ticket" />
</QStep> </QStep>
<QStep :name="2" :title="t('basicData.priceDifference')"> <QStep :name="2" :title="t('basicData.priceDifference')">
<TicketBasicData :form-data="ticket" v-model:haveNegatives="haveNegatives" /> <TicketBasicData v-model="ticket" v-model:have-negatives="haveNegatives" />
</QStep> </QStep>
<template #navigation> <template #navigation>
<QStepperNavigation class="flex justify-between"> <QStepperNavigation class="flex justify-between">

View File

@ -1,7 +1,13 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCardBeta from 'components/common/VnCardBeta.vue';
import TicketDescriptor from './TicketDescriptor.vue'; import TicketDescriptor from './TicketDescriptor.vue';
import filter from './TicketFilter.js';
</script> </script>
<template> <template>
<VnCardBeta data-key="Ticket" base-url="Tickets" :descriptor="TicketDescriptor" /> <VnCardBeta
data-key="Ticket"
base-url="Tickets"
:descriptor="TicketDescriptor"
:filter="filter"
/>
</template> </template>