Merge branch 'dev' into 7549-autofillWorkerClaimDevelopment
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Benjamin Esteve 2025-05-09 08:40:07 +00:00
commit f3b06c84a5
57 changed files with 260 additions and 124 deletions

View File

@ -64,5 +64,6 @@ export default defineConfig({
...timeouts, ...timeouts,
includeShadowDom: true, includeShadowDom: true,
waitForAnimations: true, waitForAnimations: true,
testIsolation: false,
}, },
}); });

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { computed, ref, useAttrs, watch } from 'vue'; import { computed, ref, useAttrs, watch, nextTick } from 'vue';
import { useRouter, onBeforeRouteLeave } from 'vue-router'; import { useRouter, onBeforeRouteLeave } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
@ -42,7 +42,15 @@ const $props = defineProps({
}, },
dataRequired: { dataRequired: {
type: Object, type: Object,
default: () => {}, default: () => ({}),
},
dataDefault: {
type: Object,
default: () => ({}),
},
insertOnLoad: {
type: Boolean,
default: false,
}, },
defaultSave: { defaultSave: {
type: Boolean, type: Boolean,
@ -87,6 +95,7 @@ const formData = ref();
const saveButtonRef = ref(null); const saveButtonRef = ref(null);
const watchChanges = ref(); const watchChanges = ref();
const formUrl = computed(() => $props.url); const formUrl = computed(() => $props.url);
const rowsContainer = ref(null);
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
@ -122,9 +131,11 @@ async function fetch(data) {
const rows = keyData ? data[keyData] : data; const rows = keyData ? data[keyData] : data;
resetData(rows); resetData(rows);
emit('onFetch', rows); emit('onFetch', rows);
$props.insertOnLoad && await insert();
return rows; return rows;
} }
function resetData(data) { function resetData(data) {
if (!data) return; if (!data) return;
if (data && Array.isArray(data)) { if (data && Array.isArray(data)) {
@ -135,9 +146,16 @@ function resetData(data) {
formData.value = JSON.parse(JSON.stringify(data)); formData.value = JSON.parse(JSON.stringify(data));
if (watchChanges.value) watchChanges.value(); //destroy watcher if (watchChanges.value) watchChanges.value(); //destroy watcher
watchChanges.value = watch(formData, () => (hasChanges.value = true), { deep: true }); watchChanges.value = watch(formData, (nVal) => {
} hasChanges.value = false;
const filteredNewData = nVal.filter(row => !isRowEmpty(row) || row[$props.primaryKey]);
const filteredOriginal = originalData.value.filter(row => row[$props.primaryKey]);
const changes = getDifferences(filteredOriginal, filteredNewData);
hasChanges.value = !isEmpty(changes);
}, { deep: true });
}
async function reset() { async function reset() {
await fetch(originalData.value); await fetch(originalData.value);
hasChanges.value = false; hasChanges.value = false;
@ -165,7 +183,9 @@ async function onSubmit() {
}); });
} }
isLoading.value = true; isLoading.value = true;
await saveChanges($props.saveFn ? formData.value : null); await saveChanges($props.saveFn ? formData.value : null);
} }
async function onSubmitAndGo() { async function onSubmitAndGo() {
@ -174,6 +194,10 @@ async function onSubmitAndGo() {
} }
async function saveChanges(data) { async function saveChanges(data) {
formData.value = formData.value.filter(row =>
row[$props.primaryKey] || !isRowEmpty(row)
);
if ($props.saveFn) { if ($props.saveFn) {
$props.saveFn(data, getChanges); $props.saveFn(data, getChanges);
isLoading.value = false; isLoading.value = false;
@ -203,14 +227,32 @@ async function saveChanges(data) {
}); });
} }
async function insert(pushData = $props.dataRequired) { async function insert(pushData = { ...$props.dataRequired, ...$props.dataDefault }) {
const $index = formData.value.length formData.value = formData.value.filter(row => !isRowEmpty(row));
? formData.value[formData.value.length - 1].$index + 1
: 0; const lastRow = formData.value.at(-1);
formData.value.push(Object.assign({ $index }, pushData)); const isLastRowEmpty = lastRow ? isRowEmpty(lastRow) : false;
hasChanges.value = true;
if (formData.value.length && isLastRowEmpty) return;
const $index = formData.value.length ? formData.value.at(-1).$index + 1 : 0;
const nRow = Object.assign({ $index }, pushData);
formData.value.push(nRow);
const hasChange = Object.keys(nRow).some(key => !isChange(nRow, key));
if (hasChange) hasChanges.value = true;
} }
function isRowEmpty(row) {
return Object.keys(row).every(key => isChange(row, key));
}
function isChange(row,key){
return !row[key] || key == '$index' || Object.hasOwn($props.dataRequired || {}, key);
}
async function remove(data) { async function remove(data) {
if (!data.length) if (!data.length)
return quasar.notify({ return quasar.notify({
@ -227,10 +269,8 @@ async function remove(data) {
newData = newData.filter( newData = newData.filter(
(form) => !preRemove.some((index) => index == form.$index), (form) => !preRemove.some((index) => index == form.$index),
); );
const changes = getChanges(); formData.value = newData;
if (!changes.creates?.length && !changes.updates?.length) hasChanges.value = JSON.stringify(removeIndexField(formData.value)) !== JSON.stringify(removeIndexField(originalData.value));
hasChanges.value = false;
fetch(newData);
} }
if (ids.length) { if (ids.length) {
quasar quasar
@ -248,9 +288,8 @@ async function remove(data) {
newData = newData.filter((form) => !ids.some((id) => id == form[pk])); newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
fetch(newData); fetch(newData);
}); });
} else {
reset();
} }
emit('update:selected', []); emit('update:selected', []);
} }
@ -261,7 +300,7 @@ function getChanges() {
const pk = $props.primaryKey; const pk = $props.primaryKey;
for (const [i, row] of formData.value.entries()) { for (const [i, row] of formData.value.entries()) {
if (!row[pk]) { if (!row[pk]) {
creates.push(row); creates.push(Object.assign(row, { ...$props.dataRequired }));
} else if (originalData.value[i]) { } else if (originalData.value[i]) {
const data = getDifferences(originalData.value[i], row); const data = getDifferences(originalData.value[i], row);
if (!isEmpty(data)) { if (!isEmpty(data)) {
@ -287,6 +326,33 @@ function isEmpty(obj) {
return !Object.keys(obj).length; return !Object.keys(obj).length;
} }
function removeIndexField(data) {
if (Array.isArray(data)) {
return data.map(({ $index, ...rest }) => rest);
} else if (typeof data === 'object' && data !== null) {
const { $index, ...rest } = data;
return rest;
}
}
async function handleTab(event) {
event.preventDefault();
const { shiftKey, target } = event;
const focusableSelector = `tbody tr td:not(:first-child) :is(a, button, input, textarea, select, details):not([disabled])`;
const focusableElements = rowsContainer.value?.querySelectorAll(focusableSelector);
const currentIndex = Array.prototype.indexOf.call(focusableElements, target);
const index = shiftKey ? currentIndex - 1 : currentIndex + 1;
const isLast = target === focusableElements[focusableElements.length - 1];
const isFirst = currentIndex === 0;
if ((shiftKey && !isFirst) || (!shiftKey && !isLast))
focusableElements[index]?.focus();
else if (isLast) {
await insert();
await nextTick();
}
}
async function reload(params) { async function reload(params) {
const data = await vnPaginateRef.value.fetch(params); const data = await vnPaginateRef.value.fetch(params);
fetch(data); fetch(data);
@ -312,12 +378,14 @@ watch(formUrl, async () => {
v-bind="$attrs" v-bind="$attrs"
> >
<template #body v-if="formData"> <template #body v-if="formData">
<div ref="rowsContainer" @keydown.tab="handleTab">
<slot <slot
name="body" name="body"
:rows="formData" :rows="formData"
:validate="validate" :validate="validate"
:filter="filter" :filter="filter"
></slot> ></slot>
</div>
</template> </template>
</VnPaginate> </VnPaginate>
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar"> <Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar">

View File

@ -193,11 +193,11 @@ describe('CrudModel', () => {
}); });
it('should set originalData and formatData with data and generate watchChanges', async () => { it('should set originalData and formatData with data and generate watchChanges', async () => {
data = { data = [{
name: 'Tony', name: 'Tony',
lastName: 'Stark', lastName: 'Stark',
age: 42, age: 42,
}; }];
vm.resetData(data); vm.resetData(data);

View File

@ -72,7 +72,7 @@ const getBankEntities = (data) => {
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]" :acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
:options="bankEntities" :options="bankEntities"
hide-selected hide-selected
option-label="name" option-label="bic"
option-value="id" option-value="id"
v-model="bankEntityFk" v-model="bankEntityFk"
@update:model-value="$emit('updateBic', { iban, bankEntityFk })" @update:model-value="$emit('updateBic', { iban, bankEntityFk })"

View File

@ -40,4 +40,11 @@ describe('VnBankDetail Component', () => {
await vm.autofillBic('ES1234567891324567891234'); await vm.autofillBic('ES1234567891324567891234');
expect(vm.bankEntityFk).toBe(null); expect(vm.bankEntityFk).toBe(null);
}); });
it('should not update bankEntityFk if IBAN country is not ES', async () => {
vm.bankEntities = bankEntities;
await vm.autofillBic('FR1420041010050500013M02606');
expect(vm.bankEntityFk).toBe(null);
});
}); });

View File

@ -35,6 +35,7 @@ const $props = defineProps({
selectType: { type: Boolean, default: false }, selectType: { type: Boolean, default: false },
justInput: { type: Boolean, default: false }, justInput: { type: Boolean, default: false },
goTo: { type: String, default: '' }, goTo: { type: String, default: '' },
useUserRelation: { type: Boolean, default: true },
}); });
const { t } = useI18n(); const { t } = useI18n();
@ -54,6 +55,26 @@ const defaultObservationType = computed(
let savedNote = false; let savedNote = false;
let originalText; let originalText;
onBeforeRouteLeave((to, from, next) => {
if (
(newNote.text && !$props.justInput) ||
(newNote.text !== originalText && $props.justInput)
)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.unsavedPopup.title'),
message: t('globals.unsavedPopup.subtitle'),
promise: () => next(),
},
});
else next();
});
onMounted(() => {
nextTick(() => (componentIsRendered.value = true));
});
function handleClick(e) { function handleClick(e) {
if (e.shiftKey && e.key === 'Enter') return; if (e.shiftKey && e.key === 'Enter') return;
if ($props.justInput) confirmAndUpdate(); if ($props.justInput) confirmAndUpdate();
@ -108,22 +129,6 @@ async function update() {
); );
} }
onBeforeRouteLeave((to, from, next) => {
if (
(newNote.text && !$props.justInput) ||
(newNote.text !== originalText && $props.justInput)
)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.unsavedPopup.title'),
message: t('globals.unsavedPopup.subtitle'),
promise: () => next(),
},
});
else next();
});
function fetchData([data]) { function fetchData([data]) {
newNote.text = data?.notes; newNote.text = data?.notes;
originalText = data?.notes; originalText = data?.notes;
@ -137,16 +142,38 @@ const handleObservationTypes = (data) => {
} }
}; };
onMounted(() => {
nextTick(() => (componentIsRendered.value = true));
});
async function saveAndGo() { async function saveAndGo() {
savedNote = false; savedNote = false;
await insert(); await insert();
await savedNote;
router.push({ path: $props.goTo }); router.push({ path: $props.goTo });
} }
function getUserFilter() {
const newUserFilter = $props.userFilter ?? {};
const userInclude = {
relation: 'user',
scope: {
fields: ['id', 'nickname', 'name'],
},
};
if (newUserFilter.include) {
if (Array.isArray(newUserFilter.include)) {
newUserFilter.include.push(userInclude);
} else {
newUserFilter.include = [userInclude, newUserFilter.include];
}
} else {
newUserFilter.include = userInclude;
}
if ($props.useUserRelation) {
return {
...newUserFilter,
...$props.userFilter,
};
}
return $props.filter;
}
</script> </script>
<template> <template>
<Teleport <Teleport
@ -242,7 +269,7 @@ async function saveAndGo() {
:url="$props.url" :url="$props.url"
order="created DESC" order="created DESC"
:limit="0" :limit="0"
:user-filter="userFilter" :user-filter="getUserFilter()"
:filter="filter" :filter="filter"
auto-load auto-load
ref="vnPaginateRef" ref="vnPaginateRef"
@ -261,15 +288,15 @@ async function saveAndGo() {
<QCardSection horizontal> <QCardSection horizontal>
<VnAvatar <VnAvatar
:descriptor="false" :descriptor="false"
:worker-id="note.workerFk" :worker-id="note.user?.id"
size="md" size="md"
:title="note.worker?.user.nickname" :title="note.user?.nickname"
/> />
<div class="full-width row justify-between q-pa-xs"> <div class="full-width row justify-between q-pa-xs">
<div> <div>
<VnUserLink <VnUserLink
:name="`${note.worker.user.name}`" :name="`${note.user?.name}`"
:worker-id="note.worker.id" :worker-id="note.user?.id"
/> />
<QBadge <QBadge
class="q-ml-xs" class="q-ml-xs"

View File

@ -165,6 +165,7 @@ const handleWorker = async (row) => {
:filter="developmentsFilter" :filter="developmentsFilter"
ref="claimDevelopmentForm" ref="claimDevelopmentForm"
:data-required="{ claimFk: route.params.id }" :data-required="{ claimFk: route.params.id }"
:insert-on-load="true"
v-model:selected="selected" v-model:selected="selected"
@save-changes="$router.push(`/claim/${route.params.id}/action`)" @save-changes="$router.push(`/claim/${route.params.id}/action`)"
:default-save="false" :default-save="false"

View File

@ -1,12 +1,9 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import VnNotes from 'src/components/ui/VnNotes.vue'; import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute(); const route = useRoute();
const state = useState();
const user = state.getUser();
const $props = defineProps({ const $props = defineProps({
id: { type: [Number, String], default: null }, id: { type: [Number, String], default: null },
@ -15,24 +12,13 @@ const $props = defineProps({
const claimId = computed(() => $props.id || route.params.id); const claimId = computed(() => $props.id || route.params.id);
const claimFilter = { const claimFilter = {
fields: ['id', 'created', 'workerFk', 'text'], fields: ['id', 'created', 'userFk', 'text'],
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['id', 'nickname', 'name'], fields: ['id', 'nickname', 'name'],
}, },
}, },
},
},
};
const body = {
claimFk: claimId.value,
workerFk: user.value.id,
}; };
</script> </script>
@ -43,7 +29,9 @@ const body = {
:add-note="$props.addNote" :add-note="$props.addNote"
:user-filter="claimFilter" :user-filter="claimFilter"
:filter="{ where: { claimFk: claimId } }" :filter="{ where: { claimFk: claimId } }"
:body="body" :body="{
claimFk: claimId,
}"
v-bind="$attrs" v-bind="$attrs"
style="overflow-y: auto" style="overflow-y: auto"
/> />

View File

@ -1,12 +1,15 @@
<script setup> <script setup>
import VnNotes from 'src/components/ui/VnNotes.vue'; import VnNotes from 'src/components/ui/VnNotes.vue';
import { useState } from 'src/composables/useState';
const state = useState();
const user = state.getUser();
</script> </script>
<template> <template>
<VnNotes <VnNotes
url="clientObservations" url="clientObservations"
:add-note="true" :add-note="true"
:filter="{ where: { clientFk: $route.params.id } }" :filter="{ where: { clientFk: $route.params.id } }"
:body="{ clientFk: $route.params.id }" :body="{ clientFk: $route.params.id, userFk: user.id }"
style="overflow-y: auto" style="overflow-y: auto"
:select-type="true" :select-type="true"
required required

View File

@ -76,7 +76,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
name: 'workerFk', name: 'userFk',
label: t('Author'), label: t('Author'),
tooltip: t('Worker who made the last observation'), tooltip: t('Worker who made the last observation'),
columnFilter: { columnFilter: {
@ -155,7 +155,7 @@ function exprBuilder(param, value) {
return { [`c.${param}`]: value }; return { [`c.${param}`]: value };
case 'payMethod': case 'payMethod':
return { [`c.payMethodFk`]: value }; return { [`c.payMethodFk`]: value };
case 'workerFk': case 'userFk':
return { [`co.${param}`]: value }; return { [`co.${param}`]: value };
case 'departmentFk': case 'departmentFk':
return { [`c.${param}`]: value }; return { [`c.${param}`]: value };
@ -229,10 +229,10 @@ function exprBuilder(param, value) {
<DepartmentDescriptorProxy :id="row.departmentFk" /> <DepartmentDescriptorProxy :id="row.departmentFk" />
</span> </span>
</template> </template>
<template #column-workerFk="{ row }"> <template #column-userFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.workerName }} {{ row.workerName }}
<WorkerDescriptorProxy :id="row.workerFk" /> <WorkerDescriptorProxy :id="row.userFk" />
</span> </span>
</template> </template>
</VnTable> </VnTable>

View File

@ -90,6 +90,7 @@ const columns = computed(() => [
auto-load auto-load
:data-required="{ invoiceInFk: invoiceInId }" :data-required="{ invoiceInFk: invoiceInId }"
:filter="filter" :filter="filter"
:insert-on-load="true"
v-model:selected="rowsSelected" v-model:selected="rowsSelected"
@on-fetch="(data) => (invoceInIntrastat = data)" @on-fetch="(data) => (invoceInIntrastat = data)"
> >

View File

@ -187,6 +187,7 @@ function setCursor(ref) {
url="InvoiceInTaxes" url="InvoiceInTaxes"
:filter="filter" :filter="filter"
:data-required="{ invoiceInFk: $route.params.id }" :data-required="{ invoiceInFk: $route.params.id }"
:insert-on-load="true"
auto-load auto-load
v-model:selected="rowsSelected" v-model:selected="rowsSelected"
:go-to="`/invoice-in/${$route.params.id}/due-day`" :go-to="`/invoice-in/${$route.params.id}/due-day`"

View File

@ -51,6 +51,7 @@ const submit = async (rows) => {
<CrudModel <CrudModel
:data-required="{ itemFk: route.params.id }" :data-required="{ itemFk: route.params.id }"
:default-remove="false" :default-remove="false"
:insert-on-load="true"
:filter="{ :filter="{
fields: ['id', 'itemFk', 'code'], fields: ['id', 'itemFk', 'code'],
where: { itemFk: route.params.id }, where: { itemFk: route.params.id },

View File

@ -76,15 +76,22 @@ const insertTag = (rows) => {
model="ItemTags" model="ItemTags"
url="ItemTags" url="ItemTags"
:data-required="{ :data-required="{
$index: undefined,
itemFk: route.params.id, itemFk: route.params.id,
priority: undefined,
tag: { tag: {
isFree: undefined, isFree: true,
value: undefined,
name: undefined,
},
}"
:data-default="{
tag: {
isFree: true,
value: undefined, value: undefined,
name: undefined, name: undefined,
}, },
tagFk: undefined, tagFk: undefined,
priority: undefined,
}" }"
:default-remove="false" :default-remove="false"
:user-filter="{ :user-filter="{

View File

@ -18,7 +18,7 @@ const noteFilter = computed(() => {
const body = { const body = {
vehicleFk: vehicleId.value, vehicleFk: vehicleId.value,
workerFk: user.value.id, userFk: user.value.id,
}; };
</script> </script>

View File

@ -24,10 +24,10 @@ const crudModelFilter = reactive({
where: { ticketFk: route.params.id }, where: { ticketFk: route.params.id },
}); });
const crudModelRequiredData = computed(() => ({ const crudModelDefaultData = computed(() => ({
created: Date.vnNew(),
packagingFk: null, packagingFk: null,
quantity: 0, quantity: 0,
created: Date.vnNew(),
ticketFk: route.params.id, ticketFk: route.params.id,
})); }));
@ -63,7 +63,7 @@ watch(
url="TicketPackagings" url="TicketPackagings"
model="TicketPackagings" model="TicketPackagings"
:filter="crudModelFilter" :filter="crudModelFilter"
:data-required="crudModelRequiredData" :data-default="crudModelDefaultData"
:default-remove="false" :default-remove="false"
auto-load auto-load
> >

View File

@ -719,6 +719,7 @@ watch(
:create-as-dialog="false" :create-as-dialog="false"
:crud-model="{ :crud-model="{
disableInfiniteScroll: true, disableInfiniteScroll: true,
insertOnLoad: false,
}" }"
:default-remove="false" :default-remove="false"
:default-reset="false" :default-reset="false"

View File

@ -181,6 +181,7 @@ const setUserParams = (params) => {
:create="false" :create="false"
:crud-model="{ :crud-model="{
disableInfiniteScroll: true, disableInfiniteScroll: true,
insertOnLoad: false,
}" }"
:table="{ :table="{
'row-key': 'itemFk', 'row-key': 'itemFk',

View File

@ -547,6 +547,7 @@ watch(route, () => {
}, },
]" ]"
v-text="col.value" v-text="col.value"
:data-cy="`extra-community-${col.name}`"
/> />
<TravelDescriptorProxy <TravelDescriptorProxy
v-if="col.name === 'id'" v-if="col.name === 'id'"

View File

@ -99,6 +99,10 @@ const columns = computed(() => [
workerFk: entityId, workerFk: entityId,
}, },
}" }"
:crud-model="{
insertOnLoad: false,
}"
order="paymentDate DESC" order="paymentDate DESC"
:columns="columns" :columns="columns"
auto-load auto-load

View File

@ -128,6 +128,9 @@ const columns = computed(() => [
workerFk: entityId, workerFk: entityId,
}, },
}" }"
:crud-model="{
insertOnLoad: false,
}"
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
auto-load auto-load

View File

@ -109,6 +109,9 @@ const columns = [
workerFk: entityId, workerFk: entityId,
}, },
}" }"
:crud-model="{
insertOnLoad: false,
}"
order="date DESC" order="date DESC"
:columns="columns" :columns="columns"
auto-load auto-load

View File

@ -1,28 +1,26 @@
<script setup> <script setup>
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import VnNotes from 'src/components/ui/VnNotes.vue'; import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute(); const route = useRoute();
const state = useState();
const user = state.getUser();
const userFilter = { const userFilter = {
order: 'created DESC', order: 'created DESC',
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['id', 'nickname', 'name'], fields: ['id', 'nickname', 'name'],
}, },
}, },
},
},
}; };
const body = { workerFk: route.params.id }; const body = {
workerFk: route.params.id,
userFk: user.value.id,
};
</script> </script>
<template> <template>

View File

@ -170,6 +170,9 @@ function isSigned(row) {
'row-key': 'deviceProductionFk', 'row-key': 'deviceProductionFk',
selection: 'multiple', selection: 'multiple',
}" }"
:crud-model="{
insertOnLoad: false,
}"
:table-filter="{ hiddenTags: ['userFk'] }" :table-filter="{ hiddenTags: ['userFk'] }"
> >
<template #moreBeforeActions> <template #moreBeforeActions>

View File

@ -1,4 +1,4 @@
describe('Account descriptor', () => { describe('Account descriptor', { testIsolation: true }, () => {
const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list'; const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list';
const url = '/#/account/1/summary'; const url = '/#/account/1/summary';

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('ClaimDevelopment', () => { describe('ClaimDevelopment', { testIsolation: true }, () => {
const claimId = 1; const claimId = 1;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)'; const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const thirdRow = 'tbody > :nth-child(3)'; const thirdRow = 'tbody > :nth-child(3)';

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Client fiscal data', () => { describe('Client fiscal data', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Client list', () => { describe('Client list', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit('/#/customer/list', { cy.visit('/#/customer/list', {

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Entry PreAccount Functionality', () => { describe('Entry PreAccount Functionality', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('administrative'); cy.login('administrative');
cy.visit('/#/entry/pre-account'); cy.visit('/#/entry/pre-account');

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
import moment from 'moment'; import moment from 'moment';
describe('InvoiceInBasicData', () => { describe('InvoiceInBasicData', { testIsolation: true }, () => {
const dialogInputs = '.q-dialog input'; const dialogInputs = '.q-dialog input';
const getDocumentBtns = (opt) => `[data-cy="dms-buttons"] > :nth-child(${opt})`; const getDocumentBtns = (opt) => `[data-cy="dms-buttons"] > :nth-child(${opt})`;
const futureDate = moment().add(1, 'days').format('DD-MM-YYYY'); const futureDate = moment().add(1, 'days').format('DD-MM-YYYY');

View File

@ -1,4 +1,4 @@
describe('invoiceInCorrective', () => { describe('invoiceInCorrective', { testIsolation: true }, () => {
beforeEach(() => cy.login('administrative')); beforeEach(() => cy.login('administrative'));
it('should modify the invoice', () => { it('should modify the invoice', () => {

View File

@ -1,4 +1,4 @@
describe('InvoiceInDescriptor', () => { describe('InvoiceInDescriptor', { testIsolation: true }, () => {
beforeEach(() => cy.login('administrative')); beforeEach(() => cy.login('administrative'));
describe('more options', () => { describe('more options', () => {

View File

@ -24,6 +24,7 @@ describe('InvoiceOut list', () => {
}); });
it.skip('should download all pdfs', () => { it.skip('should download all pdfs', () => {
cy.get(columnCheckbox).click();
cy.get(columnCheckbox).click(); cy.get(columnCheckbox).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click(); cy.dataCy('InvoiceOutDownloadPdfBtn').click();
}); });

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('InvoiceOut summary', () => { describe('InvoiceOut summary', { testIsolation: true }, () => {
const transferInvoice = { const transferInvoice = {
Client: { val: 'employee', type: 'select' }, Client: { val: 'employee', type: 'select' },
Type: { val: 'Error in customer data', type: 'select' }, Type: { val: 'Error in customer data', type: 'select' },

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('ItemBarcodes', () => { describe('ItemBarcodes', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/item/1/barcode`); cy.visit(`/#/item/1/barcode`);

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Item summary', () => { describe('Item summary', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/item/1/summary`); cy.visit(`/#/item/1/summary`);

View File

@ -1,4 +1,4 @@
describe('Item tag', () => { describe('Item tag', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/item/1/tags`); cy.visit(`/#/item/1/tags`);

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Login', () => { describe('Login', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/#/login'); cy.visit('/#/login');
cy.get('#switchLanguage').click(); cy.get('#switchLanguage').click();

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Logout', () => { describe('Logout', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/dashboard`); cy.visit(`/#/dashboard`);

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Monitor Tickets Table', () => { describe('Monitor Tickets Table', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1920, 1080);
cy.login('salesPerson'); cy.login('salesPerson');

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('OrderCatalog', () => { describe('OrderCatalog', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.viewport(1920, 1080); cy.viewport(1920, 1080);

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('OrderList', () => { describe('OrderList', { testIsolation: true }, () => {
const clientCreateSelect = '#formModel [data-cy="Client_select"]'; const clientCreateSelect = '#formModel [data-cy="Client_select"]';
const addressCreateSelect = '#formModel [data-cy="Address_select"]'; const addressCreateSelect = '#formModel [data-cy="Address_select"]';
const agencyCreateSelect = '#formModel [data-cy="Agency_select"]'; const agencyCreateSelect = '#formModel [data-cy="Agency_select"]';

View File

@ -1,4 +1,4 @@
describe('Cmr list', () => { describe('Cmr list', { testIsolation: true }, () => {
const getLinkSelector = (colField) => const getLinkSelector = (colField) =>
`tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`; `tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;

View File

@ -1,4 +1,4 @@
describe('RouteAutonomous', () => { describe('RouteAutonomous', { testIsolation: true }, () => {
const getLinkSelector = (colField, link = true) => const getLinkSelector = (colField, link = true) =>
`tr:first-child > [data-col-field="${colField}"] > .no-padding${ `tr:first-child > [data-col-field="${colField}"] > .no-padding${
link ? ' > .link' : '' link ? ' > .link' : ''

View File

@ -1,4 +1,4 @@
describe('Route', () => { describe('Route', { testIsolation: true }, () => {
const getSelector = (colField) => const getSelector = (colField) =>
`tr:last-child > [data-col-field="${colField}"] > .no-padding > .link`; `tr:last-child > [data-col-field="${colField}"] > .no-padding > .link`;

View File

@ -1,4 +1,4 @@
describe('Vehicle DMS', () => { describe('Vehicle DMS', { testIsolation: true }, () => {
const getSelector = (btnPosition) => const getSelector = (btnPosition) =>
`tr:last-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`; `tr:last-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
const firstRow = 'tbody > :nth-child(1)'; const firstRow = 'tbody > :nth-child(1)';
describe('TicketSale', () => { describe('TicketSale', { testIsolation: true }, () => {
describe('Ticket #23', () => { describe('Ticket #23', () => {
beforeEach(() => { beforeEach(() => {
cy.login('claimManager'); cy.login('claimManager');

View File

@ -0,0 +1,16 @@
describe('Travel Extracommunity', () => {
it('Should show travels', () => {
cy.login('logistic');
cy.visit(`/#/travel/extra-community`);
cy.get('.q-page').should('be.visible');
});
it('Should show travels when user is supplier', () => {
cy.login('petterparker');
cy.visit(`/#/travel/extra-community`);
cy.get('[data-cy="vnFilterPanelChip_continent"] > .q-chip__icon--remove').click();
cy.dataCy('extra-community-cargoSupplierNickname').each(($el) => {
cy.wrap($el).should('contain.text', 'The farmer');
});
});
});

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('UserPanel', () => { describe('UserPanel', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('VnBreadcrumbs', () => { describe('VnBreadcrumbs', { testIsolation: true }, () => {
const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el'; const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');

View File

@ -1,6 +1,6 @@
const { randomNumber, randomString } = require('../../support'); const { randomNumber, randomString } = require('../../support');
describe('VnLocation', () => { describe('VnLocation', { testIsolation: true }, () => {
const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item'; const locationOptions = '[role="listbox"] > div.q-virtual-scroll__content > .q-item';
const dialogInputs = '.q-dialog label input'; const dialogInputs = '.q-dialog label input';
const createLocationButton = '.q-form > .q-card > .vn-row:nth-child(6) .--add-icon'; const createLocationButton = '.q-form > .q-card > .vn-row:nth-child(6) .--add-icon';

View File

@ -1,5 +1,5 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('VnLog', () => { describe('VnLog', { testIsolation: true }, () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/claim/${1}/log`); cy.visit(`/#/claim/${1}/log`);

View File

@ -1,4 +1,4 @@
describe('WorkerCreate', () => { describe('WorkerCreate', { testIsolation: true }, () => {
const externalRadio = '.q-radio:nth-child(2)'; const externalRadio = '.q-radio:nth-child(2)';
const developerBossId = 120; const developerBossId = 120;
const payMethodCross = const payMethodCross =

View File

@ -1,4 +1,4 @@
describe('WorkerManagement', () => { describe('WorkerManagement', { testIsolation: true }, () => {
const nif = '12091201A'; const nif = '12091201A';
const searchButton = '.q-scrollarea__content > .q-btn--standard > .q-btn__content'; const searchButton = '.q-scrollarea__content > .q-btn--standard > .q-btn__content';
const url = '/#/worker/management'; const url = '/#/worker/management';

View File

@ -1,4 +1,4 @@
describe('WorkerNotificationsManager', () => { describe('WorkerNotificationsManager', { testIsolation: true }, () => {
const salesPersonId = 18; const salesPersonId = 18;
const developerId = 9; const developerId = 9;

View File

@ -1,4 +1,4 @@
describe('ZoneBasicData', () => { describe('ZoneBasicData', { testIsolation: true }, () => {
const priceBasicData = '[data-cy="ZoneBasicDataPrice"]'; const priceBasicData = '[data-cy="ZoneBasicDataPrice"]';
const saveBtn = '.q-btn-group > .q-btn--standard'; const saveBtn = '.q-btn-group > .q-btn--standard';

View File

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