Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8277-createEntryControl
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-04-17 10:30:36 +02:00
commit 3d573fc871
10 changed files with 46 additions and 65 deletions

View File

@ -83,7 +83,7 @@ const isLoading = ref(false);
const hasChanges = ref(false);
const originalData = ref();
const vnPaginateRef = ref();
const formData = ref([]);
const formData = ref();
const saveButtonRef = ref(null);
const watchChanges = ref();
const formUrl = computed(() => $props.url);
@ -298,6 +298,10 @@ watch(formUrl, async () => {
});
</script>
<template>
<SkeletonTable
v-if="!formData && ($attrs['auto-load'] === '' || $attrs['auto-load'])"
:columns="$attrs.columns?.length"
/>
<VnPaginate
:url="url"
:limit="limit"
@ -316,10 +320,6 @@ watch(formUrl, async () => {
></slot>
</template>
</VnPaginate>
<SkeletonTable
v-if="!formData && $attrs.autoLoad"
:columns="$attrs.columns?.length"
/>
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar">
<QBtnGroup push style="column-gap: 10px">
<slot name="moreBeforeActions" />

View File

@ -68,19 +68,19 @@ const formatDate = () => {
if (!value || value === model.value) {
textColor.value = '';
return;
}
}
const regex =
/^([0]?[1-9]|[12][0-9]|3[01])([./-])([0]?[1-9]|1[0-2])([./-](\d{1,4}))?$/;
if (!regex.test(value)){
if (!regex.test(value)) {
textColor.value = errColor;
return;
}
}
value = value.replace(/[.-]/g, '/');
const parts = value.split('/');
if (parts.length < 2) {
textColor.value = errColor;
return;
return;
}
let [day, month, year] = parts;
@ -107,13 +107,13 @@ const formatDate = () => {
let isoCandidate = `${year}/${month}/${day}`;
isoCandidate = date.formatDate(
new Date(isoCandidate).toISOString(),
'YYYY-MM-DDTHH:mm:ss.SSSZ',
);
new Date(isoCandidate).toISOString(),
'YYYY-MM-DDTHH:mm:ss.SSSZ',
);
const [isoYear, isoMonth, isoDay] = isoCandidate.split('-').map((e) => parseInt(e));
const parsedDate = new Date(isoYear, isoMonth - 1, isoDay);
const isValidDate =
const isValidDate =
parsedDate instanceof Date &&
!isNaN(parsedDate) &&
parsedDate.getFullYear() === parseInt(year) &&
@ -158,7 +158,6 @@ const handleEnter = (event) => {
<template>
<div @mouseover="hover = true" @mouseleave="hover = false">
{{ console.log($q) }}
<QInput
ref="vnInputDateRef"
v-model="inputValue"
@ -168,7 +167,7 @@ const handleEnter = (event) => {
:class="{ required: isRequired }"
:rules="mixinRules"
:clearable="false"
:input-style="{color: textColor}"
:input-style="{ color: textColor }"
@click="isPopupOpen = !isPopupOpen"
@keydown="isPopupOpen = false"
@blur="formatDate"

View File

@ -152,16 +152,6 @@ const value = computed({
},
});
const arrayDataKey =
$props.dataKey ??
($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
const arrayData = useArrayData(arrayDataKey, {
url: $props.url,
searchUrl: false,
mapKey: $attrs['map-key'],
});
const computedSortBy = computed(() => {
return $props.sortBy || $props.optionLabel + ' ASC';
});
@ -186,6 +176,16 @@ onMounted(() => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
const arrayDataKey =
$props.dataKey ??
($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
const arrayData = useArrayData(arrayDataKey, {
url: $props.url,
searchUrl: false,
mapKey: $attrs['map-key'],
});
const someIsLoading = computed(() => isLoading.value || arrayData.isLoading);
function findKeyInOptions() {
if (!$props.options) return;
return filter($props.modelValue, $props.options)?.length;
@ -366,7 +366,8 @@ function getCaption(opt) {
virtual-scroll-slice-size="options.length"
hide-bottom-space
:input-debounce="useURL ? '300' : '0'"
:loading="isLoading"
:loading="someIsLoading"
:disable="someIsLoading"
@virtual-scroll="onScroll"
@keydown="handleKeyDown"
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"

View File

@ -44,8 +44,7 @@ onBeforeMount(async () => {
});
// It enables to load data only once if the module is the same as the dataKey
if (!isSameDataKey.value || !route.params.id || $props.id !== route.params.id)
await getData();
if (!isSameDataKey.value || !route.params.id) await getData();
watch(
() => [$props.url, $props.filter],
async () => {

View File

@ -89,7 +89,6 @@ const insertTag = (rows) => {
:default-remove="false"
:user-filter="{
fields: ['id', 'itemFk', 'tagFk', 'value', 'priority'],
where: { itemFk: route.params.id },
include: {
relation: 'tag',
scope: {
@ -97,6 +96,7 @@ const insertTag = (rows) => {
},
},
}"
:filter="{ where: { itemFk: route.params.id } }"
order="priority"
auto-load
@on-fetch="onItemTagsFetched"

View File

@ -11,26 +11,19 @@ export function cloneItem() {
const router = useRouter();
const cloneItem = async (entityId) => {
const { id } = entityId;
try {
const { data } = await axios.post(`Items/${id ?? entityId}/clone`);
router.push({ name: 'ItemTags', params: { id: data.id } });
} catch (err) {
console.error('Error cloning item');
}
const { data } = await axios.post(`Items/${id ?? entityId}/clone`);
router.push({ name: 'ItemTags', params: { id: data.id } });
};
const openCloneDialog = async (entityId) => {
quasar
.dialog({
component: VnConfirm,
componentProps: {
title: t('item.descriptor.clone.title'),
message: t('item.descriptor.clone.subTitle'),
},
})
.onOk(async () => {
await cloneItem(entityId);
});
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('item.descriptor.clone.title'),
message: t('item.descriptor.clone.subTitle'),
promise: () => cloneItem(entityId),
},
});
};
return { openCloneDialog };
}

View File

@ -11,10 +11,10 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute();
const { t } = useI18n();
const arrayData = useArrayData('Supplier');
const sageTaxTypesOptions = ref([]);
const sageWithholdingsOptions = ref([]);
const sageTransactionTypesOptions = ref([]);
@ -89,6 +89,7 @@ function handleLocation(data, location) {
}"
auto-load
:clear-store-on-unmount="false"
@on-data-saved="arrayData.fetch({})"
>
<template #form="{ data, validate }">
<VnRow>

View File

@ -42,11 +42,7 @@ const groupedStates = ref([]);
auto-load
/>
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:unremovableParams="['from', 'to']"
>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
@ -188,16 +184,6 @@ const groupedStates = ref([]);
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.problems"
@update:model-value="searchFn()"
:label="t('With problems')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection v-if="!provinces">
<QSkeleton type="QInput" class="full-width" />

View File

@ -128,6 +128,7 @@ const columns = computed(() => [
columnFilter: false,
label: t('ticketList.hour'),
format: (row) => toTimeFormat(row.shipped),
orderBy: false,
},
{
align: 'left',
@ -136,6 +137,7 @@ const columns = computed(() => [
columnFilter: false,
label: t('ticketList.closure'),
format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)),
orderBy: false,
},
{
align: 'left',
@ -477,7 +479,7 @@ function setReference(data) {
prefix="card"
:array-data-props="{
url: 'Tickets/filter',
order: ['shipped DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id'],
order: ['shipped DESC', 'id DESC'],
exprBuilder,
}"
>

View File

@ -1,5 +1,5 @@
import '../commands.js';
describe('EntryDescriptor', () => {
describe.skip('EntryDescriptor', () => {
beforeEach(() => {
cy.login('buyer');
cy.visit(`/#/entry/list`);