Compare commits

...

63 Commits

Author SHA1 Message Date
Carlos Satorres 3352cea0e7 fix: refs #7529 fix e2e
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-22 06:08:11 +01:00
Carlos Satorres a0f804ab78 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7529-workerPIT 2024-11-21 12:19:30 +01:00
Alex Moreno fdc71a13ff Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix-front into dev
gitea/salix-front/pipeline/head This commit looks good Details
2024-11-21 10:26:38 +01:00
Alex Moreno bf0bda0e27 Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
gitea/salix-front/pipeline/head This commit looks good Details
2024-11-21 10:26:29 +01:00
Javier Segarra 3bc5c9bd6a Merge pull request '#8162 - E2E Tickets' (!951) from wbuezas/salix-front-mindshore-fork2:8162-E2ETickets into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #951
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
2024-11-21 09:19:54 +00:00
Jon Elias 0cefe391cb Merge pull request 'Hotfix: Show only the correct path of the search' (!954) from Hotfix-ZoneLocationsTree into master
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #954
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-21 09:15:45 +00:00
Jon Elias 747bc4af76 Merge branch 'master' into Hotfix-ZoneLocationsTree
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-21 09:13:42 +00:00
Jon Elias 5ff95c2b93 fix: locations tree
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-21 10:10:44 +01:00
Alex Moreno 0c3581f3dc Merge pull request 'hotFix(orderCatalogFilter): fix searchByTag' (!961) from hotFix_orderCatalogFilter_values into master
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #961
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
2024-11-21 09:09:51 +00:00
Javier Segarra f36363dbd2 Merge pull request 'warmfix: ItemLastEntries to date' (!981) from warmfix_itemLastEntriesFilter into test
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #981
Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
2024-11-21 09:09:50 +00:00
Javier Segarra e5434e7436 warmfix: ItemLastEntries to date
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-21 09:08:52 +00:00
Javier Segarra 0434332ec4 Merge branch 'master' into hotFix_orderCatalogFilter_values
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-21 08:27:13 +00:00
Javier Segarra 81d7b9f04f Merge branch 'dev' into 8162-E2ETickets
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-21 08:20:29 +00:00
Javier Segarra 6f324b44b8 Merge pull request 'WARMFIX: e2e jsegarra' (!973) from fix_js_e2e into test
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #973
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-21 08:20:21 +00:00
Javier Segarra 5a90434425 Merge branch 'test' into fix_js_e2e
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-21 08:19:21 +00:00
Jon Elias e943838dbe Merge pull request '#8038 added new functionality in VnSelect and refactored styles' (!871) from 8038-ImproveAndCorrectVnTable into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #871
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-21 07:08:13 +00:00
Jon Elias 4d8d56eb6e Merge branch 'dev' into 8038-ImproveAndCorrectVnTable
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-21 07:05:59 +00:00
Alex Moreno 9e41459da4 Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix-front into dev
gitea/salix-front/pipeline/head This commit looks good Details
2024-11-21 07:59:53 +01:00
Alex Moreno 6b8470d6e1 Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
gitea/salix-front/pipeline/head This commit looks good Details
2024-11-21 07:59:42 +01:00
Javier Segarra 350c28eef0 Merge pull request 'HOTfix: use id instead description to open InvoiceOutDescriptor' (!980) from hotFix_customer_balance_email into master
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #980
2024-11-21 06:52:01 +00:00
Alex Moreno 44f2ecca28 chore: requested changes
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-21 07:49:10 +01:00
Alex Moreno c5acde22a3 chore: requested changes
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-21 07:42:00 +01:00
Alex Moreno c1e06325d3 Merge pull request '#7874 show name' (!978) from 7874-warmfix-useName into test
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #978
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-21 06:04:47 +00:00
William Buezas 8e411125bf test: refs #8162 more tests and change data-testid for data-cy
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-20 18:58:08 -03:00
Javier Segarra 3b5d385d22 fix: use id instead description to open InvoiceOutDescriptor
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 22:43:04 +01:00
Jorge Penadés 7039b68bba fix: refs #7874 show name
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-20 17:23:40 +01:00
Javi Gallego bc173d9f6a fix: removed selectedClient
gitea/salix-front/pipeline/head This commit looks good Details
2024-11-20 15:35:37 +01:00
Alex Moreno 42d24359cd Merge branch 'master' into hotFix_orderCatalogFilter_values
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 12:40:39 +00:00
Alex Moreno abd79283ff fix(CatalogFilterValueDialog): from dev and fix
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 13:38:22 +01:00
Javi Gallego 2a1cc49499 fix: ticketDescriptor
gitea/salix-front/pipeline/head This commit looks good Details
2024-11-20 13:15:40 +01:00
Javier Segarra d6aedad38e perf: use const in VnLocation
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-20 10:07:03 +01:00
Javier Segarra deb6467af8 feat: remove comments
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-20 10:05:10 +01:00
Javier Segarra 9da0488184 feat: remove comments 2024-11-20 10:03:23 +01:00
Carlos Satorres 093e6cb0e8 Merge pull request 'fix: fix create bankEntity' (!976) from hotfix-createBankEntity into master
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #976
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-11-20 09:02:01 +00:00
Carlos Satorres 131cd2de8c fix: options
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 09:53:52 +01:00
Carlos Satorres 2d5d1c549b Merge branch 'hotfix-createBankEntity' of https://gitea.verdnatura.es/verdnatura/salix-front into hotfix-createBankEntity
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 09:52:14 +01:00
Carlos Satorres c59baf9cf5 fix: fix code 2024-11-20 09:52:11 +01:00
Javier Segarra 226f604f9d test: #8162 fix vnLocation spec
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-20 09:37:47 +01:00
Alex Moreno 51beef3cbe Merge branch 'master' into hotfix-createBankEntity
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 08:27:58 +00:00
Javier Segarra e10ee5e6c7 test: #8162 fix vnLocation spec
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-20 09:26:40 +01:00
Alex Moreno 32fdc836f9 fix(OrderCatalogFilter): fix field value
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 09:26:38 +01:00
Javier Segarra 1fb927488a test: #8162 fix clientList spec 2024-11-20 09:26:33 +01:00
Carlos Satorres 2806c94fdb fix: fix create bankEntity
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 09:22:50 +01:00
Javier Segarra 68c9baa7f6 Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix-front into fix_js_e2e 2024-11-20 08:12:51 +01:00
Alex Moreno e032d5988b Merge branch 'master' into hotFix_orderCatalogFilter_values
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-20 07:04:36 +00:00
Javier Segarra b4ee19bcde test: #8162 fix clientList spec
gitea/salix-front/pipeline/pr-test This commit looks good Details
2024-11-19 15:56:27 +01:00
Javier Segarra e6f8b87890 Merge branch 'test' into fix_test_jsegarra 2024-11-19 15:05:39 +01:00
Javier Segarra 65100fcf25 test: fix e2e 2024-11-19 13:45:44 +01:00
Javier Segarra 5515f55bf6 test: fix e2e 2024-11-19 12:51:05 +01:00
Jon Elias 98017df57d fix: refs #8038 solve conflicts
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-19 12:25:15 +01:00
Jon Elias 7cef1d11be Merge branch '8038-ImproveAndCorrectVnTable' of https://gitea.verdnatura.es/verdnatura/salix-front into 8038-ImproveAndCorrectVnTable
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2024-11-19 12:22:17 +01:00
Jon Elias cf6695f7ff Merge branch 'dev' of https: refs #8038//gitea.verdnatura.es/verdnatura/salix-front into 8038-ImproveAndCorrectVnTable 2024-11-19 12:22:15 +01:00
Alex Moreno c2db7be8cd fix(orderCatalogFilter): fix searchByTag
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-18 15:06:09 +01:00
William Buezas 28bfda869a refactor: refs #8162 remove comment
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-18 10:47:57 -03:00
Javier Segarra 73072794ee test: refs #8162 #8162 fix TicketList spec
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-18 14:41:27 +01:00
Javier Segarra 2f06eea8ea Merge branch 'dev' into 8162-E2ETickets
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-18 12:03:10 +00:00
Jon Elias a64575c7cc Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into Hotfix-ZoneLocationsTree
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-18 09:48:02 +01:00
Jon Elias 452ba788c9 fix: how only the correct path of the search
gitea/salix-front/pipeline/pr-master There was a failure building this commit Details
2024-11-18 09:46:34 +01:00
William Buezas d8c1bd5b16 test: refs #8162 more tests
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-17 15:24:46 -03:00
Jon Elias cc85d4ab4b Merge branch 'dev' into 8038-ImproveAndCorrectVnTable
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-13 11:02:33 +00:00
Jon Elias 9533c1a97e Merge branch 'dev' into 8038-ImproveAndCorrectVnTable
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-11-13 11:00:43 +00:00
William Buezas 4bfbd1925e test: refs #8162 ticket list e2e tests 2024-11-11 15:18:29 -03:00
Jon Elias e13090bb3b feat: refs #8038 added new functionality in VnSelect and refactor styles
gitea/salix-front/pipeline/pr-dev Build queued... Details
2024-10-25 07:01:58 +02:00
41 changed files with 562 additions and 275 deletions

View File

@ -9,8 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from './FormModelPopup.vue';
import { useState } from 'src/composables/useState';
defineProps({ showEntityField: { type: Boolean, default: true } });
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
const bicInputRef = ref(null);
@ -18,17 +16,16 @@ const state = useState();
const customer = computed(() => state.get('customer'));
const countriesFilter = {
fields: ['id', 'name', 'code'],
};
const bankEntityFormData = reactive({
name: null,
bic: null,
countryFk: customer.value?.countryFk,
id: null,
});
const countriesFilter = {
fields: ['id', 'name', 'code'],
};
const countriesOptions = ref([]);
const onDataSaved = (...args) => {
@ -44,7 +41,6 @@ onMounted(async () => {
<template>
<FetchData
url="Countries"
:filter="countriesFilter"
auto-load
@on-fetch="(data) => (countriesOptions = data)"
/>
@ -54,6 +50,7 @@ onMounted(async () => {
:title="t('title')"
:subtitle="t('subtitle')"
:form-initial-data="bankEntityFormData"
:filter="countriesFilter"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data, validate }">
@ -85,7 +82,13 @@ onMounted(async () => {
:rules="validate('bankEntity.countryFk')"
/>
</div>
<div v-if="showEntityField" class="col">
<div
v-if="
countriesOptions.find((c) => c.id === data.countryFk)?.code ==
'ES'
"
class="col"
>
<VnInput
:label="t('id')"
v-model="data.id"

View File

@ -394,6 +394,7 @@ watch(formUrl, async () => {
@click="onSubmit"
:disable="!hasChanges"
:title="t('globals.save')"
data-cy="crudModelDefaultSaveBtn"
/>
<slot name="moreAfterActions" />
</QBtnGroup>

View File

@ -394,7 +394,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
:name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
:vertical="true"
:vertical="false"
/>
</div>
<slot
@ -737,6 +737,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
fab
icon="add"
shortcut="+"
data-cy="vnTableCreateBtn"
/>
<QTooltip self="top right">
{{ createForm?.title }}

View File

@ -102,7 +102,13 @@ const mixinRules = [
<QIcon
name="close"
size="xs"
v-if="hover && value && !$attrs.disabled && $props.clearable"
v-if="
hover &&
value &&
!$attrs.disabled &&
!$attrs.readonly &&
$props.clearable
"
@click="
() => {
value = null;

View File

@ -138,8 +138,6 @@ onMounted(() => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
defineExpose({ opts: myOptions });
const arrayDataKey =
$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;
}
}
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>
<template>
@ -269,6 +291,7 @@ async function onScroll({ to, direction, from, index }) {
:option-value="optionValue"
v-bind="$attrs"
@filter="filterHandler"
@keydown="handleKeyDown"
:emit-value="nullishToTrue($attrs['emit-value'])"
:map-options="nullishToTrue($attrs['map-options'])"
:use-input="nullishToTrue($attrs['use-input'])"

View File

@ -86,7 +86,7 @@ async function send() {
</script>
<template>
<QDialog ref="dialogRef">
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
<QCard class="q-pa-sm">
<QCardSection class="row items-center q-pb-none">
<span class="text-h6 text-grey">
@ -161,6 +161,7 @@ async function send() {
:loading="isLoading"
color="primary"
unelevated
data-cy="sendSmsBtn"
/>
</QCardActions>
</QCard>

View File

@ -130,6 +130,7 @@ async function search() {
dense
standout
autofocus
data-cy="vnSearchBar"
>
<template #prepend>
<QIcon

View File

@ -1,6 +1,5 @@
<script setup>
import { useRoute } from 'vue-router';
import { defineProps } from 'vue';
const props = defineProps({
routeName: {

View File

@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
th,
td {
padding: 1px 10px 1px 10px;
max-width: 100px;
max-width: 130px;
div span {
overflow: hidden;
white-space: nowrap;

View File

@ -100,7 +100,7 @@ async function remove() {
</QMenu>
</QItem>
<QSeparator />
<QItem @click="confirmRemove()" v-ripple clickable>
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>

View File

@ -130,7 +130,7 @@ function cancel() {
<template #body-cell-description="{ row, value }">
<QTd auto-width align="right" class="link">
{{ value }}
<ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
<ItemDescriptorProxy :id="row.itemFk" />
</QTd>
</template>
</QTable>

View File

@ -25,7 +25,7 @@ const claimFilter = computed(() => {
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname'],
fields: ['id', 'nickname', 'name'],
},
},
},

View File

@ -256,10 +256,10 @@ const showBalancePdf = ({ id }) => {
{{ toCurrency(balances[rowIndex]?.balance) }}
</template>
<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 }) }}
<InvoiceOutDescriptorProxy :id="row.description" />
</div>
<InvoiceOutDescriptorProxy :id="row.id" />
</span>
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
{{ row.description }}
</span>

View File

@ -254,10 +254,7 @@ watchEffect(selectedRows);
@update:model-value="fetchClientAddress"
>
<template #option="scope">
<QItem
v-bind="scope.itemProps"
@click="selectedClient(scope.opt)"
>
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} -
@ -296,18 +293,17 @@ watchEffect(selectedRows);
: ''
} `
}}
<span>
{{
scope.opt?.nickname
}}</span
>
<span>{{
scope.opt?.nickname
}}</span>
<span
v-if="
scope.opt?.province ||
scope.opt?.city ||
scope.opt?.street
"
>, {{ scope.opt?.street }},
>
, {{ scope.opt?.street }},
{{ scope.opt?.city }},
{{
scope.opt?.province?.name
@ -316,8 +312,8 @@ watchEffect(selectedRows);
{{
scope.opt?.agencyMode
?.name
}}</span
>
}}
</span>
</QItemLabel>
</QItemSection>
</QItem>

View File

@ -170,7 +170,7 @@ onMounted(async () => {
from.value = getDate(_from, 'from');
const _to = Date.vnNew();
_to.setDate(_to.getDate() + 10);
to.value = getDate(Date.vnNew(), 'to');
to.value = getDate(_to, 'to');
updateFilter();

View File

@ -2,7 +2,7 @@
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
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';
const props = defineProps({
@ -31,47 +31,26 @@ const applyTags = () => {
emit('applyTags', tagInfo);
};
const removeTagGroupParam = (valIndex = null) => {
if (!valIndex) {
tagValues.value = [{}];
} else {
(tagValues.value || []).splice(valIndex, 1);
}
};
const getSelectedTagValues = async (tag) => {
try {
if (!tag?.id) return;
const filter = {
fields: ['value'],
order: 'value ASC',
limit: 30,
};
if (!tag?.id) return;
const filter = {
fields: ['value'],
order: 'value ASC',
limit: 30,
};
const url = `Tags/${tag?.id}/filterValue`;
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(url, {
params,
});
tagOptions.value = data;
} catch (err) {
console.error('Error getting selected tag values');
}
const url = `Tags/${tag?.id}/filterValue`;
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(url, {
params,
});
tagOptions.value = data;
};
</script>
<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">
<QBtn
round
color="primary"
style="position: absolute; z-index: 1; right: 0; top: 0"
icon="search"
type="submit"
>
</QBtn>
<VnSelect
:label="t('params.tag')"
v-model="selectedTag"
@ -84,17 +63,7 @@ const getSelectedTagValues = async (tag) => {
rounded
:emit-value="false"
use-input
@update:model-value="($event) => getSelectedTagValues($event)"
/>
<QBtn
icon="add_circle"
shortcut="+"
flat
class="filter-icon q-mb-md"
size="md"
dense
:disabled="!selectedTag || !tagValues[0].value"
@click="tagValues.unshift({})"
@update:model-value="getSelectedTagValues"
/>
<div
v-for="(value, index) in tagValues"
@ -106,7 +75,7 @@ const getSelectedTagValues = async (tag) => {
v-if="!selectedTag?.isFree && tagOptions"
:label="t('components.itemsFilterPanel.value')"
v-model="value.value"
:options="tagOptions || []"
:options="tagOptions"
option-value="value"
option-label="value"
dense
@ -124,7 +93,6 @@ const getSelectedTagValues = async (tag) => {
:label="t('components.itemsFilterPanel.value')"
:disable="!value"
is-outlined
:is-clearable="false"
class="col"
/>
<QBtn
@ -135,11 +103,25 @@ const getSelectedTagValues = async (tag) => {
rounded
flat
class="filter-icon col-2"
:disabled="!value.value"
@click="removeTagGroupParam(index)"
@click="tagValues.splice(index, 1)"
/>
</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>
</QForm>
</template>

View File

@ -4,18 +4,19 @@ import { useRoute, useRouter } from 'vue-router';
import { onBeforeMount, onMounted, onUnmounted, ref, computed, watch } from 'vue';
import axios from 'axios';
import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue';
import CatalogItem from 'components/ui/CatalogItem.vue';
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CatalogItem from 'src/components/ui/CatalogItem.vue';
import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import getParamWhere from 'src/filters/getParamWhere';
import { useArrayData } from 'composables/useArrayData';
import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute();
const router = useRouter();
const stateStore = useStateStore();
const { t } = useI18n();
const arrayData = useArrayData('OrderCatalogList');
const dataKey = 'OrderCatalogList';
const arrayData = useArrayData(dataKey);
const store = arrayData.store;
const showFilter = ref(null);
const tags = ref([]);
@ -102,7 +103,7 @@ watch(
<template>
<VnSearchbar
data-key="OrderCatalogList"
:data-key="dataKey"
:user-params="catalogParams"
:static-params="['orderFk', 'orderBy']"
:redirect="false"
@ -113,7 +114,7 @@ watch(
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea v-if="showFilter" class="fit text-grey-8">
<OrderCatalogFilter
data-key="OrderCatalogList"
:data-key="dataKey"
:tag-value="tagValue"
:tags="tags"
:initial-catalog-params="catalogParams"
@ -123,7 +124,7 @@ watch(
<QPage class="column items-center q-pa-md">
<div class="full-width">
<VnPaginate
data-key="OrderCatalogList"
:data-key="dataKey"
url="Orders/CatalogFilter"
:limit="50"
:user-params="catalogParams"

View File

@ -32,11 +32,12 @@ const route = useRoute();
const arrayData = useArrayData(props.dataKey);
const currentParams = ref({});
const categoryList = ref(null);
const selectedCategoryFk = ref(null);
const typeList = ref([]);
const selectedTypeFk = ref(null);
const generalSearchParam = ref(null);
const searchByTag = ref(null);
const vnFilterPanelRef = ref();
const orderByList = ref([
@ -52,26 +53,30 @@ const orderWayList = ref([
const orderBySelected = ref('relevancy DESC, name');
const orderWaySelected = ref('ASC');
onMounted(() => {
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
selectedTypeFk.value = getParamWhere(route, 'typeFk');
});
const resetCategory = (params, search) => {
selectedCategoryFk.value = null;
typeList.value = null;
params.categoryFk = null;
params.typeFk = null;
arrayData.store.userFilter = null;
removeTagGroupParam(params, search);
removeTagGroupParam(search);
};
const selectCategory = (params, category, search) => {
if (params.categoryFk === category?.id) {
resetCategory(params, search);
params.categoryFk = null;
} else {
selectedCategoryFk.value = category?.id;
params.categoryFk = category?.id;
params.typeFk = null;
selectedTypeFk.value = null;
loadTypes(category?.id);
return;
}
selectedCategoryFk.value = category?.id;
params.categoryFk = category?.id;
params.typeFk = null;
selectedTypeFk.value = null;
loadTypes(category?.id);
search();
};
@ -115,13 +120,23 @@ const applyTags = (tagInfo, params, search) => {
search();
};
const removeTagGroupParam = (params, search, valIndex = null) => {
if (!valIndex) {
params.tagGroups = null;
search();
async function onSearchByTag(value) {
if (!value.target.value) return;
if (!currentParams.value?.tagGroups) {
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 {
params.tagGroups.splice(valIndex, 1);
search();
currentParams.value.tagGroups.splice(valIndex, 1);
}
};
@ -142,6 +157,12 @@ const getCategoryClass = (category, params) => {
}
};
const clearFilter = (key) => {
if (key === 'categoryFk') {
resetCategory();
}
};
function addOrder(value, field, params) {
let { orderBy } = params;
orderBy = JSON.parse(orderBy);
@ -157,7 +178,7 @@ onMounted(() => {
</script>
<template>
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
<FetchData url="ItemCategories" auto-load @on-fetch="setCategoryList" />
<VnFilterPanel
ref="vnFilterPanelRef"
:data-key="props.dataKey"
@ -166,7 +187,8 @@ onMounted(() => {
:expr-builder="exprBuilder"
:custom-tags="['tagGroups', 'categoryFk']"
:redirect="false"
search-url="params"
@remove="clearFilter"
v-model="currentParams"
>
<template #tags="{ tag, formatFn }">
<strong v-if="tag.label === 'typeFk'">
@ -188,7 +210,7 @@ onMounted(() => {
@remove="
customTag.label === 'categoryFk'
? resetCategory(params, searchFn)
: removeTagGroupParam(params, searchFn, valIndex)
: removeTagGroupParam(searchFn, valIndex)
"
>
<strong v-if="customTag.label === 'categoryFk'">
@ -288,46 +310,39 @@ onMounted(() => {
</QItemSection>
</QItem>
<QSeparator />
<QItem class="q-mt-lg">
<VnSelect
<QItem class="q-mt-lg q-pa-none">
<VnInput
:label="t('components.itemsFilterPanel.value')"
:options="props.tagValue"
dense
outlined
rounded
:is-clearable="false"
v-model="generalSearchParam"
@update:model-value="
applyTags(
{ values: [{ value: generalSearchParam }] },
params,
searchFn
)
"
v-model="searchByTag"
@keyup.enter="(val) => onSearchByTag(val, params)"
>
<template #prepend>
<QIcon name="search" />
</template>
<template #after>
<template #append>
<QBtn
icon="add_circle"
shortcut="+"
flat
color="primary"
size="md"
dense
/>
<QPopupProxy>
<CatalogFilterValueDialog
style="display: inline-block"
:tags="tags"
@apply-tags="
($event) => applyTags($event, params, searchFn)
($event) => applyTags($event, currentParams, searchFn)
"
/>
</QPopupProxy>
</template>
</VnSelect>
</VnInput>
</QItem>
<QSeparator />
</template>

View File

@ -126,7 +126,6 @@ const setWireTransfer = async () => {
(_, requestResponse) =>
onBankEntityCreated(requestResponse, row)
"
:show-entity-field="false"
/>
</template>
<template #option="scope">

View File

@ -130,6 +130,7 @@ function ticketFilter(ticket) {
<QBadge
text-color="black"
:color="entity.ticketState.state.classColor"
data-cy="ticketDescriptorStateBadge"
>
{{ entity.ticketState.state.name }}
</QBadge>
@ -174,7 +175,7 @@ function ticketFilter(ticket) {
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
</QIcon>
<QIcon
v-if="entity.problem.includes('hasRisk')"
v-if="entity?.problem?.includes('hasRisk')"
name="vn:risk"
size="xs"
color="primary"

View File

@ -239,7 +239,7 @@ function makeInvoiceDialog() {
}
async function makeInvoice() {
const params = {
ticketsIds: [parseInt(ticketId)],
ticketsIds: [parseInt(ticketId.value)],
};
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
@ -265,7 +265,7 @@ async function transferClient(client) {
async function addTurn(day) {
const params = {
ticketFk: parseInt(ticketId),
ticketFk: parseInt(ticketId.value),
weekDay: day,
agencyModeFk: ticket.value.agencyModeFk,
};
@ -280,7 +280,7 @@ async function addTurn(day) {
async function createRefund(withWarehouse) {
const params = {
ticketsIds: [parseInt(ticketId)],
ticketsIds: [parseInt(ticketId.value)],
withWarehouse: withWarehouse,
negative: true,
};
@ -368,7 +368,7 @@ async function uploadDocuware(force) {
const { data } = await axios.post(`Docuwares/upload`, {
fileCabinet: 'deliveryNote',
ticketIds: [parseInt(ticketId)],
ticketIds: [parseInt(ticketId.value)],
});
if (data) notify({ message: t('PDF sent!'), type: 'positive' });

View File

@ -75,6 +75,7 @@ const cancel = () => {
dense
style="width: 50%"
@click="save()"
data-cy="saveManaBtn"
>
{{ t('globals.save') }}
</QBtn>

View File

@ -86,12 +86,14 @@ async function handleSave() {
option-value="id"
v-model="row.observationTypeFk"
:disable="!!row.id"
data-cy="ticketNotesObservationType"
/>
<VnInput
:label="t('basicData.description')"
v-model="row.description"
class="col"
@keyup.enter="handleSave"
data-cy="ticketNotesDescription"
/>
<QIcon
name="delete"
@ -99,6 +101,7 @@ async function handleSave() {
class="cursor-pointer"
color="primary"
@click="handleDelete(row)"
data-cy="ticketNotesRemoveNoteBtn"
>
<QTooltip>
{{ t('ticketNotes.removeNote') }}
@ -113,6 +116,7 @@ async function handleSave() {
class="fill-icon-on-hover q-ml-md"
color="primary"
@click="ticketNotesCrudRef.insert()"
data-cy="ticketNotesAddNoteBtn"
>
<QTooltip>
{{ t('ticketNotes.addNote') }}

View File

@ -584,6 +584,7 @@ watch(
color="primary"
:disable="!isTicketEditable || ticketState === 'OK'"
@click="changeTicketState('OK')"
data-cy="ticketSaleOkStateBtn"
>
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
</QBtn>
@ -592,6 +593,7 @@ watch(
color="primary"
:label="t('ticketList.state')"
:disable="!isTicketEditable"
data-cy="ticketSaleStateDropdown"
>
<VnSelect
:options="editableStatesOptions"
@ -601,6 +603,7 @@ watch(
hide-dropdown-icon
focus-on-mount
@update:model-value="changeTicketState"
data-cy="ticketSaleStateSelect"
/>
</QBtnDropdown>
<TicketSaleMoreActions
@ -633,6 +636,7 @@ watch(
icon="vn:splitline"
:disable="!isTicketEditable || !hasSelectedRows"
@click="setTransferParams()"
data-cy="ticketSaleTransferBtn"
>
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
<TicketTransfer
@ -712,7 +716,13 @@ watch(
{{ t('ticketSale.visible') }}: {{ row.visible || 0 }}
</QTooltip>
</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>
{{ t('ticketSale.reserved') }}
</QTooltip>
@ -865,7 +875,14 @@ watch(
</VnTable>
<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">
{{ t('Add item to basket') }}
</QTooltip>

View File

@ -179,6 +179,7 @@ const createRefund = async (withWarehouse) => {
color="primary"
:label="t('ticketSale.more')"
:disable="disable"
data-cy="ticketSaleMoreActionsDropdown"
>
<template #label>
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
@ -190,6 +191,7 @@ const createRefund = async (withWarehouse) => {
v-close-popup
v-ripple
@click="showSmsDialog('productNotAvailable')"
data-cy="sendShortageSMSItem"
>
<QItemSection>
<QItemLabel>{{ t('Send shortage SMS') }}</QItemLabel>
@ -201,12 +203,18 @@ const createRefund = async (withWarehouse) => {
v-close-popup
v-ripple
@click="calculateSalePrice()"
data-cy="recalculatePriceItem"
>
<QItemSection>
<QItemLabel>{{ t('Recalculate price') }}</QItemLabel>
</QItemSection>
</QItem>
<QItem clickable v-ripple @click="emit('getMana')">
<QItem
clickable
v-ripple
@click="emit('getMana')"
data-cy="updateDiscountItem"
>
<QItemSection>
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
</QItemSection>
@ -215,6 +223,7 @@ const createRefund = async (withWarehouse) => {
v-model.number="newDiscount"
:label="t('ticketSale.discount')"
type="number"
data-cy="ticketSaleDiscountInput"
/>
</TicketEditManaProxy>
</QItem>
@ -224,6 +233,7 @@ const createRefund = async (withWarehouse) => {
v-close-popup
v-ripple
@click="createClaim()"
data-cy="createClaimItem"
>
<QItemSection>
<QItemLabel>{{ t('Add claim') }}</QItemLabel>
@ -235,6 +245,7 @@ const createRefund = async (withWarehouse) => {
v-close-popup
v-ripple
@click="setReserved(true)"
data-cy="markAsReservedItem"
>
<QItemSection>
<QItemLabel>{{ t('Mark as reserved') }}</QItemLabel>
@ -246,12 +257,13 @@ const createRefund = async (withWarehouse) => {
v-close-popup
v-ripple
@click="setReserved(false)"
data-cy="unmarkAsReservedItem"
>
<QItemSection>
<QItemLabel>{{ t('Unmark as reserved') }}</QItemLabel>
</QItemSection>
</QItem>
<QItem clickable v-ripple>
<QItem clickable v-ripple data-cy="ticketSaleRefundItem">
<QItemSection>
<QItemLabel>{{ t('Refund') }}</QItemLabel>
</QItemSection>
@ -260,12 +272,22 @@ const createRefund = async (withWarehouse) => {
</QItemSection>
<QMenu anchor="top end" self="top start" auto-close bordered>
<QList>
<QItem v-ripple clickable @click="createRefund(true)">
<QItem
v-ripple
clickable
@click="createRefund(true)"
data-cy="ticketSaleRefundWithWarehouse"
>
<QItemSection>
{{ t('with warehouse') }}
</QItemSection>
</QItem>
<QItem v-ripple clickable @click="createRefund(false)">
<QItem
v-ripple
clickable
@click="createRefund(false)"
data-cy="ticketSaleRefundWithoutWarehouse"
>
<QItemSection>
{{ t('without warehouse') }}
</QItemSection>

View File

@ -100,6 +100,7 @@ function toTicketUrl(section) {
ref="summaryRef"
:url="`Tickets/${entityId}/summary`"
data-key="TicketSummary"
data-cy="ticketSummary"
>
<template #header-left>
<VnToSummary

View File

@ -91,7 +91,7 @@ onMounted(() => (_transfer.value = $props.transfer));
</script>
<template>
<QPopupProxy ref="QPopupProxyRef">
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketTransferPopup">
<QCard class="q-px-md" style="display: flex; width: 80vw">
<QTable
:rows="transfer.sales"

View File

@ -57,6 +57,7 @@ defineExpose({ transferSales });
v-model.number="_transfer.ticketId"
:label="t('Transfer to ticket')"
:clearable="false"
data-cy="ticketTransferDestinationTicketInput"
>
<template #append>
<QBtn
@ -64,6 +65,7 @@ defineExpose({ transferSales });
color="primary"
@click="transferSales(_transfer.ticketId)"
style="width: 30px"
data-cy="ticketTransferTransferBtn"
/>
</template>
</VnInput>
@ -72,6 +74,7 @@ defineExpose({ transferSales });
color="primary"
class="full-width q-my-lg"
@click="transferSales()"
data-cy="ticketTransferNewTicketBtn"
/>
</QForm>
</template>

View File

@ -462,6 +462,7 @@ function setReference(data) {
data-key="TicketList"
:label="t('Search ticket')"
:info="t('You can search by ticket id or alias')"
data-cy="ticketListSearchBar"
/>
<RightMenu>
<template #right-panel>
@ -489,6 +490,7 @@ function setReference(data) {
'row-key': 'id',
selection: 'multiple',
}"
data-cy="ticketListTable"
>
<template #column-statusIcons="{ row }">
<TicketProblems :row="row" />

View File

@ -15,7 +15,7 @@ const filter = {
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname'],
fields: ['id', 'nickname', 'name'],
},
},
},

View File

@ -59,7 +59,6 @@ const deleteRelative = async (id) => {
auto-load
data-key="workerIrpfs"
:max-width="false"
:data-required="{ workerFk: route.params.id }"
>
<template #form="{ data }">
<QCard class="q-px-lg q-py-lg">
@ -79,6 +78,9 @@ const deleteRelative = async (id) => {
option-label="description"
option-value="id"
v-model="data.disabilityGradeFk"
id="disabilityGrades"
data-cy="disabilityGrades"
hide-selected
/>
<VnInputDate
@ -148,6 +150,7 @@ const deleteRelative = async (id) => {
@click="workerPitCrudRef.onSubmit"
:disable="!workerPitCrudRef.hasChanges"
:title="t('globals.save')"
data-cy="workerPitRelativeSaveBtn"
/>
</QBtnGroup>
</div>
@ -212,6 +215,7 @@ const deleteRelative = async (id) => {
icon="add"
shortcut="+"
style="flex: 0"
data-cy="addRelative"
/>
</VnRow>
</QCard>
@ -245,7 +249,7 @@ en:
geographicMobilityDate: Geographic Mobility Date
childPension: Child Pension
spousePension: Spouse Pension
isDependend: Dependent Support / Reduced Mobility
isDependend: Dependent Suport / Reduced Mobility
spouseNif: Spouse NIF (Tax ID)
hasHousingPaymentBefore: Housing Payments Before 2011
hasHousingPaymentAfter: Housing Payments After 2011

View File

@ -24,7 +24,6 @@ function notIsLocations(ifIsFalse, ifIsTrue) {
:descriptor="ZoneDescriptor"
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
:search-data-key="notIsLocations('ZoneList', undefined)"
:custom-url="`Zones/${route.params?.id}/getLeaves`"
:searchbar-props="{
url: notIsLocations('Zones', 'ZoneLocations'),
label: notIsLocations(t('list.searchZone'), t('list.searchLocation')),

View File

@ -39,8 +39,7 @@ const url = computed(() => `Zones/${route.params.id}/getLeaves`);
const arrayData = useArrayData(datakey, {
url: url.value,
});
const { store } = arrayData;
const storeData = computed(() => store.data);
const store = arrayData.store;
const defaultNode = {
id: null,
@ -66,8 +65,20 @@ const onNodeExpanded = async (nodeKeysArray) => {
if (!nodeKeysSet.has(null)) return;
const wasExpanded = !previousExpandedNodes.value.has(lastNodeKey);
if (wasExpanded) await fetchNodeLeaves(lastNodeKey);
else {
if (wasExpanded && treeRef.value) {
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(
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x))
);
@ -83,41 +94,21 @@ const formatNodeSelected = (node) => {
if (node.selected === 1) node.selected = true;
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 = [{}];
};
const fetchNodeLeaves = async (nodeKey) => {
try {
const node = treeRef.value?.getNodeByKey(nodeKey);
if (!node || node.sons === 0) return;
if (!treeRef.value) return;
const node = treeRef.value?.getNodeByKey(nodeKey);
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 };
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();
}
state.set('Tree', node);
};
function getNodeIds(node) {
if (!node) return [];
let ids = [];
if (node.id) ids.push(node.id);
@ -128,60 +119,46 @@ function getNodeIds(node) {
return ids;
}
watch(storeData, async (val) => {
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
if (!nodes.value[0]) nodes.value = [defaultNode];
nodes.value[0].childs = [...val];
const fetchedNodeKeys = val.flatMap(getNodeIds);
state.set('Tree', [...fetchedNodeKeys]);
watch(
() => store.data,
async (val) => {
if (!val) return;
// // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
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 === '') {
val.forEach((n) => {
formatNodeSelected(n);
});
} else {
for (let n of state.get('Tree')) await fetchNodeLeaves(n);
expanded.value = [null, ...fetchedNodeKeys];
}
previousExpandedNodes.value = new Set(expanded.value);
});
if (!store.userParams?.search) {
val.forEach((n) => {
formatNodeSelected(n);
});
store.data = null;
expanded.value = [null];
} else {
for (let n of state.get('Tree')) {
await fetchNodeLeaves(n);
}
expanded.value = [null, ...fetchedNodeKeys];
}
previousExpandedNodes.value = new Set(expanded.value);
},
{ immediate: true }
);
const reFetch = async () => {
const { data } = await arrayData.fetch({ append: false });
nodes.value = data;
expanded.value = [null];
};
onMounted(async () => {
if (store.userParams?.search && !props.showSearchBar) {
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);
if (store.userParams?.search) await arrayData.fetch({});
});
onUnmounted(() => {
state.set('Tree', undefined);
arrayData.destroy();
});
</script>

View File

@ -6,7 +6,11 @@ describe('Client list', () => {
cy.visit('/#/customer/list', {
timeout: 5000,
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' },
Street: { val: 'C/ STREET 1' },
Email: { val: 'user.test@1.com' },
'Business type': { val: 'Otros', type: 'select' },
'Sales person': { val: 'salesboss', type: 'select' },
'Sales person': { val: 'employee', type: 'select' },
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
'Business type': { val: 'Otros', type: 'select' },
};
cy.fillInForm(data);
@ -47,17 +51,19 @@ describe('Client list', () => {
it('Client founded create ticket', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.clickButtonsDescriptor(2);
cy.openActionDescriptor('Create ticket');
cy.waitForElement('#formModel');
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.checkValueSelectForm(1, search);
cy.checkValueSelectForm(2, search);
});
it('Client founded create order', () => {
const search = 'Jessica Jones';
cy.searchByLabel('Name', search);
cy.clickButtonsDescriptor(4);
cy.openActionDescriptor('New order');
cy.waitForElement('#formModel');
cy.waitForElement('.q-form');
cy.checkValueForm(1, search);
cy.checkValueForm(2, search);
});
});

View File

@ -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/);
});
});

View File

@ -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');
});
});

View File

@ -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');
});
});

View File

@ -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/);
});
});

View File

@ -7,6 +7,9 @@ describe('VnLocation', () => {
prefix: '.q-dialog__inner > .column > #formModel > .q-card',
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 ', () => {
beforeEach(() => {
cy.viewport(1280, 720);
@ -16,46 +19,23 @@ describe('VnLocation', () => {
cy.get(createLocationButton).click();
});
it('should filter provinces based on selected country', () => {
// Select a country
cy.selectOption(
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
'Ecuador'
);
// 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);
const country = 'Ecuador';
cy.selectOption(countrySelector, country);
cy.get(countrySelector).should('have.length', 1);
cy.get(citySelector).should('have.length', 1);
});
it('should filter towns based on selected province', () => {
// Select a country
cy.selectOption(
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`,
'Ecuador'
);
// 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);
const country = 'Ecuador';
cy.selectOption(countrySelector, country);
cy.get(provinceSelector).should('have.length', 1);
cy.get(citySelector).should('have.length', 1);
});
it('should pass selected country', () => {
// Select a country
const country = 'Ecuador';
const province = 'Province five';
cy.selectOption(
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
country
);
cy.selectOption(countrySelector, country);
cy.selectOption(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
province
@ -80,13 +60,11 @@ describe('VnLocation', () => {
cy.get(locationOptions).should('have.length.at.least', 5);
});
it('input filter location as "al"', function () {
// cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('al');
cy.get(locationOptions).should('have.length.at.least', 4);
});
it('input filter location as "ecuador"', function () {
// cy.get(inputLocation).click();
cy.get(inputLocation).clear();
cy.get(inputLocation).type('ecuador');
cy.get(locationOptions).should('have.length.at.least', 1);
@ -142,7 +120,6 @@ describe('VnLocation', () => {
const province = 'Saskatchew';
cy.get(createLocationButton).click();
cy.get(dialogInputs).eq(0).type(postCode);
// city create button
cy.get(
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
).click();
@ -151,7 +128,6 @@ describe('VnLocation', () => {
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
cy.get('#q-portal--dialog--1 .q-btn--standard').click();
cy.waitForElement('.q-form');
checkVnLocation(postCode, province);
});

View File

@ -1,9 +1,19 @@
describe('WorkerPit', () => {
const familySituationInput = '[data-cy="Family Situation_input"]';
const familySituation = '1';
const disabilityGradesSelect = '[data-cy="Disability Grades_select"]';
const childPensionInput = '[data-cy="Child Pension_input"]';
const childPension = '120';
const spouseNifInput = '[data-cy="Spouse Pension_input"]';
const spouseNif = '65117125P';
const spousePensionInput = '[data-cy="Spouse Pension_input"]';
const spousePension = '120';
const addRelative = '[data-cy="addRelative"]';
const isDescendantSelect = '[data-cy="Descendant/Ascendant_select"]';
const birthedInput = '[data-cy="Birth Year_input"]';
const birthed = '2002';
const adoptionYearInput = '[data-cy="Adoption Year_input"]';
const adoptionYear = '2004';
const saveRelative = '[data-cy="workerPitRelativeSaveBtn"]';
beforeEach(() => {
cy.viewport(1920, 1080);
@ -11,18 +21,18 @@ describe('WorkerPit', () => {
cy.visit(`/#/worker/1107/pit`);
});
it('complete PIT', () => {
cy.get(familySituationInput).type(familySituation);
cy.get(disabilityGradesSelect).click('{downArrow}{enter}');
cy.get(childPensionInput).type(childPension);
// cy.get('.q-notification__message').should('have.text', 'Data created');
});
// it('delete pda', () => {
// cy.get('.q-card > .q-item > .q-item__section--side > .q-icon').click();
// cy.get(
// '.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
// ).click();
// cy.get('.q-notification__message').should('have.text', 'PDA deallocated');
// it('complete PIT', () => {
// cy.get(familySituationInput).type(familySituation);
// cy.get(childPensionInput).type(childPension);
// cy.get(spouseNifInput).type(spouseNif);
// cy.get(spousePensionInput).type(spousePension);
// });
it('delete relative', () => {
cy.get(addRelative).click();
cy.get(isDescendantSelect).type('{downArrow}{downArrow}{enter}');
cy.get(birthedInput).type(birthed);
cy.get(adoptionYearInput).type(adoptionYear);
cy.get(saveRelative).click();
});
});

View File

@ -297,16 +297,20 @@ Cypress.Commands.add('checkNotification', (text) => {
Cypress.Commands.add('checkValueForm', (id, search) => {
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);
});
Cypress.Commands.add('checkValueSelectForm', (id, search) => {
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);
});
Cypress.Commands.add('searchByLabel', (label, value) => {
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}"]`);
});