Merge branch 'feature/TicketBasicData' of https://gitea.verdnatura.es/hyervoni/salix-front-mindshore into feature/TicketBasicData
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-06-25 22:27:21 +02:00
commit 5419bc4d52
5 changed files with 29 additions and 14 deletions

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
: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
: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>