Merge branch 'dev' of https: refs #8388//gitea.verdnatura.es/verdnatura/salix-front into 8388-fineTunningInvoiceIn
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
cda333fabd
|
@ -0,0 +1,136 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useClipboard } from 'src/composables/useClipboard';
|
||||||
|
|
||||||
|
const { copyText } = useClipboard();
|
||||||
|
const target = ref();
|
||||||
|
const qmenuRef = ref();
|
||||||
|
const colField = ref();
|
||||||
|
let colValue = '';
|
||||||
|
let textValue = '';
|
||||||
|
|
||||||
|
defineExpose({ handler });
|
||||||
|
|
||||||
|
const arrayData = defineModel({
|
||||||
|
type: Object,
|
||||||
|
});
|
||||||
|
|
||||||
|
function handler(event) {
|
||||||
|
const clickedElement = event.target.closest('td');
|
||||||
|
if (!clickedElement) return;
|
||||||
|
|
||||||
|
target.value = event.target;
|
||||||
|
qmenuRef.value.show();
|
||||||
|
colField.value = clickedElement.getAttribute('data-col-field');
|
||||||
|
colValue = isNaN(+clickedElement.getAttribute('data-col-value'))
|
||||||
|
? clickedElement.getAttribute('data-col-value')
|
||||||
|
: +clickedElement.getAttribute('data-col-value');
|
||||||
|
textValue = getDeepestText(clickedElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDeepestText(node) {
|
||||||
|
const walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, {
|
||||||
|
acceptNode: (textNode) => {
|
||||||
|
return textNode.nodeValue.trim()
|
||||||
|
? NodeFilter.FILTER_ACCEPT
|
||||||
|
: NodeFilter.FILTER_REJECT;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
let lastText = '';
|
||||||
|
while (walker.nextNode()) {
|
||||||
|
lastText = walker.currentNode.nodeValue.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastText;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function selectionFilter() {
|
||||||
|
await arrayData.value.addFilter({ params: { [colField.value]: colValue } });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function selectionExclude() {
|
||||||
|
await arrayData.value.addFilter({
|
||||||
|
params: { [colField.value]: { neq: colValue } },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function selectionRemoveFilter() {
|
||||||
|
await arrayData.value.addFilter({ params: { [colField.value]: undefined } });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function removeAllFilters() {
|
||||||
|
await arrayData.value.applyFilter({ params: {} });
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyValue() {
|
||||||
|
copyText(textValue, {
|
||||||
|
component: {
|
||||||
|
copyValue: textValue,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<QMenu
|
||||||
|
ref="qmenuRef"
|
||||||
|
:target
|
||||||
|
class="column q-pa-sm justify-left"
|
||||||
|
auto-close
|
||||||
|
no-parent-event
|
||||||
|
>
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
icon="filter_list"
|
||||||
|
@click="selectionFilter()"
|
||||||
|
class="text-weight-regular"
|
||||||
|
align="left"
|
||||||
|
:label="$t('Filter by selection')"
|
||||||
|
no-caps
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
icon="dangerous"
|
||||||
|
@click="selectionExclude()"
|
||||||
|
class="text-weight-regular"
|
||||||
|
align="left"
|
||||||
|
:label="$t('Exclude selection')"
|
||||||
|
no-caps
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
icon="filter_list_off"
|
||||||
|
@click="selectionRemoveFilter()"
|
||||||
|
class="text-weight-regular"
|
||||||
|
align="left"
|
||||||
|
:label="$t('Remove filter')"
|
||||||
|
no-caps
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
icon="filter_list_off"
|
||||||
|
@click="removeAllFilters()"
|
||||||
|
class="text-weight-regular"
|
||||||
|
align="left"
|
||||||
|
:label="$t('Remove all filters')"
|
||||||
|
no-caps
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
icon="file_copy"
|
||||||
|
@click="copyValue()"
|
||||||
|
class="text-weight-regular"
|
||||||
|
align="left"
|
||||||
|
:label="$t('Copy value')"
|
||||||
|
no-caps
|
||||||
|
/>
|
||||||
|
</QMenu>
|
||||||
|
</template>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Filter by selection: Filtro por selección
|
||||||
|
Exclude selection: Excluir selección
|
||||||
|
Remove filter: Quitar filtro por selección
|
||||||
|
Remove all filters: Eliminar todos los filtros
|
||||||
|
Copy value: Copiar valor
|
||||||
|
</i18n>
|
|
@ -136,6 +136,9 @@ async function addFilter(value, name) {
|
||||||
value = value === '' ? undefined : value;
|
value = value === '' ? undefined : value;
|
||||||
let field = columnFilter.value?.name ?? $props.column.name ?? name;
|
let field = columnFilter.value?.name ?? $props.column.name ?? name;
|
||||||
|
|
||||||
|
delete arrayData.store?.userParams?.[field];
|
||||||
|
delete arrayData.store?.filter?.where?.[field];
|
||||||
|
|
||||||
if (columnFilter.value?.inWhere) {
|
if (columnFilter.value?.inWhere) {
|
||||||
if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field;
|
if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field;
|
||||||
return await arrayData.addFilterWhere({ [field]: value });
|
return await arrayData.addFilterWhere({ [field]: value });
|
||||||
|
|
|
@ -33,6 +33,7 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||||
import VnTableFilter from './VnTableFilter.vue';
|
import VnTableFilter from './VnTableFilter.vue';
|
||||||
import { getColAlign } from 'src/composables/getColAlign';
|
import { getColAlign } from 'src/composables/getColAlign';
|
||||||
import RightMenu from '../common/RightMenu.vue';
|
import RightMenu from '../common/RightMenu.vue';
|
||||||
|
import VnContextMenu from './VnContextMenu.vue';
|
||||||
import VnScroll from '../common/VnScroll.vue';
|
import VnScroll from '../common/VnScroll.vue';
|
||||||
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
|
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
|
||||||
import VnCheckbox from '../common/VnCheckbox.vue';
|
import VnCheckbox from '../common/VnCheckbox.vue';
|
||||||
|
@ -182,8 +183,9 @@ const app = inject('app');
|
||||||
const tableHeight = useTableHeight();
|
const tableHeight = useTableHeight();
|
||||||
const vnScrollRef = ref(null);
|
const vnScrollRef = ref(null);
|
||||||
|
|
||||||
const editingRow = ref(null);
|
const editingRow = ref();
|
||||||
const editingField = ref(null);
|
const editingField = ref();
|
||||||
|
const contextMenuRef = ref({});
|
||||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||||
const selectRegex = /select/;
|
const selectRegex = /select/;
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
|
@ -220,6 +222,10 @@ onBeforeMount(() => {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
||||||
|
document.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
contextMenuRef.value.handler(event);
|
||||||
|
});
|
||||||
mode.value =
|
mode.value =
|
||||||
quasar.platform.is.mobile && !$props.disableOption?.card
|
quasar.platform.is.mobile && !$props.disableOption?.card
|
||||||
? CARD_MODE
|
? CARD_MODE
|
||||||
|
@ -243,6 +249,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
onUnmounted(async () => {
|
onUnmounted(async () => {
|
||||||
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
||||||
|
document.removeEventListener('contextmenu', {});
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -852,6 +859,7 @@ const handleHeaderSelection = (evt, data) => {
|
||||||
]"
|
]"
|
||||||
:data-row-index="rowIndex"
|
:data-row-index="rowIndex"
|
||||||
:data-col-field="col?.name"
|
:data-col-field="col?.name"
|
||||||
|
:data-col-value="row?.[col?.name]"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="no-padding no-margin"
|
class="no-padding no-margin"
|
||||||
|
@ -1162,6 +1170,7 @@ const handleHeaderSelection = (evt, data) => {
|
||||||
</template>
|
</template>
|
||||||
</FormModelPopup>
|
</FormModelPopup>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
|
<VnContextMenu ref="contextMenuRef" v-model="arrayData" />
|
||||||
<VnScroll
|
<VnScroll
|
||||||
ref="vnScrollRef"
|
ref="vnScrollRef"
|
||||||
v-if="isTableMode"
|
v-if="isTableMode"
|
||||||
|
|
|
@ -77,7 +77,12 @@ function columnName(col) {
|
||||||
<template #tags="{ tag, formatFn, getLocale }">
|
<template #tags="{ tag, formatFn, getLocale }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ getLocale(`${tag.label}`) }}: </strong>
|
<strong>{{ getLocale(`${tag.label}`) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span
|
||||||
|
:class="{
|
||||||
|
'text-decoration-line-through': typeof chip === 'object',
|
||||||
|
}"
|
||||||
|
>{{ formatFn(tag) }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
|
|
|
@ -124,6 +124,7 @@ const {
|
||||||
} = toRefs($props);
|
} = toRefs($props);
|
||||||
const myOptions = ref([]);
|
const myOptions = ref([]);
|
||||||
const myOptionsOriginal = ref([]);
|
const myOptionsOriginal = ref([]);
|
||||||
|
const myOptionsMap = ref(new Map());
|
||||||
const vnSelectRef = ref();
|
const vnSelectRef = ref();
|
||||||
const lastVal = ref();
|
const lastVal = ref();
|
||||||
const noOneText = t('globals.noOne');
|
const noOneText = t('globals.noOne');
|
||||||
|
@ -140,7 +141,7 @@ const styleAttrs = computed(() => {
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
});
|
});
|
||||||
const isLoading = ref(false);
|
const hasFocus = ref(false);
|
||||||
const useURL = computed(() => $props.url);
|
const useURL = computed(() => $props.url);
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -166,6 +167,10 @@ const computedSortBy = computed(() => {
|
||||||
return $props.sortBy || $props.optionLabel + ' ASC';
|
return $props.sortBy || $props.optionLabel + ' ASC';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const valueIsObject = computed(
|
||||||
|
() => modelValue.value && typeof modelValue.value == 'object',
|
||||||
|
);
|
||||||
|
|
||||||
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
||||||
|
|
||||||
watch(options, (newValue) => {
|
watch(options, (newValue) => {
|
||||||
|
@ -173,12 +178,22 @@ watch(options, (newValue) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(modelValue, async (newValue) => {
|
watch(modelValue, async (newValue) => {
|
||||||
|
if (newValue?.neq) newValue = newValue.neq;
|
||||||
if (!myOptions?.value?.some((option) => option[optionValue.value] == newValue))
|
if (!myOptions?.value?.some((option) => option[optionValue.value] == newValue))
|
||||||
await fetchFilter(newValue);
|
await fetchFilter(newValue);
|
||||||
|
|
||||||
if ($props.noOne) myOptions.value.unshift(noOneOpt.value);
|
if ($props.noOne) myOptions.value.unshift(noOneOpt.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => myOptionsOriginal.value,
|
||||||
|
(newValue) => {
|
||||||
|
for (const item of newValue) {
|
||||||
|
myOptionsMap.value.set(item[optionValue.value], item);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setOptions(options.value);
|
setOptions(options.value);
|
||||||
if (useURL.value && $props.modelValue && !findKeyInOptions())
|
if (useURL.value && $props.modelValue && !findKeyInOptions())
|
||||||
|
@ -187,7 +202,7 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const someIsLoading = computed(
|
const someIsLoading = computed(
|
||||||
() => (isLoading.value || !!arrayData?.isLoading?.value) && !isMenuOpened.value,
|
() => !!arrayData?.isLoading?.value && !isMenuOpened.value,
|
||||||
);
|
);
|
||||||
function findKeyInOptions() {
|
function findKeyInOptions() {
|
||||||
if (!$props.options) return;
|
if (!$props.options) return;
|
||||||
|
@ -224,6 +239,9 @@ function filter(val, options) {
|
||||||
|
|
||||||
async function fetchFilter(val) {
|
async function fetchFilter(val) {
|
||||||
if (!$props.url) return;
|
if (!$props.url) return;
|
||||||
|
if (val && typeof val == 'object') {
|
||||||
|
val = val.neq;
|
||||||
|
}
|
||||||
|
|
||||||
const { fields, include, limit } = $props;
|
const { fields, include, limit } = $props;
|
||||||
const sortBy = computedSortBy.value;
|
const sortBy = computedSortBy.value;
|
||||||
|
@ -298,13 +316,11 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
if (from === 0 && index === 0) return;
|
if (from === 0 && index === 0) return;
|
||||||
if (!useURL.value && !$props.fetchRef) return;
|
if (!useURL.value && !$props.fetchRef) return;
|
||||||
if (direction === 'decrease') return;
|
if (direction === 'decrease') return;
|
||||||
if (to === lastIndex && arrayData.store.hasMoreData && !isLoading.value) {
|
if (to === lastIndex && arrayData.store.hasMoreData) {
|
||||||
isLoading.value = true;
|
|
||||||
await arrayData.loadMore();
|
await arrayData.loadMore();
|
||||||
setOptions(arrayData.store.data);
|
setOptions(arrayData.store.data);
|
||||||
vnSelectRef.value.scrollTo(lastIndex);
|
vnSelectRef.value.scrollTo(lastIndex);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
isLoading.value = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,22 +363,30 @@ function getCaption(opt) {
|
||||||
if (optionCaption.value === false) return;
|
if (optionCaption.value === false) return;
|
||||||
return opt[optionCaption.value] || opt[optionValue.value];
|
return opt[optionCaption.value] || opt[optionValue.value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOptionLabel(property) {
|
||||||
|
if (!myOptionsMap.value.size) return;
|
||||||
|
let value = modelValue.value;
|
||||||
|
if (property) {
|
||||||
|
value = modelValue.value[property];
|
||||||
|
}
|
||||||
|
return myOptionsMap.value.get(value)?.[optionLabel.value];
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QSelect
|
<QSelect
|
||||||
|
ref="vnSelectRef"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:options="myOptions"
|
:options="myOptions"
|
||||||
:option-label="optionLabel"
|
:option-label="optionLabel"
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
v-bind="{ ...$attrs, ...styleAttrs, hideSelected: hasFocus }"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
:map-options="nullishToTrue($attrs['map-options'])"
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
:use-input="nullishToTrue($attrs['use-input'])"
|
:use-input="hasFocus || !value"
|
||||||
:hide-selected="nullishToTrue($attrs['hide-selected'])"
|
:fill-input="false"
|
||||||
:fill-input="nullishToTrue($attrs['fill-input'])"
|
|
||||||
ref="vnSelectRef"
|
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
|
@ -372,10 +396,20 @@ function getCaption(opt) {
|
||||||
:loading="someIsLoading"
|
:loading="someIsLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
@popup-hide="isMenuOpened = false"
|
@popup-hide="isMenuOpened = false"
|
||||||
@popup-show="isMenuOpened = true"
|
@popup-show="
|
||||||
|
async () => {
|
||||||
|
isMenuOpened = true;
|
||||||
|
hasFocus = true;
|
||||||
|
await $nextTick();
|
||||||
|
vnSelectRef?.$el?.querySelector('input')?.focus();
|
||||||
|
}
|
||||||
|
"
|
||||||
@keydown="handleKeyDown"
|
@keydown="handleKeyDown"
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
:data-url="url"
|
:data-url="url"
|
||||||
|
@blur="hasFocus = false"
|
||||||
|
@update:model-value="() => vnSelectRef.blur()"
|
||||||
|
:is-required="false"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -430,6 +464,17 @@ function getCaption(opt) {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
<template #selected v-if="valueIsObject && nullishToTrue($attrs['emit-value'])">
|
||||||
|
<span class="nowrap">
|
||||||
|
<span
|
||||||
|
class="text-strike"
|
||||||
|
v-if="modelValue?.neq"
|
||||||
|
v-text="getOptionLabel('neq')"
|
||||||
|
:title="getOptionLabel('neq')"
|
||||||
|
/>
|
||||||
|
<span v-else>{{ JSON.stringify(modelValue) }}</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</QSelect>
|
</QSelect>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -437,4 +482,12 @@ function getCaption(opt) {
|
||||||
.q-field--outlined {
|
.q-field--outlined {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
.q-field__native {
|
||||||
|
@extend .nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nowrap {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -186,6 +186,7 @@ async function remove(key) {
|
||||||
function formatValue(value) {
|
function formatValue(value) {
|
||||||
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
||||||
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
||||||
|
if (value && typeof value === 'object') return '';
|
||||||
|
|
||||||
return `"${value}"`;
|
return `"${value}"`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,13 @@ const closeForm = () => {
|
||||||
class="editOption"
|
class="editOption"
|
||||||
:label="t('Field to edit')"
|
:label="t('Field to edit')"
|
||||||
:options="fieldsOptions"
|
:options="fieldsOptions"
|
||||||
hide-selected
|
|
||||||
option-label="label"
|
option-label="label"
|
||||||
|
option-value="name"
|
||||||
v-model="selectedField"
|
v-model="selectedField"
|
||||||
data-cy="EditFixedPriceSelectOption"
|
data-cy="EditFixedPriceSelectOption"
|
||||||
@update:model-value="newValue = null"
|
@update:model-value="newValue = null"
|
||||||
:class="{ 'is-select': selectedField?.component === 'select' }"
|
:class="{ 'is-select': selectedField?.component === 'select' }"
|
||||||
|
:emit-value="false"
|
||||||
>
|
>
|
||||||
<template #option="{ opt, itemProps }">
|
<template #option="{ opt, itemProps }">
|
||||||
<QItem v-bind="itemProps" class="q-pa-xs row items-center">
|
<QItem v-bind="itemProps" class="q-pa-xs row items-center">
|
||||||
|
|
|
@ -463,6 +463,32 @@ function setReference(data) {
|
||||||
|
|
||||||
dialogData.value.value.description = newDescription;
|
dialogData.value.value.description = newDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exprBuilder(param, value) {
|
||||||
|
switch (param) {
|
||||||
|
case 'stateFk':
|
||||||
|
return { 'ts.stateFk': value };
|
||||||
|
case 'provinceFk':
|
||||||
|
return { 'a.provinceFk': value };
|
||||||
|
case 'hour':
|
||||||
|
return { 'z.hour': value };
|
||||||
|
case 'shipped':
|
||||||
|
return {
|
||||||
|
't.shipped': {
|
||||||
|
between: this.dateRange(value),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
case 'departmentFk':
|
||||||
|
return { 'c.departmentFk': value };
|
||||||
|
case 'id':
|
||||||
|
case 'refFk':
|
||||||
|
case 'zoneFk':
|
||||||
|
case 'nickname':
|
||||||
|
case 'agencyModeFk':
|
||||||
|
case 'warehouseFk':
|
||||||
|
return { [`t.${param}`]: value };
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -657,42 +683,36 @@ function setReference(data) {
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnInputDate
|
||||||
<VnInputDate
|
placeholder="dd-mm-aaa"
|
||||||
placeholder="dd-mm-aaa"
|
:label="t('globals.landed')"
|
||||||
:label="t('globals.landed')"
|
v-model="data.landed"
|
||||||
v-model="data.landed"
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnSelect
|
||||||
<VnSelect
|
url="Warehouses"
|
||||||
url="Warehouses"
|
:sort-by="['name']"
|
||||||
:sort-by="['name']"
|
:label="t('globals.warehouse')"
|
||||||
:label="t('globals.warehouse')"
|
v-model="data.warehouseId"
|
||||||
v-model="data.warehouseId"
|
hide-selected
|
||||||
hide-selected
|
required
|
||||||
required
|
:where="{
|
||||||
:where="{
|
isForTicket: true,
|
||||||
isForTicket: true,
|
}"
|
||||||
}"
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnSelect
|
||||||
<VnSelect
|
:label="t('globals.agency')"
|
||||||
:label="t('globals.agency')"
|
v-model="data.agencyModeId"
|
||||||
v-model="data.agencyModeId"
|
:options="agenciesOptions"
|
||||||
:options="agenciesOptions"
|
option-value="agencyModeFk"
|
||||||
option-value="agencyModeFk"
|
option-label="agencyMode"
|
||||||
option-label="agencyMode"
|
hide-selected
|
||||||
hide-selected
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
|
@ -58,8 +58,8 @@ describe('Client list', { testIsolation: true }, () => {
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
cy.checkValueForm(1, search);
|
cy.checkValueForm(1, search);
|
||||||
cy.checkValueForm(2, search);
|
cy.checkValueForm(2, search);
|
||||||
cy.dataCy('Customer_select').should('have.value', search);
|
cy.dataCy('Customer_select').contains(search);
|
||||||
cy.dataCy('Address_select').should('have.value', search);
|
cy.dataCy('Address_select').contains(search);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Client founded create order', () => {
|
it('Client founded create order', () => {
|
||||||
|
@ -74,7 +74,7 @@ describe('Client list', { testIsolation: true }, () => {
|
||||||
cy.waitForElement('#formModel');
|
cy.waitForElement('#formModel');
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
cy.checkValueForm(1, search);
|
cy.checkValueForm(1, search);
|
||||||
cy.dataCy('Client_select').should('have.value', search);
|
cy.dataCy('Client_select').contains(search);
|
||||||
cy.dataCy('Address_select').should('have.value', search);
|
cy.dataCy('Address_select').contains(search);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -95,7 +95,7 @@ describe('EntryBuys', () => {
|
||||||
|
|
||||||
cy.get('input[data-cy="itemFk-create-popup"]').type('1');
|
cy.get('input[data-cy="itemFk-create-popup"]').type('1');
|
||||||
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
||||||
cy.get('input[data-cy="Grouping mode_select"]').should('have.value', 'packing');
|
cy.dataCy('Grouping mode_select').contains('packing');
|
||||||
cy.get('button[data-cy="FormModelPopup_save"]').click();
|
cy.get('button[data-cy="FormModelPopup_save"]').click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,11 +17,9 @@ describe('EntryNotes', () => {
|
||||||
const editObservation = (rowIndex, type, description) => {
|
const editObservation = (rowIndex, type, description) => {
|
||||||
cy.get(`td[data-col-field="description"][data-row-index="${rowIndex}"]`)
|
cy.get(`td[data-col-field="description"][data-row-index="${rowIndex}"]`)
|
||||||
.click()
|
.click()
|
||||||
.clear()
|
|
||||||
.type(description);
|
.type(description);
|
||||||
cy.get(`td[data-col-field="observationTypeFk"][data-row-index="${rowIndex}"]`)
|
cy.get(`td[data-col-field="observationTypeFk"][data-row-index="${rowIndex}"]`)
|
||||||
.click()
|
.click()
|
||||||
.clear()
|
|
||||||
.type(type);
|
.type(type);
|
||||||
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
|
|
|
@ -44,9 +44,9 @@ describe('invoiceInCorrective', { testIsolation: true }, () => {
|
||||||
cy.url().should('include', `/invoice-in/${correctingFk}/summary`);
|
cy.url().should('include', `/invoice-in/${correctingFk}/summary`);
|
||||||
cy.visit(`/#/invoice-in/${correctingFk}/corrective`);
|
cy.visit(`/#/invoice-in/${correctingFk}/corrective`);
|
||||||
|
|
||||||
cy.dataCy('invoiceInCorrective_class').should('be.disabled');
|
checkIsDisabled('class');
|
||||||
cy.dataCy('invoiceInCorrective_type').should('be.disabled');
|
checkIsDisabled('type');
|
||||||
cy.dataCy('invoiceInCorrective_reason').should('be.disabled');
|
checkIsDisabled('reason');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,4 +56,10 @@ describe('invoiceInCorrective', { testIsolation: true }, () => {
|
||||||
cy.clickDescriptorAction(4);
|
cy.clickDescriptorAction(4);
|
||||||
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
|
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function checkIsDisabled(column) {
|
||||||
|
cy.dataCy(`invoiceInCorrective_${column}`)
|
||||||
|
.parents('.q-field')
|
||||||
|
.should('have.class', 'q-field--disabled');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -132,9 +132,9 @@ function createCorrective() {
|
||||||
const correctingId = response.body;
|
const correctingId = response.body;
|
||||||
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
||||||
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
||||||
cy.dataCy('invoiceInCorrective_class').should('contain.value', 'R2');
|
cy.dataCy('invoiceInCorrective_class').contains('R2');
|
||||||
cy.dataCy('invoiceInCorrective_type').should('contain.value', 'diferencias');
|
cy.dataCy('invoiceInCorrective_type').contains('diferencias');
|
||||||
cy.dataCy('invoiceInCorrective_reason').should('contain.value', 'sales details');
|
cy.dataCy('invoiceInCorrective_reason').contains('sales details');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ describe('InvoiceInList', () => {
|
||||||
title: mockInvoiceRef,
|
title: mockInvoiceRef,
|
||||||
listBox: { 0: '11/16/2001', 3: 'The farmer' },
|
listBox: { 0: '11/16/2001', 3: 'The farmer' },
|
||||||
});
|
});
|
||||||
cy.dataCy('invoiceInBasicDataCompanyFk').should('have.value', 'ORN');
|
cy.dataCy('invoiceInBasicDataCompanyFk').contains('ORN');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,8 +59,8 @@ describe('OrderList', { testIsolation: true }, () => {
|
||||||
).click();
|
).click();
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
|
||||||
cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne');
|
cy.get(clientCreateSelect).contains('Bruce Wayne');
|
||||||
cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne');
|
cy.get(addressCreateSelect).contains('Bruce Wayne');
|
||||||
cy.dataCy('landedDate').find('input').type('06/01/2001');
|
cy.dataCy('landedDate').find('input').type('06/01/2001');
|
||||||
cy.selectOption(agencyCreateSelect, 1);
|
cy.selectOption(agencyCreateSelect, 1);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('ParkingBasicData', () => {
|
describe('ParkingBasicData', () => {
|
||||||
const codeInput = 'form .q-card .q-input input';
|
const codeInput = 'form .q-card .q-input input';
|
||||||
const sectorSelect = 'form .q-card .q-select input';
|
const sectorSelect = 'form .q-card .q-select';
|
||||||
const sectorOpt = '.q-menu .q-item';
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/shelving/parking/1/basic-data`);
|
cy.visit(`/#/shelving/parking/1/basic-data`);
|
||||||
|
@ -17,8 +16,7 @@ describe('ParkingBasicData', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the code and sector', () => {
|
it('should edit the code and sector', () => {
|
||||||
cy.get(sectorSelect).type('First');
|
cy.selectOption(sectorSelect, 'First');
|
||||||
cy.get(sectorOpt).click();
|
|
||||||
|
|
||||||
cy.get(codeInput).eq(0).clear();
|
cy.get(codeInput).eq(0).clear();
|
||||||
cy.get(codeInput).eq(0).type('700-01');
|
cy.get(codeInput).eq(0).type('700-01');
|
||||||
|
@ -27,7 +25,7 @@ describe('ParkingBasicData', () => {
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
|
|
||||||
cy.get(sectorSelect).should('have.value', 'First sector');
|
cy.get(sectorSelect).contains('First sector');
|
||||||
cy.get(codeInput).should('have.value', '700-01');
|
cy.get(codeInput).should('have.value', '700-01');
|
||||||
cy.dataCy('Picking order_input').should('have.value', 80230);
|
cy.dataCy('Picking order_input').should('have.value', 80230);
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,11 +44,11 @@ describe('TicketList', () => {
|
||||||
cy.intercept('GET', /\/api\/Clients\?filter/).as('clientFilter');
|
cy.intercept('GET', /\/api\/Clients\?filter/).as('clientFilter');
|
||||||
cy.vnTableCreateBtn();
|
cy.vnTableCreateBtn();
|
||||||
cy.wait('@clientFilter');
|
cy.wait('@clientFilter');
|
||||||
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
|
cy.dataCy('Customer_select').contains('Bruce Wayne');
|
||||||
cy.dataCy('Address_select').click();
|
cy.dataCy('Address_select').click();
|
||||||
|
|
||||||
cy.getOption().click();
|
cy.getOption().click();
|
||||||
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
|
cy.dataCy('Address_select').contains('Bruce Wayne');
|
||||||
});
|
});
|
||||||
it('Client list create new ticket', () => {
|
it('Client list create new ticket', () => {
|
||||||
cy.vnTableCreateBtn();
|
cy.vnTableCreateBtn();
|
||||||
|
|
|
@ -5,48 +5,27 @@ describe('UserPanel', { testIsolation: true }, () => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#dashboard`);
|
cy.visit(`/#dashboard`);
|
||||||
cy.waitForElement('.q-page', 6000);
|
cy.waitForElement('.q-page', 6000);
|
||||||
});
|
|
||||||
|
|
||||||
it('should notify when update user warehouse', () => {
|
|
||||||
const userWarehouse =
|
|
||||||
'.q-menu .q-gutter-xs > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native> .q-field__input';
|
|
||||||
|
|
||||||
// Abro el panel
|
|
||||||
cy.openUserPanel();
|
cy.openUserPanel();
|
||||||
|
|
||||||
// Compruebo la opcion inicial
|
|
||||||
cy.get(userWarehouse).should('have.value', 'VNL').click();
|
|
||||||
|
|
||||||
// Actualizo la opción
|
|
||||||
cy.getOption(3);
|
|
||||||
|
|
||||||
//Compruebo la notificación
|
|
||||||
cy.get('.q-notification').should('be.visible');
|
|
||||||
cy.get(userWarehouse).should('have.value', 'VNH');
|
|
||||||
|
|
||||||
//Restauro el valor
|
|
||||||
cy.get(userWarehouse).click();
|
|
||||||
cy.getOption(2);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should notify when update user company', () => {
|
it('should notify when update user company', () => {
|
||||||
const userCompany =
|
changeSelect('User company', 'VNH', 'VNL');
|
||||||
'.q-menu .q-gutter-xs > :nth-child(2) > .q-field--float > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native> .q-field__input';
|
|
||||||
|
|
||||||
// Abro el panel
|
|
||||||
cy.openUserPanel();
|
|
||||||
|
|
||||||
// Compruebo la opcion inicial
|
|
||||||
cy.get(userCompany).should('have.value', 'Warehouse One').click();
|
|
||||||
|
|
||||||
//Actualizo la opción
|
|
||||||
cy.getOption(3);
|
|
||||||
|
|
||||||
//Compruebo la notificación
|
|
||||||
cy.get('.q-notification').should('be.visible');
|
|
||||||
cy.get(userCompany).should('have.value', 'TestingWarehouse');
|
|
||||||
|
|
||||||
//Restauro el valor
|
|
||||||
cy.get(userCompany).click();
|
|
||||||
cy.getOption(1);
|
|
||||||
});
|
});
|
||||||
|
it('should notify when update user warehouse', () => {
|
||||||
|
changeSelect('User warehouse', 'TestingWarehouse', 'Warehouse One');
|
||||||
|
});
|
||||||
|
|
||||||
|
function changeSelect(field, newOption, oldOption) {
|
||||||
|
cy.get('.q-menu')
|
||||||
|
.contains(field)
|
||||||
|
.then(($field) => {
|
||||||
|
cy.wrap($field).contains(oldOption);
|
||||||
|
cy.selectOption($field, newOption);
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.wrap($field).contains(newOption);
|
||||||
|
|
||||||
|
// Restore
|
||||||
|
cy.selectOption($field, oldOption);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe('VnLocation', { testIsolation: true }, () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
|
||||||
).click();
|
).click();
|
||||||
cy.dataCy('locationProvince').should('have.value', province);
|
cy.dataCy('locationProvince').contains(province);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Worker Create', () => {
|
describe('Worker Create', () => {
|
||||||
|
|
|
@ -11,6 +11,6 @@ describe('WorkerLocker', () => {
|
||||||
it('should allocates a locker', () => {
|
it('should allocates a locker', () => {
|
||||||
cy.selectOption(lockerSelect, lockerCode);
|
cy.selectOption(lockerSelect, lockerCode);
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.get(lockerSelect).invoke('val').should('eq', lockerCode);
|
cy.get(lockerSelect).contains(lockerCode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -178,36 +178,37 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
|
||||||
cy.waitSpinner();
|
cy.waitSpinner();
|
||||||
const { form = '.q-form > .q-card', attr = 'aria-label' } = opts;
|
const { form = '.q-form > .q-card', attr = 'aria-label' } = opts;
|
||||||
cy.waitForElement(form);
|
cy.waitForElement(form);
|
||||||
cy.get(`${form} input`).each(([el]) => {
|
|
||||||
cy.wrap(el)
|
|
||||||
.invoke('attr', attr)
|
|
||||||
.then((key) => {
|
|
||||||
const field = obj[key];
|
|
||||||
if (!field) return;
|
|
||||||
if (typeof field == 'string')
|
|
||||||
return cy
|
|
||||||
.wrap(el)
|
|
||||||
.type(`{selectall}{backspace}${field}`, { delay: 0 });
|
|
||||||
|
|
||||||
const { type, val } = field;
|
cy.get(`${form} .q-field`).each(($el) => {
|
||||||
switch (type) {
|
cy.wrap($el).then(($element) => {
|
||||||
case 'select':
|
const key = $element.attr(attr) || $element.find(`[${attr}]`).attr(attr);
|
||||||
cy.selectOption(el, val);
|
const field = obj[key];
|
||||||
break;
|
if (!field) return;
|
||||||
case 'date':
|
|
||||||
cy.get(el).type(`{selectall}{backspace}${val}`).blur();
|
const { type, val } =
|
||||||
break;
|
typeof field === 'string' ? { type: 'string', val: field } : field;
|
||||||
case 'time':
|
|
||||||
cy.get(el).click();
|
switch (type) {
|
||||||
cy.get('.q-time .q-time__clock').contains(val.h).click();
|
case 'select':
|
||||||
cy.get('.q-time .q-time__clock').contains(val.m).click();
|
cy.selectOption($el, val);
|
||||||
cy.get('.q-time .q-time__link').contains(val.x).click();
|
break;
|
||||||
break;
|
case 'date':
|
||||||
default:
|
cy.wrap($el)
|
||||||
cy.wrap(el).type(`{selectall}${val}`, { delay: 0 });
|
.find('input')
|
||||||
break;
|
.type(`{selectall}{backspace}${val}`)
|
||||||
}
|
.blur();
|
||||||
});
|
break;
|
||||||
|
case 'time':
|
||||||
|
cy.wrap($el).click();
|
||||||
|
cy.get('.q-time .q-time__clock').contains(val.h).click();
|
||||||
|
cy.get('.q-time .q-time__clock').contains(val.m).click();
|
||||||
|
cy.get('.q-time .q-time__link').contains(val.x).click();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cy.wrap($el).find('input').type(`{selectall}${val}`, { delay: 0 });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue