Compare commits
101 Commits
8224-conte
...
dev
Author | SHA1 | Date |
---|---|---|
|
8b61d1a4c7 | |
|
8f3621efc6 | |
|
50f1b5b326 | |
|
7cacdbdf94 | |
|
7afd6b3dcd | |
|
51402f9f3f | |
|
a4c4d987c7 | |
|
b1bde7be97 | |
|
5c927cec4b | |
|
ab0d2e60b7 | |
|
0502abfca5 | |
|
b1ef9b1bd3 | |
|
68d1f3cb18 | |
|
debae747db | |
|
671f0c1e67 | |
|
cbb36d0ec7 | |
|
beeeedbb84 | |
|
34fc2d403d | |
|
fca1c77791 | |
|
b993428201 | |
|
035530c4ce | |
|
3ed45ec8e1 | |
|
5bb452186e | |
|
148e49b153 | |
|
7dd6cc71e2 | |
|
d611a7387c | |
|
03dd5831c2 | |
|
69f1f4d47c | |
|
44d395054a | |
|
cfe64d644e | |
|
e8ea2ebaa2 | |
|
a3c917f82a | |
|
91c627324a | |
|
5cad6103a5 | |
|
efd2738553 | |
|
cc33568c27 | |
|
d5fc3423d6 | |
|
e064f9e706 | |
|
cb47858f65 | |
|
686edc0b51 | |
|
876f40b4a3 | |
|
53cea184cc | |
|
7f7c86def2 | |
|
5e17117db3 | |
|
494369c8f7 | |
|
b213ffca3e | |
|
334d39eeef | |
|
5f9d498700 | |
|
98c73f8462 | |
|
0efa72e4a8 | |
|
81d50bb118 | |
|
160ff54a66 | |
|
8a2e301bb7 | |
|
004890a3a9 | |
|
7424d7eb9a | |
|
4cc46e5181 | |
|
bb59be3023 | |
|
971194c0f6 | |
|
1ceb6b1aef | |
|
4f12a31b1a | |
|
9c6ffc76cb | |
|
442f3dbd48 | |
|
092a29d555 | |
|
8e08f65173 | |
|
e4003c6116 | |
|
aedcda4799 | |
|
10d8db6de3 | |
|
d36be31927 | |
|
5c6fc94dd6 | |
|
35914be54a | |
|
0fa1b6ee9d | |
|
d838d9b55a | |
|
03cced3ac6 | |
|
1cf9d08a90 | |
|
00ed2b2f6e | |
|
1a27833081 | |
|
8dd6926ab7 | |
|
608086bd8d | |
|
395c3a8ec9 | |
|
8d6a15eefd | |
|
2bfd2b09f2 | |
|
b7cfabd1a2 | |
|
19550188b8 | |
|
d477b6c477 | |
|
4d9912e9b5 | |
|
97c63c2689 | |
|
36d306e827 | |
|
3a8f6455d3 | |
|
f3f1ec8039 | |
|
01744012bc | |
|
0f17aa13ae | |
|
d5a2c880cc | |
|
b22d693a44 | |
|
5703798781 | |
|
c075f39576 | |
|
87c1c16d26 | |
|
5b42e97d83 | |
|
e874375276 | |
|
be69781e17 | |
|
523cacbffe | |
|
9c8aaf65d1 |
|
@ -64,5 +64,6 @@ export default defineConfig({
|
||||||
...timeouts,
|
...timeouts,
|
||||||
includeShadowDom: true,
|
includeShadowDom: true,
|
||||||
waitForAnimations: true,
|
waitForAnimations: true,
|
||||||
|
testIsolation: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -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">
|
||||||
<slot
|
<div ref="rowsContainer" @keydown.tab="handleTab">
|
||||||
name="body"
|
<slot
|
||||||
:rows="formData"
|
name="body"
|
||||||
:validate="validate"
|
:rows="formData"
|
||||||
:filter="filter"
|
:validate="validate"
|
||||||
></slot>
|
:filter="filter"
|
||||||
|
></slot>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnPaginate>
|
</VnPaginate>
|
||||||
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar">
|
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && hasSubToolbar">
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useClipboard } from 'src/composables/useClipboard';
|
|
||||||
|
|
||||||
const { copyText } = useClipboard();
|
|
||||||
const target = ref();
|
|
||||||
const qmenuRef = ref();
|
|
||||||
const colField = ref();
|
|
||||||
let colValue = '';
|
|
||||||
let textValue = '';
|
|
||||||
|
|
||||||
defineExpose({ handler });
|
|
||||||
|
|
||||||
const arrayData = defineModel({
|
|
||||||
type: Object,
|
|
||||||
});
|
|
||||||
|
|
||||||
function handler(event) {
|
|
||||||
const clickedElement = event.target.closest('td');
|
|
||||||
if (!clickedElement) return;
|
|
||||||
|
|
||||||
target.value = event.target;
|
|
||||||
qmenuRef.value.show();
|
|
||||||
colField.value = clickedElement.getAttribute('data-col-field');
|
|
||||||
colValue = isNaN(+clickedElement.getAttribute('data-col-value'))
|
|
||||||
? clickedElement.getAttribute('data-col-value')
|
|
||||||
: +clickedElement.getAttribute('data-col-value');
|
|
||||||
textValue = getDeepestText(clickedElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDeepestText(node) {
|
|
||||||
const walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, {
|
|
||||||
acceptNode: (textNode) => {
|
|
||||||
return textNode.nodeValue.trim()
|
|
||||||
? NodeFilter.FILTER_ACCEPT
|
|
||||||
: NodeFilter.FILTER_REJECT;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
let lastText = '';
|
|
||||||
while (walker.nextNode()) {
|
|
||||||
lastText = walker.currentNode.nodeValue.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
return lastText;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function selectionFilter() {
|
|
||||||
await arrayData.value.addFilter({ params: { [colField.value]: colValue } });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function selectionExclude() {
|
|
||||||
await arrayData.value.addFilter({
|
|
||||||
params: { [colField.value]: { neq: colValue } },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function selectionRemoveFilter() {
|
|
||||||
await arrayData.value.addFilter({ params: { [colField.value]: undefined } });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function removeAllFilters() {
|
|
||||||
await arrayData.value.applyFilter({ params: {} });
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyValue() {
|
|
||||||
copyText(textValue, {
|
|
||||||
component: {
|
|
||||||
copyValue: textValue,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<QMenu
|
|
||||||
ref="qmenuRef"
|
|
||||||
:target
|
|
||||||
class="column q-pa-sm justify-left"
|
|
||||||
auto-close
|
|
||||||
no-parent-event
|
|
||||||
>
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
icon="filter_list"
|
|
||||||
@click="selectionFilter()"
|
|
||||||
class="text-weight-regular"
|
|
||||||
align="left"
|
|
||||||
:label="$t('Filter by selection')"
|
|
||||||
no-caps
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
icon="dangerous"
|
|
||||||
@click="selectionExclude()"
|
|
||||||
class="text-weight-regular"
|
|
||||||
align="left"
|
|
||||||
:label="$t('Exclude selection')"
|
|
||||||
no-caps
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
icon="filter_list_off"
|
|
||||||
@click="selectionRemoveFilter()"
|
|
||||||
class="text-weight-regular"
|
|
||||||
align="left"
|
|
||||||
:label="$t('Remove filter')"
|
|
||||||
no-caps
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
icon="filter_list_off"
|
|
||||||
@click="removeAllFilters()"
|
|
||||||
class="text-weight-regular"
|
|
||||||
align="left"
|
|
||||||
:label="$t('Remove all filters')"
|
|
||||||
no-caps
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
icon="file_copy"
|
|
||||||
@click="copyValue()"
|
|
||||||
class="text-weight-regular"
|
|
||||||
align="left"
|
|
||||||
:label="$t('Copy value')"
|
|
||||||
no-caps
|
|
||||||
/>
|
|
||||||
</QMenu>
|
|
||||||
</template>
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Filter by selection: Filtro por selección
|
|
||||||
Exclude selection: Excluir selección
|
|
||||||
Remove filter: Quitar filtro por selección
|
|
||||||
Remove all filters: Eliminar todos los filtros
|
|
||||||
Copy value: Copiar valor
|
|
||||||
</i18n>
|
|
|
@ -136,9 +136,6 @@ async function addFilter(value, name) {
|
||||||
value = value === '' ? undefined : value;
|
value = value === '' ? undefined : value;
|
||||||
let field = columnFilter.value?.name ?? $props.column.name ?? name;
|
let field = columnFilter.value?.name ?? $props.column.name ?? name;
|
||||||
|
|
||||||
delete arrayData.store?.userParams?.[field];
|
|
||||||
delete arrayData.store?.filter?.where?.[field];
|
|
||||||
|
|
||||||
if (columnFilter.value?.inWhere) {
|
if (columnFilter.value?.inWhere) {
|
||||||
if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field;
|
if (columnFilter.value.alias) field = columnFilter.value.alias + '.' + field;
|
||||||
return await arrayData.addFilterWhere({ [field]: value });
|
return await arrayData.addFilterWhere({ [field]: value });
|
||||||
|
|
|
@ -33,7 +33,6 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||||
import VnTableFilter from './VnTableFilter.vue';
|
import VnTableFilter from './VnTableFilter.vue';
|
||||||
import { getColAlign } from 'src/composables/getColAlign';
|
import { getColAlign } from 'src/composables/getColAlign';
|
||||||
import RightMenu from '../common/RightMenu.vue';
|
import RightMenu from '../common/RightMenu.vue';
|
||||||
import VnContextMenu from './VnContextMenu.vue';
|
|
||||||
import VnScroll from '../common/VnScroll.vue';
|
import VnScroll from '../common/VnScroll.vue';
|
||||||
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
|
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
|
||||||
import VnCheckbox from '../common/VnCheckbox.vue';
|
import VnCheckbox from '../common/VnCheckbox.vue';
|
||||||
|
@ -179,9 +178,8 @@ const app = inject('app');
|
||||||
const tableHeight = useTableHeight();
|
const tableHeight = useTableHeight();
|
||||||
const vnScrollRef = ref(null);
|
const vnScrollRef = ref(null);
|
||||||
|
|
||||||
const editingRow = ref();
|
const editingRow = ref(null);
|
||||||
const editingField = ref();
|
const editingField = ref(null);
|
||||||
const contextMenuRef = ref({});
|
|
||||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||||
const selectRegex = /select/;
|
const selectRegex = /select/;
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
|
@ -218,10 +216,6 @@ onBeforeMount(() => {
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
||||||
document.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
contextMenuRef.value.handler(event);
|
|
||||||
});
|
|
||||||
mode.value =
|
mode.value =
|
||||||
quasar.platform.is.mobile && !$props.disableOption?.card
|
quasar.platform.is.mobile && !$props.disableOption?.card
|
||||||
? CARD_MODE
|
? CARD_MODE
|
||||||
|
@ -245,7 +239,6 @@ onMounted(async () => {
|
||||||
|
|
||||||
onUnmounted(async () => {
|
onUnmounted(async () => {
|
||||||
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
||||||
document.removeEventListener('contextmenu', {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -691,8 +684,10 @@ const handleHeaderSelection = (evt, data) => {
|
||||||
ref="CrudModelRef"
|
ref="CrudModelRef"
|
||||||
@on-fetch="
|
@on-fetch="
|
||||||
(...args) => {
|
(...args) => {
|
||||||
selectAll = false;
|
if ($props.multiCheck.expand) {
|
||||||
selected = [];
|
selectAll = false;
|
||||||
|
selected = [];
|
||||||
|
}
|
||||||
emit('onFetch', ...args);
|
emit('onFetch', ...args);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
@ -840,7 +835,6 @@ const handleHeaderSelection = (evt, data) => {
|
||||||
]"
|
]"
|
||||||
:data-row-index="rowIndex"
|
:data-row-index="rowIndex"
|
||||||
:data-col-field="col?.name"
|
:data-col-field="col?.name"
|
||||||
:data-col-value="row?.[col?.name]"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="no-padding no-margin"
|
class="no-padding no-margin"
|
||||||
|
@ -1151,7 +1145,6 @@ const handleHeaderSelection = (evt, data) => {
|
||||||
</template>
|
</template>
|
||||||
</FormModelPopup>
|
</FormModelPopup>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
<VnContextMenu ref="contextMenuRef" v-model="arrayData" />
|
|
||||||
<VnScroll
|
<VnScroll
|
||||||
ref="vnScrollRef"
|
ref="vnScrollRef"
|
||||||
v-if="isTableMode"
|
v-if="isTableMode"
|
||||||
|
|
|
@ -77,12 +77,7 @@ function columnName(col) {
|
||||||
<template #tags="{ tag, formatFn, getLocale }">
|
<template #tags="{ tag, formatFn, getLocale }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ getLocale(`${tag.label}`) }}: </strong>
|
<strong>{{ getLocale(`${tag.label}`) }}: </strong>
|
||||||
<span
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
:class="{
|
|
||||||
'text-decoration-line-through': typeof chip === 'object',
|
|
||||||
}"
|
|
||||||
>{{ formatFn(tag) }}</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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 })"
|
||||||
|
|
|
@ -30,7 +30,7 @@ const onClick = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const { data } = axios.get(props.url, params);
|
const { data } = await axios.get(props.url, params);
|
||||||
rows.value = data;
|
rows.value = data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const response = error.response;
|
const response = error.response;
|
||||||
|
@ -83,7 +83,7 @@ defineEmits(['update:selected', 'select:all']);
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-else
|
v-else
|
||||||
v-text="t('records', { rows: rows.length ?? 0 })"
|
v-text="t('records', { rows: rows?.length ?? 0 })"
|
||||||
/>
|
/>
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -124,7 +124,6 @@ const {
|
||||||
} = toRefs($props);
|
} = toRefs($props);
|
||||||
const myOptions = ref([]);
|
const myOptions = ref([]);
|
||||||
const myOptionsOriginal = ref([]);
|
const myOptionsOriginal = ref([]);
|
||||||
const myOptionsMap = ref(new Map());
|
|
||||||
const vnSelectRef = ref();
|
const vnSelectRef = ref();
|
||||||
const lastVal = ref();
|
const lastVal = ref();
|
||||||
const noOneText = t('globals.noOne');
|
const noOneText = t('globals.noOne');
|
||||||
|
@ -141,7 +140,7 @@ const styleAttrs = computed(() => {
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
});
|
});
|
||||||
const hasFocus = ref(false);
|
const isLoading = ref(false);
|
||||||
const useURL = computed(() => $props.url);
|
const useURL = computed(() => $props.url);
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -167,10 +166,6 @@ const computedSortBy = computed(() => {
|
||||||
return $props.sortBy || $props.optionLabel + ' ASC';
|
return $props.sortBy || $props.optionLabel + ' ASC';
|
||||||
});
|
});
|
||||||
|
|
||||||
const valueIsObject = computed(
|
|
||||||
() => modelValue.value && typeof modelValue.value == 'object',
|
|
||||||
);
|
|
||||||
|
|
||||||
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
||||||
|
|
||||||
watch(options, (newValue) => {
|
watch(options, (newValue) => {
|
||||||
|
@ -178,22 +173,12 @@ watch(options, (newValue) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(modelValue, async (newValue) => {
|
watch(modelValue, async (newValue) => {
|
||||||
if (newValue?.neq) newValue = newValue.neq;
|
|
||||||
if (!myOptions?.value?.some((option) => option[optionValue.value] == newValue))
|
if (!myOptions?.value?.some((option) => option[optionValue.value] == newValue))
|
||||||
await fetchFilter(newValue);
|
await fetchFilter(newValue);
|
||||||
|
|
||||||
if ($props.noOne) myOptions.value.unshift(noOneOpt.value);
|
if ($props.noOne) myOptions.value.unshift(noOneOpt.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
|
||||||
() => myOptionsOriginal.value,
|
|
||||||
(newValue) => {
|
|
||||||
for (const item of newValue) {
|
|
||||||
myOptionsMap.value.set(item[optionValue.value], item);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setOptions(options.value);
|
setOptions(options.value);
|
||||||
if (useURL.value && $props.modelValue && !findKeyInOptions())
|
if (useURL.value && $props.modelValue && !findKeyInOptions())
|
||||||
|
@ -202,7 +187,7 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const someIsLoading = computed(
|
const someIsLoading = computed(
|
||||||
() => !!arrayData?.isLoading?.value && !isMenuOpened.value,
|
() => (isLoading.value || !!arrayData?.isLoading?.value) && !isMenuOpened.value,
|
||||||
);
|
);
|
||||||
function findKeyInOptions() {
|
function findKeyInOptions() {
|
||||||
if (!$props.options) return;
|
if (!$props.options) return;
|
||||||
|
@ -239,9 +224,6 @@ function filter(val, options) {
|
||||||
|
|
||||||
async function fetchFilter(val) {
|
async function fetchFilter(val) {
|
||||||
if (!$props.url) return;
|
if (!$props.url) return;
|
||||||
if (val && typeof val == 'object') {
|
|
||||||
val = val.neq;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { fields, include, limit } = $props;
|
const { fields, include, limit } = $props;
|
||||||
const sortBy = computedSortBy.value;
|
const sortBy = computedSortBy.value;
|
||||||
|
@ -316,11 +298,13 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
if (from === 0 && index === 0) return;
|
if (from === 0 && index === 0) return;
|
||||||
if (!useURL.value && !$props.fetchRef) return;
|
if (!useURL.value && !$props.fetchRef) return;
|
||||||
if (direction === 'decrease') return;
|
if (direction === 'decrease') return;
|
||||||
if (to === lastIndex && arrayData.store.hasMoreData) {
|
if (to === lastIndex && arrayData.store.hasMoreData && !isLoading.value) {
|
||||||
|
isLoading.value = true;
|
||||||
await arrayData.loadMore();
|
await arrayData.loadMore();
|
||||||
setOptions(arrayData.store.data);
|
setOptions(arrayData.store.data);
|
||||||
vnSelectRef.value.scrollTo(lastIndex);
|
vnSelectRef.value.scrollTo(lastIndex);
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,30 +347,22 @@ function getCaption(opt) {
|
||||||
if (optionCaption.value === false) return;
|
if (optionCaption.value === false) return;
|
||||||
return opt[optionCaption.value] || opt[optionValue.value];
|
return opt[optionCaption.value] || opt[optionValue.value];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOptionLabel(property) {
|
|
||||||
if (!myOptionsMap.value.size) return;
|
|
||||||
let value = modelValue.value;
|
|
||||||
if (property) {
|
|
||||||
value = modelValue.value[property];
|
|
||||||
}
|
|
||||||
return myOptionsMap.value.get(value)?.[optionLabel.value];
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QSelect
|
<QSelect
|
||||||
ref="vnSelectRef"
|
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:options="myOptions"
|
:options="myOptions"
|
||||||
:option-label="optionLabel"
|
:option-label="optionLabel"
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="{ ...$attrs, ...styleAttrs, hideSelected: hasFocus }"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
:map-options="nullishToTrue($attrs['map-options'])"
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
:use-input="hasFocus || !value"
|
:use-input="nullishToTrue($attrs['use-input'])"
|
||||||
:fill-input="false"
|
:hide-selected="nullishToTrue($attrs['hide-selected'])"
|
||||||
|
:fill-input="nullishToTrue($attrs['fill-input'])"
|
||||||
|
ref="vnSelectRef"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
|
@ -396,20 +372,10 @@ function getOptionLabel(property) {
|
||||||
:loading="someIsLoading"
|
:loading="someIsLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
@popup-hide="isMenuOpened = false"
|
@popup-hide="isMenuOpened = false"
|
||||||
@popup-show="
|
@popup-show="isMenuOpened = true"
|
||||||
async () => {
|
|
||||||
isMenuOpened = true;
|
|
||||||
hasFocus = true;
|
|
||||||
await $nextTick();
|
|
||||||
vnSelectRef?.$el?.querySelector('input')?.focus();
|
|
||||||
}
|
|
||||||
"
|
|
||||||
@keydown="handleKeyDown"
|
@keydown="handleKeyDown"
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||||
:data-url="url"
|
:data-url="url"
|
||||||
@blur="hasFocus = false"
|
|
||||||
@update:model-value="() => vnSelectRef.blur()"
|
|
||||||
:is-required="false"
|
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -459,17 +425,6 @@ function getOptionLabel(property) {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
<template #selected v-if="valueIsObject && nullishToTrue($attrs['emit-value'])">
|
|
||||||
<span class="nowrap">
|
|
||||||
<span
|
|
||||||
class="text-strike"
|
|
||||||
v-if="modelValue?.neq"
|
|
||||||
v-text="getOptionLabel('neq')"
|
|
||||||
:title="getOptionLabel('neq')"
|
|
||||||
/>
|
|
||||||
<span v-else>{{ JSON.stringify(modelValue) }}</span>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</QSelect>
|
</QSelect>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -477,12 +432,4 @@ function getOptionLabel(property) {
|
||||||
.q-field--outlined {
|
.q-field--outlined {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
.q-field__native {
|
|
||||||
@extend .nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nowrap {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -186,7 +186,6 @@ async function remove(key) {
|
||||||
function formatValue(value) {
|
function formatValue(value) {
|
||||||
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
||||||
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
||||||
if (value && typeof value === 'object') return '';
|
|
||||||
|
|
||||||
return `"${value}"`;
|
return `"${value}"`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -12,6 +12,7 @@ const $props = defineProps({
|
||||||
const isWorker = ref(false);
|
const isWorker = ref(false);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
if (!$props.workerId) return;
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
data: { exists },
|
data: { exists },
|
||||||
|
|
|
@ -138,6 +138,7 @@ const columns = computed(() => [
|
||||||
: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"
|
||||||
|
|
|
@ -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,25 +12,14 @@ 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: {
|
include: {
|
||||||
relation: 'worker',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'firstName', 'lastName'],
|
fields: ['id', 'nickname', 'name'],
|
||||||
include: {
|
|
||||||
relation: 'user',
|
|
||||||
scope: {
|
|
||||||
fields: ['id', 'nickname', 'name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const body = {
|
|
||||||
claimFk: claimId.value,
|
|
||||||
workerFk: user.value.id,
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -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"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -165,7 +165,6 @@ const updateDateParams = (value, params) => {
|
||||||
v-if="campaignList"
|
v-if="campaignList"
|
||||||
data-key="CustomerConsumption"
|
data-key="CustomerConsumption"
|
||||||
url="Clients/consumption"
|
url="Clients/consumption"
|
||||||
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
|
||||||
:filter="{ where: { clientFk: route.params.id } }"
|
:filter="{ where: { clientFk: route.params.id } }"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
search-url="consumption"
|
search-url="consumption"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -130,20 +130,22 @@ async function onDataSaved(formData, { id }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getSupplierClientReferences(value) {
|
async function getSupplierClientReferences(data) {
|
||||||
if (!value) return (initialData.description = '');
|
if (!data) return (initialData.description = '');
|
||||||
const params = { bankAccount: value };
|
const params = { bankAccount: data.compensationAccount };
|
||||||
const { data } = await axios(`Clients/getClientOrSupplierReference`, { params });
|
const { data: reference } = await axios(`Clients/getClientOrSupplierReference`, {
|
||||||
if (!data.clientId) {
|
params,
|
||||||
initialData.description = t('Supplier Compensation Reference', {
|
});
|
||||||
supplierId: data.supplierId,
|
if (reference.supplierId) {
|
||||||
supplierName: data.supplierName,
|
data.description = t('Supplier Compensation Reference', {
|
||||||
|
supplierId: reference.supplierId,
|
||||||
|
supplierName: reference.supplierName,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
initialData.description = t('Client Compensation Reference', {
|
data.description = t('Client Compensation Reference', {
|
||||||
clientId: data.clientId,
|
clientId: reference.clientId,
|
||||||
clientName: data.clientName,
|
clientName: reference.clientName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +254,7 @@ async function getAmountPaid() {
|
||||||
:label="t('Compensation account')"
|
:label="t('Compensation account')"
|
||||||
clearable
|
clearable
|
||||||
v-model="data.compensationAccount"
|
v-model="data.compensationAccount"
|
||||||
@blur="getSupplierClientReferences(data.compensationAccount)"
|
@blur="getSupplierClientReferences(data)"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</div>
|
</div>
|
||||||
|
@ -288,6 +290,9 @@ async function getAmountPaid() {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
en:
|
||||||
|
Supplier Compensation Reference: ({supplierId}) Ntro Proveedor {supplierName}
|
||||||
|
Client Compensation Reference: ({clientId}) Ntro Cliente {clientName}
|
||||||
es:
|
es:
|
||||||
New payment: Añadir pago
|
New payment: Añadir pago
|
||||||
Date: Fecha
|
Date: Fecha
|
||||||
|
|
|
@ -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)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -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`"
|
||||||
|
|
|
@ -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 },
|
||||||
|
|
|
@ -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="{
|
||||||
|
|
|
@ -218,8 +218,8 @@ const dateStyle = (date) =>
|
||||||
}
|
}
|
||||||
: { color: dateColor, 'background-color': 'transparent' };
|
: { color: dateColor, 'background-color': 'transparent' };
|
||||||
|
|
||||||
const onDataSaved = async () => {
|
const onDataSaved = () => {
|
||||||
await tableRef.value.CrudModelRef.saveChanges();
|
tableRef.value.CrudModelRef.saveChanges();
|
||||||
selectedRows.value = [];
|
selectedRows.value = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -71,13 +71,12 @@ const closeForm = () => {
|
||||||
class="editOption"
|
class="editOption"
|
||||||
:label="t('Field to edit')"
|
:label="t('Field to edit')"
|
||||||
:options="fieldsOptions"
|
:options="fieldsOptions"
|
||||||
|
hide-selected
|
||||||
option-label="label"
|
option-label="label"
|
||||||
option-value="name"
|
|
||||||
v-model="selectedField"
|
v-model="selectedField"
|
||||||
data-cy="EditFixedPriceSelectOption"
|
data-cy="EditFixedPriceSelectOption"
|
||||||
@update:model-value="newValue = null"
|
@update:model-value="newValue = null"
|
||||||
:class="{ 'is-select': selectedField?.component === 'select' }"
|
:class="{ 'is-select': selectedField?.component === 'select' }"
|
||||||
:emit-value="false"
|
|
||||||
/>
|
/>
|
||||||
<component
|
<component
|
||||||
:is="inputs[selectedField?.component || 'input']"
|
:is="inputs[selectedField?.component || 'input']"
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
>
|
>
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -463,32 +463,6 @@ function setReference(data) {
|
||||||
|
|
||||||
dialogData.value.value.description = newDescription;
|
dialogData.value.value.description = newDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
|
||||||
switch (param) {
|
|
||||||
case 'stateFk':
|
|
||||||
return { 'ts.stateFk': value };
|
|
||||||
case 'provinceFk':
|
|
||||||
return { 'a.provinceFk': value };
|
|
||||||
case 'hour':
|
|
||||||
return { 'z.hour': value };
|
|
||||||
case 'shipped':
|
|
||||||
return {
|
|
||||||
't.shipped': {
|
|
||||||
between: this.dateRange(value),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
case 'departmentFk':
|
|
||||||
return { 'c.departmentFk': value };
|
|
||||||
case 'id':
|
|
||||||
case 'refFk':
|
|
||||||
case 'zoneFk':
|
|
||||||
case 'nickname':
|
|
||||||
case 'agencyModeFk':
|
|
||||||
case 'warehouseFk':
|
|
||||||
return { [`t.${param}`]: value };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -683,36 +657,42 @@ function exprBuilder(param, value) {
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInputDate
|
<div class="col">
|
||||||
placeholder="dd-mm-aaa"
|
<VnInputDate
|
||||||
:label="t('globals.landed')"
|
placeholder="dd-mm-aaa"
|
||||||
v-model="data.landed"
|
:label="t('globals.landed')"
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
v-model="data.landed"
|
||||||
/>
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<div class="col">
|
||||||
url="Warehouses"
|
<VnSelect
|
||||||
:sort-by="['name']"
|
url="Warehouses"
|
||||||
:label="t('globals.warehouse')"
|
:sort-by="['name']"
|
||||||
v-model="data.warehouseId"
|
:label="t('globals.warehouse')"
|
||||||
hide-selected
|
v-model="data.warehouseId"
|
||||||
required
|
hide-selected
|
||||||
:where="{
|
required
|
||||||
isForTicket: true,
|
:where="{
|
||||||
}"
|
isForTicket: true,
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
}"
|
||||||
/>
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<div class="col">
|
||||||
:label="t('globals.agency')"
|
<VnSelect
|
||||||
v-model="data.agencyModeId"
|
:label="t('globals.agency')"
|
||||||
:options="agenciesOptions"
|
v-model="data.agencyModeId"
|
||||||
option-value="agencyModeFk"
|
:options="agenciesOptions"
|
||||||
option-label="agencyMode"
|
option-value="agencyModeFk"
|
||||||
hide-selected
|
option-label="agencyMode"
|
||||||
/>
|
hide-selected
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
|
@ -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'"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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: {
|
include: {
|
||||||
relation: 'worker',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'firstName', 'lastName'],
|
fields: ['id', 'nickname', 'name'],
|
||||||
include: {
|
|
||||||
relation: 'user',
|
|
||||||
scope: {
|
|
||||||
fields: ['id', 'nickname', 'name'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const body = { workerFk: route.params.id };
|
const body = {
|
||||||
|
workerFk: route.params.id,
|
||||||
|
userFk: user.value.id,
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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';
|
||||||
|
|
||||||
|
|
|
@ -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)';
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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', {
|
||||||
|
@ -58,8 +58,8 @@ describe('Client list', () => {
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
cy.checkValueForm(1, search);
|
cy.checkValueForm(1, search);
|
||||||
cy.checkValueForm(2, search);
|
cy.checkValueForm(2, search);
|
||||||
cy.dataCy('Customer_select').contains(search);
|
cy.dataCy('Customer_select').should('have.value', search);
|
||||||
cy.dataCy('Address_select').contains(search);
|
cy.dataCy('Address_select').should('have.value', search);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Client founded create order', () => {
|
it('Client founded create order', () => {
|
||||||
|
@ -74,7 +74,7 @@ describe('Client list', () => {
|
||||||
cy.waitForElement('#formModel');
|
cy.waitForElement('#formModel');
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
cy.checkValueForm(1, search);
|
cy.checkValueForm(1, search);
|
||||||
cy.dataCy('Client_select').contains(search);
|
cy.dataCy('Client_select').should('have.value', search);
|
||||||
cy.dataCy('Address_select').contains(search);
|
cy.dataCy('Address_select').should('have.value', search);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -95,7 +95,7 @@ describe('EntryBuys', () => {
|
||||||
|
|
||||||
cy.get('input[data-cy="itemFk-create-popup"]').type('1');
|
cy.get('input[data-cy="itemFk-create-popup"]').type('1');
|
||||||
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
||||||
cy.dataCy('Grouping mode_select').contains('packing');
|
cy.get('input[data-cy="Grouping mode_select"]').should('have.value', 'packing');
|
||||||
cy.get('button[data-cy="FormModelPopup_save"]').click();
|
cy.get('button[data-cy="FormModelPopup_save"]').click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,9 +17,11 @@ describe('EntryNotes', () => {
|
||||||
const editObservation = (rowIndex, type, description) => {
|
const editObservation = (rowIndex, type, description) => {
|
||||||
cy.get(`td[data-col-field="description"][data-row-index="${rowIndex}"]`)
|
cy.get(`td[data-col-field="description"][data-row-index="${rowIndex}"]`)
|
||||||
.click()
|
.click()
|
||||||
|
.clear()
|
||||||
.type(description);
|
.type(description);
|
||||||
cy.get(`td[data-col-field="observationTypeFk"][data-row-index="${rowIndex}"]`)
|
cy.get(`td[data-col-field="observationTypeFk"][data-row-index="${rowIndex}"]`)
|
||||||
.click()
|
.click()
|
||||||
|
.clear()
|
||||||
.type(type);
|
.type(type);
|
||||||
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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', () => {
|
||||||
|
@ -44,9 +44,9 @@ describe('invoiceInCorrective', () => {
|
||||||
cy.url().should('include', `/invoice-in/${correctingFk}/summary`);
|
cy.url().should('include', `/invoice-in/${correctingFk}/summary`);
|
||||||
cy.visit(`/#/invoice-in/${correctingFk}/corrective`);
|
cy.visit(`/#/invoice-in/${correctingFk}/corrective`);
|
||||||
|
|
||||||
checkIsDisabled('class');
|
cy.dataCy('invoiceInCorrective_class').should('be.disabled');
|
||||||
checkIsDisabled('type');
|
cy.dataCy('invoiceInCorrective_type').should('be.disabled');
|
||||||
checkIsDisabled('reason');
|
cy.dataCy('invoiceInCorrective_reason').should('be.disabled');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,10 +56,4 @@ describe('invoiceInCorrective', () => {
|
||||||
cy.clickDescriptorAction(4);
|
cy.clickDescriptorAction(4);
|
||||||
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
|
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
function checkIsDisabled(column) {
|
|
||||||
cy.dataCy(`invoiceInCorrective_${column}`)
|
|
||||||
.parents('.q-field')
|
|
||||||
.should('have.class', 'q-field--disabled');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('InvoiceInDescriptor', () => {
|
describe('InvoiceInDescriptor', { testIsolation: true }, () => {
|
||||||
beforeEach(() => cy.login('administrative'));
|
beforeEach(() => cy.login('administrative'));
|
||||||
|
|
||||||
describe('more options', () => {
|
describe('more options', () => {
|
||||||
|
@ -132,9 +132,9 @@ function createCorrective() {
|
||||||
const correctingId = response.body;
|
const correctingId = response.body;
|
||||||
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
||||||
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
||||||
cy.dataCy('invoiceInCorrective_class').contains('R2');
|
cy.dataCy('invoiceInCorrective_class').should('contain.value', 'R2');
|
||||||
cy.dataCy('invoiceInCorrective_type').contains('diferencias');
|
cy.dataCy('invoiceInCorrective_type').should('contain.value', 'diferencias');
|
||||||
cy.dataCy('invoiceInCorrective_reason').contains('sales details');
|
cy.dataCy('invoiceInCorrective_reason').should('contain.value', 'sales details');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,11 @@ describe('InvoiceInIntrastat', () => {
|
||||||
|
|
||||||
it('should edit the first line', () => {
|
it('should edit the first line', () => {
|
||||||
cy.selectOption(`${firstRow} ${codes}`, 'Plantas vivas: Esqueje/injerto, Vid');
|
cy.selectOption(`${firstRow} ${codes}`, 'Plantas vivas: Esqueje/injerto, Vid');
|
||||||
|
cy.get(firstRowAmount).clear();
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.get(codes).eq(0).contains('6021010: Plantas vivas: Esqueje/injerto, Vid');
|
cy.get(codes)
|
||||||
|
.eq(0)
|
||||||
|
.should('have.value', '6021010: Plantas vivas: Esqueje/injerto, Vid');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a new row', () => {
|
it('should add a new row', () => {
|
||||||
|
@ -27,7 +30,7 @@ describe('InvoiceInIntrastat', () => {
|
||||||
'FR',
|
'FR',
|
||||||
]);
|
]);
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.checkNotification('Data saved');
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove the first line', () => {
|
it('should remove the first line', () => {
|
||||||
|
|
|
@ -52,7 +52,7 @@ describe('InvoiceInList', () => {
|
||||||
title: mockInvoiceRef,
|
title: mockInvoiceRef,
|
||||||
listBox: { 0: '11/16/2001', 3: 'The farmer' },
|
listBox: { 0: '11/16/2001', 3: 'The farmer' },
|
||||||
});
|
});
|
||||||
cy.dataCy('invoiceInBasicDataCompanyFk').contains('ORN');
|
cy.dataCy('invoiceInBasicDataCompanyFk').should('have.value', 'ORN');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe('InvoiceInVat', () => {
|
||||||
it('should edit the sage iva', () => {
|
it('should edit the sage iva', () => {
|
||||||
cy.selectOption(`${firstLineVat} ${vats}`, 'H.P. IVA 21% CEE');
|
cy.selectOption(`${firstLineVat} ${vats}`, 'H.P. IVA 21% CEE');
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.get(vats).eq(0).contains('8: H.P. IVA 21% CEE');
|
cy.get(vats).eq(0).should('have.value', '8: H.P. IVA 21% CEE');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should mark the line as deductible VAT', () => {
|
it('should mark the line as deductible VAT', () => {
|
||||||
|
@ -23,7 +23,9 @@ describe('InvoiceInVat', () => {
|
||||||
|
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
|
|
||||||
cy.get(`${firstLineVat} [data-cy="isDeductible_checkbox"]`).click();
|
cy.get(`${firstLineVat} [data-cy="isDeductible_checkbox"]`)
|
||||||
|
|
||||||
|
.click();
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
});
|
});
|
||||||
|
|
|
@ -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' },
|
||||||
|
|
|
@ -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`);
|
||||||
|
|
|
@ -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`);
|
||||||
|
|
|
@ -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`);
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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`);
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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"]';
|
||||||
|
@ -59,8 +59,8 @@ describe('OrderList', () => {
|
||||||
).click();
|
).click();
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
|
||||||
cy.get(clientCreateSelect).contains('Bruce Wayne');
|
cy.get(clientCreateSelect).should('have.value', 'Bruce Wayne');
|
||||||
cy.get(addressCreateSelect).contains('Bruce Wayne');
|
cy.get(addressCreateSelect).should('have.value', 'Bruce Wayne');
|
||||||
cy.dataCy('landedDate').find('input').type('06/01/2001');
|
cy.dataCy('landedDate').find('input').type('06/01/2001');
|
||||||
cy.selectOption(agencyCreateSelect, 1);
|
cy.selectOption(agencyCreateSelect, 1);
|
||||||
|
|
||||||
|
|
|
@ -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`;
|
||||||
|
|
||||||
|
|
|
@ -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' : ''
|
||||||
|
|
|
@ -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`;
|
||||||
|
|
||||||
|
|
|
@ -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`;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('ParkingBasicData', () => {
|
describe('ParkingBasicData', () => {
|
||||||
const codeInput = 'form .q-card .q-input input';
|
const codeInput = 'form .q-card .q-input input';
|
||||||
const sectorSelect = 'form .q-card .q-select';
|
const sectorSelect = 'form .q-card .q-select input';
|
||||||
|
const sectorOpt = '.q-menu .q-item';
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/shelving/parking/1/basic-data`);
|
cy.visit(`/#/shelving/parking/1/basic-data`);
|
||||||
|
@ -16,7 +17,8 @@ describe('ParkingBasicData', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the code and sector', () => {
|
it('should edit the code and sector', () => {
|
||||||
cy.selectOption(sectorSelect, 'First');
|
cy.get(sectorSelect).type('First');
|
||||||
|
cy.get(sectorOpt).click();
|
||||||
|
|
||||||
cy.get(codeInput).eq(0).clear();
|
cy.get(codeInput).eq(0).clear();
|
||||||
cy.get(codeInput).eq(0).type('700-01');
|
cy.get(codeInput).eq(0).type('700-01');
|
||||||
|
@ -25,7 +27,7 @@ describe('ParkingBasicData', () => {
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
|
|
||||||
cy.get(sectorSelect).contains('First sector');
|
cy.get(sectorSelect).should('have.value', 'First sector');
|
||||||
cy.get(codeInput).should('have.value', '700-01');
|
cy.get(codeInput).should('have.value', '700-01');
|
||||||
cy.dataCy('Picking order_input').should('have.value', 80230);
|
cy.dataCy('Picking order_input').should('have.value', 80230);
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,11 +44,11 @@ describe('TicketList', () => {
|
||||||
cy.intercept('GET', /\/api\/Clients\?filter/).as('clientFilter');
|
cy.intercept('GET', /\/api\/Clients\?filter/).as('clientFilter');
|
||||||
cy.vnTableCreateBtn();
|
cy.vnTableCreateBtn();
|
||||||
cy.wait('@clientFilter');
|
cy.wait('@clientFilter');
|
||||||
cy.dataCy('Customer_select').contains('Bruce Wayne');
|
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
|
||||||
cy.dataCy('Address_select').click();
|
cy.dataCy('Address_select').click();
|
||||||
|
|
||||||
cy.getOption().click();
|
cy.getOption().click();
|
||||||
cy.dataCy('Address_select').contains('Bruce Wayne');
|
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
|
||||||
});
|
});
|
||||||
it('Client list create new ticket', () => {
|
it('Client list create new ticket', () => {
|
||||||
cy.vnTableCreateBtn();
|
cy.vnTableCreateBtn();
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,31 +1,52 @@
|
||||||
/// <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');
|
||||||
cy.visit(`/#dashboard`);
|
cy.visit(`/#dashboard`);
|
||||||
cy.waitForElement('.q-page', 6000);
|
cy.waitForElement('.q-page', 6000);
|
||||||
cy.openUserPanel();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should notify when update user company', () => {
|
|
||||||
changeSelect('User company', 'VNH', 'VNL');
|
|
||||||
});
|
|
||||||
it('should notify when update user warehouse', () => {
|
it('should notify when update user warehouse', () => {
|
||||||
changeSelect('User warehouse', 'TestingWarehouse', 'Warehouse One');
|
const userWarehouse =
|
||||||
|
'.q-menu .q-gutter-xs > :nth-child(3) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native> .q-field__input';
|
||||||
|
|
||||||
|
// Abro el panel
|
||||||
|
cy.openUserPanel();
|
||||||
|
|
||||||
|
// Compruebo la opcion inicial
|
||||||
|
cy.get(userWarehouse).should('have.value', 'VNL').click();
|
||||||
|
|
||||||
|
// Actualizo la opción
|
||||||
|
cy.getOption(3);
|
||||||
|
|
||||||
|
//Compruebo la notificación
|
||||||
|
cy.get('.q-notification').should('be.visible');
|
||||||
|
cy.get(userWarehouse).should('have.value', 'VNH');
|
||||||
|
|
||||||
|
//Restauro el valor
|
||||||
|
cy.get(userWarehouse).click();
|
||||||
|
cy.getOption(2);
|
||||||
});
|
});
|
||||||
|
it('should notify when update user company', () => {
|
||||||
|
const userCompany =
|
||||||
|
'.q-menu .q-gutter-xs > :nth-child(2) > .q-field--float > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native> .q-field__input';
|
||||||
|
|
||||||
function changeSelect(field, newOption, oldOption) {
|
// Abro el panel
|
||||||
cy.get('.q-menu')
|
cy.openUserPanel();
|
||||||
.contains(field)
|
|
||||||
.then(($field) => {
|
|
||||||
cy.wrap($field).contains(oldOption);
|
|
||||||
cy.selectOption($field, newOption);
|
|
||||||
cy.checkNotification('Data saved');
|
|
||||||
cy.wrap($field).contains(newOption);
|
|
||||||
|
|
||||||
// Restore
|
// Compruebo la opcion inicial
|
||||||
cy.selectOption($field, oldOption);
|
cy.get(userCompany).should('have.value', 'Warehouse One').click();
|
||||||
});
|
|
||||||
}
|
//Actualizo la opción
|
||||||
|
cy.getOption(3);
|
||||||
|
|
||||||
|
//Compruebo la notificación
|
||||||
|
cy.get('.q-notification').should('be.visible');
|
||||||
|
cy.get(userCompany).should('have.value', 'TestingWarehouse');
|
||||||
|
|
||||||
|
//Restauro el valor
|
||||||
|
cy.get(userCompany).click();
|
||||||
|
cy.getOption(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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';
|
||||||
|
@ -41,7 +41,7 @@ describe('VnLocation', () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
|
||||||
).click();
|
).click();
|
||||||
cy.dataCy('locationProvince').contains(province);
|
cy.dataCy('locationProvince').should('have.value', province);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Worker Create', () => {
|
describe('Worker Create', () => {
|
||||||
|
|
|
@ -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`);
|
||||||
|
|
|
@ -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 =
|
||||||
|
|
|
@ -11,6 +11,6 @@ describe('WorkerLocker', () => {
|
||||||
it('should allocates a locker', () => {
|
it('should allocates a locker', () => {
|
||||||
cy.selectOption(lockerSelect, lockerCode);
|
cy.selectOption(lockerSelect, lockerCode);
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.get(lockerSelect).contains(lockerCode);
|
cy.get(lockerSelect).invoke('val').should('eq', lockerCode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('WorkerNotificationsManager', () => {
|
describe('WorkerNotificationsManager', { testIsolation: true }, () => {
|
||||||
const salesPersonId = 18;
|
const salesPersonId = 18;
|
||||||
const developerId = 9;
|
const developerId = 9;
|
||||||
|
|
||||||
|
|
|
@ -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';
|
||||||
|
|
||||||
|
|
|
@ -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' },
|
||||||
|
|
|
@ -26,8 +26,27 @@ describe('ZoneDeliveryDays', () => {
|
||||||
});
|
});
|
||||||
}).as('events');
|
}).as('events');
|
||||||
|
|
||||||
cy.selectOption('[data-cy="ZoneDeliveryDaysPostcodeSelect"]', postcode);
|
cy.dataCy('ZoneDeliveryDaysPostcodeSelect').type(postcode);
|
||||||
cy.selectOption('[data-cy="ZoneDeliveryDaysAgencySelect"]', agency);
|
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.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(submitForm).click();
|
cy.get(submitForm).click();
|
||||||
cy.wait('@events').then((interception) => {
|
cy.wait('@events').then((interception) => {
|
||||||
|
|
|
@ -178,37 +178,36 @@ Cypress.Commands.add('fillInForm', (obj, opts = {}) => {
|
||||||
cy.waitSpinner();
|
cy.waitSpinner();
|
||||||
const { form = '.q-form > .q-card', attr = 'aria-label' } = opts;
|
const { form = '.q-form > .q-card', attr = 'aria-label' } = opts;
|
||||||
cy.waitForElement(form);
|
cy.waitForElement(form);
|
||||||
|
cy.get(`${form} input`).each(([el]) => {
|
||||||
|
cy.wrap(el)
|
||||||
|
.invoke('attr', attr)
|
||||||
|
.then((key) => {
|
||||||
|
const field = obj[key];
|
||||||
|
if (!field) return;
|
||||||
|
if (typeof field == 'string')
|
||||||
|
return cy
|
||||||
|
.wrap(el)
|
||||||
|
.type(`{selectall}{backspace}${field}`, { delay: 0 });
|
||||||
|
|
||||||
cy.get(`${form} .q-field`).each(($el) => {
|
const { type, val } = field;
|
||||||
cy.wrap($el).then(($element) => {
|
switch (type) {
|
||||||
const key = $element.attr(attr) || $element.find(`[${attr}]`).attr(attr);
|
case 'select':
|
||||||
const field = obj[key];
|
cy.selectOption(el, val);
|
||||||
if (!field) return;
|
break;
|
||||||
|
case 'date':
|
||||||
const { type, val } =
|
cy.get(el).type(`{selectall}{backspace}${val}`).blur();
|
||||||
typeof field === 'string' ? { type: 'string', val: field } : field;
|
break;
|
||||||
|
case 'time':
|
||||||
switch (type) {
|
cy.get(el).click();
|
||||||
case 'select':
|
cy.get('.q-time .q-time__clock').contains(val.h).click();
|
||||||
cy.selectOption($el, val);
|
cy.get('.q-time .q-time__clock').contains(val.m).click();
|
||||||
break;
|
cy.get('.q-time .q-time__link').contains(val.x).click();
|
||||||
case 'date':
|
break;
|
||||||
cy.wrap($el)
|
default:
|
||||||
.find('input')
|
cy.wrap(el).type(`{selectall}${val}`, { delay: 0 });
|
||||||
.type(`{selectall}{backspace}${val}`)
|
break;
|
||||||
.blur();
|
}
|
||||||
break;
|
});
|
||||||
case 'time':
|
|
||||||
cy.wrap($el).click();
|
|
||||||
cy.get('.q-time .q-time__clock').contains(val.h).click();
|
|
||||||
cy.get('.q-time .q-time__clock').contains(val.m).click();
|
|
||||||
cy.get('.q-time .q-time__link').contains(val.x).click();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cy.wrap($el).find('input').type(`{selectall}${val}`, { delay: 0 });
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue