Ticket basic data #474

Merged
jsegarra merged 15 commits from :feature/TicketBasicData into dev 2024-06-25 20:28:01 +00:00
5 changed files with 29 additions and 14 deletions
Showing only changes of commit 5419bc4d52 - Show all commits

View File

@ -1,5 +1,6 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import isValidDate from 'filters/isValidDate'; import isValidDate from 'filters/isValidDate';
const props = defineProps({ const props = defineProps({
@ -24,6 +25,9 @@ const hover = ref(false);
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
const joinDateAndTime = (date, time) => { const joinDateAndTime = (date, time) => {
if (!date) { if (!date) {
return null; return null;
@ -91,6 +95,8 @@ const styleAttrs = computed(() => {
readonly readonly
:model-value="displayDate(value)" :model-value="displayDate(value)"
v-bind="{ ...$attrs, ...styleAttrs }" v-bind="{ ...$attrs, ...styleAttrs }"
:class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null"
@click="isPopupOpen = true" @click="isPopupOpen = true"
> >
<template #append> <template #append>

View File

@ -17,8 +17,9 @@ const props = defineProps({
default: false, default: false,
}, },
}); });
const { t } = useI18n();
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
const value = computed({ const value = computed({
get() { get() {
@ -71,6 +72,8 @@ const styleAttrs = computed(() => {
readonly readonly
:model-value="formatTime(value)" :model-value="formatTime(value)"
v-bind="{ ...$attrs, ...styleAttrs }" v-bind="{ ...$attrs, ...styleAttrs }"
:class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null"
@click="isPopupOpen = true" @click="isPopupOpen = true"
> >
<template #append> <template #append>

View File

@ -116,12 +116,12 @@ const totalDifference = computed(() => {
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0); return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
}); });
const showMovablecolumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : [])); const showMovablecolumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
const haveDifferences = computed(() => _ticketData.value.sale.haveDifferences); const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences);
const ticketHaveNegatives = () => { const ticketHaveNegatives = () => {
let _haveNegatives = false; let _haveNegatives = false;
let haveNotNegatives = false; let haveNotNegatives = false;
_ticketData.value.withoutNegatives = false; _ticketData.value.withoutNegatives = false;
_ticketData.value.sale.items.forEach((item) => { _ticketData.value?.sale?.items.forEach((item) => {
if (item.quantity > item.movable) _haveNegatives = true; if (item.quantity > item.movable) _haveNegatives = true;
else haveNotNegatives = true; else haveNotNegatives = true;
}); });

View File

@ -396,7 +396,11 @@ onMounted(() => onFormModelInit());
</QIcon> </QIcon>
</template> </template>
</VnSelect> </VnSelect>
<VnInput :label="t('basicData.alias')" v-model="formData.nickname" /> <VnInput

deberia ser requerido no? Quiero decir, le falta el *

deberia ser requerido no? Quiero decir, le falta el *

Revisar el resto de campos

Revisar el resto de campos

Añadido.

Commit: 54e3eb6f0d

Añadido. Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/54e3eb6f0d7de3726ffa6269e7d9c02b2b9faa5d
:label="t('basicData.alias')"
v-model="formData.nickname"
:required="true"
/>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md no-wrap"> <VnRow class="row q-gutter-md q-mb-md no-wrap">
<VnSelect <VnSelect
@ -417,7 +421,6 @@ onMounted(() => onFormModelInit());
:options="agenciesOptions" :options="agenciesOptions"
hide-selected hide-selected
map-options map-options
Review

No se ve el texto, sino el id del registro

No se ve el texto, sino el id del registro
Review

No se ve el name ya que no hay no existen zoneOptions para los registros cargados, es algo medio raro la verdad como esta planteado, ya que en salix si desplegas el input de zonas te va a aparecer que no hay resultados.
Y en lilium esto es un problema porque el QSelect utiliza las options para mapear el resultado en base al value.

No se ve el name ya que no hay no existen `zoneOptions` para los registros cargados, es algo medio raro la verdad como esta planteado, ya que en salix si desplegas el input de zonas te va a aparecer que no hay resultados. Y en lilium esto es un problema porque el `QSelect` utiliza las options para mapear el resultado en base al value.
:required="true"
@focus="agencyFetchRef.fetch()" @focus="agencyFetchRef.fetch()"
/> />
<VnSelect <VnSelect
@ -450,7 +453,11 @@ onMounted(() => onFormModelInit());
v-model="formData.shipped" v-model="formData.shipped"
:required="true" :required="true"
/> />
<VnInputTime :label="t('basicData.shippedHour')" v-model="formData.shipped" /> <VnInputTime
:label="t('basicData.shippedHour')"
v-model="formData.shipped"
:required="true"
/>
<VnInputDate <VnInputDate
:label="t('basicData.landed')" :label="t('basicData.landed')"
v-model="formData.landed" v-model="formData.landed"

View File

@ -156,7 +156,6 @@ onBeforeMount(async () => await getTicketData());
v-model="step" v-model="step"
ref="stepperRef" ref="stepperRef"
color="primary" color="primary"
header-nav
animated animated
keep-alive keep-alive
style="max-width: 800px; margin: auto" style="max-width: 800px; margin: auto"
@ -176,19 +175,19 @@ onBeforeMount(async () => await getTicketData());
/> />
</QStep> </QStep>
<template #navigation> <template #navigation>
<QStepperNavigation> <QStepperNavigation class="flex justify-between">
<QBtn <QBtn
@click="onNextStep()"
color="primary"
:label="step === 2 ? t('basicData.finalize') : t('basicData.next')"
/>
<QBtn
v-if="step > 1"
flat flat
color="primary" color="primary"
@click="stepperRef.previous()" @click="stepperRef.previous()"
:label="t('basicData.back')" :label="t('basicData.back')"
class="q-ml-sm" class="q-ml-sm"
:class="{ invisible: step === 1 }"
/>
<QBtn
@click="onNextStep()"
color="primary"
:label="step === 2 ? t('basicData.finalize') : t('basicData.next')"
/> />
</QStepperNavigation> </QStepperNavigation>
</template> </template>