Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7229-fixDownloadFile
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
d1055ad572
|
@ -9,8 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
defineProps({ showEntityField: { type: Boolean, default: true } });
|
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
const emit = defineEmits(['onDataSaved']);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const bicInputRef = ref(null);
|
const bicInputRef = ref(null);
|
||||||
|
@ -18,17 +16,16 @@ const state = useState();
|
||||||
|
|
||||||
const customer = computed(() => state.get('customer'));
|
const customer = computed(() => state.get('customer'));
|
||||||
|
|
||||||
|
const countriesFilter = {
|
||||||
|
fields: ['id', 'name', 'code'],
|
||||||
|
};
|
||||||
|
|
||||||
const bankEntityFormData = reactive({
|
const bankEntityFormData = reactive({
|
||||||
name: null,
|
name: null,
|
||||||
bic: null,
|
bic: null,
|
||||||
countryFk: customer.value?.countryFk,
|
countryFk: customer.value?.countryFk,
|
||||||
id: null,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const countriesFilter = {
|
|
||||||
fields: ['id', 'name', 'code'],
|
|
||||||
};
|
|
||||||
|
|
||||||
const countriesOptions = ref([]);
|
const countriesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (...args) => {
|
const onDataSaved = (...args) => {
|
||||||
|
@ -44,7 +41,6 @@ onMounted(async () => {
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Countries"
|
url="Countries"
|
||||||
:filter="countriesFilter"
|
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (countriesOptions = data)"
|
@on-fetch="(data) => (countriesOptions = data)"
|
||||||
/>
|
/>
|
||||||
|
@ -54,6 +50,7 @@ onMounted(async () => {
|
||||||
:title="t('title')"
|
:title="t('title')"
|
||||||
:subtitle="t('subtitle')"
|
:subtitle="t('subtitle')"
|
||||||
:form-initial-data="bankEntityFormData"
|
:form-initial-data="bankEntityFormData"
|
||||||
|
:filter="countriesFilter"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
|
@ -85,7 +82,13 @@ onMounted(async () => {
|
||||||
:rules="validate('bankEntity.countryFk')"
|
:rules="validate('bankEntity.countryFk')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showEntityField" class="col">
|
<div
|
||||||
|
v-if="
|
||||||
|
countriesOptions.find((c) => c.id === data.countryFk)?.code ==
|
||||||
|
'ES'
|
||||||
|
"
|
||||||
|
class="col"
|
||||||
|
>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('id')"
|
:label="t('id')"
|
||||||
v-model="data.id"
|
v-model="data.id"
|
||||||
|
|
|
@ -394,6 +394,7 @@ watch(formUrl, async () => {
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
|
data-cy="crudModelDefaultSaveBtn"
|
||||||
/>
|
/>
|
||||||
<slot name="moreAfterActions" />
|
<slot name="moreAfterActions" />
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
|
|
|
@ -394,7 +394,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:vertical="true"
|
:vertical="false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<slot
|
<slot
|
||||||
|
@ -737,6 +737,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
fab
|
fab
|
||||||
icon="add"
|
icon="add"
|
||||||
shortcut="+"
|
shortcut="+"
|
||||||
|
data-cy="vnTableCreateBtn"
|
||||||
/>
|
/>
|
||||||
<QTooltip self="top right">
|
<QTooltip self="top right">
|
||||||
{{ createForm?.title }}
|
{{ createForm?.title }}
|
||||||
|
|
|
@ -101,7 +101,13 @@ const mixinRules = [
|
||||||
<QIcon
|
<QIcon
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
v-if="hover && value && !$attrs.disabled && $props.clearable"
|
v-if="
|
||||||
|
hover &&
|
||||||
|
value &&
|
||||||
|
!$attrs.disabled &&
|
||||||
|
!$attrs.readonly &&
|
||||||
|
$props.clearable
|
||||||
|
"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
value = null;
|
value = null;
|
||||||
|
|
|
@ -138,8 +138,6 @@ onMounted(() => {
|
||||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ opts: myOptions });
|
|
||||||
|
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
||||||
|
|
||||||
|
@ -259,6 +257,30 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ opts: myOptions });
|
||||||
|
|
||||||
|
function handleKeyDown(event) {
|
||||||
|
if (event.key === 'Tab') {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const inputValue = vnSelectRef.value?.inputValue;
|
||||||
|
|
||||||
|
if (inputValue) {
|
||||||
|
const matchingOption = myOptions.value.find(
|
||||||
|
(option) =>
|
||||||
|
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matchingOption) {
|
||||||
|
emit('update:modelValue', matchingOption[optionValue.value]);
|
||||||
|
} else {
|
||||||
|
emit('update:modelValue', inputValue);
|
||||||
|
}
|
||||||
|
vnSelectRef.value?.hidePopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -269,6 +291,7 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
|
@keydown="handleKeyDown"
|
||||||
: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="nullishToTrue($attrs['use-input'])"
|
||||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDialog ref="dialogRef">
|
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
||||||
<QCard class="q-pa-sm">
|
<QCard class="q-pa-sm">
|
||||||
<QCardSection class="row items-center q-pb-none">
|
<QCardSection class="row items-center q-pb-none">
|
||||||
<span class="text-h6 text-grey">
|
<span class="text-h6 text-grey">
|
||||||
|
@ -161,6 +161,7 @@ async function send() {
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
unelevated
|
unelevated
|
||||||
|
data-cy="sendSmsBtn"
|
||||||
/>
|
/>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -130,6 +130,7 @@ async function search() {
|
||||||
dense
|
dense
|
||||||
standout
|
standout
|
||||||
autofocus
|
autofocus
|
||||||
|
data-cy="vnSearchBar"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { defineProps } from 'vue';
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
routeName: {
|
routeName: {
|
||||||
|
|
|
@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 1px 10px 1px 10px;
|
padding: 1px 10px 1px 10px;
|
||||||
max-width: 100px;
|
max-width: 130px;
|
||||||
div span {
|
div span {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
|
@ -768,6 +768,7 @@ travel:
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Days in forward
|
daysInForward: Days in forward
|
||||||
|
isRaid: Raid
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperature
|
temperature: Temperature
|
||||||
destination: Destination
|
destination: Destination
|
||||||
|
|
|
@ -762,6 +762,7 @@ travel:
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Días redada
|
daysInForward: Días redada
|
||||||
|
isRaid: Redada
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperatura
|
temperature: Temperatura
|
||||||
destination: Destino
|
destination: Destino
|
||||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -130,7 +130,7 @@ function cancel() {
|
||||||
<template #body-cell-description="{ row, value }">
|
<template #body-cell-description="{ row, value }">
|
||||||
<QTd auto-width align="right" class="link">
|
<QTd auto-width align="right" class="link">
|
||||||
{{ value }}
|
{{ value }}
|
||||||
<ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
|
@ -25,7 +25,7 @@ const claimFilter = computed(() => {
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'nickname'],
|
fields: ['id', 'nickname', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -256,10 +256,10 @@ const showBalancePdf = ({ id }) => {
|
||||||
{{ toCurrency(balances[rowIndex]?.balance) }}
|
{{ toCurrency(balances[rowIndex]?.balance) }}
|
||||||
</template>
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<div class="link" v-if="row.isInvoice">
|
<span class="link" v-if="row.isInvoice" @click.stop>
|
||||||
{{ t('bill', { ref: row.description }) }}
|
{{ t('bill', { ref: row.description }) }}
|
||||||
<InvoiceOutDescriptorProxy :id="row.description" />
|
<InvoiceOutDescriptorProxy :id="row.id" />
|
||||||
</div>
|
</span>
|
||||||
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||||
{{ row.description }}
|
{{ row.description }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -221,7 +221,7 @@ onMounted(async () => {
|
||||||
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
|
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
|
||||||
}}</QTooltip>
|
}}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
|
<QIcon v-if="!!row.isRaid" name="vn:net" color="primary">
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
t('globals.raid', { daysInForward: row.daysInForward })
|
t('globals.raid', { daysInForward: row.daysInForward })
|
||||||
|
|
|
@ -170,7 +170,7 @@ onMounted(async () => {
|
||||||
from.value = getDate(_from, 'from');
|
from.value = getDate(_from, 'from');
|
||||||
const _to = Date.vnNew();
|
const _to = Date.vnNew();
|
||||||
_to.setDate(_to.getDate() + 10);
|
_to.setDate(_to.getDate() + 10);
|
||||||
to.value = getDate(Date.vnNew(), 'to');
|
to.value = getDate(_to, 'to');
|
||||||
|
|
||||||
updateFilter();
|
updateFilter();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -31,47 +31,26 @@ const applyTags = () => {
|
||||||
emit('applyTags', tagInfo);
|
emit('applyTags', tagInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTagGroupParam = (valIndex = null) => {
|
|
||||||
if (!valIndex) {
|
|
||||||
tagValues.value = [{}];
|
|
||||||
} else {
|
|
||||||
(tagValues.value || []).splice(valIndex, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
if (!tag?.id) return;
|
||||||
if (!tag?.id) return;
|
const filter = {
|
||||||
const filter = {
|
fields: ['value'],
|
||||||
fields: ['value'],
|
order: 'value ASC',
|
||||||
order: 'value ASC',
|
limit: 30,
|
||||||
limit: 30,
|
};
|
||||||
};
|
|
||||||
|
|
||||||
const url = `Tags/${tag?.id}/filterValue`;
|
const url = `Tags/${tag?.id}/filterValue`;
|
||||||
const params = { filter: JSON.stringify(filter) };
|
const params = { filter: JSON.stringify(filter) };
|
||||||
const { data } = await axios.get(url, {
|
const { data } = await axios.get(url, {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
tagOptions.value = data;
|
tagOptions.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QForm @submit="applyTags(tagValues)" class="all-pointer-events">
|
<QForm @submit="applyTags()" class="all-pointer-events">
|
||||||
<QCard class="q-pa-sm column q-pa-lg">
|
<QCard class="q-pa-sm column q-pa-lg">
|
||||||
<QBtn
|
|
||||||
round
|
|
||||||
color="primary"
|
|
||||||
style="position: absolute; z-index: 1; right: 0; top: 0"
|
|
||||||
icon="search"
|
|
||||||
type="submit"
|
|
||||||
>
|
|
||||||
</QBtn>
|
|
||||||
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.tag')"
|
:label="t('params.tag')"
|
||||||
v-model="selectedTag"
|
v-model="selectedTag"
|
||||||
|
@ -84,17 +63,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
rounded
|
rounded
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
use-input
|
use-input
|
||||||
@update:model-value="($event) => getSelectedTagValues($event)"
|
@update:model-value="getSelectedTagValues"
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
icon="add_circle"
|
|
||||||
shortcut="+"
|
|
||||||
flat
|
|
||||||
class="filter-icon q-mb-md"
|
|
||||||
size="md"
|
|
||||||
dense
|
|
||||||
:disabled="!selectedTag || !tagValues[0].value"
|
|
||||||
@click="tagValues.unshift({})"
|
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-for="(value, index) in tagValues"
|
v-for="(value, index) in tagValues"
|
||||||
|
@ -106,7 +75,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
v-if="!selectedTag?.isFree && tagOptions"
|
v-if="!selectedTag?.isFree && tagOptions"
|
||||||
:label="t('components.itemsFilterPanel.value')"
|
:label="t('components.itemsFilterPanel.value')"
|
||||||
v-model="value.value"
|
v-model="value.value"
|
||||||
:options="tagOptions || []"
|
:options="tagOptions"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="value"
|
option-label="value"
|
||||||
dense
|
dense
|
||||||
|
@ -124,7 +93,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:label="t('components.itemsFilterPanel.value')"
|
:label="t('components.itemsFilterPanel.value')"
|
||||||
:disable="!value"
|
:disable="!value"
|
||||||
is-outlined
|
is-outlined
|
||||||
:is-clearable="false"
|
|
||||||
class="col"
|
class="col"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -135,11 +103,25 @@ const getSelectedTagValues = async (tag) => {
|
||||||
rounded
|
rounded
|
||||||
flat
|
flat
|
||||||
class="filter-icon col-2"
|
class="filter-icon col-2"
|
||||||
:disabled="!value.value"
|
@click="tagValues.splice(index, 1)"
|
||||||
@click="removeTagGroupParam(index)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<QBtn
|
||||||
|
icon="add_circle"
|
||||||
|
shortcut="+"
|
||||||
|
flat
|
||||||
|
class="filter-icon q-mb-md"
|
||||||
|
size="md"
|
||||||
|
dense
|
||||||
|
@click="tagValues.push({})"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon="search"
|
||||||
|
type="submit"
|
||||||
|
:label="$t('globals.search')"
|
||||||
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
</QForm>
|
</QForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,18 +4,19 @@ import { useRoute, useRouter } from 'vue-router';
|
||||||
import { onBeforeMount, onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
import { onBeforeMount, onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import CatalogItem from 'components/ui/CatalogItem.vue';
|
import CatalogItem from 'src/components/ui/CatalogItem.vue';
|
||||||
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
|
import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import getParamWhere from 'src/filters/getParamWhere';
|
import getParamWhere from 'src/filters/getParamWhere';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const arrayData = useArrayData('OrderCatalogList');
|
const dataKey = 'OrderCatalogList';
|
||||||
|
const arrayData = useArrayData(dataKey);
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const showFilter = ref(null);
|
const showFilter = ref(null);
|
||||||
const tags = ref([]);
|
const tags = ref([]);
|
||||||
|
@ -102,7 +103,7 @@ watch(
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="OrderCatalogList"
|
:data-key="dataKey"
|
||||||
:user-params="catalogParams"
|
:user-params="catalogParams"
|
||||||
:static-params="['orderFk', 'orderBy']"
|
:static-params="['orderFk', 'orderBy']"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
|
@ -113,7 +114,7 @@ watch(
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea v-if="showFilter" class="fit text-grey-8">
|
<QScrollArea v-if="showFilter" class="fit text-grey-8">
|
||||||
<OrderCatalogFilter
|
<OrderCatalogFilter
|
||||||
data-key="OrderCatalogList"
|
:data-key="dataKey"
|
||||||
:tag-value="tagValue"
|
:tag-value="tagValue"
|
||||||
:tags="tags"
|
:tags="tags"
|
||||||
:initial-catalog-params="catalogParams"
|
:initial-catalog-params="catalogParams"
|
||||||
|
@ -123,7 +124,7 @@ watch(
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
data-key="OrderCatalogList"
|
:data-key="dataKey"
|
||||||
url="Orders/CatalogFilter"
|
url="Orders/CatalogFilter"
|
||||||
:limit="50"
|
:limit="50"
|
||||||
:user-params="catalogParams"
|
:user-params="catalogParams"
|
||||||
|
|
|
@ -32,11 +32,12 @@ const route = useRoute();
|
||||||
|
|
||||||
const arrayData = useArrayData(props.dataKey);
|
const arrayData = useArrayData(props.dataKey);
|
||||||
|
|
||||||
|
const currentParams = ref({});
|
||||||
const categoryList = ref(null);
|
const categoryList = ref(null);
|
||||||
const selectedCategoryFk = ref(null);
|
const selectedCategoryFk = ref(null);
|
||||||
const typeList = ref([]);
|
const typeList = ref([]);
|
||||||
const selectedTypeFk = ref(null);
|
const selectedTypeFk = ref(null);
|
||||||
const generalSearchParam = ref(null);
|
const searchByTag = ref(null);
|
||||||
|
|
||||||
const vnFilterPanelRef = ref();
|
const vnFilterPanelRef = ref();
|
||||||
const orderByList = ref([
|
const orderByList = ref([
|
||||||
|
@ -52,26 +53,30 @@ const orderWayList = ref([
|
||||||
const orderBySelected = ref('relevancy DESC, name');
|
const orderBySelected = ref('relevancy DESC, name');
|
||||||
const orderWaySelected = ref('ASC');
|
const orderWaySelected = ref('ASC');
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
|
||||||
|
selectedTypeFk.value = getParamWhere(route, 'typeFk');
|
||||||
|
});
|
||||||
|
|
||||||
const resetCategory = (params, search) => {
|
const resetCategory = (params, search) => {
|
||||||
selectedCategoryFk.value = null;
|
selectedCategoryFk.value = null;
|
||||||
typeList.value = null;
|
typeList.value = null;
|
||||||
params.categoryFk = null;
|
params.categoryFk = null;
|
||||||
params.typeFk = null;
|
params.typeFk = null;
|
||||||
arrayData.store.userFilter = null;
|
arrayData.store.userFilter = null;
|
||||||
removeTagGroupParam(params, search);
|
removeTagGroupParam(search);
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectCategory = (params, category, search) => {
|
const selectCategory = (params, category, search) => {
|
||||||
if (params.categoryFk === category?.id) {
|
if (params.categoryFk === category?.id) {
|
||||||
resetCategory(params, search);
|
resetCategory(params, search);
|
||||||
params.categoryFk = null;
|
return;
|
||||||
} else {
|
|
||||||
selectedCategoryFk.value = category?.id;
|
|
||||||
params.categoryFk = category?.id;
|
|
||||||
params.typeFk = null;
|
|
||||||
selectedTypeFk.value = null;
|
|
||||||
loadTypes(category?.id);
|
|
||||||
}
|
}
|
||||||
|
selectedCategoryFk.value = category?.id;
|
||||||
|
params.categoryFk = category?.id;
|
||||||
|
params.typeFk = null;
|
||||||
|
selectedTypeFk.value = null;
|
||||||
|
loadTypes(category?.id);
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,13 +120,23 @@ const applyTags = (tagInfo, params, search) => {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTagGroupParam = (params, search, valIndex = null) => {
|
async function onSearchByTag(value) {
|
||||||
if (!valIndex) {
|
if (!value.target.value) return;
|
||||||
params.tagGroups = null;
|
if (!currentParams.value?.tagGroups) {
|
||||||
search();
|
currentParams.value.tagGroups = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
currentParams.value.tagGroups.push({
|
||||||
|
values: [{ value: value.target.value }],
|
||||||
|
});
|
||||||
|
searchByTag.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeTagGroupParam = (search, valIndex) => {
|
||||||
|
if (!valIndex && valIndex !== 0) {
|
||||||
|
currentParams.value.tagGroups = null;
|
||||||
} else {
|
} else {
|
||||||
params.tagGroups.splice(valIndex, 1);
|
currentParams.value.tagGroups.splice(valIndex, 1);
|
||||||
search();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,6 +157,12 @@ const getCategoryClass = (category, params) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const clearFilter = (key) => {
|
||||||
|
if (key === 'categoryFk') {
|
||||||
|
resetCategory();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function addOrder(value, field, params) {
|
function addOrder(value, field, params) {
|
||||||
let { orderBy } = params;
|
let { orderBy } = params;
|
||||||
orderBy = JSON.parse(orderBy);
|
orderBy = JSON.parse(orderBy);
|
||||||
|
@ -157,7 +178,7 @@ onMounted(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
|
<FetchData url="ItemCategories" auto-load @on-fetch="setCategoryList" />
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
ref="vnFilterPanelRef"
|
ref="vnFilterPanelRef"
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
|
@ -166,7 +187,8 @@ onMounted(() => {
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:custom-tags="['tagGroups', 'categoryFk']"
|
:custom-tags="['tagGroups', 'categoryFk']"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
search-url="params"
|
@remove="clearFilter"
|
||||||
|
v-model="currentParams"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<strong v-if="tag.label === 'typeFk'">
|
<strong v-if="tag.label === 'typeFk'">
|
||||||
|
@ -188,7 +210,7 @@ onMounted(() => {
|
||||||
@remove="
|
@remove="
|
||||||
customTag.label === 'categoryFk'
|
customTag.label === 'categoryFk'
|
||||||
? resetCategory(params, searchFn)
|
? resetCategory(params, searchFn)
|
||||||
: removeTagGroupParam(params, searchFn, valIndex)
|
: removeTagGroupParam(searchFn, valIndex)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<strong v-if="customTag.label === 'categoryFk'">
|
<strong v-if="customTag.label === 'categoryFk'">
|
||||||
|
@ -288,46 +310,39 @@ onMounted(() => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
|
<QItem class="q-mt-lg q-pa-none">
|
||||||
<QItem class="q-mt-lg">
|
<VnInput
|
||||||
<VnSelect
|
|
||||||
:label="t('components.itemsFilterPanel.value')"
|
:label="t('components.itemsFilterPanel.value')"
|
||||||
:options="props.tagValue"
|
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
v-model="generalSearchParam"
|
v-model="searchByTag"
|
||||||
@update:model-value="
|
@keyup.enter="(val) => onSearchByTag(val, params)"
|
||||||
applyTags(
|
|
||||||
{ values: [{ value: generalSearchParam }] },
|
|
||||||
params,
|
|
||||||
searchFn
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="search" />
|
<QIcon name="search" />
|
||||||
</template>
|
</template>
|
||||||
<template #after>
|
<template #append>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
shortcut="+"
|
shortcut="+"
|
||||||
flat
|
flat
|
||||||
color="primary"
|
color="primary"
|
||||||
size="md"
|
size="md"
|
||||||
|
dense
|
||||||
/>
|
/>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<CatalogFilterValueDialog
|
<CatalogFilterValueDialog
|
||||||
style="display: inline-block"
|
style="display: inline-block"
|
||||||
:tags="tags"
|
:tags="tags"
|
||||||
@apply-tags="
|
@apply-tags="
|
||||||
($event) => applyTags($event, params, searchFn)
|
($event) => applyTags($event, currentParams, searchFn)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnInput>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -126,7 +126,6 @@ const setWireTransfer = async () => {
|
||||||
(_, requestResponse) =>
|
(_, requestResponse) =>
|
||||||
onBankEntityCreated(requestResponse, row)
|
onBankEntityCreated(requestResponse, row)
|
||||||
"
|
"
|
||||||
:show-entity-field="false"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
|
|
@ -33,6 +33,7 @@ const canEditZone = useAcl().hasAny([
|
||||||
const agencyFetchRef = ref();
|
const agencyFetchRef = ref();
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
|
const currenciesOptions = ref([]);
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
|
|
|
@ -130,6 +130,7 @@ function ticketFilter(ticket) {
|
||||||
<QBadge
|
<QBadge
|
||||||
text-color="black"
|
text-color="black"
|
||||||
:color="entity.ticketState.state.classColor"
|
:color="entity.ticketState.state.classColor"
|
||||||
|
data-cy="ticketDescriptorStateBadge"
|
||||||
>
|
>
|
||||||
{{ entity.ticketState.state.name }}
|
{{ entity.ticketState.state.name }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
|
@ -174,7 +175,7 @@ function ticketFilter(ticket) {
|
||||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="entity.problem.includes('hasRisk')"
|
v-if="entity?.problem?.includes('hasRisk')"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
|
@ -239,7 +239,7 @@ function makeInvoiceDialog() {
|
||||||
}
|
}
|
||||||
async function makeInvoice() {
|
async function makeInvoice() {
|
||||||
const params = {
|
const params = {
|
||||||
ticketsIds: [parseInt(ticketId)],
|
ticketsIds: [parseInt(ticketId.value)],
|
||||||
};
|
};
|
||||||
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ async function transferClient(client) {
|
||||||
|
|
||||||
async function addTurn(day) {
|
async function addTurn(day) {
|
||||||
const params = {
|
const params = {
|
||||||
ticketFk: parseInt(ticketId),
|
ticketFk: parseInt(ticketId.value),
|
||||||
weekDay: day,
|
weekDay: day,
|
||||||
agencyModeFk: ticket.value.agencyModeFk,
|
agencyModeFk: ticket.value.agencyModeFk,
|
||||||
};
|
};
|
||||||
|
@ -280,7 +280,7 @@ async function addTurn(day) {
|
||||||
|
|
||||||
async function createRefund(withWarehouse) {
|
async function createRefund(withWarehouse) {
|
||||||
const params = {
|
const params = {
|
||||||
ticketsIds: [parseInt(ticketId)],
|
ticketsIds: [parseInt(ticketId.value)],
|
||||||
withWarehouse: withWarehouse,
|
withWarehouse: withWarehouse,
|
||||||
negative: true,
|
negative: true,
|
||||||
};
|
};
|
||||||
|
@ -368,7 +368,7 @@ async function uploadDocuware(force) {
|
||||||
|
|
||||||
const { data } = await axios.post(`Docuwares/upload`, {
|
const { data } = await axios.post(`Docuwares/upload`, {
|
||||||
fileCabinet: 'deliveryNote',
|
fileCabinet: 'deliveryNote',
|
||||||
ticketIds: [parseInt(ticketId)],
|
ticketIds: [parseInt(ticketId.value)],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
|
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
|
||||||
|
|
|
@ -75,6 +75,7 @@ const cancel = () => {
|
||||||
dense
|
dense
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
@click="save()"
|
@click="save()"
|
||||||
|
data-cy="saveManaBtn"
|
||||||
>
|
>
|
||||||
{{ t('globals.save') }}
|
{{ t('globals.save') }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -86,12 +86,14 @@ async function handleSave() {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.observationTypeFk"
|
v-model="row.observationTypeFk"
|
||||||
:disable="!!row.id"
|
:disable="!!row.id"
|
||||||
|
data-cy="ticketNotesObservationType"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('basicData.description')"
|
:label="t('basicData.description')"
|
||||||
v-model="row.description"
|
v-model="row.description"
|
||||||
class="col"
|
class="col"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
|
data-cy="ticketNotesDescription"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="delete"
|
name="delete"
|
||||||
|
@ -99,6 +101,7 @@ async function handleSave() {
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="handleDelete(row)"
|
@click="handleDelete(row)"
|
||||||
|
data-cy="ticketNotesRemoveNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.removeNote') }}
|
{{ t('ticketNotes.removeNote') }}
|
||||||
|
@ -113,6 +116,7 @@ async function handleSave() {
|
||||||
class="fill-icon-on-hover q-ml-md"
|
class="fill-icon-on-hover q-ml-md"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="ticketNotesCrudRef.insert()"
|
@click="ticketNotesCrudRef.insert()"
|
||||||
|
data-cy="ticketNotesAddNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.addNote') }}
|
{{ t('ticketNotes.addNote') }}
|
||||||
|
|
|
@ -584,6 +584,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:disable="!isTicketEditable || ticketState === 'OK'"
|
:disable="!isTicketEditable || ticketState === 'OK'"
|
||||||
@click="changeTicketState('OK')"
|
@click="changeTicketState('OK')"
|
||||||
|
data-cy="ticketSaleOkStateBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
@ -592,6 +593,7 @@ watch(
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketList.state')"
|
:label="t('ticketList.state')"
|
||||||
:disable="!isTicketEditable"
|
:disable="!isTicketEditable"
|
||||||
|
data-cy="ticketSaleStateDropdown"
|
||||||
>
|
>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:options="editableStatesOptions"
|
:options="editableStatesOptions"
|
||||||
|
@ -601,6 +603,7 @@ watch(
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="changeTicketState"
|
@update:model-value="changeTicketState"
|
||||||
|
data-cy="ticketSaleStateSelect"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
<TicketSaleMoreActions
|
<TicketSaleMoreActions
|
||||||
|
@ -633,6 +636,7 @@ watch(
|
||||||
icon="vn:splitline"
|
icon="vn:splitline"
|
||||||
:disable="!isTicketEditable || !hasSelectedRows"
|
:disable="!isTicketEditable || !hasSelectedRows"
|
||||||
@click="setTransferParams()"
|
@click="setTransferParams()"
|
||||||
|
data-cy="ticketSaleTransferBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||||
<TicketTransfer
|
<TicketTransfer
|
||||||
|
@ -712,7 +716,13 @@ watch(
|
||||||
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="row.reserved" color="primary" name="vn:reserva" size="xs">
|
<QIcon
|
||||||
|
v-if="row.reserved"
|
||||||
|
color="primary"
|
||||||
|
name="vn:reserva"
|
||||||
|
size="xs"
|
||||||
|
data-cy="ticketSaleReservedIcon"
|
||||||
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketSale.reserved') }}
|
{{ t('ticketSale.reserved') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
@ -865,7 +875,14 @@ watch(
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" shortcut="+" />
|
<QBtn
|
||||||
|
@click="newOrderFromTicket()"
|
||||||
|
color="primary"
|
||||||
|
fab
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
data-cy="ticketSaleAddToBasketBtn"
|
||||||
|
/>
|
||||||
<QTooltip class="text-no-wrap">
|
<QTooltip class="text-no-wrap">
|
||||||
{{ t('Add item to basket') }}
|
{{ t('Add item to basket') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
|
|
@ -179,6 +179,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ticketSale.more')"
|
:label="t('ticketSale.more')"
|
||||||
:disable="disable"
|
:disable="disable"
|
||||||
|
data-cy="ticketSaleMoreActionsDropdown"
|
||||||
>
|
>
|
||||||
<template #label>
|
<template #label>
|
||||||
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
||||||
|
@ -190,6 +191,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="showSmsDialog('productNotAvailable')"
|
@click="showSmsDialog('productNotAvailable')"
|
||||||
|
data-cy="sendShortageSMSItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
|
||||||
|
@ -201,12 +203,18 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="calculateSalePrice()"
|
@click="calculateSalePrice()"
|
||||||
|
data-cy="recalculatePriceItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple @click="emit('getMana')">
|
<QItem
|
||||||
|
clickable
|
||||||
|
v-ripple
|
||||||
|
@click="emit('getMana')"
|
||||||
|
data-cy="updateDiscountItem"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -215,6 +223,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-model.number="newDiscount"
|
v-model.number="newDiscount"
|
||||||
:label="t('ticketSale.discount')"
|
:label="t('ticketSale.discount')"
|
||||||
type="number"
|
type="number"
|
||||||
|
data-cy="ticketSaleDiscountInput"
|
||||||
/>
|
/>
|
||||||
</TicketEditManaProxy>
|
</TicketEditManaProxy>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -224,6 +233,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="createClaim()"
|
@click="createClaim()"
|
||||||
|
data-cy="createClaimItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
|
||||||
|
@ -235,6 +245,7 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(true)"
|
@click="setReserved(true)"
|
||||||
|
data-cy="markAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
|
||||||
|
@ -246,12 +257,13 @@ const createRefund = async (withWarehouse) => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-ripple
|
v-ripple
|
||||||
@click="setReserved(false)"
|
@click="setReserved(false)"
|
||||||
|
data-cy="unmarkAsReservedItem"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem clickable v-ripple>
|
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -260,12 +272,22 @@ const createRefund = async (withWarehouse) => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||||
<QList>
|
<QList>
|
||||||
<QItem v-ripple clickable @click="createRefund(true)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(true)"
|
||||||
|
data-cy="ticketSaleRefundWithWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('with warehouse') }}
|
{{ t('with warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable @click="createRefund(false)">
|
<QItem
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="createRefund(false)"
|
||||||
|
data-cy="ticketSaleRefundWithoutWarehouse"
|
||||||
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('without warehouse') }}
|
{{ t('without warehouse') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -100,6 +100,7 @@ function toTicketUrl(section) {
|
||||||
ref="summaryRef"
|
ref="summaryRef"
|
||||||
:url="`Tickets/${entityId}/summary`"
|
:url="`Tickets/${entityId}/summary`"
|
||||||
data-key="TicketSummary"
|
data-key="TicketSummary"
|
||||||
|
data-cy="ticketSummary"
|
||||||
>
|
>
|
||||||
<template #header-left>
|
<template #header-left>
|
||||||
<VnToSummary
|
<VnToSummary
|
||||||
|
|
|
@ -91,7 +91,7 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketTransferPopup">
|
||||||
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="transfer.sales"
|
:rows="transfer.sales"
|
||||||
|
|
|
@ -57,6 +57,7 @@ defineExpose({ transferSales });
|
||||||
v-model.number="_transfer.ticketId"
|
v-model.number="_transfer.ticketId"
|
||||||
:label="t('Transfer to ticket')"
|
:label="t('Transfer to ticket')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
|
data-cy="ticketTransferDestinationTicketInput"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -64,6 +65,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="transferSales(_transfer.ticketId)"
|
@click="transferSales(_transfer.ticketId)"
|
||||||
style="width: 30px"
|
style="width: 30px"
|
||||||
|
data-cy="ticketTransferTransferBtn"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
|
@ -72,6 +74,7 @@ defineExpose({ transferSales });
|
||||||
color="primary"
|
color="primary"
|
||||||
class="full-width q-my-lg"
|
class="full-width q-my-lg"
|
||||||
@click="transferSales()"
|
@click="transferSales()"
|
||||||
|
data-cy="ticketTransferNewTicketBtn"
|
||||||
/>
|
/>
|
||||||
</QForm>
|
</QForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -462,6 +462,7 @@ function setReference(data) {
|
||||||
data-key="TicketList"
|
data-key="TicketList"
|
||||||
:label="t('Search ticket')"
|
:label="t('Search ticket')"
|
||||||
:info="t('You can search by ticket id or alias')"
|
:info="t('You can search by ticket id or alias')"
|
||||||
|
data-cy="ticketListSearchBar"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -489,6 +490,7 @@ function setReference(data) {
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
}"
|
}"
|
||||||
|
data-cy="ticketListTable"
|
||||||
>
|
>
|
||||||
<template #column-statusIcons="{ row }">
|
<template #column-statusIcons="{ row }">
|
||||||
<TicketProblems :row="row" />
|
<TicketProblems :row="row" />
|
||||||
|
|
|
@ -21,12 +21,7 @@ const agenciesOptions = ref([]);
|
||||||
@on-fetch="(data) => (agenciesOptions = data)"
|
@on-fetch="(data) => (agenciesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FormModel
|
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel" auto-load>
|
||||||
:url="`Travels/${route.params.id}`"
|
|
||||||
:url-update="`Travels/${route.params.id}`"
|
|
||||||
model="Travel"
|
|
||||||
auto-load
|
|
||||||
>
|
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput v-model="data.ref" :label="t('globals.reference')" />
|
<VnInput v-model="data.ref" :label="t('globals.reference')" />
|
||||||
|
@ -78,6 +73,7 @@ const agenciesOptions = ref([]);
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
<QCheckbox v-model="data.isRaid" :label="t('travel.basicData.isRaid')" />
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('travel.summary.delivered')"
|
:label="t('travel.summary.delivered')"
|
||||||
v-model="data.isDelivered"
|
v-model="data.isDelivered"
|
||||||
|
@ -93,7 +89,7 @@ const agenciesOptions = ref([]);
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
raidDays: Al rellenarlo, generamos una redada. Indica los días que un travel se moverá automáticamente en el tiempo
|
raidDays: Si se marca "Redada", la fecha de entrega se moverá automáticamente los días indicados (incluido 0). Si se deja vacio, la fecha no cambiará
|
||||||
en:
|
en:
|
||||||
raidDays: When filling, a raid is generated. Enter the number of days the travel will automatically forward in time
|
raidDays: If "Raid" is checked, the landing date will automatically shift by the specified number of days (including 0). If left empty, the date will stay the same.
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,34 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import TravelDescriptor from './TravelDescriptor.vue';
|
import TravelDescriptor from './TravelDescriptor.vue';
|
||||||
|
import filter from './TravelFilter.js';
|
||||||
const filter = {
|
|
||||||
fields: [
|
|
||||||
'id',
|
|
||||||
'ref',
|
|
||||||
'shipped',
|
|
||||||
'landed',
|
|
||||||
'totalEntries',
|
|
||||||
'warehouseInFk',
|
|
||||||
'warehouseOutFk',
|
|
||||||
'cargoSupplierFk',
|
|
||||||
'agencyModeFk',
|
|
||||||
],
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
relation: 'warehouseIn',
|
|
||||||
scope: {
|
|
||||||
fields: ['name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relation: 'warehouseOut',
|
|
||||||
scope: {
|
|
||||||
fields: ['name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
|
|
|
@ -7,6 +7,7 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
import TravelDescriptorMenuItems from './TravelDescriptorMenuItems.vue';
|
import TravelDescriptorMenuItems from './TravelDescriptorMenuItems.vue';
|
||||||
|
import filter from './TravelFilter.js';
|
||||||
|
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
|
|
||||||
|
@ -21,35 +22,6 @@ const $props = defineProps({
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const filter = {
|
|
||||||
fields: [
|
|
||||||
'id',
|
|
||||||
'ref',
|
|
||||||
'shipped',
|
|
||||||
'landed',
|
|
||||||
'totalEntries',
|
|
||||||
'warehouseInFk',
|
|
||||||
'warehouseOutFk',
|
|
||||||
'cargoSupplierFk',
|
|
||||||
'agencyModeFk',
|
|
||||||
'daysInForward',
|
|
||||||
],
|
|
||||||
include: [
|
|
||||||
{
|
|
||||||
relation: 'warehouseIn',
|
|
||||||
scope: {
|
|
||||||
fields: ['name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
relation: 'warehouseOut',
|
|
||||||
scope: {
|
|
||||||
fields: ['name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
@ -65,7 +37,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
|
||||||
:title="data.title"
|
:title="data.title"
|
||||||
:subtitle="data.subtitle"
|
:subtitle="data.subtitle"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
data-key="travelData"
|
data-key="Travel"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
>
|
>
|
||||||
<template #menu="{ entity }">
|
<template #menu="{ entity }">
|
||||||
|
@ -80,12 +52,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
|
||||||
</template>
|
</template>
|
||||||
<template #icons="{ entity }">
|
<template #icons="{ entity }">
|
||||||
<QCardActions class="q-gutter-x-md">
|
<QCardActions class="q-gutter-x-md">
|
||||||
<QIcon
|
<QIcon v-if="entity.isRaid" name="vn:net" color="primary" size="xs">
|
||||||
v-if="entity.daysInForward"
|
|
||||||
name="vn:net"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
t('globals.raid', { daysInForward: entity.daysInForward })
|
t('globals.raid', { daysInForward: entity.daysInForward })
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
export default {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
'ref',
|
||||||
|
'shipped',
|
||||||
|
'landed',
|
||||||
|
'totalEntries',
|
||||||
|
'warehouseInFk',
|
||||||
|
'warehouseOutFk',
|
||||||
|
'cargoSupplierFk',
|
||||||
|
'agencyModeFk',
|
||||||
|
'isRaid',
|
||||||
|
'daysInForward',
|
||||||
|
],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'warehouseIn',
|
||||||
|
scope: {
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'warehouseOut',
|
||||||
|
scope: {
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
|
@ -268,6 +268,11 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
||||||
:label="t('globals.warehouseOut')"
|
:label="t('globals.warehouseOut')"
|
||||||
:value="travel.warehouseOut?.name"
|
:value="travel.warehouseOut?.name"
|
||||||
/>
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
:label="t('travel.basicData.isRaid')"
|
||||||
|
v-model="travel.isRaid"
|
||||||
|
:disable="true"
|
||||||
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('travel.summary.delivered')"
|
:label="t('travel.summary.delivered')"
|
||||||
v-model="travel.isDelivered"
|
v-model="travel.isDelivered"
|
||||||
|
@ -286,6 +291,10 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
||||||
:label="t('globals.warehouseIn')"
|
:label="t('globals.warehouseIn')"
|
||||||
:value="travel.warehouseIn?.name"
|
:value="travel.warehouseIn?.name"
|
||||||
/>
|
/>
|
||||||
|
<VnLv
|
||||||
|
:label="t('travel.basicData.daysInForward')"
|
||||||
|
:value="travel?.daysInForward"
|
||||||
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('travel.summary.received')"
|
:label="t('travel.summary.received')"
|
||||||
v-model="travel.isReceived"
|
v-model="travel.isReceived"
|
||||||
|
@ -303,10 +312,6 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
||||||
<VnLv :label="t('globals.reference')" :value="travel.ref" />
|
<VnLv :label="t('globals.reference')" :value="travel.ref" />
|
||||||
<VnLv label="m³" :value="travel.m3" />
|
<VnLv label="m³" :value="travel.m3" />
|
||||||
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
|
<VnLv :label="t('globals.totalEntries')" :value="travel.totalEntries" />
|
||||||
<VnLv
|
|
||||||
:label="t('travel.basicData.daysInForward')"
|
|
||||||
:value="travel?.daysInForward"
|
|
||||||
/>
|
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="full-width">
|
<QCard class="full-width">
|
||||||
<VnTitle :text="t('travel.summary.entries')" />
|
<VnTitle :text="t('travel.summary.entries')" />
|
||||||
|
|
|
@ -227,10 +227,12 @@ const columns = computed(() => [
|
||||||
>
|
>
|
||||||
<template #column-status="{ row }">
|
<template #column-status="{ row }">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
|
<QIcon v-if="!!row.isRaid" name="vn:net" color="primary">
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
t('globals.raid', { daysInForward: row.daysInForward })
|
t('globals.raid', {
|
||||||
|
daysInForward: row.daysInForward,
|
||||||
|
})
|
||||||
}}</QTooltip
|
}}</QTooltip
|
||||||
>
|
>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
|
|
|
@ -15,7 +15,7 @@ const filter = {
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'nickname'],
|
fields: ['id', 'nickname', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,7 +24,6 @@ function notIsLocations(ifIsFalse, ifIsTrue) {
|
||||||
:descriptor="ZoneDescriptor"
|
:descriptor="ZoneDescriptor"
|
||||||
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
|
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
|
||||||
:search-data-key="notIsLocations('ZoneList', undefined)"
|
:search-data-key="notIsLocations('ZoneList', undefined)"
|
||||||
:custom-url="`Zones/${route.params?.id}/getLeaves`"
|
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: notIsLocations('Zones', 'ZoneLocations'),
|
url: notIsLocations('Zones', 'ZoneLocations'),
|
||||||
label: notIsLocations(t('list.searchZone'), t('list.searchLocation')),
|
label: notIsLocations(t('list.searchZone'), t('list.searchLocation')),
|
||||||
|
|
|
@ -39,8 +39,7 @@ const url = computed(() => `Zones/${route.params.id}/getLeaves`);
|
||||||
const arrayData = useArrayData(datakey, {
|
const arrayData = useArrayData(datakey, {
|
||||||
url: url.value,
|
url: url.value,
|
||||||
});
|
});
|
||||||
const { store } = arrayData;
|
const store = arrayData.store;
|
||||||
const storeData = computed(() => store.data);
|
|
||||||
|
|
||||||
const defaultNode = {
|
const defaultNode = {
|
||||||
id: null,
|
id: null,
|
||||||
|
@ -66,8 +65,20 @@ const onNodeExpanded = async (nodeKeysArray) => {
|
||||||
if (!nodeKeysSet.has(null)) return;
|
if (!nodeKeysSet.has(null)) return;
|
||||||
|
|
||||||
const wasExpanded = !previousExpandedNodes.value.has(lastNodeKey);
|
const wasExpanded = !previousExpandedNodes.value.has(lastNodeKey);
|
||||||
if (wasExpanded) await fetchNodeLeaves(lastNodeKey);
|
if (wasExpanded && treeRef.value) {
|
||||||
else {
|
const node = treeRef.value?.getNodeByKey(lastNodeKey);
|
||||||
|
const params = { parentId: node.id };
|
||||||
|
const response = await axios.get(`Zones/${route.params.id}/getLeaves`, {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
if (response.data) {
|
||||||
|
node.childs = response.data.map((n) => {
|
||||||
|
if (n.sons > 0) n.childs = [{}];
|
||||||
|
return n;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await fetchNodeLeaves(lastNodeKey, true);
|
||||||
|
} else {
|
||||||
const difference = new Set(
|
const difference = new Set(
|
||||||
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x))
|
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x))
|
||||||
);
|
);
|
||||||
|
@ -83,41 +94,21 @@ const formatNodeSelected = (node) => {
|
||||||
if (node.selected === 1) node.selected = true;
|
if (node.selected === 1) node.selected = true;
|
||||||
else if (node.selected === 0) node.selected = false;
|
else if (node.selected === 0) node.selected = false;
|
||||||
|
|
||||||
if (node.childs && node.childs.length > 0) {
|
|
||||||
expanded.value.push(node.id);
|
|
||||||
|
|
||||||
node.childs.forEach((childNode) => {
|
|
||||||
formatNodeSelected(childNode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.sons > 0 && !node.childs) node.childs = [{}];
|
if (node.sons > 0 && !node.childs) node.childs = [{}];
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchNodeLeaves = async (nodeKey) => {
|
const fetchNodeLeaves = async (nodeKey) => {
|
||||||
try {
|
if (!treeRef.value) return;
|
||||||
const node = treeRef.value?.getNodeByKey(nodeKey);
|
const node = treeRef.value?.getNodeByKey(nodeKey);
|
||||||
if (!node || node.sons === 0) return;
|
if (node.selected === 1) node.selected = true;
|
||||||
|
else if (node.selected === 0) node.selected = false;
|
||||||
|
if (!node || node.sons === 0) return;
|
||||||
|
|
||||||
const params = { parentId: node.id };
|
state.set('Tree', node);
|
||||||
const response = await axios.get(`Zones/${route.params.id}/getLeaves`, {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
if (response.data) {
|
|
||||||
node.childs = response.data.map((n) => {
|
|
||||||
formatNodeSelected(n);
|
|
||||||
return n;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
state.set('Tree', node);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching department leaves', err);
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getNodeIds(node) {
|
function getNodeIds(node) {
|
||||||
|
if (!node) return [];
|
||||||
let ids = [];
|
let ids = [];
|
||||||
if (node.id) ids.push(node.id);
|
if (node.id) ids.push(node.id);
|
||||||
|
|
||||||
|
@ -128,60 +119,46 @@ function getNodeIds(node) {
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(storeData, async (val) => {
|
watch(
|
||||||
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
|
() => store.data,
|
||||||
if (!nodes.value[0]) nodes.value = [defaultNode];
|
async (val) => {
|
||||||
nodes.value[0].childs = [...val];
|
if (!val) return;
|
||||||
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
// // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
|
||||||
state.set('Tree', [...fetchedNodeKeys]);
|
if (!nodes.value[0]) nodes.value = [defaultNode];
|
||||||
|
nodes.value[0].childs = [...val];
|
||||||
|
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
||||||
|
state.set('Tree', [...fetchedNodeKeys]);
|
||||||
|
|
||||||
if (store.userParams?.search === '') {
|
if (!store.userParams?.search) {
|
||||||
val.forEach((n) => {
|
val.forEach((n) => {
|
||||||
formatNodeSelected(n);
|
formatNodeSelected(n);
|
||||||
});
|
});
|
||||||
} else {
|
store.data = null;
|
||||||
for (let n of state.get('Tree')) await fetchNodeLeaves(n);
|
expanded.value = [null];
|
||||||
expanded.value = [null, ...fetchedNodeKeys];
|
} else {
|
||||||
}
|
for (let n of state.get('Tree')) {
|
||||||
previousExpandedNodes.value = new Set(expanded.value);
|
await fetchNodeLeaves(n);
|
||||||
});
|
}
|
||||||
|
expanded.value = [null, ...fetchedNodeKeys];
|
||||||
|
}
|
||||||
|
previousExpandedNodes.value = new Set(expanded.value);
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
const reFetch = async () => {
|
const reFetch = async () => {
|
||||||
const { data } = await arrayData.fetch({ append: false });
|
const { data } = await arrayData.fetch({ append: false });
|
||||||
nodes.value = data;
|
nodes.value = data;
|
||||||
|
expanded.value = [null];
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (store.userParams?.search && !props.showSearchBar) {
|
if (store.userParams?.search) await arrayData.fetch({});
|
||||||
await reFetch();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const stateTree = state.get('Tree');
|
|
||||||
const tree = stateTree ? [...state.get('Tree')] : [null];
|
|
||||||
const lastStateTree = state.get('TreeState');
|
|
||||||
if (tree) {
|
|
||||||
for (let n of tree) {
|
|
||||||
await fetchNodeLeaves(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastStateTree) {
|
|
||||||
tree.push(lastStateTree);
|
|
||||||
await fetchNodeLeaves(lastStateTree);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
if (lastStateTree) {
|
|
||||||
document.getElementById(lastStateTree).scrollIntoView();
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
expanded.value.unshift(null);
|
|
||||||
previousExpandedNodes.value = new Set(expanded.value);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
state.set('Tree', undefined);
|
state.set('Tree', undefined);
|
||||||
|
arrayData.destroy();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,11 @@ describe('Client list', () => {
|
||||||
cy.visit('/#/customer/list', {
|
cy.visit('/#/customer/list', {
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
onBeforeLoad(win) {
|
onBeforeLoad(win) {
|
||||||
cy.stub(win, 'open');
|
cy.stub(win, 'open')
|
||||||
|
.callsFake((url) => {
|
||||||
|
return win.open.wrappedMethod.call(win, url, '_self');
|
||||||
|
})
|
||||||
|
.as('Open');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -20,9 +24,9 @@ describe('Client list', () => {
|
||||||
'Web user': { val: 'user_test_1' },
|
'Web user': { val: 'user_test_1' },
|
||||||
Street: { val: 'C/ STREET 1' },
|
Street: { val: 'C/ STREET 1' },
|
||||||
Email: { val: 'user.test@1.com' },
|
Email: { val: 'user.test@1.com' },
|
||||||
'Business type': { val: 'Otros', type: 'select' },
|
'Sales person': { val: 'employee', type: 'select' },
|
||||||
'Sales person': { val: 'salesboss', type: 'select' },
|
|
||||||
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
|
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
|
||||||
|
'Business type': { val: 'Otros', type: 'select' },
|
||||||
};
|
};
|
||||||
cy.fillInForm(data);
|
cy.fillInForm(data);
|
||||||
|
|
||||||
|
@ -47,17 +51,19 @@ describe('Client list', () => {
|
||||||
it('Client founded create ticket', () => {
|
it('Client founded create ticket', () => {
|
||||||
const search = 'Jessica Jones';
|
const search = 'Jessica Jones';
|
||||||
cy.searchByLabel('Name', search);
|
cy.searchByLabel('Name', search);
|
||||||
cy.clickButtonsDescriptor(2);
|
cy.openActionDescriptor('Create ticket');
|
||||||
cy.waitForElement('#formModel');
|
cy.waitForElement('#formModel');
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
cy.checkValueForm(1, search);
|
cy.checkValueSelectForm(1, search);
|
||||||
|
cy.checkValueSelectForm(2, search);
|
||||||
});
|
});
|
||||||
it('Client founded create order', () => {
|
it('Client founded create order', () => {
|
||||||
const search = 'Jessica Jones';
|
const search = 'Jessica Jones';
|
||||||
cy.searchByLabel('Name', search);
|
cy.searchByLabel('Name', search);
|
||||||
cy.clickButtonsDescriptor(4);
|
cy.openActionDescriptor('New order');
|
||||||
cy.waitForElement('#formModel');
|
cy.waitForElement('#formModel');
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
|
cy.checkValueForm(1, search);
|
||||||
cy.checkValueForm(2, search);
|
cy.checkValueForm(2, search);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketList', () => {
|
||||||
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/list');
|
||||||
|
});
|
||||||
|
|
||||||
|
const searchResults = (search) => {
|
||||||
|
cy.dataCy('vnSearchBar').find('input').focus();
|
||||||
|
if (search) cy.dataCy('vnSearchBar').find('input').type(search);
|
||||||
|
cy.dataCy('vnSearchBar').find('input').type('{enter}');
|
||||||
|
cy.dataCy('ticketListTable').should('exist');
|
||||||
|
cy.get(firstRow).should('exist');
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should search results', () => {
|
||||||
|
cy.dataCy('ticketListTable').should('not.exist');
|
||||||
|
cy.get('.q-field__control').should('exist');
|
||||||
|
searchResults();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open ticket sales', () => {
|
||||||
|
searchResults();
|
||||||
|
cy.window().then((win) => {
|
||||||
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
|
});
|
||||||
|
cy.get(firstRow).find('.q-btn:first').click();
|
||||||
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open ticket summary', () => {
|
||||||
|
searchResults();
|
||||||
|
cy.get(firstRow).find('.q-btn:last').click();
|
||||||
|
cy.dataCy('ticketSummary').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Client list create new client', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
const data = {
|
||||||
|
Customer: { val: 1, type: 'select' },
|
||||||
|
Warehouse: { val: 'Warehouse One', type: 'select' },
|
||||||
|
Address: { val: 'employee', type: 'select' },
|
||||||
|
Landed: { val: '01-01-2024', type: 'date' },
|
||||||
|
};
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
cy.url().should('match', /\/ticket\/\d+\/summary/);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,25 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketRequest', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/observation');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Creates and deletes a note', () => {
|
||||||
|
cy.dataCy('ticketNotesAddNoteBtn').should('exist');
|
||||||
|
cy.dataCy('ticketNotesAddNoteBtn').click();
|
||||||
|
cy.dataCy('ticketNotesObservationType').should('exist');
|
||||||
|
cy.selectOption('[data-cy="ticketNotesObservationType"]:last', 'Weight');
|
||||||
|
cy.dataCy('ticketNotesDescription').should('exist');
|
||||||
|
cy.get('[data-cy="ticketNotesDescription"]:last').type(
|
||||||
|
'This is a note description'
|
||||||
|
);
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.dataCy('ticketNotesRemoveNoteBtn').should('exist');
|
||||||
|
cy.dataCy('ticketNotesRemoveNoteBtn').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,22 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketRequest', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/request');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Creates a new request', () => {
|
||||||
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
const data = {
|
||||||
|
Description: { val: 'Purchase description' },
|
||||||
|
Atender: { val: 'buyerNick', type: 'select' },
|
||||||
|
Quantity: { val: 2 },
|
||||||
|
Price: { val: 123 },
|
||||||
|
};
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,131 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
const c = require('croppie');
|
||||||
|
|
||||||
|
describe('TicketSale', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/sale');
|
||||||
|
});
|
||||||
|
|
||||||
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
|
const selectFirstRow = () => {
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
||||||
|
};
|
||||||
|
|
||||||
|
it('it should add item to basket', () => {
|
||||||
|
cy.window().then((win) => {
|
||||||
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
|
});
|
||||||
|
cy.dataCy('ticketSaleAddToBasketBtn').should('exist');
|
||||||
|
cy.dataCy('ticketSaleAddToBasketBtn').click();
|
||||||
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/order\/\d+\/catalog/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should send SMS', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="sendShortageSMSItem"]');
|
||||||
|
cy.dataCy('sendShortageSMSItem').should('exist');
|
||||||
|
cy.dataCy('sendShortageSMSItem').click();
|
||||||
|
cy.dataCy('vnSmsDialog').should('exist');
|
||||||
|
cy.dataCy('sendSmsBtn').click();
|
||||||
|
cy.checkNotification('SMS sent');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should recalculate price when "Recalculate price" is clicked', () => {
|
||||||
|
cy.intercept('POST', '**/recalculatePrice').as('recalculatePrice');
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="recalculatePriceItem"]');
|
||||||
|
cy.dataCy('recalculatePriceItem').should('exist');
|
||||||
|
cy.dataCy('recalculatePriceItem').click();
|
||||||
|
cy.wait('@recalculatePrice').its('response.statusCode').should('eq', 200);
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should update discount when "Update discount" is clicked', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="updateDiscountItem"]');
|
||||||
|
cy.dataCy('updateDiscountItem').should('exist');
|
||||||
|
cy.dataCy('updateDiscountItem').click();
|
||||||
|
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
|
||||||
|
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
|
||||||
|
cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
|
||||||
|
cy.dataCy('saveManaBtn').click();
|
||||||
|
cy.waitForElement('.q-notification__message');
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('adds claim', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.dataCy('createClaimItem').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.url().should('match', /\/claim\/\d+\/basic-data/);
|
||||||
|
// Delete created claim to avoid cluttering the database
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.dataCy('deleteClaim').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('Data deleted');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('marks row as reserved', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="markAsReservedItem"]');
|
||||||
|
cy.dataCy('markAsReservedItem').click();
|
||||||
|
cy.dataCy('ticketSaleReservedIcon').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('unmarks row as reserved', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.waitForElement('[data-cy="unmarkAsReservedItem"]');
|
||||||
|
cy.dataCy('unmarkAsReservedItem').click();
|
||||||
|
cy.dataCy('ticketSaleReservedIcon').should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('refunds row with warehouse', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.dataCy('ticketSaleRefundItem').click();
|
||||||
|
cy.dataCy('ticketSaleRefundWithWarehouse').click();
|
||||||
|
cy.checkNotification('The following refund ticket have been created');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('refunds row without warehouse', () => {
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
|
cy.dataCy('ticketSaleRefundItem').click();
|
||||||
|
cy.dataCy('ticketSaleRefundWithoutWarehouse').click();
|
||||||
|
cy.checkNotification('The following refund ticket have been created');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('transfers ticket', () => {
|
||||||
|
cy.visit('/#/ticket/32/sale');
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleTransferBtn').click();
|
||||||
|
cy.dataCy('ticketTransferPopup').should('exist');
|
||||||
|
cy.dataCy('ticketTransferNewTicketBtn').click();
|
||||||
|
// existen 3 elementos "tbody" necesito checkear que el segundo elemento tbody tenga una row sola
|
||||||
|
cy.get('tbody').eq(1).find('tr').should('have.length', 1);
|
||||||
|
selectFirstRow();
|
||||||
|
cy.dataCy('ticketSaleTransferBtn').click();
|
||||||
|
cy.dataCy('ticketTransferPopup').should('exist');
|
||||||
|
cy.dataCy('ticketTransferDestinationTicketInput').find('input').focus();
|
||||||
|
cy.dataCy('ticketTransferDestinationTicketInput').find('input').type('32');
|
||||||
|
cy.dataCy('ticketTransferTransferBtn').click();
|
||||||
|
// checkear que la url contenga /ticket/1000002/sale
|
||||||
|
cy.url().should('match', /\/ticket\/32\/sale/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to ticket logs', () => {
|
||||||
|
cy.get(firstRow).find('.q-btn:last').click();
|
||||||
|
cy.url().should('match', /\/ticket\/31\/log/);
|
||||||
|
});
|
||||||
|
});
|
|
@ -7,6 +7,9 @@ describe('VnLocation', () => {
|
||||||
prefix: '.q-dialog__inner > .column > #formModel > .q-card',
|
prefix: '.q-dialog__inner > .column > #formModel > .q-card',
|
||||||
sufix: ' .q-field__inner > .q-field__control',
|
sufix: ' .q-field__inner > .q-field__control',
|
||||||
};
|
};
|
||||||
|
const countrySelector = `${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`;
|
||||||
|
const provinceSelector = `${createForm.prefix} > :nth-child(5) > :nth-child(2) > ${createForm.sufix}`;
|
||||||
|
const citySelector = `${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`;
|
||||||
describe('CreateFormDialog ', () => {
|
describe('CreateFormDialog ', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
|
@ -16,46 +19,23 @@ describe('VnLocation', () => {
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
});
|
});
|
||||||
it('should filter provinces based on selected country', () => {
|
it('should filter provinces based on selected country', () => {
|
||||||
// Select a country
|
const country = 'Ecuador';
|
||||||
cy.selectOption(
|
cy.selectOption(countrySelector, country);
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
|
cy.get(countrySelector).should('have.length', 1);
|
||||||
'Ecuador'
|
cy.get(citySelector).should('have.length', 1);
|
||||||
);
|
|
||||||
// Verify that provinces are filtered
|
|
||||||
cy.get(
|
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
|
|
||||||
).should('have.length', 1);
|
|
||||||
|
|
||||||
// Verify that towns are filtered
|
|
||||||
cy.get(
|
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
|
||||||
).should('have.length', 1);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should filter towns based on selected province', () => {
|
it('should filter towns based on selected province', () => {
|
||||||
// Select a country
|
const country = 'Ecuador';
|
||||||
cy.selectOption(
|
cy.selectOption(countrySelector, country);
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`,
|
cy.get(provinceSelector).should('have.length', 1);
|
||||||
'Ecuador'
|
cy.get(citySelector).should('have.length', 1);
|
||||||
);
|
|
||||||
// Verify that provinces are filtered
|
|
||||||
cy.get(
|
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
|
|
||||||
).should('have.length', 1);
|
|
||||||
|
|
||||||
// Verify that towns are filtered
|
|
||||||
cy.get(
|
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
|
||||||
).should('have.length', 1);
|
|
||||||
});
|
});
|
||||||
it('should pass selected country', () => {
|
it('should pass selected country', () => {
|
||||||
// Select a country
|
|
||||||
const country = 'Ecuador';
|
const country = 'Ecuador';
|
||||||
const province = 'Province five';
|
const province = 'Province five';
|
||||||
cy.selectOption(
|
|
||||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
|
cy.selectOption(countrySelector, country);
|
||||||
country
|
|
||||||
);
|
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
||||||
province
|
province
|
||||||
|
@ -80,13 +60,11 @@ describe('VnLocation', () => {
|
||||||
cy.get(locationOptions).should('have.length.at.least', 5);
|
cy.get(locationOptions).should('have.length.at.least', 5);
|
||||||
});
|
});
|
||||||
it('input filter location as "al"', function () {
|
it('input filter location as "al"', function () {
|
||||||
// cy.get(inputLocation).click();
|
|
||||||
cy.get(inputLocation).clear();
|
cy.get(inputLocation).clear();
|
||||||
cy.get(inputLocation).type('al');
|
cy.get(inputLocation).type('al');
|
||||||
cy.get(locationOptions).should('have.length.at.least', 4);
|
cy.get(locationOptions).should('have.length.at.least', 4);
|
||||||
});
|
});
|
||||||
it('input filter location as "ecuador"', function () {
|
it('input filter location as "ecuador"', function () {
|
||||||
// cy.get(inputLocation).click();
|
|
||||||
cy.get(inputLocation).clear();
|
cy.get(inputLocation).clear();
|
||||||
cy.get(inputLocation).type('ecuador');
|
cy.get(inputLocation).type('ecuador');
|
||||||
cy.get(locationOptions).should('have.length.at.least', 1);
|
cy.get(locationOptions).should('have.length.at.least', 1);
|
||||||
|
@ -142,7 +120,6 @@ describe('VnLocation', () => {
|
||||||
const province = 'Saskatchew';
|
const province = 'Saskatchew';
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
cy.get(dialogInputs).eq(0).type(postCode);
|
cy.get(dialogInputs).eq(0).type(postCode);
|
||||||
// city create button
|
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
|
||||||
).click();
|
).click();
|
||||||
|
@ -151,7 +128,6 @@ describe('VnLocation', () => {
|
||||||
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
||||||
cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
|
|
||||||
checkVnLocation(postCode, province);
|
checkVnLocation(postCode, province);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -297,16 +297,20 @@ Cypress.Commands.add('checkNotification', (text) => {
|
||||||
|
|
||||||
Cypress.Commands.add('checkValueForm', (id, search) => {
|
Cypress.Commands.add('checkValueForm', (id, search) => {
|
||||||
cy.get(
|
cy.get(
|
||||||
`.grid-create > :nth-child(${id}) > .q-field__inner>.q-field__control> .q-field__control-container>.q-field__native >.q-field__input`
|
`.grid-create > :nth-child(${id}) > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input`
|
||||||
).should('have.value', search);
|
).should('have.value', search);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('checkValueSelectForm', (id, search) => {
|
Cypress.Commands.add('checkValueSelectForm', (id, search) => {
|
||||||
cy.get(
|
cy.get(
|
||||||
`.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container>.q-field__native>.q-field__input`
|
`.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input`
|
||||||
).should('have.value', search);
|
).should('have.value', search);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('searchByLabel', (label, value) => {
|
Cypress.Commands.add('searchByLabel', (label, value) => {
|
||||||
cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
|
cy.get(`[label="${label}"] > .q-field > .q-field__inner`).type(`${value}{enter}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('dataCy', (dataTestId, attr = 'data-cy') => {
|
||||||
|
return cy.get(`[${attr}="${dataTestId}"]`);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue