forked from verdnatura/salix-front
Merge branch 'dev' into Fix-TicketsModule
This commit is contained in:
commit
cd4b17048c
|
@ -2,9 +2,11 @@ import axios from 'axios';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { Router } from 'src/router';
|
import { Router } from 'src/router';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||||
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
const stateQuery = useStateQueryStore();
|
||||||
const baseUrl = '/api/';
|
const baseUrl = '/api/';
|
||||||
|
|
||||||
axios.defaults.baseURL = baseUrl;
|
axios.defaults.baseURL = baseUrl;
|
||||||
|
@ -15,7 +17,7 @@ const onRequest = (config) => {
|
||||||
if (token.length && !config.headers.Authorization) {
|
if (token.length && !config.headers.Authorization) {
|
||||||
config.headers.Authorization = token;
|
config.headers.Authorization = token;
|
||||||
}
|
}
|
||||||
|
stateQuery.add(config);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,10 +26,10 @@ const onRequestError = (error) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResponse = (response) => {
|
const onResponse = (response) => {
|
||||||
const { method } = response.config;
|
const config = response.config;
|
||||||
|
stateQuery.remove(config);
|
||||||
|
|
||||||
const isSaveRequest = method === 'patch';
|
if (config.method === 'patch') {
|
||||||
if (isSaveRequest) {
|
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +37,8 @@ const onResponse = (response) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResponseError = (error) => {
|
const onResponseError = (error) => {
|
||||||
|
stateQuery.remove(error.config);
|
||||||
|
|
||||||
let message = '';
|
let message = '';
|
||||||
|
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
|
|
|
@ -79,14 +79,20 @@ async function onProvinceCreated(data) {
|
||||||
watch(
|
watch(
|
||||||
() => [postcodeFormData.countryFk],
|
() => [postcodeFormData.countryFk],
|
||||||
async (newCountryFk, oldValueFk) => {
|
async (newCountryFk, oldValueFk) => {
|
||||||
if (!!oldValueFk[0] && newCountryFk[0] !== oldValueFk[0]) {
|
if (Array.isArray(newCountryFk)) {
|
||||||
|
newCountryFk = newCountryFk[0];
|
||||||
|
}
|
||||||
|
if (Array.isArray(oldValueFk)) {
|
||||||
|
oldValueFk = oldValueFk[0];
|
||||||
|
}
|
||||||
|
if (!!oldValueFk && newCountryFk !== oldValueFk) {
|
||||||
postcodeFormData.provinceFk = null;
|
postcodeFormData.provinceFk = null;
|
||||||
postcodeFormData.townFk = null;
|
postcodeFormData.townFk = null;
|
||||||
}
|
}
|
||||||
if ((newCountryFk, newCountryFk !== postcodeFormData.countryFk)) {
|
if (oldValueFk !== newCountryFk) {
|
||||||
await provincesFetchDataRef.value.fetch({
|
await provincesFetchDataRef.value.fetch({
|
||||||
where: {
|
where: {
|
||||||
countryFk: newCountryFk[0],
|
countryFk: newCountryFk,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await townsFetchDataRef.value.fetch({
|
await townsFetchDataRef.value.fetch({
|
||||||
|
@ -103,9 +109,12 @@ watch(
|
||||||
watch(
|
watch(
|
||||||
() => postcodeFormData.provinceFk,
|
() => postcodeFormData.provinceFk,
|
||||||
async (newProvinceFk) => {
|
async (newProvinceFk) => {
|
||||||
if (newProvinceFk[0] && newProvinceFk[0] !== postcodeFormData.provinceFk) {
|
if (Array.isArray(newProvinceFk)) {
|
||||||
|
newProvinceFk = newProvinceFk[0];
|
||||||
|
}
|
||||||
|
if (newProvinceFk !== postcodeFormData.provinceFk) {
|
||||||
await townsFetchDataRef.value.fetch({
|
await townsFetchDataRef.value.fetch({
|
||||||
where: { provinceFk: newProvinceFk[0] },
|
where: { provinceFk: newProvinceFk },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,16 +134,26 @@ async function handleCountries(data) {
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="provincesFetchDataRef"
|
ref="provincesFetchDataRef"
|
||||||
@on-fetch="handleProvinces"
|
@on-fetch="handleProvinces"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
auto-load
|
auto-load
|
||||||
url="Provinces/location"
|
url="Provinces/location"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="townsFetchDataRef"
|
ref="townsFetchDataRef"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
@on-fetch="handleTowns"
|
@on-fetch="handleTowns"
|
||||||
auto-load
|
auto-load
|
||||||
url="Towns/location"
|
url="Towns/location"
|
||||||
/>
|
/>
|
||||||
<FetchData @on-fetch="handleCountries" auto-load url="Countries" />
|
<FetchData
|
||||||
|
@on-fetch="handleCountries"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
|
auto-load
|
||||||
|
url="Countries"
|
||||||
|
/>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
url-create="postcodes"
|
url-create="postcodes"
|
||||||
model="postcode"
|
model="postcode"
|
||||||
|
|
|
@ -46,6 +46,8 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
url="Autonomies/location"
|
url="Autonomies/location"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
/>
|
/>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
:title="t('New province')"
|
:title="t('New province')"
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import PinnedModules from './PinnedModules.vue';
|
import PinnedModules from './PinnedModules.vue';
|
||||||
import UserPanel from 'components/UserPanel.vue';
|
import UserPanel from 'components/UserPanel.vue';
|
||||||
|
@ -12,6 +13,7 @@ import VnAvatar from './ui/VnAvatar.vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
const stateQuery = useStateQueryStore();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const appName = 'Lilium';
|
const appName = 'Lilium';
|
||||||
|
@ -50,6 +52,14 @@ const pinnedModulesRef = ref();
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
|
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
|
||||||
|
<QSpinner
|
||||||
|
color="primary"
|
||||||
|
class="q-ml-md"
|
||||||
|
:class="{
|
||||||
|
'no-visible': !stateQuery.isLoading().value,
|
||||||
|
}"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<div id="searchbar" class="searchbar"></div>
|
<div id="searchbar" class="searchbar"></div>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
|
|
|
@ -141,6 +141,7 @@ function findKeyInOptions() {
|
||||||
function setOptions(data) {
|
function setOptions(data) {
|
||||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||||
|
emit('update:options', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filter(val, options) {
|
function filter(val, options) {
|
||||||
|
|
|
@ -288,3 +288,7 @@ input::-webkit-inner-spin-button {
|
||||||
color: $info;
|
color: $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-visible {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ onBeforeMount(() => {
|
||||||
>
|
>
|
||||||
<template #body-cell-id="{ row }">
|
<template #body-cell-id="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat color="primary"> {{ row.ticketFk }}</QBtn>
|
<QBtn flat class="link"> {{ row.ticketFk }}</QBtn>
|
||||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -251,7 +251,7 @@ onBeforeMount(() => {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-requester="{ row }">
|
<template #body-cell-requester="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat dense color="primary"> {{ row.requesterName }}</QBtn>
|
<QBtn flat dense class="link"> {{ row.requesterName }}</QBtn>
|
||||||
<WorkerDescriptorProxy :id="row.requesterFk" />
|
<WorkerDescriptorProxy :id="row.requesterFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -292,7 +292,7 @@ onBeforeMount(() => {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-concept="{ row }">
|
<template #body-cell-concept="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat dense color="primary"> {{ row.itemDescription }}</QBtn>
|
<QBtn flat dense class="link"> {{ row.itemDescription }}</QBtn>
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -174,6 +174,16 @@ const decrement = (paramsObj, key) => {
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="params.myTeam"
|
||||||
|
:label="t('params.myTeam')"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
toggle-indeterminate
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QCard bordered>
|
<QCard bordered>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
|
@ -274,11 +284,11 @@ en:
|
||||||
to: To
|
to: To
|
||||||
mine: For me
|
mine: For me
|
||||||
state: State
|
state: State
|
||||||
|
myTeam: My team
|
||||||
dateFiltersTooltip: Cannot choose a range of dates and days onward at the same time
|
dateFiltersTooltip: Cannot choose a range of dates and days onward at the same time
|
||||||
denied: Denied
|
denied: Denied
|
||||||
accepted: Accepted
|
accepted: Accepted
|
||||||
pending: Pending
|
pending: Pending
|
||||||
|
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
search: Búsqueda general
|
search: Búsqueda general
|
||||||
|
@ -291,6 +301,7 @@ es:
|
||||||
to: Hasta
|
to: Hasta
|
||||||
mine: Para mi
|
mine: Para mi
|
||||||
state: Estado
|
state: Estado
|
||||||
|
myTeam: Mi equipo
|
||||||
dateFiltersTooltip: No se puede seleccionar un rango de fechas y días en adelante a la vez
|
dateFiltersTooltip: No se puede seleccionar un rango de fechas y días en adelante a la vez
|
||||||
denied: Denegada
|
denied: Denegada
|
||||||
accepted: Aceptada
|
accepted: Aceptada
|
||||||
|
|
|
@ -12,6 +12,7 @@ import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { toTimeFormat } from 'filters/date.js';
|
import { toTimeFormat } from 'filters/date.js';
|
||||||
|
|
||||||
|
@ -28,14 +29,17 @@ const { validate } = useValidator();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const agencyFetchRef = ref(null);
|
const canEditZone = useAcl().hasAny([
|
||||||
const zonesFetchRef = ref(null);
|
{ model: 'Ticket', props: 'editZone', accessType: 'WRITE' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const agencyFetchRef = ref();
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
|
const zoneSelectRef = ref();
|
||||||
const formData = ref($props.formData);
|
const formData = ref($props.formData);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -44,6 +48,8 @@ watch(
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onMounted(() => onFormModelInit());
|
||||||
|
|
||||||
const agencyByWarehouseFilter = computed(() => ({
|
const agencyByWarehouseFilter = computed(() => ({
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
order: 'name ASC',
|
order: 'name ASC',
|
||||||
|
@ -52,8 +58,7 @@ const agencyByWarehouseFilter = computed(() => ({
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function zoneWhere() {
|
const zoneWhere = computed(() => {
|
||||||
if (formData?.value?.agencyModeFk) {
|
|
||||||
return formData.value?.agencyModeFk
|
return formData.value?.agencyModeFk
|
||||||
? {
|
? {
|
||||||
shipped: formData.value?.shipped,
|
shipped: formData.value?.shipped,
|
||||||
|
@ -62,8 +67,7 @@ function zoneWhere() {
|
||||||
warehouseFk: formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
const getLanded = async (params) => {
|
const getLanded = async (params) => {
|
||||||
try {
|
try {
|
||||||
|
@ -270,7 +274,17 @@ const redirectToCustomerAddress = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => onFormModelInit());
|
async function getZone(options) {
|
||||||
|
if (!zoneId.value) return;
|
||||||
|
|
||||||
|
const zone = options.find((z) => z.id == zoneId.value);
|
||||||
|
if (zone) return;
|
||||||
|
|
||||||
|
const { data } = await axios.get('Zones/' + zoneId.value, {
|
||||||
|
params: { filter: JSON.stringify({ fields: ['id', 'name'] }) },
|
||||||
|
});
|
||||||
|
zoneSelectRef.value.opts.push(data);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -416,6 +430,7 @@ onMounted(() => onFormModelInit());
|
||||||
:rules="validate('basicData.agency')"
|
:rules="validate('basicData.agency')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
ref="zoneSelectRef"
|
||||||
:label="t('basicData.zone')"
|
:label="t('basicData.zone')"
|
||||||
v-model="zoneId"
|
v-model="zoneId"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -424,11 +439,10 @@ onMounted(() => onFormModelInit());
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
sort-by="id"
|
sort-by="id"
|
||||||
:where="zoneWhere"
|
:where="zoneWhere"
|
||||||
hide-selected
|
|
||||||
map-options
|
|
||||||
:required="true"
|
|
||||||
@focus="zonesFetchRef.fetch()"
|
|
||||||
:rules="validate('basicData.zone')"
|
:rules="validate('basicData.zone')"
|
||||||
|
:required="true"
|
||||||
|
:disable="!canEditZone"
|
||||||
|
@update:options="getZone"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
|
export const useStateQueryStore = defineStore('stateQueryStore', () => {
|
||||||
|
const queries = ref(new Set());
|
||||||
|
|
||||||
|
function add(query) {
|
||||||
|
queries.value.add(query);
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLoading() {
|
||||||
|
return computed(() => queries.value.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove(query) {
|
||||||
|
queries.value.delete(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
queries.value = new Set();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
add,
|
||||||
|
isLoading,
|
||||||
|
remove,
|
||||||
|
queries,
|
||||||
|
reset,
|
||||||
|
};
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client consignee', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/address', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client balance', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/balance', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client basic data', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/basic-data', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client billing data', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/billing-data', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client credits', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/credits', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client fiscal data', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/fiscal-data', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client greuges', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/greuges', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,63 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client list', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/#/customer/list', {
|
||||||
|
timeout: 5000,
|
||||||
|
onBeforeLoad(win) {
|
||||||
|
cy.stub(win, 'open');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Client list create new client', () => {
|
||||||
|
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
const data = {
|
||||||
|
Name: { val: 'Name 1' },
|
||||||
|
'Social name': { val: 'TEST 1' },
|
||||||
|
'Tax number': { val: '20852113Z' },
|
||||||
|
'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' },
|
||||||
|
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
|
||||||
|
};
|
||||||
|
cy.fillInForm(data);
|
||||||
|
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
|
||||||
|
cy.checkNotification('created');
|
||||||
|
cy.url().should('include', '/summary');
|
||||||
|
});
|
||||||
|
it('Client list search client', () => {
|
||||||
|
const search = 'Jessica Jones';
|
||||||
|
cy.searchByLabel('Name', search);
|
||||||
|
|
||||||
|
cy.get('.title > span').should('have.text', search);
|
||||||
|
let id = null;
|
||||||
|
cy.get('.q-item > .q-item__label').then((text) => {
|
||||||
|
id = text.text().trim().split('#')[1];
|
||||||
|
cy.get('.q-item > .q-item__label').should('have.text', ` #${id}`);
|
||||||
|
cy.url().should('include', `/customer/${id}/summary`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Client founded create ticket', () => {
|
||||||
|
const search = 'Jessica Jones';
|
||||||
|
cy.searchByLabel('Name', search);
|
||||||
|
cy.clickButtonsDescriptor(2);
|
||||||
|
cy.waitForElement('#formModel');
|
||||||
|
cy.waitForElement('.q-form');
|
||||||
|
cy.checkValueForm(1, search);
|
||||||
|
});
|
||||||
|
it('Client founded create order', () => {
|
||||||
|
const search = 'Jessica Jones';
|
||||||
|
cy.searchByLabel('Name', search);
|
||||||
|
cy.clickButtonsDescriptor(4);
|
||||||
|
cy.waitForElement('#formModel');
|
||||||
|
cy.waitForElement('.q-form');
|
||||||
|
cy.checkValueForm(2, search);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client notes', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/notes', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client recoveries', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/recoveries', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client web-access', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/web-access', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client credit opinion', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/credit-management/credit-contracts', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client credit opinion', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/credit-management/credit-opinion', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client consumption', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/others/consumption', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client contacts', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/others/contacts', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client mandates', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/others/mandates', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client samples', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/others/samples', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client unpaid', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1110/others/unpaid', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Client web payments', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('#/customer/1101/others/web-payments', {
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-card').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -7,41 +7,46 @@ vi.mock('src/composables/useSession', () => ({
|
||||||
getToken: () => 'DEFAULT_TOKEN',
|
getToken: () => 'DEFAULT_TOKEN',
|
||||||
isLoggedIn: () => vi.fn(),
|
isLoggedIn: () => vi.fn(),
|
||||||
destroy: () => vi.fn(),
|
destroy: () => vi.fn(),
|
||||||
})
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
|
vi.mock('src/stores/useStateQueryStore', () => ({
|
||||||
|
useStateQueryStore: () => ({
|
||||||
|
add: () => vi.fn(),
|
||||||
|
remove: () => vi.fn(),
|
||||||
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('Axios boot', () => {
|
describe('Axios boot', () => {
|
||||||
|
|
||||||
describe('onRequest()', async () => {
|
describe('onRequest()', async () => {
|
||||||
it('should set the "Authorization" property on the headers', async () => {
|
it('should set the "Authorization" property on the headers', async () => {
|
||||||
const config = { headers: {} };
|
const config = { headers: {} };
|
||||||
|
|
||||||
const resultConfig = onRequest(config);
|
const resultConfig = onRequest(config);
|
||||||
|
|
||||||
expect(resultConfig).toEqual(expect.objectContaining({
|
expect(resultConfig).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: 'DEFAULT_TOKEN'
|
Authorization: 'DEFAULT_TOKEN',
|
||||||
}
|
},
|
||||||
}));
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('onResponseError()', async () => {
|
describe('onResponseError()', async () => {
|
||||||
it('should call to the Notify plugin with a message error for an status code "500"', async () => {
|
it('should call to the Notify plugin with a message error for an status code "500"', async () => {
|
||||||
Notify.create = vi.fn()
|
Notify.create = vi.fn();
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 500
|
status: 500,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = onResponseError(error);
|
const result = onResponseError(error);
|
||||||
|
|
||||||
|
expect(result).rejects.toEqual(expect.objectContaining(error));
|
||||||
expect(result).rejects.toEqual(
|
|
||||||
expect.objectContaining(error)
|
|
||||||
);
|
|
||||||
expect(Notify.create).toHaveBeenCalledWith(
|
expect(Notify.create).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
message: 'An internal server error has ocurred',
|
message: 'An internal server error has ocurred',
|
||||||
|
@ -51,25 +56,22 @@ describe('Axios boot', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call to the Notify plugin with a message from the response property', async () => {
|
it('should call to the Notify plugin with a message from the response property', async () => {
|
||||||
Notify.create = vi.fn()
|
Notify.create = vi.fn();
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 401,
|
status: 401,
|
||||||
data: {
|
data: {
|
||||||
error: {
|
error: {
|
||||||
message: 'Invalid user or password'
|
message: 'Invalid user or password',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = onResponseError(error);
|
const result = onResponseError(error);
|
||||||
|
|
||||||
|
expect(result).rejects.toEqual(expect.objectContaining(error));
|
||||||
expect(result).rejects.toEqual(
|
|
||||||
expect.objectContaining(error)
|
|
||||||
);
|
|
||||||
expect(Notify.create).toHaveBeenCalledWith(
|
expect(Notify.create).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
message: 'Invalid user or password',
|
message: 'Invalid user or password',
|
||||||
|
@ -77,5 +79,5 @@ describe('Axios boot', () => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
import { describe, expect, it, beforeEach, beforeAll } from 'vitest';
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
|
||||||
|
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||||
|
|
||||||
|
describe('useStateQueryStore', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
createWrapper({}, {});
|
||||||
|
});
|
||||||
|
|
||||||
|
const stateQueryStore = useStateQueryStore();
|
||||||
|
const { add, isLoading, remove, reset } = useStateQueryStore();
|
||||||
|
const firstQuery = { url: 'myQuery' };
|
||||||
|
|
||||||
|
function getQueries() {
|
||||||
|
return stateQueryStore.queries;
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
reset();
|
||||||
|
expect(getQueries().size).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add two queries', async () => {
|
||||||
|
expect(getQueries().size).toBeFalsy();
|
||||||
|
add(firstQuery);
|
||||||
|
|
||||||
|
expect(getQueries().size).toBeTruthy();
|
||||||
|
expect(getQueries().has(firstQuery)).toBeTruthy();
|
||||||
|
|
||||||
|
add();
|
||||||
|
expect(getQueries().size).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add and remove loading state', async () => {
|
||||||
|
expect(isLoading().value).toBeFalsy();
|
||||||
|
add(firstQuery);
|
||||||
|
expect(isLoading().value).toBeTruthy();
|
||||||
|
remove(firstQuery);
|
||||||
|
expect(isLoading().value).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add and remove query', async () => {
|
||||||
|
const secondQuery = { ...firstQuery };
|
||||||
|
const thirdQuery = { ...firstQuery };
|
||||||
|
|
||||||
|
add(firstQuery);
|
||||||
|
add(secondQuery);
|
||||||
|
|
||||||
|
const beforeCount = getQueries().size;
|
||||||
|
add(thirdQuery);
|
||||||
|
expect(getQueries().has(thirdQuery)).toBeTruthy();
|
||||||
|
|
||||||
|
remove(thirdQuery);
|
||||||
|
expect(getQueries().has(thirdQuery)).toBeFalsy();
|
||||||
|
expect(getQueries().size).toBe(beforeCount);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue