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

View File

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

View File

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

View File

@ -396,7 +396,11 @@ onMounted(() => onFormModelInit());
</QIcon>
</template>
</VnSelect>
<VnInput :label="t('basicData.alias')" v-model="formData.nickname" />
<VnInput
:label="t('basicData.alias')"
v-model="formData.nickname"
:required="true"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md no-wrap">
<VnSelect
@ -417,7 +421,6 @@ onMounted(() => onFormModelInit());
:options="agenciesOptions"
hide-selected
map-options
:required="true"
@focus="agencyFetchRef.fetch()"
/>
<VnSelect
@ -450,7 +453,11 @@ onMounted(() => onFormModelInit());
v-model="formData.shipped"
:required="true"
/>
<VnInputTime :label="t('basicData.shippedHour')" v-model="formData.shipped" />
<VnInputTime
:label="t('basicData.shippedHour')"
v-model="formData.shipped"
:required="true"
/>
<VnInputDate
:label="t('basicData.landed')"
v-model="formData.landed"

View File

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