Merge branch 'dev' into 8725_submit_form_onClick

This commit is contained in:
Javier Segarra 2025-03-10 10:29:53 +01:00
commit 9e037c0300
64 changed files with 783 additions and 687 deletions

4
Jenkinsfile vendored
View File

@ -122,8 +122,8 @@ pipeline {
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'sh test/cypress/cypressParallel.sh 2'
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'sh test/cypress/cypressParallel.sh 3'
}
}
}

View File

@ -57,7 +57,7 @@ const refresh = () => window.location.reload();
:class="{
'no-visible': !stateQuery.isLoading().value,
}"
size="xs"
size="sm"
data-cy="loading-spinner"
/>
<QSpace />

View File

@ -87,7 +87,7 @@ const makeInvoice = async () => {
(data) => (
(rectificativeTypeOptions = data),
(transferInvoiceParams.cplusRectificationTypeFk = data.filter(
(type) => type.description == 'I Por diferencias'
(type) => type.description == 'I Por diferencias',
)[0].id)
)
"
@ -100,7 +100,7 @@ const makeInvoice = async () => {
(data) => (
(siiTypeInvoiceOutsOptions = data),
(transferInvoiceParams.siiTypeInvoiceOutFk = data.filter(
(type) => type.code == 'R4'
(type) => type.code == 'R4',
)[0].id)
)
"
@ -122,7 +122,6 @@ const makeInvoice = async () => {
<VnRow>
<VnSelect
:label="t('Client')"
:options="clientsOptions"
hide-selected
option-label="name"
option-value="id"

View File

@ -1136,9 +1136,13 @@ es:
.grid-create {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
grid-template-columns: 1fr 1fr;
max-width: 100%;
grid-gap: 20px;
margin: 0 auto;
.col-span-2 {
grid-column: span 2;
}
}
.flex-one {

View File

@ -56,7 +56,12 @@ async function confirm() {
{{ t('The notification will be sent to the following address') }}
</QCardSection>
<QCardSection class="q-pt-none">
<VnInput v-model="address" is-outlined autofocus />
<VnInput
v-model="address"
is-outlined
autofocus
data-cy="SendEmailNotifiactionDialogInput"
/>
</QCardSection>
<QCardActions align="right">
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />

View File

@ -5,7 +5,7 @@ import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
import { useArrayData } from 'composables/useArrayData';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useState } from 'src/composables/useState';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import { useClipboard } from 'src/composables/useClipboard';
import VnMoreOptions from './VnMoreOptions.vue';
@ -42,6 +42,7 @@ const $props = defineProps({
const state = useState();
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const { copyText } = useClipboard();
const { viewSummary } = useSummaryDialog();
@ -50,6 +51,9 @@ let store;
let entity;
const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
const DESCRIPTOR_PROXY = 'DescriptorProxy';
const moduleName = ref();
const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value;
defineExpose({ getData });
onBeforeMount(async () => {
@ -76,15 +80,18 @@ onBeforeMount(async () => {
);
});
const routeName = computed(() => {
const DESCRIPTOR_PROXY = 'DescriptorProxy';
function getName() {
let name = $props.dataKey;
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
name = name.split(DESCRIPTOR_PROXY)[0];
}
return `${name}Summary`;
return name;
}
const routeName = computed(() => {
let routeName = getName();
return `${routeName}Summary`;
});
async function getData() {
store.url = $props.url;
store.filter = $props.filter ?? {};
@ -120,20 +127,35 @@ function copyIdText(id) {
const emit = defineEmits(['onFetch']);
const iconModule = computed(() => route.matched[1].meta.icon);
const toModule = computed(() =>
route.matched[1].path.split('/').length > 2
? route.matched[1].redirect
: route.matched[1].children[0].redirect,
);
const iconModule = computed(() => {
moduleName.value = getName();
if (isSameModuleName) {
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
?.meta?.icon;
} else {
return route.matched[1].meta.icon;
}
});
const toModule = computed(() => {
moduleName.value = getName();
if (isSameModuleName) {
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
?.children[0]?.redirect;
} else {
return route.matched[1].path.split('/').length > 2
? route.matched[1].redirect
: route.matched[1].children[0].redirect;
}
});
</script>
<template>
<div class="descriptor">
<template v-if="entity && !isLoading">
<div class="header bg-primary q-pa-sm justify-between">
<slot name="header-extra-action"
><QBtn
<slot name="header-extra-action">
<QBtn
round
flat
dense
@ -141,13 +163,13 @@ const toModule = computed(() =>
:icon="iconModule"
color="white"
class="link"
:to="$attrs['to-module'] ?? toModule"
:to="toModule"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn></slot
>
</QBtn>
</slot>
<QBtn
@click.stop="viewSummary(entity.id, $props.summary, $props.width)"
round
@ -230,7 +252,6 @@ const toModule = computed(() =>
</div>
<slot name="after" />
</template>
<!-- Skeleton -->
<SkeletonDescriptor v-if="!entity || isLoading" />
</div>
<QInnerLoading

View File

@ -33,6 +33,10 @@ const props = defineProps({
type: String,
default: '',
},
userFilter: {
type: Object,
default: null,
},
filter: {
type: Object,
default: null,

View File

@ -148,8 +148,7 @@ export function useArrayData(key, userOptions) {
}
async function applyFilter({ filter, params }, fetchOptions = {}) {
if (filter) store.userFilter = filter;
store.filter = {};
if (filter) store.filter = filter;
if (params) store.userParams = { ...params };
const response = await fetch(fetchOptions);

View File

@ -337,5 +337,5 @@ input::-webkit-inner-spin-button {
}
.containerShrinked {
width: 80%;
width: 70%;
}

View File

@ -149,14 +149,12 @@ const columns = computed(() => [
:right-search="false"
>
<template #more-create-dialog="{ data }">
<QCardSection>
<VnInputPassword
:label="t('Password')"
v-model="data.password"
:required="true"
autocomplete="new-password"
/>
</QCardSection>
</template>
</VnTable>
</template>

View File

@ -16,7 +16,6 @@ const filter = {
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } },
{ relation: 'company', scope: { fields: ['id', 'code'] } },
],
where: { clientFk: route.params.id },
order: ['created DESC'],
limit: 20,
};
@ -65,7 +64,8 @@ const columns = computed(() => [
<VnTable
data-key="Mandates"
url="Mandates"
:filter="filter"
:user-filter="filter"
:filter="{ where: { clientFk: route.params.id } }"
auto-load
:columns="columns"
class="full-width q-mt-md"

View File

@ -146,9 +146,8 @@ async function deleteEntry() {
<template>
<CardDescriptor
ref="entryDescriptorRef"
:url="`Entries/${entityId}`"
:userFilter="entryFilter"
:filter="entryFilter"
title="supplier.nickname"
data-key="Entry"
width="lg-width"

View File

@ -283,7 +283,11 @@ onBeforeMount(async () => {
</script>
<template>
<VnSection :data-key="dataKey" prefix="entry">
<VnSection
:data-key="dataKey"
prefix="entry"
:array-data-props="{ url: 'Entries/filter' }"
>
<template #advanced-menu>
<EntryFilter :data-key="dataKey" />
</template>

View File

@ -70,6 +70,7 @@ function ticketFilter(invoice) {
icon="vn:client"
color="primary"
:to="{ name: 'CustomerCard', params: { id: entity.client.id } }"
data-cy="invoiceOutDescriptorCustomerCard"
>
<QTooltip>{{ t('invoiceOut.card.customerCard') }}</QTooltip>
</QBtn>
@ -81,6 +82,7 @@ function ticketFilter(invoice) {
name: 'TicketList',
query: { table: ticketFilter(entity) },
}"
data-cy="invoiceOutDescriptorTicketList"
>
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
</QBtn>

View File

@ -185,7 +185,7 @@ watchEffect(selectedRows);
prefix="invoiceOut"
:array-data-props="{
url: 'InvoiceOuts/filter',
order: ['id DESC'],
order: 'id DESC',
}"
>
<template #advanced-menu>
@ -230,7 +230,7 @@ watchEffect(selectedRows);
</span>
</template>
<template #more-create-dialog="{ data }">
<div class="row q-col-gutter-xs">
<div class="row q-col-gutter-xs col-span-2">
<div class="col-12">
<div class="q-col-gutter-xs">
<VnRow fixed>
@ -396,7 +396,6 @@ watchEffect(selectedRows);
:label="
t('invoiceOutList.tableVisibleColumns.taxArea')
"
:options="taxAreasOptions"
option-label="code"
option-value="code"
/>

View File

@ -20,7 +20,7 @@ const props = defineProps({
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:un-removable-params="['from', 'to']"
:unremovable-params="['from', 'to']"
:hidden-tags="['from', 'to']"
>
<template #tags="{ tag, formatFn }">

View File

@ -156,9 +156,7 @@ const columns = computed(() => [
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
const query = JSON.parse(route.query?.createForm);
formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientFk: query?.clientFk });
await onClientSelected(JSON.parse(route.query?.createForm));
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
const clientFk = query?.clientFk;
@ -177,7 +175,6 @@ watch(
tableRef.value.create.formInitialData = formInitialData.value;
}
},
{ immediate: true },
);
async function onClientSelected({ clientFk }, formData = {}) {
@ -191,13 +188,17 @@ async function onClientSelected({ clientFk }, formData = {}) {
addressOptions.value = data;
formData.defaultAddressFk = data[0].client.defaultAddressFk;
formData.addressId = formData.defaultAddressFk;
formInitialData.value = { addressId: formData.addressId, clientFk };
formInitialData.value = { ...formData, clientFk };
await fetchAgencies(formData);
}
async function fetchAgencies({ landed, addressId }) {
if (!landed || !addressId) return (agencyList.value = []);
async function fetchAgencies(formData) {
const { landed, addressId } = formData;
if (!landed || !addressId) {
formData.defaultAddressFk = formInitialData.value.defaultAddressFk;
return (agencyList.value = []);
}
const { data } = await axios.get('Agencies/landsThatDay', {
params: {
@ -220,6 +221,11 @@ const getDateColor = (date) => {
if (difference == 0) return 'bg-warning';
if (difference < 0) return 'bg-success';
};
const isDefaultAddress = (opt, data) => {
const addressId = data.defaultAddressFk ?? data.addressId;
return addressId === opt.id && opt.isActive;
};
</script>
<template>
@ -310,10 +316,7 @@ const getDateColor = (date) => {
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="
scope.opt.isActive &&
data.defaultAddressFk === scope.opt.id
"
v-if="isDefaultAddress(scope.opt, data)"
size="sm"
color="grey"
name="star"

View File

@ -27,12 +27,16 @@ const getZone = async () => {
const filter = {
where: { routeFk: $props.id ? $props.id : route.params.id },
};
const { data } = await axios.get('Tickets/findOne', {
const { data } = await axios.get('Tickets/filter', {
params: {
filter: JSON.stringify(filter),
},
});
zoneId.value = data.zoneFk;
if (!data.length) return;
const firstRecord = data[0];
zoneId.value = firstRecord.zoneFk;
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
zone.value = zoneData.name;
};

View File

@ -172,6 +172,7 @@ const filterColumns = computed(() => {
>
<template #more-create-dialog="{ data }">
<VnInput
class="col-span-2"
:label="t('globals.name')"
v-model="data.socialName"
:uppercase="true"

View File

@ -123,7 +123,7 @@ async function handleSave() {
}
function validateFields(item) {
// Only validate fields that are being updated
const shouldExist = (field) => !isUpdate || field in item;
const shouldExist = (field) => field in item;
if (!shouldExist('ticketServiceTypeFk') && !item.ticketServiceTypeFk) {
notify('Description is required', 'negative');

View File

@ -54,8 +54,7 @@ onBeforeMount(() => {
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
formInitialData.value = JSON.parse(route.query?.createForm);
await onClientSelected(formInitialData.value);
await onClientSelected(JSON.parse(route.query?.createForm));
} else if (route.query?.table) {
const query = route.query?.table;
const clientId = +JSON.parse(query)?.clientFk;
@ -273,12 +272,18 @@ const fetchAddresses = async (formData) => {
return;
}
const { data } = await getAddresses(formData.clientId);
formInitialData.value = { clientId: formData.clientId };
if (!data) return;
if (!data) {
formInitialData.value = { clientId: formData.clientId };
return;
}
addressesOptions.value = data;
selectedClient.value = data[0].client;
formData.addressId = selectedClient.value.defaultAddressFk;
formInitialData.value.addressId = formData.addressId;
formInitialData.value = {
clientId: formData.clientId,
addressId: formData.addressId,
};
};
watch(
() => route.query.table,

View File

@ -1,6 +1,6 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'src/components/common/VnCardBeta.vue';
</script>
<template>
<VnCard data-key="Wagon" url="Wagons" />
<VnCardBeta data-key="Wagon" url="Wagons" :descriptor="{}" />
</template>

View File

@ -8,6 +8,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import { computed, ref } from 'vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSection from 'src/components/common/VnSection.vue';
const quasar = useQuasar();
const arrayData = useArrayData('WagonList');
@ -15,6 +16,7 @@ const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
const tableRef = ref();
const dataKey = 'WagonList';
const filter = {
include: {
relation: 'type',
@ -75,101 +77,110 @@ function navigate(id) {
}
async function remove(row) {
try {
await axios.delete(`Wagons/${row.id}`).then(async () => {
quasar.notify({
message: t('wagon.list.removeItem'),
type: 'positive',
});
store.data.splice(store.data.indexOf(row), 1);
window.location.reload();
await axios.delete(`Wagons/${row.id}`).then(async () => {
quasar.notify({
message: t('wagon.list.removeItem'),
type: 'positive',
});
} catch (error) {
//
}
store.data.splice(store.data.indexOf(row), 1);
window.location.reload();
});
}
</script>
<template>
<QPage class="column items-center q-pa-md">
<VnTable
ref="tableRef"
data-key="WagonList"
url="Wagons"
:filter="filter"
<VnSection
:data-key="dataKey"
:columns="columns"
order="id DESC"
:column-search="false"
:default-mode="'card'"
:disable-option="{ table: true }"
:create="{
urlCreate: 'Wagons',
title: t('Create new wagon'),
onDataSaved: () => tableRef.reload(),
formInitialData: {},
prefix="card"
:array-data-props="{
url: 'Wagons',
exprBuilder,
order: 'id DESC',
}"
>
<template #more-create-dialog="{ data }">
<VnInput
filled
v-model="data.label"
:label="t('wagon.create.label')"
type="number"
min="0"
:rules="[(val) => !!val || t('wagon.warnings.labelNotEmpty')]"
/>
<VnInput
filled
v-model="data.plate"
:label="t('wagon.list.plate')"
:rules="[(val) => !!val || t('wagon.warnings.plateNotEmpty')]"
/>
<VnInput
filled
v-model="data.volume"
:label="t('wagon.list.volume')"
type="number"
min="0"
:rules="[(val) => !!val || t('wagon.warnings.volumeNotEmpty')]"
/>
<VnSelect
url="WagonTypes"
filled
v-model="data.typeFk"
use-input
fill-input
hide-selected
input-debounce="0"
option-label="name"
option-value="id"
emit-value
map-options
:label="t('globals.type')"
:options="filteredWagonTypes"
:rules="[(val) => !!val || t('wagon.warnings.typeNotEmpty')]"
@filter="filterType"
<template #body>
<VnTable
ref="tableRef"
:data-key="dataKey"
:create="{
urlCreate: 'Wagons',
title: t('Create new wagon'),
onDataSaved: () => tableRef.reload(),
formInitialData: {},
}"
:filter="filter"
:columns="columns"
:column-search="false"
:default-mode="'card'"
:disable-option="{ table: true }"
:right-search="false"
>
<template v-if="data.typeFk" #append>
<QIcon
name="cancel"
@click.stop.prevent="data.typeFk = null"
class="cursor-pointer"
<template #more-create-dialog="{ data }">
<VnInput
filled
v-model="data.label"
:label="t('wagon.create.label')"
type="number"
min="0"
:rules="[(val) => !!val || t('wagon.warnings.labelNotEmpty')]"
/>
<VnInput
filled
v-model="data.plate"
:label="t('wagon.list.plate')"
:rules="[(val) => !!val || t('wagon.warnings.plateNotEmpty')]"
/>
<VnInput
filled
v-model="data.volume"
:label="t('wagon.list.volume')"
type="number"
min="0"
:rules="[
(val) => !!val || t('wagon.warnings.volumeNotEmpty'),
]"
/>
<VnSelect
url="WagonTypes"
filled
v-model="data.typeFk"
use-input
fill-input
hide-selected
input-debounce="0"
option-label="name"
option-value="id"
emit-value
map-options
:label="t('globals.type')"
:options="filteredWagonTypes"
:rules="[(val) => !!val || t('wagon.warnings.typeNotEmpty')]"
@filter="filterType"
>
<template v-if="data.typeFk" #append>
<QIcon
name="cancel"
@click.stop.prevent="data.typeFk = null"
class="cursor-pointer"
/>
</template>
<template #no-option>
<QItem>
<QItemSection class="text-grey">
{{ t('wagon.warnings.noData') }}
</QItemSection>
</QItem>
</template>
</VnSelect>
</template>
<template #no-option>
<QItem>
<QItemSection class="text-grey">
{{ t('wagon.warnings.noData') }}
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnTable>
</template>
</VnTable>
</VnSection>
</QPage>
</template>
<i18n>
es:
Create new wagon: Crear nuevo vagón
</i18n>
</i18n>

View File

@ -223,7 +223,7 @@ async function autofillBic(worker) {
:right-search="false"
>
<template #more-create-dialog="{ data }">
<div class="q-pa-lg full-width">
<div class="col-span-2">
<VnRadio
v-model="data.isFreelance"
:val="false"

View File

@ -29,10 +29,10 @@ const setFilteredAddresses = (data) => {
<template #form="{ data, validate }">
<VnRow>
<VnInput
data-cy="zone-basic-data-name"
:label="t('Name')"
clearable
v-model="data.name"
data-cy="ZoneBasicDataName"
:required="true"
/>
</VnRow>
@ -75,7 +75,6 @@ const setFilteredAddresses = (data) => {
min="0"
/>
</VnRow>
<VnRow>
<VnInput
v-model="data.travelingDays"
@ -86,7 +85,6 @@ const setFilteredAddresses = (data) => {
/>
<VnInputTime v-model="data.hour" :label="t('Closing')" :required="true" />
</VnRow>
<VnRow>
<VnInput
v-model="data.price"
@ -95,6 +93,7 @@ const setFilteredAddresses = (data) => {
min="0"
:required="true"
clearable
data-cy="ZoneBasicDataPrice"
/>
<VnInput
v-model="data.priceOptimum"

View File

@ -1,38 +1,7 @@
<script setup>
import { useRoute } from 'vue-router';
import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'src/components/common/VnCardBeta.vue';
import ZoneDescriptor from './ZoneDescriptor.vue';
import ZoneFilterPanel from '../ZoneFilterPanel.vue';
import filter from './ZoneFilter.js';
const route = useRoute();
const routeName = computed(() => route.name);
function notIsLocations(ifIsFalse, ifIsTrue) {
if (routeName.value != 'ZoneLocations') return ifIsFalse;
return ifIsTrue;
}
</script>
<template>
<VnCard
data-key="Zone"
:url="notIsLocations('Zones', undefined)"
:descriptor="ZoneDescriptor"
:filter="filter"
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
:search-data-key="notIsLocations('ZoneList', undefined)"
:searchbar-props="{
url: notIsLocations('Zones', 'ZoneLocations'),
label: notIsLocations($t('list.searchZone'), $t('list.searchLocation')),
info: $t('list.searchInfo'),
whereFilter: notIsLocations((value) => {
return /^\d+$/.test(value)
? { id: value }
: { name: { like: `%${value}%` } };
}),
}"
/>
<VnCardBeta data-key="Zone" url="Zones" :descriptor="ZoneDescriptor" />
</template>

View File

@ -36,13 +36,13 @@ function openConfirmDialog(callback) {
}
</script>
<template>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable data-cy="Delete_button">
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>
<QItemSection>{{ t('deleteZone') }}</QItemSection>
</QItem>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable data-cy="Clone_button">
<QItemSection avatar>
<QIcon name="content_copy" />
</QItemSection>

View File

@ -171,9 +171,10 @@ onMounted(() => {
openConfirmationModal(
t('eventsPanel.deleteTitle'),
t('eventsPanel.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
data-cy="ZoneEventExclusionDeleteBtn"
/>
<QBtn
:label="isNew ? t('globals.add') : t('globals.save')"

View File

@ -18,7 +18,6 @@ import axios from 'axios';
const props = defineProps({
date: {
type: Date,
required: true,
default: null,
},
event: {
@ -58,7 +57,7 @@ const arrayData = useArrayData('ZoneEvents');
const createEvent = async () => {
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
eventInclusionFormData.value.wdays
eventInclusionFormData.value.wdays,
);
if (inclusionType.value == 'day') eventInclusionFormData.value.weekDays = '';
@ -74,7 +73,7 @@ const createEvent = async () => {
else
await axios.put(
`Zones/${route.params.id}/events/${props.event?.id}`,
eventInclusionFormData.value
eventInclusionFormData.value,
);
await refetchEvents();
@ -123,12 +122,14 @@ onMounted(() => {
dense
val="day"
:label="t('eventsInclusionForm.oneDay')"
data-cy="ZoneEventInclusionDayRadio"
/>
<QRadio
v-model="inclusionType"
dense
val="indefinitely"
:label="t('eventsInclusionForm.indefinitely')"
data-cy="ZoneEventInclusionIndefinitelyRadio"
/>
<QRadio
v-model="inclusionType"
@ -136,6 +137,7 @@ onMounted(() => {
val="range"
:label="t('eventsInclusionForm.rangeOfDates')"
class="q-mb-sm"
data-cy="ZoneEventInclusionRangeRadio"
/>
</div>
<VnRow>
@ -221,7 +223,7 @@ onMounted(() => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
/>

View File

@ -1,18 +1,14 @@
<script setup>
import { ref } from 'vue';
import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import ZoneEventsPanel from './ZoneEventsPanel.vue';
import ZoneCalendarGrid from '../ZoneCalendarGrid.vue';
import ZoneEventInclusionForm from './ZoneEventInclusionForm.vue';
import ZoneEventExclusionForm from './ZoneEventExclusionForm.vue';
import { useStateStore } from 'stores/useStateStore';
import { reactive } from 'vue';
import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n();
const stateStore = useStateStore();
const firstDay = ref();
const lastDay = ref();
@ -43,14 +39,16 @@ const onZoneEventFormClose = () => {
</script>
<template>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
<ZoneEventsPanel
:first-day="firstDay"
:last-day="lastDay"
:events="events"
v-model:formModeName="formModeName"
/>
</Teleport>
<RightMenu>
<template #right-panel>
<ZoneEventsPanel
:first-day="firstDay"
:last-day="lastDay"
:events="events"
v-model:formModeName="formModeName"
/>
</template>
</RightMenu>
<QPage class="q-pa-md flex justify-center">
<ZoneCalendarGrid
v-model:events="events"

View File

@ -14,12 +14,10 @@ import { useVnConfirm } from 'composables/useVnConfirm';
const props = defineProps({
firstDay: {
type: Date,
required: true,
default: null,
},
lastDay: {
type: Date,
required: true,
default: null,
},
events: {
@ -67,7 +65,7 @@ watch(
async () => {
await fetchData();
},
{ immediate: true, deep: true }
{ immediate: true, deep: true },
);
const formatWdays = (event) => {
@ -178,9 +176,10 @@ onMounted(async () => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent(event.id)
() => deleteEvent(event.id),
)
"
data-cy="ZoneEventsPanelDeleteBtn"
>
<QTooltip>{{ t('eventsPanel.delete') }}</QTooltip>
</QBtn>

View File

@ -1,6 +1,7 @@
<script setup>
import { onMounted, ref, computed, watch, onUnmounted } from 'vue';
import { useRoute } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
@ -30,7 +31,7 @@ const emit = defineEmits(['update:tickedNodes']);
const route = useRoute();
const state = useState();
const stateStore = useStateStore();
const treeRef = ref();
const expanded = ref([]);
@ -82,7 +83,7 @@ const onNodeExpanded = async (nodeKeysArray) => {
await fetchNodeLeaves(lastNodeKey, true);
} else {
const difference = new Set(
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x))
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x)),
);
const collapsedNode = Array.from(difference).pop();
const node = treeRef.value?.getNodeByKey(collapsedNode);
@ -135,7 +136,7 @@ watch(
}
previousExpandedNodes.value = new Set(expanded.value);
},
{ immediate: true }
{ immediate: true },
);
const reFetch = async () => {
@ -153,6 +154,17 @@ onUnmounted(() => {
</script>
<template>
<Teleport to="#section-searchbar" v-if="stateStore.isHeaderMounted()">
<VnSearchbar
v-if="!showSearchBar"
:data-key="datakey"
:url="url"
:redirect="false"
:search-remove-params="false"
:label="$t('zone.searchLocations')"
:info="$t('zone.searchLocationsInfo')"
/>
</Teleport>
<VnInput
v-if="showSearchBar"
v-model="store.userParams.search"
@ -163,13 +175,6 @@ onUnmounted(() => {
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
</template>
</VnInput>
<VnSearchbar
v-if="!showSearchBar"
:data-key="datakey"
:url="url"
:redirect="false"
:search-remove-params="false"
/>
<QTree
ref="treeRef"
:nodes="nodes"

View File

@ -2,5 +2,5 @@
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Zone" url="/ZoneLogs"></VnLog>
<VnLog model="Zone" />
</template>

View File

@ -1,74 +0,0 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
const { t } = useI18n();
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'agencyModeFk':
return {
agencyModeFk: value,
};
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
}
};
const tableFilter = {
include: [
{
relation: 'agencyMode',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'address',
scope: {
fields: ['id', 'nickname', 'provinceFk', 'postalCode'],
include: [
{
relation: 'province',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'postcode',
scope: {
fields: ['code', 'townFk'],
include: {
relation: 'town',
scope: {
fields: ['id', 'name'],
},
},
},
},
],
},
},
],
};
</script>
<template>
<VnSearchbar
data-key="ZonesList"
url="Zones"
:filter="tableFilter"
:expr-builder="exprBuilder"
:label="t('list.searchZone')"
:info="t('list.searchInfo')"
custom-route-redirect-name="ZoneSummary"
/>
</template>

View File

@ -60,10 +60,11 @@ onMounted(async () => {
<template>
<CardSummary
data-key="Zone"
data-key="ZoneSummary"
ref="summary"
:url="`Zones/${entityId}`"
:filter="filter"
:entity-id="entityId"
>
<template #header="{ entity }">
<div>#{{ entity.id }} - {{ entity.name }}</div>

View File

@ -185,6 +185,7 @@ const handleDateClick = (timestamp) => {
:class="{
'--today': isToday(timestamp),
}"
data-cy="ZoneCalendarDay"
>
<QPopupProxy v-if="isZoneDeliveryView">
<ZoneClosingTable

View File

@ -3,7 +3,6 @@ import { ref } from 'vue';
import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue';
import ZoneCalendarGrid from './ZoneCalendarGrid.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const firstDay = ref(null);
const lastDay = ref(null);
@ -11,7 +10,6 @@ const events = ref([]);
</script>
<template>
<ZoneSearchbar />
<RightMenu>
<template #right-panel>
<ZoneDeliveryPanel />

View File

@ -46,7 +46,7 @@ watch(
inq.value = {
deliveryMethodFk: { inq: deliveryMethods.value[deliveryMethodFk.value] },
};
}
},
);
</script>
@ -89,7 +89,7 @@ watch(
v-model="formData.geoFk"
url="Postcodes/location"
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
:sort-by="['code ASC']"
:sort-by="'code ASC'"
option-value="geoFk"
option-label="code"
:filter-options="['code']"
@ -98,6 +98,7 @@ watch(
outlined
rounded
map-key="geoFk"
data-cy="ZoneDeliveryDaysPostcodeSelect"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -129,6 +130,7 @@ watch(
dense
outlined
rounded
data-cy="ZoneDeliveryDaysAgencySelect"
/>
<VnSelect
v-else

View File

@ -1,69 +0,0 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'components/common/VnSelect.vue';
import order from 'src/router/modules/order';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
exprBuilder: {
type: Function,
default: null,
},
});
const agencies = ref([]);
</script>
<template>
<FetchData
url="AgencyModes"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (agencies = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag }">
<div class="q-gutter-x-xs">
<strong>{{ t(`filterPanel.${tag.label}`) }}: </strong>
<span>{{ tag.value }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
:label="t('list.name')"
v-model="params.name"
is-outlined
data-cy="zoneFilterPanelNameInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('filterPanel.agencyModeFk')"
v-model="params.agencyModeFk"
:options="agencies"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
outlined
rounded
data-cy="zoneFilterPanelAgencySelect"
>
</VnSelect>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>

View File

@ -14,9 +14,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputTime from 'src/components/common/VnInputTime.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
const router = useRouter();
@ -25,7 +23,7 @@ const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm();
const tableRef = ref();
const warehouseOptions = ref([]);
const dataKey = 'ZoneList';
const tableFilter = {
include: [
{
@ -114,6 +112,7 @@ const columns = computed(() => [
columnFilter: {
inWhere: true,
},
columnClass: 'shrink-column',
},
{
align: 'left',
@ -169,77 +168,128 @@ function formatRow(row) {
return dashIfEmpty(`${row?.address?.nickname},
${row?.address?.postcode?.town?.name} (${row?.address?.province?.name})`);
}
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'agencyModeFk':
return {
agencyModeFk: value,
};
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
case 'price':
return {
price: value,
};
}
};
</script>
<template>
<ZoneSearchbar />
<RightMenu>
<template #right-panel>
<ZoneFilterPanel data-key="ZonesList" />
</template>
</RightMenu>
<VnTable
ref="tableRef"
data-key="ZonesList"
url="Zones"
:create="{
urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
formInitialData: {},
}"
:user-filter="tableFilter"
<VnSection
:data-key="dataKey"
:columns="columns"
redirect="zone"
:right-search="false"
prefix="zone"
:array-data-props="{
url: 'Zones',
order: ['id ASC'],
userFilter: tableFilter,
exprBuilder,
}"
>
<template #column-addressFk="{ row }">
{{ dashIfEmpty(formatRow(row)) }}
<template #body>
<div class="table-container">
<div class="column items-center">
<VnTable
ref="tableRef"
:data-key="dataKey"
:columns="columns"
redirect="Zone"
:create="{
urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
formInitialData: {},
}"
table-height="85vh"
>
<template #column-addressFk="{ row }">
{{ dashIfEmpty(formatRow(row)) }}
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="AgencyModes"
v-model="data.agencyModeFk"
option-value="id"
option-label="name"
:label="t('list.agency')"
/>
<VnInput
v-model="data.price"
:label="t('list.price')"
min="0"
type="number"
required="true"
/>
<VnInput
v-model="data.bonus"
:label="t('zone.bonus')"
min="0"
type="number"
/>
<VnInput
v-model="data.travelingDays"
:label="t('zone.travelingDays')"
type="number"
min="0"
/>
<VnInputTime v-model="data.hour" :label="t('list.close')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</div>
</div>
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="AgencyModes"
sort-by="name ASC"
v-model="data.agencyModeFk"
:label="t('list.agency')"
/>
<VnInput
v-model="data.price"
:label="t('list.price')"
min="0"
type="number"
required="true"
/>
<VnInput
v-model="data.bonus"
:label="t('zone.bonus')"
min="0"
type="number"
/>
<VnInput
v-model="data.travelingDays"
:label="t('zone.travelingDays')"
type="number"
min="0"
/>
<VnInputTime v-model="data.hour" :label="t('list.close')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</VnSection>
</template>
<style lang="scss" scoped>
.table-container {
display: flex;
justify-content: center;
}
.column {
display: flex;
flex-direction: column;
align-items: center;
min-width: 70%;
}
:deep(.shrink-column) {
width: 8%;
}
</style>
<i18n>
es:
Search zone: Buscar zona

View File

@ -7,7 +7,6 @@ import FetchData from 'components/FetchData.vue';
import { toDateFormat } from 'src/filters/date.js';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const { t } = useI18n();
const weekdayStore = useWeekdayStore();
@ -31,7 +30,7 @@ const columns = computed(() => [
label: t('list.id'),
name: 'id',
field: 'zoneFk',
align: 'left',
align: 'center',
},
]);
@ -53,7 +52,6 @@ onMounted(() => weekdayStore.initStore());
@on-fetch="(data) => (details = data)"
auto-load
/>
<ZoneSearchbar />
<VnSubToolbar />
<QPage class="column items-center q-pa-md">
<QCard class="containerShrinked q-pa-md">

View File

@ -11,10 +11,13 @@ zone:
m3Max: Max m³
deleteTitle: This item will be deleted
deleteSubtitle: Are you sure you want to continue?
volumetric: Volumetric
bonus: Bonus
closing: Closing
travelingDays: Traveling days
search: Search zone
searchInfo: Search zone by id or name
searchLocations: Search locations
searchLocationsInfo: Search locations by post code
list:
clone: Clone
id: Id
@ -30,6 +33,7 @@ list:
confirmCloneTitle: All it's properties will be copied
confirmCloneSubtitle: Do you want to clone this zone?
warehouse: Warehouse
isVolumetric: Volumetric
createZone: Create zone
zoneSummary: Summary
addressFk: Address

View File

@ -15,6 +15,10 @@ zone:
bonus: Bonificación
closing: Cierre
travelingDays: Días de viaje
search: Buscar zona
searchInfo: Buscar zona por Id o nombre
searchLocations: Buscar localización
searchLocationsInfo: Buscar localización por código postal
list:
clone: Clonar
id: Id

View File

@ -1,10 +1,15 @@
import { RouterView } from 'vue-router';
import { setRectificative } from 'src/pages/InvoiceIn/composables/setRectificative';
const invoiceInCard = {
name: 'InvoiceInCard',
path: ':id',
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
redirect: { name: 'InvoiceInSummary' },
beforeEnter: async (to, from, next) => {
await setRectificative(to);
next();
},
meta: {
menu: [
'InvoiceInBasicData',
@ -32,8 +37,7 @@ const invoiceInCard = {
title: 'basicData',
icon: 'vn:settings',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInBasicData.vue'),
},
{
name: 'InvoiceInVat',
@ -51,8 +55,7 @@ const invoiceInCard = {
title: 'dueDay',
icon: 'vn:calendar',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInDueDay.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInDueDay.vue'),
},
{
name: 'InvoiceInIntrastat',
@ -61,8 +64,7 @@ const invoiceInCard = {
title: 'intrastat',
icon: 'vn:lines',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue'),
},
{
name: 'InvoiceInCorrective',
@ -71,8 +73,7 @@ const invoiceInCard = {
title: 'corrective',
icon: 'attachment',
},
component: () =>
import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCorrective.vue'),
},
{
name: 'InvoiceInLog',
@ -86,7 +87,7 @@ const invoiceInCard = {
],
};
export default {
export default {
name: 'InvoiceIn',
path: '/invoice-in',
meta: {
@ -98,7 +99,7 @@ export default {
component: RouterView,
redirect: { name: 'InvoiceInMain' },
children: [
{
{
name: 'InvoiceInMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
@ -111,7 +112,7 @@ export default {
component: () => import('src/pages/InvoiceIn/InvoiceInList.vue'),
children: [
{
name: 'InvoiceInList',
name: 'InvoiceInList',
path: 'list',
meta: {
title: 'list',
@ -137,9 +138,10 @@ export default {
title: 'serial',
icon: 'view_list',
},
component: () => import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
component: () =>
import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
},
],
},
],
};
};

View File

@ -1,52 +1,60 @@
import { RouterView } from 'vue-router';
const wagonCard = {
name: 'WagonCard',
path: ':id',
component: () => import('src/pages/Wagon/Card/WagonCard.vue'),
redirect: { name: 'WagonEdit' },
meta: {
menu: ['WagonEdit'],
},
children: [
{
path: 'edit',
name: 'WagonEdit',
meta: {
title: 'wagonEdit',
icon: 'edit',
},
component: () => import('src/pages/Wagon/WagonCreate.vue'),
},
],
};
export default {
path: '/wagon',
name: 'Wagon',
path: '/wagon',
meta: {
title: 'wagons',
icon: 'vn:trolley',
moduleName: 'Wagon',
menu: ['WagonList', 'WagonTypeList', 'WagonCounter'],
},
component: RouterView,
redirect: { name: 'WagonMain' },
menus: {
main: ['WagonList', 'WagonTypeList', 'WagonCounter', 'WagonTray'],
card: [],
},
children: [
{
path: '/wagon',
path: '',
name: 'WagonMain',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'WagonList' },
redirect: { name: 'WagonIndexMain' },
children: [
{
path: 'list',
name: 'WagonList',
meta: {
title: 'list',
icon: 'vn:trolley',
},
path: '',
name: 'WagonIndexMain',
redirect: { name: 'WagonList' },
component: () => import('src/pages/Wagon/WagonList.vue'),
},
{
path: 'create',
name: 'WagonCreate',
meta: {
title: 'wagonCreate',
icon: 'create',
},
component: () => import('src/pages/Wagon/WagonCreate.vue'),
},
{
path: ':id/edit',
name: 'WagonEdit',
meta: {
title: 'wagonEdit',
icon: 'edit',
},
component: () => import('src/pages/Wagon/WagonCreate.vue'),
children: [
{
name: 'WagonList',
path: 'list',
meta: {
title: 'list',
icon: 'view_list',
},
},
wagonCard,
],
},
{
path: 'counter',
@ -57,40 +65,32 @@ export default {
},
component: () => import('src/pages/Wagon/WagonCounter.vue'),
},
],
},
{
path: '/wagon/type',
name: 'WagonTypeMain',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'WagonTypeList' },
children: [
{
path: 'list',
name: 'WagonTypeList',
meta: {
title: 'typesList',
icon: 'view_list',
},
component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'),
},
{
path: 'create',
name: 'WagonTypeCreate',
meta: {
title: 'typeCreate',
icon: 'create',
},
component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'),
},
{
path: ':id/edit',
name: 'WagonTypeEdit',
meta: {
title: 'typeEdit',
icon: 'edit',
},
component: () => import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
path: 'type',
name: 'WagonTypeMain',
redirect: { name: 'WagonTypeList' },
children: [
{
path: 'list',
name: 'WagonTypeList',
meta: {
title: 'typesList',
icon: 'view_list',
},
component: () =>
import('src/pages/Wagon/Type/WagonTypeList.vue'),
},
{
path: ':id/edit',
name: 'WagonTypeEdit',
meta: {
title: 'typeEdit',
icon: 'edit',
},
component: () =>
import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
},
],
},
],
},

View File

@ -1,24 +1,12 @@
import { RouterView } from 'vue-router';
export default {
path: '/zone',
name: 'Zone',
const zoneCard = {
name: 'ZoneCard',
path: ':id',
component: () => import('src/pages/Zone/Card/ZoneCard.vue'),
redirect: { name: 'ZoneSummary' },
meta: {
title: 'zones',
icon: 'vn:zone',
moduleName: 'Zone',
keyBinding: 'z',
},
component: RouterView,
redirect: { name: 'ZoneMain' },
menus: {
main: [
'ZoneList',
'ZoneDeliveryDays',
'ZoneUpcomingList',
'ZoneUpcomingDeliveries',
],
card: [
menu: [
'ZoneBasicData',
'ZoneWarehouses',
'ZoneHistory',
@ -28,19 +16,102 @@ export default {
},
children: [
{
path: '/zone',
name: 'ZoneSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Zone/Card/ZoneSummary.vue'),
},
{
path: 'basic-data',
name: 'ZoneBasicData',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'),
},
{
path: 'location',
name: 'ZoneLocations',
meta: {
title: 'locations',
icon: 'my_location',
},
component: () => import('src/pages/Zone/Card/ZoneLocations.vue'),
},
{
path: 'warehouses',
name: 'ZoneWarehouses',
meta: {
title: 'warehouses',
icon: 'home',
},
component: () => import('src/pages/Zone/Card/ZoneWarehouses.vue'),
},
{
path: 'log',
name: 'ZoneHistory',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Zone/Card/ZoneLog.vue'),
},
{
path: 'events',
name: 'ZoneEvents',
meta: {
title: 'calendar',
icon: 'vn:calendar',
},
component: () => import('src/pages/Zone/Card/ZoneEvents.vue'),
},
],
};
export default {
name: 'Zone',
path: '/zone',
meta: {
title: 'zones',
icon: 'vn:zone',
moduleName: 'Zone',
keyBinding: 'z',
menu: [
'ZoneList',
'ZoneDeliveryDays',
'ZoneUpcomingList',
'ZoneUpcomingDeliveries',
],
},
component: RouterView,
redirect: { name: 'ZoneMain' },
children: [
{
name: 'ZoneMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'ZoneList' },
redirect: { name: 'ZoneIndexMain' },
children: [
{
path: 'list',
name: 'ZoneList',
meta: {
title: 'zonesList',
icon: 'view_list',
},
path: '',
name: 'ZoneIndexMain',
redirect: { name: 'ZoneList' },
component: () => import('src/pages/Zone/ZoneList.vue'),
children: [
{
name: 'ZoneList',
path: 'list',
meta: {
title: 'list',
icon: 'view_list',
},
},
zoneCard,
],
},
{
path: 'delivery-days',
@ -62,67 +133,5 @@ export default {
},
],
},
{
name: 'ZoneCard',
path: ':id',
component: () => import('src/pages/Zone/Card/ZoneCard.vue'),
redirect: { name: 'ZoneSummary' },
children: [
{
name: 'ZoneSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Zone/Card/ZoneSummary.vue'),
},
{
name: 'ZoneBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Zone/Card/ZoneBasicData.vue'),
},
{
name: 'ZoneLocations',
path: 'location',
meta: {
title: 'locations',
icon: 'my_location',
},
component: () => import('src/pages/Zone/Card/ZoneLocations.vue'),
},
{
name: 'ZoneWarehouses',
path: 'warehouses',
meta: {
title: 'warehouses',
icon: 'home',
},
component: () => import('src/pages/Zone/Card/ZoneWarehouses.vue'),
},
{
name: 'ZoneHistory',
path: 'log',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Zone/Card/ZoneLog.vue'),
},
{
name: 'ZoneEvents',
path: 'events',
meta: {
title: 'calendar',
icon: 'vn:calendar',
},
component: () => import('src/pages/Zone/Card/ZoneEvents.vue'),
},
],
},
],
};

View File

@ -16,6 +16,11 @@ describe.skip('InvoiceOut manual invoice', () => {
cy.checkNotification('Data saved');
cy.get('.q-virtual-scroll__content > :nth-child(1) > :nth-child(3)').click();
cy.get(':nth-child(8) > .value > .link').click();
cy.get('.header > :nth-child(3) > .q-btn__content').click();
cy.get('.q-menu > .descriptor > .header').should('be.visible');
cy.get(
'.q-menu > .descriptor > .header > [data-cy="descriptor-more-opts"] > .q-btn__content',
).click();
cy.get('[data-cy="descriptor-more-opts-menu"] > .q-list > :nth-child(4)').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -7,7 +7,6 @@ describe('InvoiceOut summary', () => {
const firstRowDescriptors = (opt) =>
`tbody > :nth-child(1) > :nth-child(${opt}) > .q-btn`;
const toCustomerSummary = '[href="#/customer/1101"]';
const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
const selectMenuOption = (opt) => `.q-menu > .q-list > :nth-child(${opt})`;
const confirmSend = '.q-btn--unelevated';
@ -25,8 +24,8 @@ describe('InvoiceOut summary', () => {
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the client summary and the ticket list', () => {
cy.get(toCustomerSummary).click();
it('should open the client summary', () => {
cy.dataCy('invoiceOutDescriptorCustomerCard').click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
@ -51,6 +50,7 @@ describe('InvoiceOut summary', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
@ -59,18 +59,11 @@ describe('InvoiceOut summary', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(3)).click();
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
cy.dataCy('SendEmailNotifiactionDialogInput').should('be.visible');
cy.get(confirmSend).click();
cy.checkNotification('Notification sent');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(4)).click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
it('should book the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get(selectMenuOption(5)).click();

View File

@ -1,5 +1,9 @@
/// <reference types="cypress" />
describe('OrderList', () => {
const clientCreateSelect = '#formModel [data-cy="Client_select"]';
const addressCreateSelect = '#formModel [data-cy="Address_select"]';
const agencyCreateSelect = '#formModel [data-cy="Agency_select"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
@ -8,16 +12,14 @@ describe('OrderList', () => {
it('create order', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.get('[data-cy="Client_select"]').type('1101');
cy.get('.q-menu').contains('Bruce Wayne').click();
cy.get('[data-cy="Address_select"]').click();
cy.selectOption(clientCreateSelect, 1101);
cy.get(addressCreateSelect).click();
cy.get(
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
).should('have.text', 'star');
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.selectOption(agencyCreateSelect, 1);
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
@ -32,7 +34,7 @@ describe('OrderList', () => {
cy.dataCy('Customer ID_input').type('1101{enter}');
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click();
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
@ -54,10 +56,11 @@ describe('OrderList', () => {
`[href="#/order/list?createForm={%22clientFk%22:${clientId},%22addressId%22:1}"] > .q-btn__content > .q-icon`,
).click();
cy.dataCy('vnTableCreateBtn').click();
cy.get('[data-cy="Client_select"]').should('have.value', 'Bruce Wayne');
cy.get('[data-cy="Address_select"]').should('have.value', 'Bruce Wayne');
cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne');
cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne');
cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click();
cy.get(agencyCreateSelect).click();
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();

View File

@ -32,18 +32,18 @@ describe.skip('Route extended list', () => {
const originalFields = [
{ selector: selectors.worker, type: 'select', value: 'logistic' },
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
{ selector: selectors.vehicle, type: 'select', value: '3333-IMK' },
{ selector: selectors.date, type: 'date', value: '01/02/2024' },
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
{ selector: selectors.description, type: 'input', value: 'Test route' },
{ selector: selectors.served, type: 'checkbox', value: checkboxState.uncheck },
];
const updateFields = [
{ selector: selectors.worker, type: 'select', value: 'salesperson' },
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
{ selector: selectors.vehicle, type: 'select', value: '1111-IMK' },
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
{ selector: selectors.date, type: 'date', value: '11/01/2001' },
{ selector: selectors.description, type: 'input', value: 'Description updated' },
{ selector: selectors.served, type: 'checkbox', value: checkboxState.check },
];
@ -57,11 +57,11 @@ describe.skip('Route extended list', () => {
break;
case 'input':
cy.get(selector).should('be.visible').click();
cy.dataCy('null_input').clear().type(`${value}{enter}`);
cy.dataCy('null_input').clear().type(`${value}`);
break;
case 'date':
cy.get(selector).should('be.visible').click();
cy.dataCy('null_inputDate').clear().type(`${value}{enter}`);
cy.dataCy('null_inputDate').clear().type(`${value}`);
break;
case 'checkbox':
cy.get(selector).should('be.visible').click().click();
@ -76,15 +76,6 @@ describe.skip('Route extended list', () => {
cy.typeSearchbar('{enter}');
});
after(() => {
cy.visit(url);
cy.typeSearchbar('{enter}');
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.removeBtn).click();
cy.dataCy(selectors.confirmBtn).click();
});
it('Should list routes', () => {
cy.get('.q-table')
.children()
@ -97,9 +88,9 @@ describe.skip('Route extended list', () => {
const data = {
Worker: { val: 'logistic', type: 'select' },
Agency: { val: 'Super-Man delivery', type: 'select' },
Agency: { val: 'inhouse pickup', type: 'select' },
Vehicle: { val: '3333-IMK', type: 'select' },
Date: { val: '02-01-2024', type: 'date' },
Date: { val: '01-01-2001', type: 'date' },
From: { val: '01-01-2024', type: 'date' },
To: { val: '10-01-2024', type: 'date' },
'Km start': { val: 1000 },
@ -129,7 +120,7 @@ describe.skip('Route extended list', () => {
it('Should clone selected route', () => {
cy.get(selectors.lastRowSelectCheckBox).click();
cy.get(selectors.cloneBtn).click();
cy.dataCy('route.Starting date_inputDate').type('10-05-2001{enter}');
cy.dataCy('route.Starting date_inputDate').type('10-05-2001').click();
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.validateContent(selectors.date, '05/10/2001');
});
@ -142,10 +133,6 @@ describe.skip('Route extended list', () => {
const fileName = 'download.zip';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
cy.task('deleteFile', `${downloadsFolder}/${fileName}`).then((deleted) => {
expect(deleted).to.be.true;
});
});
it('Should mark as served the selected route', () => {
@ -165,6 +152,13 @@ describe.skip('Route extended list', () => {
cy.checkNotification(dataSaved);
});
it('Should add ticket to route', () => {
cy.dataCy('tableAction-0').last().click();
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.checkNotification(dataSaved);
});
it('Should save changes in route', () => {
updateFields.forEach(({ selector, type, value }) => {
fillField(selector, type, value);
@ -175,18 +169,15 @@ describe.skip('Route extended list', () => {
cy.typeSearchbar('{enter}');
updateFields.forEach(({ selector, value }) => {
updateFields.forEach(({ selector, value, type }) => {
if (type === 'date') {
const [month, day, year] = value.split('/');
value = `${day}/${month}/${year}`;
}
cy.validateContent(selector, value);
});
});
it('Should add ticket to route', () => {
cy.dataCy('tableAction-0').last().click();
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
cy.checkNotification(dataSaved);
});
it('Should open summary pop-up when click summuary icon', () => {
cy.dataCy('tableAction-1').last().click();
cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value);

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" />
describe('Ticket Lack detail', () => {
describe.skip('Ticket Lack detail', () => {
beforeEach(() => {
cy.login('developer');
cy.intercept('GET', /\/api\/Tickets\/itemLack\/5.*$/, {

View File

@ -38,8 +38,8 @@ describe('TicketList', () => {
it('filter client and create ticket', () => {
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
searchResults();
cy.wait('@ticketSearchbar');
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.dataCy('Customer ID_input').clear('1');
cy.dataCy('Customer ID_input').type('1101{enter}');

View File

@ -27,7 +27,7 @@ describe('VnSearchBar', () => {
const searchAndCheck = (searchTerm, expectedText) => {
cy.clearSearchbar();
cy.typeSearchbar(`${searchTerm}{enter}`);
cy.get(idGap).should('have.text', expectedText);
cy.get(idGap).should('include.text', expectedText);
};
const checkTableLength = (expectedLength) => {

View File

@ -1,4 +1,4 @@
describe.skip('WagonCreate', () => {
describe('WagonCreate', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
@ -17,7 +17,7 @@ describe.skip('WagonCreate', () => {
'.grid-create > [label="Volume"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Volume_input"]',
).type('100');
cy.selectOption('[data-cy="Type_select"]', '1');
cy.dataCy('FormModelPopup_save').click();
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
});
});

View File

@ -2,7 +2,7 @@ describe('WagonTypeCreate', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/wagon/type/create');
cy.visit('/#/wagon/type/list');
cy.waitForElement('.q-page', 6000);
});

View File

@ -1,5 +1,5 @@
describe('ZoneBasicData', () => {
const priceBasicData = '[data-cy="Price_input"]';
const priceBasicData = '[data-cy="ZoneBasicDataPrice"]';
const saveBtn = '.q-btn-group > .q-btn--standard';
beforeEach(() => {
@ -8,20 +8,13 @@ describe('ZoneBasicData', () => {
cy.visit('/#/zone/4/basic-data');
});
it('should throw an error if the name is empty', () => {
cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}');
cy.get(saveBtn).click();
cy.checkNotification("can't be blank");
});
it('should throw an error if the price is empty', () => {
cy.get(priceBasicData).clear();
cy.get(saveBtn).click();
cy.checkNotification('cannot be blank');
cy.get('.q-field__messages > div').should('have.text', 'Field required');
});
it("should edit the basicData's zone", () => {
it("should edit the basicData's zone name", () => {
cy.get('.q-card > :nth-child(1)').type(' modified');
cy.get(saveBtn).click();
cy.checkNotification('Data saved');

View File

@ -0,0 +1,51 @@
describe('ZoneCalendar', () => {
const addEventBtn = '.q-page-sticky > div > .q-btn';
const submitBtn = '.q-mt-lg > .q-btn--standard';
const deleteBtn = '[data-cy="ZoneEventsPanelDeleteBtn"]';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/13/events`);
});
it('should include a one day event, then delete it', () => {
cy.get(addEventBtn).click();
cy.dataCy('ZoneEventInclusionDayRadio').click();
cy.get('.q-card > :nth-child(5)').type('01/01/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should include an indefinitely event for monday and tuesday', () => {
cy.get(addEventBtn).click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(2)').click();
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should include a range of dates event', () => {
cy.get(addEventBtn).click();
cy.dataCy('ZoneEventInclusionRangeRadio').click();
cy.get('.flex > .q-gutter-x-sm > :nth-child(1)').click();
cy.dataCy('From_inputDate').type('01/01/2001');
cy.dataCy('To_inputDate').type('31/01/2001');
cy.get(submitBtn).click();
cy.get(deleteBtn).click();
cy.dataCy('VnConfirm_confirm').click();
});
it('should exclude an event', () => {
cy.get('.q-mb-sm > .q-radio__inner').click();
cy.get('.q-current-day > .q-calendar-month__day--label__wrapper').click();
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(
'.q-current-day > .q-calendar-month__day--content > [data-cy="ZoneCalendarDay"]',
).click();
cy.dataCy('ZoneEventExclusionDeleteBtn').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -1,4 +1,4 @@
describe.skip('ZoneCreate', () => {
describe('ZoneCreate', () => {
const data = {
Name: { val: 'Zone pickup D' },
Price: { val: '3' },

View File

@ -1,15 +1,61 @@
describe('ZoneDeliveryDays', () => {
const postcode = '46680';
const agency = 'Gotham247Expensive';
const submitForm = '.q-form > .q-btn > .q-btn__content';
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/delivery-days`);
});
it('should query for the day', () => {
it('should return no data when querying without params', () => {
cy.get('.q-form > .q-btn > .q-btn__content').click();
cy.get('.q-notification__message').should(
'have.text',
'No service for the specified zone'
'No service for the specified zone',
);
});
it('should query for delivery', () => {
cy.intercept('GET', /\/api\/Zones\/getEvents/, (req) => {
req.headers['cache-control'] = 'no-cache';
req.headers['pragma'] = 'no-cache';
req.headers['expires'] = '0';
req.on('response', (res) => {
delete res.headers['if-none-match'];
delete res.headers['if-modified-since'];
});
}).as('events');
cy.dataCy('ZoneDeliveryDaysPostcodeSelect').type(postcode);
cy.get('.q-menu .q-item').contains(postcode).click();
cy.get('.q-menu').then(($menu) => {
if ($menu.is(':visible')) {
cy.get('[data-cy="ZoneDeliveryDaysPostcodeSelect"]')
.as('focusedElement')
.focus();
cy.get('@focusedElement').blur();
}
});
cy.get('.q-menu').should('not.exist');
cy.dataCy('ZoneDeliveryDaysAgencySelect').type(agency);
cy.get('.q-menu .q-item').contains(agency).click();
cy.get('.q-menu').then(($menu) => {
if ($menu.is(':visible')) {
cy.get('[data-cy="ZoneDeliveryDaysAgencySelect"]')
.as('focusedElement')
.focus();
cy.get('@focusedElement').blur();
}
});
cy.get('.q-menu').should('not.exist');
cy.get(submitForm).click();
cy.wait('@events').then((interception) => {
cy.log('interception: ', interception);
const data = interception.response.body.events;
expect(data.length).to.be.greaterThan(0);
});
});
});

View File

@ -1,21 +1,25 @@
describe('ZoneList', () => {
const agency = 'inhouse pickup';
const firstSummaryIcon =
':nth-child(1) > .q-table--col-auto-width > [data-cy="tableAction-0"]';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/zone/list');
});
it('should filter by agency', () => {
cy.dataCy('zoneFilterPanelNameInput').type('{downArrow}{enter}');
cy.typeSearchbar('{enter}');
});
it('should open the zone summary', () => {
cy.dataCy('zoneFilterPanelAgencySelect').type(agency);
cy.get('.q-menu .q-item').contains(agency).click();
cy.get(':nth-child(1) > [data-col-field="agencyModeFk"]').should(
'include.text',
agency,
);
cy.get(firstSummaryIcon).click();
cy.get('.header > .q-icon').click();
cy.url().should('include', 'zone/1/summary');
});
it('should clone the zone', () => {
cy.get('.router-link-active > .q-icon').click();
cy.dataCy('tableAction-1').eq(1).click();
cy.dataCy('VnConfirm_confirm').click();
cy.url().should('not.include', 'zone/2/');
cy.url().should('match', /zone\/\d+\/basic-data/);
});
});

View File

@ -0,0 +1,26 @@
describe('ZoneLocations', () => {
const data = {
Warehouse: { val: 'Warehouse One', type: 'select' },
};
const postalCode =
'[style=""] > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > :nth-child(1) > :nth-child(2) > :nth-child(1) > .q-tree__node--parent > .q-tree__node-collapsible > .q-tree__children';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/zone/2/location`);
});
it('should show all locations on entry', () => {
cy.get('.q-tree > :nth-child(1) > :nth-child(2) > :nth-child(1)')
.children()
.should('have.length', 9);
});
it('should be able to search by postal code', () => {
cy.get('#searchbarForm').type('46680');
cy.get('.router-link-active > .q-icon').click();
cy.get(postalCode).should('include.text', '46680');
});
});

View File

@ -0,0 +1,22 @@
describe('ZoneSummary', () => {
const agency = 'inhouse pickup';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/zone/2/summary');
});
it('should clone the zone, then delete it', () => {
cy.dataCy('descriptor-more-opts').click();
cy.dataCy('Clone_button').click();
cy.dataCy('VnConfirm_confirm').click();
cy.url().should('not.include', 'zone/2/');
cy.url().should('match', /zone\/\d+\/basic-data/);
cy.get('.list-box > :nth-child(1)').should('include.text', agency);
cy.get('.title > span').should('include.text', 'Zone pickup B');
cy.get('.q-page').should('exist');
cy.dataCy('descriptor-more-opts').click();
cy.dataCy('Delete_button').click();
cy.dataCy('VnConfirm_confirm').click();
});
});

View File

@ -1,9 +1,17 @@
describe('ZoneUpcomingDeliveries', () => {
const tableFields = (opt) =>
`:nth-child(1) > .q-table__container > .q-table__middle > .q-table > thead > tr > :nth-child(${opt})`;
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/upcoming-deliveries`);
});
it('should show the page', () => {});
it('should show the page', () => {
cy.get('.q-card').should('be.visible');
cy.get(tableFields(1)).should('be.visible').should('have.text', 'Province');
cy.get(tableFields(2)).should('be.visible').should('have.text', 'Closing');
cy.get(tableFields(3)).should('be.visible').should('have.text', 'Id');
});
});

View File

@ -1,20 +1,19 @@
describe.skip('ZoneWarehouse', () => {
describe('ZoneWarehouse', () => {
const data = {
Warehouse: { val: 'Warehouse One', type: 'select' },
Warehouse: { val: 'Warehouse Two', type: 'select' },
};
const dataError = 'The introduced warehouse already exists';
const saveBtn = '.q-btn--standard > .q-btn__content > .block';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/zone/2/warehouses`);
cy.visit(`/#/zone/1/warehouses`);
});
it('should throw an error if the warehouse chosen is already put in the zone', () => {
cy.addBtnClick();
cy.dataCy('Warehouse_select').type('Warehouse Two{enter}');
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
cy.get(saveBtn).click();
cy.checkNotification(dataError);
});
@ -26,7 +25,5 @@ describe.skip('ZoneWarehouse', () => {
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get('tbody > :nth-child(2) > :nth-child(2) > .q-icon').click();
cy.get('[title="Confirm"]').click();
cy.reload();
});
});