Compare commits
121 Commits
feat_save_
...
dev
Author | SHA1 | Date |
---|---|---|
|
a9e3cad8ba | |
|
93e29fdde6 | |
|
22747995cb | |
|
33a6e5ebd3 | |
|
86a3192c17 | |
|
85074b3ca4 | |
|
de4e5ce669 | |
|
90fb1485b0 | |
|
5b5ce033f0 | |
|
e470fa70e2 | |
|
8b61d1a4c7 | |
|
8f3621efc6 | |
|
50f1b5b326 | |
|
7cacdbdf94 | |
|
7afd6b3dcd | |
|
51402f9f3f | |
|
a4c4d987c7 | |
|
b1bde7be97 | |
|
5c927cec4b | |
|
ab0d2e60b7 | |
|
0502abfca5 | |
|
b1ef9b1bd3 | |
|
68d1f3cb18 | |
|
debae747db | |
|
671f0c1e67 | |
|
beeeedbb84 | |
|
34fc2d403d | |
|
d3b6223473 | |
|
b68f4331b8 | |
|
9d500a0655 | |
|
20aea5b7df | |
|
5bb452186e | |
|
148e49b153 | |
|
7dd6cc71e2 | |
|
cfe64d644e | |
|
91c627324a | |
|
5cad6103a5 | |
|
d5fc3423d6 | |
|
e064f9e706 | |
|
cb47858f65 | |
|
686edc0b51 | |
|
876f40b4a3 | |
|
53cea184cc | |
|
7f7c86def2 | |
|
5e17117db3 | |
|
494369c8f7 | |
|
de93eba293 | |
|
48b5cfe69b | |
|
b213ffca3e | |
|
334d39eeef | |
|
4e650378a4 | |
|
5f9d498700 | |
|
47f8abe013 | |
|
98c73f8462 | |
|
be88029197 | |
|
6ab54908ed | |
|
0efa72e4a8 | |
|
81d50bb118 | |
|
160ff54a66 | |
|
8a2e301bb7 | |
|
004890a3a9 | |
|
7424d7eb9a | |
|
8e33c79446 | |
|
4cc46e5181 | |
|
c432709a04 | |
|
dd218361f0 | |
|
3ceabd5831 | |
|
8dd67efeb9 | |
|
bb59be3023 | |
|
971194c0f6 | |
|
a8222788ca | |
|
c31218e4fe | |
|
8e10d9d09d | |
|
b85407d8c2 | |
|
1ceb6b1aef | |
|
4f12a31b1a | |
|
9c6ffc76cb | |
|
442f3dbd48 | |
|
092a29d555 | |
|
8e08f65173 | |
|
e4003c6116 | |
|
aedcda4799 | |
|
10d8db6de3 | |
|
d36be31927 | |
|
753fa8489c | |
|
a8d39a9b96 | |
|
5c6fc94dd6 | |
|
81308230ec | |
|
35914be54a | |
|
5b870c2c2c | |
|
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,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { QLayout } from 'quasar';
|
||||||
import mainShortcutMixin from './mainShortcutMixin';
|
import mainShortcutMixin from './mainShortcutMixin';
|
||||||
import { useCau } from 'src/composables/useCau';
|
import { useCau } from 'src/composables/useCau';
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app, router }) => {
|
||||||
QForm.mixins = [qFormMixin];
|
QForm.mixins = [qFormMixin];
|
||||||
QLayout.mixins = [mainShortcutMixin];
|
QLayout.mixins = [mainShortcutMixin];
|
||||||
|
|
||||||
|
@ -22,6 +22,14 @@ export default boot(({ app }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (response?.status) {
|
switch (response?.status) {
|
||||||
|
case 401:
|
||||||
|
if (!router.currentRoute.value.name.toLowerCase().includes('login')) {
|
||||||
|
message = 'errors.sessionExpired';
|
||||||
|
} else message = 'login.loginError';
|
||||||
|
break;
|
||||||
|
case 403:
|
||||||
|
if (!message || message.toLowerCase() === 'access denied')
|
||||||
|
message = 'errors.accessDenied';
|
||||||
case 422:
|
case 422:
|
||||||
if (error.name == 'ValidationError')
|
if (error.name == 'ValidationError')
|
||||||
message += ` "${responseError.details.context}.${Object.keys(
|
message += ` "${responseError.details.context}.${Object.keys(
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -181,6 +181,10 @@ const col = computed(() => {
|
||||||
newColumn.component = 'checkbox';
|
newColumn.component = 'checkbox';
|
||||||
if ($props.default && !newColumn.component) newColumn.component = $props.default;
|
if ($props.default && !newColumn.component) newColumn.component = $props.default;
|
||||||
|
|
||||||
|
if (typeof newColumn.component !== 'string') {
|
||||||
|
newColumn.attrs = { ...newColumn.component.attrs, autofocus: $props.autofocus };
|
||||||
|
newColumn.event = { ...newColumn.component.event, ...$props?.eventHandlers };
|
||||||
|
}
|
||||||
return newColumn;
|
return newColumn;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -331,15 +331,9 @@ function stopEventPropagation(event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearSelected() {
|
|
||||||
if ($props.multiCheck.expand) {
|
|
||||||
selectAll.value = false;
|
|
||||||
selected.value = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function reload(params) {
|
function reload(params) {
|
||||||
clearSelected();
|
selected.value = [];
|
||||||
|
selectAll.value = false;
|
||||||
CrudModelRef.value.reload(params);
|
CrudModelRef.value.reload(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -690,7 +684,10 @@ const handleHeaderSelection = (evt, data) => {
|
||||||
ref="CrudModelRef"
|
ref="CrudModelRef"
|
||||||
@on-fetch="
|
@on-fetch="
|
||||||
(...args) => {
|
(...args) => {
|
||||||
clearSelected();
|
if ($props.multiCheck.expand) {
|
||||||
|
selectAll = false;
|
||||||
|
selected = [];
|
||||||
|
}
|
||||||
emit('onFetch', ...args);
|
emit('onFetch', ...args);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
|
@ -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 })"
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref, useTemplateRef } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
|
||||||
|
import VnSelectDialog from './VnSelectDialog.vue';
|
||||||
|
import CreateNewExpenseForm from '../CreateNewExpenseForm.vue';
|
||||||
|
import FetchData from '../FetchData.vue';
|
||||||
|
|
||||||
|
const model = defineModel({ type: [String, Number, Object] });
|
||||||
|
const { t } = useI18n();
|
||||||
|
const expenses = ref([]);
|
||||||
|
const selectDialogRef = useTemplateRef('selectDialogRef');
|
||||||
|
|
||||||
|
async function autocompleteExpense(evt) {
|
||||||
|
const val = evt.target.value;
|
||||||
|
if (!val || isNaN(val)) return;
|
||||||
|
const lookup = expenses.value.find(({ id }) => id == useAccountShortToStandard(val));
|
||||||
|
if (selectDialogRef.value)
|
||||||
|
selectDialogRef.value.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnSelectDialog
|
||||||
|
v-bind="$attrs"
|
||||||
|
ref="selectDialogRef"
|
||||||
|
v-model="model"
|
||||||
|
:options="expenses"
|
||||||
|
option-value="id"
|
||||||
|
:option-label="(x) => `${x.id}: ${x.name}`"
|
||||||
|
:filter-options="['id', 'name']"
|
||||||
|
:tooltip="t('Create a new expense')"
|
||||||
|
:acls="[{ model: 'Expense', props: '*', accessType: 'WRITE' }]"
|
||||||
|
@keydown.tab.prevent="autocompleteExpense"
|
||||||
|
>
|
||||||
|
<template #form>
|
||||||
|
<CreateNewExpenseForm @on-data-saved="$refs.expensesRef.fetch()" />
|
||||||
|
</template>
|
||||||
|
</VnSelectDialog>
|
||||||
|
<FetchData
|
||||||
|
ref="expensesRef"
|
||||||
|
url="Expenses"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (expenses = data)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Create a new expense: Crear nuevo gasto
|
||||||
|
</i18n>
|
|
@ -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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -400,6 +400,8 @@ errors:
|
||||||
updateUserConfig: Error updating user config
|
updateUserConfig: Error updating user config
|
||||||
tokenConfig: Error fetching token config
|
tokenConfig: Error fetching token config
|
||||||
writeRequest: The requested operation could not be completed
|
writeRequest: The requested operation could not be completed
|
||||||
|
sessionExpired: Your session has expired. Please log in again
|
||||||
|
accessDenied: Access denied
|
||||||
claimBeginningQuantity: Cannot import a line with a claimed quantity of 0
|
claimBeginningQuantity: Cannot import a line with a claimed quantity of 0
|
||||||
login:
|
login:
|
||||||
title: Login
|
title: Login
|
||||||
|
|
|
@ -396,6 +396,8 @@ errors:
|
||||||
updateUserConfig: Error al actualizar la configuración de usuario
|
updateUserConfig: Error al actualizar la configuración de usuario
|
||||||
tokenConfig: Error al obtener configuración de token
|
tokenConfig: Error al obtener configuración de token
|
||||||
writeRequest: No se pudo completar la operación solicitada
|
writeRequest: No se pudo completar la operación solicitada
|
||||||
|
sessionExpired: Tu sesión ha expirado, por favor vuelve a iniciar sesión
|
||||||
|
accessDenied: Acceso denegado
|
||||||
claimBeginningQuantity: No se puede importar una linea sin una cantidad reclamada
|
claimBeginningQuantity: No se puede importar una linea sin una cantidad reclamada
|
||||||
login:
|
login:
|
||||||
title: Inicio de sesión
|
title: Inicio de sesión
|
||||||
|
|
|
@ -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,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"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -73,6 +73,7 @@ const columns = computed(() => [
|
||||||
optionLabel: 'code',
|
optionLabel: 'code',
|
||||||
options: companies.value,
|
options: companies.value,
|
||||||
},
|
},
|
||||||
|
orderBy: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'warehouse',
|
name: 'warehouse',
|
||||||
|
|
|
@ -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)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, nextTick } from 'vue';
|
import { ref, computed, markRaw } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { getTotal } from 'src/composables/getTotal';
|
import { getTotal } from 'src/composables/getTotal';
|
||||||
import { toCurrency } from 'src/filters';
|
import { toCurrency } from 'src/filters';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
|
||||||
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
|
|
||||||
import { getExchange } from 'src/composables/getExchange';
|
import { getExchange } from 'src/composables/getExchange';
|
||||||
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import VnSelectExpense from 'src/components/common/VnSelectExpense.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const arrayData = useArrayData();
|
const arrayData = useArrayData();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const invoiceIn = computed(() => arrayData.store.data);
|
const invoiceIn = computed(() => arrayData.store.data);
|
||||||
|
@ -24,100 +19,142 @@ const expenses = ref([]);
|
||||||
const sageTaxTypes = ref([]);
|
const sageTaxTypes = ref([]);
|
||||||
const sageTransactionTypes = ref([]);
|
const sageTransactionTypes = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const invoiceInFormRef = ref();
|
const invoiceInVatTableRef = ref();
|
||||||
|
|
||||||
defineProps({
|
defineProps({ actionIcon: { type: String, default: 'add' } });
|
||||||
actionIcon: {
|
|
||||||
type: String,
|
function taxRate(invoiceInTax) {
|
||||||
default: 'add',
|
const sageTaxTypeId = invoiceInTax.taxTypeSageFk;
|
||||||
},
|
const taxRateSelection = sageTaxTypes.value.find(
|
||||||
});
|
(transaction) => transaction.id == sageTaxTypeId,
|
||||||
|
);
|
||||||
|
const taxTypeSage = taxRateSelection?.rate ?? 0;
|
||||||
|
const taxableBase = invoiceInTax?.taxableBase ?? 0;
|
||||||
|
|
||||||
|
return (taxTypeSage / 100) * taxableBase;
|
||||||
|
}
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'expense',
|
name: 'expenseFk',
|
||||||
label: t('Expense'),
|
label: t('Expense'),
|
||||||
field: (row) => row.expenseFk,
|
component: markRaw(VnSelectExpense),
|
||||||
options: expenses.value,
|
format: (row) => {
|
||||||
model: 'expenseFk',
|
const expense = expenses.value.find((e) => e.id === row.expenseFk);
|
||||||
optionValue: 'id',
|
return expense ? `${expense.id}: ${expense.name}` : row.expenseFk;
|
||||||
optionLabel: (row) => `${row.id}: ${row.name}`,
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
isEditable: true,
|
||||||
|
create: true,
|
||||||
|
width: '250px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'taxablebase',
|
name: 'taxableBase',
|
||||||
label: t('Taxable base'),
|
label: t('Taxable base'),
|
||||||
field: (row) => row.taxableBase,
|
component: 'number',
|
||||||
model: 'taxableBase',
|
attrs: {
|
||||||
|
clearable: true,
|
||||||
|
'clear-icon': 'close',
|
||||||
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
isEditable: true,
|
||||||
|
create: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'isDeductible',
|
name: 'isDeductible',
|
||||||
label: t('invoiceIn.isDeductible'),
|
label: t('invoiceIn.isDeductible'),
|
||||||
field: (row) => row.isDeductible,
|
component: 'checkbox',
|
||||||
model: 'isDeductible',
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
isEditable: true,
|
||||||
|
create: true,
|
||||||
|
createAttrs: {
|
||||||
|
defaultValue: true,
|
||||||
|
},
|
||||||
|
width: '100px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'sageiva',
|
name: 'taxTypeSageFk',
|
||||||
label: t('Sage iva'),
|
label: t('Sage iva'),
|
||||||
field: (row) => row.taxTypeSageFk,
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
options: sageTaxTypes.value,
|
options: sageTaxTypes.value,
|
||||||
model: 'taxTypeSageFk',
|
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: (row) => `${row.id}: ${row.vat}`,
|
optionLabel: (row) => `${row.id}: ${row.vat}`,
|
||||||
|
filterOptions: ['id', 'vat'],
|
||||||
|
'data-cy': 'vat-sageiva',
|
||||||
|
},
|
||||||
|
format: (row) => {
|
||||||
|
const taxType = sageTaxTypes.value.find((t) => t.id === row.taxTypeSageFk);
|
||||||
|
return taxType ? `${taxType.id}: ${taxType.vat}` : row.taxTypeSageFk;
|
||||||
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
isEditable: true,
|
||||||
|
create: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'sagetransaction',
|
name: 'transactionTypeSageFk',
|
||||||
label: t('Sage transaction'),
|
label: t('Sage transaction'),
|
||||||
field: (row) => row.transactionTypeSageFk,
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
options: sageTransactionTypes.value,
|
options: sageTransactionTypes.value,
|
||||||
model: 'transactionTypeSageFk',
|
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: (row) => `${row.id}: ${row.transaction}`,
|
optionLabel: (row) => `${row.id}: ${row.transaction}`,
|
||||||
|
filterOptions: ['id', 'transaction'],
|
||||||
|
},
|
||||||
|
format: (row) => {
|
||||||
|
const transType = sageTransactionTypes.value.find(
|
||||||
|
(t) => t.id === row.transactionTypeSageFk,
|
||||||
|
);
|
||||||
|
return transType
|
||||||
|
? `${transType.id}: ${transType.transaction}`
|
||||||
|
: row.transactionTypeSageFk;
|
||||||
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
isEditable: true,
|
||||||
|
create: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'rate',
|
name: 'rate',
|
||||||
label: t('Rate'),
|
label: t('Rate'),
|
||||||
sortable: true,
|
sortable: false,
|
||||||
field: (row) => taxRate(row, row.taxTypeSageFk),
|
format: (row) => taxRate(row).toFixed(2),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'foreignvalue',
|
name: 'foreignValue',
|
||||||
label: t('Foreign value'),
|
label: t('Foreign value'),
|
||||||
|
component: 'number',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: (row) => row.foreignValue,
|
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
create: true,
|
||||||
|
disable: !isNotEuro(currency.value),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'total',
|
name: 'total',
|
||||||
label: 'Total',
|
label: t('Total'),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
format: (row) => (Number(row.taxableBase || 0) + Number(taxRate(row))).toFixed(2),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const tableRows = computed(
|
||||||
|
() => invoiceInVatTableRef.value?.CrudModelRef?.formData || [],
|
||||||
|
);
|
||||||
const taxableBaseTotal = computed(() => {
|
const taxableBaseTotal = computed(() => {
|
||||||
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
|
return getTotal(tableRows.value, 'taxableBase');
|
||||||
});
|
});
|
||||||
|
|
||||||
const taxRateTotal = computed(() => {
|
const taxRateTotal = computed(() => {
|
||||||
return getTotal(invoiceInFormRef.value.formData, null, {
|
return tableRows.value.reduce((sum, row) => sum + Number(taxRate(row)), 0);
|
||||||
cb: taxRate,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const combinedTotal = computed(() => {
|
const combinedTotal = computed(() => {
|
||||||
return +taxableBaseTotal.value + +taxRateTotal.value;
|
return +taxableBaseTotal.value + +taxRateTotal.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const filter = {
|
const filter = computed(() => ({
|
||||||
fields: [
|
fields: [
|
||||||
'id',
|
'id',
|
||||||
'invoiceInFk',
|
'invoiceInFk',
|
||||||
|
@ -131,388 +168,75 @@ const filter = {
|
||||||
where: {
|
where: {
|
||||||
invoiceInFk: route.params.id,
|
invoiceInFk: route.params.id,
|
||||||
},
|
},
|
||||||
};
|
}));
|
||||||
|
|
||||||
const isNotEuro = (code) => code != 'EUR';
|
const isNotEuro = (code) => code != 'EUR';
|
||||||
|
|
||||||
function taxRate(invoiceInTax) {
|
async function handleForeignValueUpdate(val, row) {
|
||||||
const sageTaxTypeId = invoiceInTax.taxTypeSageFk;
|
if (!isNotEuro(currency.value)) return;
|
||||||
const taxRateSelection = sageTaxTypes.value.find(
|
row.taxableBase = await getExchange(
|
||||||
(transaction) => transaction.id == sageTaxTypeId,
|
val,
|
||||||
|
invoiceIn.value?.currencyFk,
|
||||||
|
invoiceIn.value?.issued,
|
||||||
);
|
);
|
||||||
const taxTypeSage = taxRateSelection?.rate ?? 0;
|
|
||||||
const taxableBase = invoiceInTax?.taxableBase ?? 0;
|
|
||||||
|
|
||||||
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function autocompleteExpense(evt, row, col, ref) {
|
|
||||||
const val = evt.target.value;
|
|
||||||
if (!val) return;
|
|
||||||
|
|
||||||
const param = isNaN(val) ? row[col.model] : val;
|
|
||||||
const lookup = expenses.value.find(
|
|
||||||
({ id }) => id == useAccountShortToStandard(param),
|
|
||||||
);
|
|
||||||
|
|
||||||
ref.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCursor(ref) {
|
|
||||||
nextTick(() => {
|
|
||||||
const select = ref.vnSelectDialogRef
|
|
||||||
? ref.vnSelectDialogRef.vnSelectRef
|
|
||||||
: ref.vnSelectRef;
|
|
||||||
select.$el.querySelector('input').setSelectionRange(0, 0);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData url="Expenses" auto-load @on-fetch="(data) => (expenses = data)" />
|
||||||
ref="expensesRef"
|
|
||||||
url="Expenses"
|
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (expenses = data)"
|
|
||||||
/>
|
|
||||||
<FetchData url="SageTaxTypes" auto-load @on-fetch="(data) => (sageTaxTypes = data)" />
|
<FetchData url="SageTaxTypes" auto-load @on-fetch="(data) => (sageTaxTypes = data)" />
|
||||||
<FetchData
|
<FetchData
|
||||||
url="sageTransactionTypes"
|
url="sageTransactionTypes"
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (sageTransactionTypes = data)"
|
@on-fetch="(data) => (sageTransactionTypes = data)"
|
||||||
/>
|
/>
|
||||||
<CrudModel
|
<VnTable
|
||||||
ref="invoiceInFormRef"
|
|
||||||
v-if="invoiceIn"
|
v-if="invoiceIn"
|
||||||
|
ref="invoiceInVatTableRef"
|
||||||
data-key="InvoiceInTaxes"
|
data-key="InvoiceInTaxes"
|
||||||
url="InvoiceInTaxes"
|
url="InvoiceInTaxes"
|
||||||
|
save-url="InvoiceInTaxes/crud"
|
||||||
: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`"
|
|
||||||
>
|
|
||||||
<template #body="{ rows }">
|
|
||||||
<QTable
|
|
||||||
v-model:selected="rowsSelected"
|
|
||||||
selection="multiple"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:is-editable="true"
|
||||||
row-key="$index"
|
:table="{ selection: 'multiple', 'row-key': '$index' }"
|
||||||
:grid="$q.screen.lt.sm"
|
footer
|
||||||
>
|
:right-search="false"
|
||||||
<template #body-cell-expense="{ row, col }">
|
:column-search="false"
|
||||||
<QTd>
|
:disable-option="{ card: true }"
|
||||||
<VnSelectDialog
|
class="q-pa-none"
|
||||||
:ref="`expenseRef-${row.$index}`"
|
:create="{
|
||||||
v-model="row[col.model]"
|
urlCreate: 'InvoiceInTaxes',
|
||||||
:options="col.options"
|
title: t('Add tax'),
|
||||||
:option-value="col.optionValue"
|
formInitialData: { invoiceInFk: $route.params.id, isDeductible: true },
|
||||||
:option-label="col.optionLabel"
|
onDataSaved: () => invoiceInVatTableRef.reload(),
|
||||||
:filter-options="['id', 'name']"
|
|
||||||
:tooltip="t('Create a new expense')"
|
|
||||||
:acls="[
|
|
||||||
{ model: 'Expense', props: '*', accessType: 'WRITE' },
|
|
||||||
]"
|
|
||||||
@keydown.tab.prevent="
|
|
||||||
autocompleteExpense(
|
|
||||||
$event,
|
|
||||||
row,
|
|
||||||
col,
|
|
||||||
$refs[`expenseRef-${row.$index}`],
|
|
||||||
)
|
|
||||||
"
|
|
||||||
@update:model-value="
|
|
||||||
setCursor($refs[`expenseRef-${row.$index}`])
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
<template #form>
|
|
||||||
<CreateNewExpenseForm
|
|
||||||
@on-data-saved="$refs.expensesRef.fetch()"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnSelectDialog>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-isDeductible="{ row }">
|
|
||||||
<QTd align="center">
|
|
||||||
<QCheckbox
|
|
||||||
v-model="row.isDeductible"
|
|
||||||
data-cy="isDeductible_checkbox"
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-taxablebase="{ row }">
|
|
||||||
<QTd shrink>
|
|
||||||
<VnInputNumber
|
|
||||||
clear-icon="close"
|
|
||||||
v-model="row.taxableBase"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-sageiva="{ row, col }">
|
|
||||||
<QTd>
|
|
||||||
<VnSelect
|
|
||||||
:ref="`sageivaRef-${row.$index}`"
|
|
||||||
v-model="row[col.model]"
|
|
||||||
:options="col.options"
|
|
||||||
:option-value="col.optionValue"
|
|
||||||
:option-label="col.optionLabel"
|
|
||||||
:filter-options="['id', 'vat']"
|
|
||||||
data-cy="vat-sageiva"
|
|
||||||
@update:model-value="
|
|
||||||
setCursor($refs[`sageivaRef-${row.$index}`])
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ scope.opt.vat }}</QItemLabel>
|
|
||||||
<QItemLabel>
|
|
||||||
{{ `#${scope.opt.id}` }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-sagetransaction="{ row, col }">
|
|
||||||
<QTd>
|
|
||||||
<VnSelect
|
|
||||||
:ref="`sagetransactionRef-${row.$index}`"
|
|
||||||
v-model="row[col.model]"
|
|
||||||
:options="col.options"
|
|
||||||
:option-value="col.optionValue"
|
|
||||||
:option-label="col.optionLabel"
|
|
||||||
:filter-options="['id', 'transaction']"
|
|
||||||
@update:model-value="
|
|
||||||
setCursor($refs[`sagetransactionRef-${row.$index}`])
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{
|
|
||||||
scope.opt.transaction
|
|
||||||
}}</QItemLabel>
|
|
||||||
<QItemLabel>
|
|
||||||
{{ `#${scope.opt.id}` }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-foreignvalue="{ row }">
|
|
||||||
<QTd shrink>
|
|
||||||
<VnInputNumber
|
|
||||||
:class="{
|
|
||||||
'no-pointer-events': !isNotEuro(currency),
|
|
||||||
}"
|
}"
|
||||||
:disable="!isNotEuro(currency)"
|
:crud-model="{ goTo: `/invoice-in/${$route.params.id}/due-day` }"
|
||||||
v-model="row.foreignValue"
|
>
|
||||||
@update:model-value="
|
<template #column-footer-taxableBase>
|
||||||
async (val) => {
|
|
||||||
if (!isNotEuro(currency)) return;
|
|
||||||
row.taxableBase = await getExchange(
|
|
||||||
val,
|
|
||||||
row.currencyFk,
|
|
||||||
invoiceIn.issued,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #bottom-row>
|
|
||||||
<QTr class="bg">
|
|
||||||
<QTd />
|
|
||||||
<QTd />
|
|
||||||
<QTd>
|
|
||||||
{{ toCurrency(taxableBaseTotal) }}
|
{{ toCurrency(taxableBaseTotal) }}
|
||||||
</QTd>
|
</template>
|
||||||
<QTd />
|
<template #column-footer-rate>
|
||||||
<QTd />
|
|
||||||
<QTd />
|
|
||||||
<QTd>
|
|
||||||
{{ toCurrency(taxRateTotal) }}
|
{{ toCurrency(taxRateTotal) }}
|
||||||
</QTd>
|
</template>
|
||||||
<QTd />
|
<template #column-footer-total>
|
||||||
<QTd>
|
|
||||||
{{ toCurrency(combinedTotal) }}
|
{{ toCurrency(combinedTotal) }}
|
||||||
</QTd>
|
|
||||||
</QTr>
|
|
||||||
</template>
|
</template>
|
||||||
|
</VnTable>
|
||||||
<template #item="props">
|
|
||||||
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
|
|
||||||
<QCard bordered flat class="q-my-xs">
|
|
||||||
<QCardSection>
|
|
||||||
<QCheckbox v-model="props.selected" dense />
|
|
||||||
</QCardSection>
|
|
||||||
<QSeparator />
|
|
||||||
<QList>
|
|
||||||
<QItem>
|
|
||||||
<VnSelectDialog
|
|
||||||
:label="t('Expense')"
|
|
||||||
class="full-width"
|
|
||||||
v-model="props.row['expenseFk']"
|
|
||||||
:options="expenses"
|
|
||||||
option-value="id"
|
|
||||||
:option-label="(row) => `${row.id}:${row.name}`"
|
|
||||||
:filter-options="['id', 'name']"
|
|
||||||
:tooltip="t('Create a new expense')"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
<template #form>
|
|
||||||
<CreateNewExpenseForm />
|
|
||||||
</template>
|
|
||||||
</VnSelectDialog>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<VnInputNumber
|
|
||||||
:label="t('Taxable base')"
|
|
||||||
:class="{
|
|
||||||
'no-pointer-events': isNotEuro(currency),
|
|
||||||
}"
|
|
||||||
class="full-width"
|
|
||||||
:disable="isNotEuro(currency)"
|
|
||||||
clear-icon="close"
|
|
||||||
v-model="props.row.taxableBase"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Sage iva')"
|
|
||||||
class="full-width"
|
|
||||||
v-model="props.row['taxTypeSageFk']"
|
|
||||||
:options="sageTaxTypes"
|
|
||||||
option-value="id"
|
|
||||||
:option-label="(row) => `${row.id}:${row.vat}`"
|
|
||||||
:filter-options="['id', 'vat']"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{
|
|
||||||
scope.opt.vat
|
|
||||||
}}</QItemLabel>
|
|
||||||
<QItemLabel>
|
|
||||||
{{ `#${scope.opt.id}` }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<VnSelect
|
|
||||||
class="full-width"
|
|
||||||
v-model="props.row['transactionTypeSageFk']"
|
|
||||||
:options="sageTransactionTypes"
|
|
||||||
option-value="id"
|
|
||||||
:option-label="
|
|
||||||
(row) => `${row.id}:${row.transaction}`
|
|
||||||
"
|
|
||||||
:filter-options="['id', 'transaction']"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{
|
|
||||||
scope.opt.transaction
|
|
||||||
}}</QItemLabel>
|
|
||||||
<QItemLabel>
|
|
||||||
{{ `#${scope.opt.id}` }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelect>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
{{ toCurrency(taxRate(props.row), currency) }}
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<VnInputNumber
|
|
||||||
:label="t('Foreign value')"
|
|
||||||
class="full-width"
|
|
||||||
:class="{
|
|
||||||
'no-pointer-events': !isNotEuro(currency),
|
|
||||||
}"
|
|
||||||
:disable="!isNotEuro(currency)"
|
|
||||||
v-model="props.row.foreignValue"
|
|
||||||
/>
|
|
||||||
</QItem>
|
|
||||||
</QList>
|
|
||||||
</QCard>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</QTable>
|
|
||||||
</template>
|
|
||||||
</CrudModel>
|
|
||||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
|
||||||
<QBtn
|
|
||||||
color="primary"
|
|
||||||
icon="add"
|
|
||||||
size="lg"
|
|
||||||
v-shortcut="'+'"
|
|
||||||
round
|
|
||||||
@click="invoiceInFormRef.insert()"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('Add tax') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</QPageSticky>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.bg {
|
|
||||||
background-color: var(--vn-light-gray);
|
|
||||||
}
|
|
||||||
@media (max-width: $breakpoint-xs) {
|
|
||||||
.q-dialog {
|
|
||||||
.q-card {
|
|
||||||
&__section:not(:first-child) {
|
|
||||||
.q-item {
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.q-checkbox {
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.q-item {
|
|
||||||
min-height: 0;
|
|
||||||
}
|
|
||||||
.default-icon {
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 50px;
|
|
||||||
background-color: $primary;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Expense: Gasto
|
Expense: Gasto
|
||||||
Create a new expense: Crear nuevo gasto
|
Create a new expense: Crear nuevo gasto
|
||||||
Add tax: Crear gasto
|
Add tax: Añadir Gasto/IVA # Changed label slightly
|
||||||
Taxable base: Base imp.
|
Taxable base: Base imp.
|
||||||
Sage tax: Sage iva
|
Sage iva: Sage iva # Kept original label
|
||||||
Sage transaction: Sage transacción
|
Sage transaction: Sage transacción
|
||||||
Rate: Tasa
|
Rate: Cuota # Changed label
|
||||||
Foreign value: Divisa
|
Foreign value: Divisa
|
||||||
|
Total: Total
|
||||||
|
invoiceIn.isDeductible: Deducible
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -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="{
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { Notify } from 'quasar';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
|
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { useLogin } from 'src/composables/useLogin';
|
import { useLogin } from 'src/composables/useLogin';
|
||||||
|
import useNotify from 'src/composables/useNotify';
|
||||||
import VnLogo from 'components/ui/VnLogo.vue';
|
import VnLogo from 'components/ui/VnLogo.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -15,16 +14,14 @@ const session = useSession();
|
||||||
const loginCache = useLogin();
|
const loginCache = useLogin();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const username = ref('');
|
const username = ref('');
|
||||||
const password = ref('');
|
const password = ref('');
|
||||||
const keepLogin = ref(true);
|
const keepLogin = ref(true);
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
const params = {
|
const params = { user: username.value, password: password.value };
|
||||||
user: username.value,
|
|
||||||
password: password.value,
|
|
||||||
};
|
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.post('Accounts/login', params);
|
const { data } = await axios.post('Accounts/login', params);
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
@ -33,11 +30,7 @@ async function onSubmit() {
|
||||||
await session.setLogin(data);
|
await session.setLogin(data);
|
||||||
} catch (res) {
|
} catch (res) {
|
||||||
if (res.response?.data?.error?.code === 'REQUIRES_2FA') {
|
if (res.response?.data?.error?.code === 'REQUIRES_2FA') {
|
||||||
Notify.create({
|
notify(t('login.twoFactorRequired'), 'warning', 'phoneLink_lock');
|
||||||
message: t('login.twoFactorRequired'),
|
|
||||||
icon: 'phoneLink_lock',
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
params.keepLogin = keepLogin.value;
|
params.keepLogin = keepLogin.value;
|
||||||
loginCache.setUser(params);
|
loginCache.setUser(params);
|
||||||
return router.push({
|
return router.push({
|
||||||
|
@ -45,10 +38,7 @@ async function onSubmit() {
|
||||||
query: router.currentRoute.value?.query,
|
query: router.currentRoute.value?.query,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Notify.create({
|
throw res;
|
||||||
message: t('login.loginError'),
|
|
||||||
type: 'negative',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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: {
|
|
||||||
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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -66,6 +66,8 @@ const excludeType = computed({
|
||||||
const arrayData = useArrayData('ZoneEvents');
|
const arrayData = useArrayData('ZoneEvents');
|
||||||
|
|
||||||
const exclusionGeoCreate = async () => {
|
const exclusionGeoCreate = async () => {
|
||||||
|
if (await zoneHasTickets(route.params.id, dated.value)) return;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
zoneFk: parseInt(route.params.id),
|
zoneFk: parseInt(route.params.id),
|
||||||
date: dated.value,
|
date: dated.value,
|
||||||
|
@ -87,6 +89,8 @@ const exclusionCreate = async () => {
|
||||||
};
|
};
|
||||||
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
|
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
|
||||||
for (const id of zoneIds) {
|
for (const id of zoneIds) {
|
||||||
|
if (await zoneHasTickets(id, dated.value)) return;
|
||||||
|
|
||||||
const url = `Zones/${id}/exclusions`;
|
const url = `Zones/${id}/exclusions`;
|
||||||
let today = moment(dated.value);
|
let today = moment(dated.value);
|
||||||
let lastDay = today.clone().add(nMonths, 'months').endOf('month');
|
let lastDay = today.clone().add(nMonths, 'months').endOf('month');
|
||||||
|
@ -123,6 +127,26 @@ const exclusionCreate = async () => {
|
||||||
await refetchEvents();
|
await refetchEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const zoneHasTickets = async (zoneId, date) => {
|
||||||
|
const filter = {
|
||||||
|
where: {
|
||||||
|
zoneFk: zoneId,
|
||||||
|
shipped: date,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const params = { filter: JSON.stringify(filter) };
|
||||||
|
const { data } = await axios.get('Tickets', { params });
|
||||||
|
if (data.length > 0) {
|
||||||
|
quasar.notify({
|
||||||
|
message: t('eventsExclusionForm.cantCloseZone'),
|
||||||
|
type: 'negative',
|
||||||
|
});
|
||||||
|
await refetchEvents();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
if (excludeType.value === 'all') exclusionCreate();
|
if (excludeType.value === 'all') exclusionCreate();
|
||||||
else exclusionGeoCreate();
|
else exclusionGeoCreate();
|
||||||
|
|
|
@ -80,6 +80,7 @@ eventsExclusionForm:
|
||||||
all: All
|
all: All
|
||||||
specificLocations: Specific locations
|
specificLocations: Specific locations
|
||||||
rootTreeLabel: Locations where it is not distributed
|
rootTreeLabel: Locations where it is not distributed
|
||||||
|
cantCloseZone: Can not close this zone because there are tickets programmed for that day
|
||||||
eventsInclusionForm:
|
eventsInclusionForm:
|
||||||
addEvent: Add event
|
addEvent: Add event
|
||||||
editEvent: Edit event
|
editEvent: Edit event
|
||||||
|
|
|
@ -81,6 +81,7 @@ eventsExclusionForm:
|
||||||
all: Todo
|
all: Todo
|
||||||
specificLocations: Localizaciones concretas
|
specificLocations: Localizaciones concretas
|
||||||
rootTreeLabel: Localizaciones en las que no se reparte
|
rootTreeLabel: Localizaciones en las que no se reparte
|
||||||
|
cantCloseZone: No se puede cerrar la zona porque hay tickets programados para ese día
|
||||||
eventsInclusionForm:
|
eventsInclusionForm:
|
||||||
addEvent: Añadir evento
|
addEvent: Añadir evento
|
||||||
editEvent: Editar evento
|
editEvent: Editar evento
|
||||||
|
|
|
@ -24,13 +24,8 @@ export CI=true
|
||||||
export TZ=Europe/Madrid
|
export TZ=Europe/Madrid
|
||||||
|
|
||||||
# IMAGES
|
# IMAGES
|
||||||
docker build -t registry.verdnatura.es/salix-back:dev -f "$salix_dir/back/Dockerfile" "$salix_dir"
|
docker-compose -f test/cypress/docker-compose.yml --project-directory . pull db
|
||||||
cd "$salix_dir" && npx myt run -t
|
docker-compose -f test/cypress/docker-compose.yml --project-directory . pull back
|
||||||
docker exec vn-database sh -c "rm -rf /mysql-template"
|
|
||||||
docker exec vn-database sh -c "cp -a /var/lib/mysql /mysql-template"
|
|
||||||
docker commit vn-database registry.verdnatura.es/salix-db:dev
|
|
||||||
docker rm -f vn-database
|
|
||||||
cd "$current_dir"
|
|
||||||
docker build -f ./docs/Dockerfile.dev -t lilium-dev .
|
docker build -f ./docs/Dockerfile.dev -t lilium-dev .
|
||||||
# END IMAGES
|
# END IMAGES
|
||||||
|
|
||||||
|
|
|
@ -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', {
|
||||||
|
|
|
@ -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', () => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('InvoiceInDescriptor', () => {
|
describe('InvoiceInDescriptor', { testIsolation: true }, () => {
|
||||||
beforeEach(() => cy.login('administrative'));
|
beforeEach(() => cy.login('administrative'));
|
||||||
|
|
||||||
describe('more options', () => {
|
describe('more options', () => {
|
||||||
|
|
|
@ -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,18 +1,17 @@
|
||||||
/// <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`);
|
||||||
cy.waitForElement('.q-page', 6000);
|
cy.waitForElement('.q-page', 6000);
|
||||||
});
|
});
|
||||||
describe('by user', () => {
|
|
||||||
it('should logout', () => {
|
it('should logout', () => {
|
||||||
cy.get('#user').click();
|
cy.get('#user').click();
|
||||||
cy.get('#logout').click();
|
cy.get('#logout').click();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
describe('not user', () => {
|
it('should throw session expired error if token has expired or is not valid during navigation', () => {
|
||||||
beforeEach(() => {
|
|
||||||
cy.intercept('GET', '**StarredModules**', {
|
cy.intercept('GET', '**StarredModules**', {
|
||||||
statusCode: 401,
|
statusCode: 401,
|
||||||
body: {
|
body: {
|
||||||
|
@ -25,13 +24,9 @@ describe('Logout', () => {
|
||||||
},
|
},
|
||||||
statusMessage: 'AUTHORIZATION_REQUIRED',
|
statusMessage: 'AUTHORIZATION_REQUIRED',
|
||||||
}).as('badRequest');
|
}).as('badRequest');
|
||||||
});
|
|
||||||
|
|
||||||
it('when token not exists', () => {
|
|
||||||
cy.get('.q-list').should('be.visible').first().should('be.visible').click();
|
cy.get('.q-list').should('be.visible').first().should('be.visible').click();
|
||||||
cy.wait('@badRequest');
|
cy.wait('@badRequest');
|
||||||
|
|
||||||
cy.checkNotification('Authorization Required');
|
cy.checkNotification('Your session has expired. Please log in again');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -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"]';
|
||||||
|
|
|
@ -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('RoadMap', () => {
|
describe.skip('RoadMap', () => {
|
||||||
const getSelector = (colField) =>
|
const getSelector = (colField) =>
|
||||||
`tr:last-child > [data-col-field="${colField}"] > .no-padding`;
|
`tr:last-child > [data-col-field="${colField}"] > .no-padding`;
|
||||||
|
|
||||||
|
|
|
@ -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,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,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');
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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 =
|
||||||
|
|
|
@ -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('ZoneCalendar', () => {
|
describe('ZoneCalendar', { testIsolation: true }, () => {
|
||||||
const addEventBtn = '.q-page-sticky > div > .q-btn';
|
const addEventBtn = '.q-page-sticky > div > .q-btn';
|
||||||
const submitBtn = '.q-mt-lg > .q-btn--standard';
|
const submitBtn = '.q-mt-lg > .q-btn--standard';
|
||||||
const deleteBtn = 'ZoneEventsPanelDeleteBtn';
|
const deleteBtn = 'ZoneEventsPanelDeleteBtn';
|
||||||
|
@ -47,4 +47,20 @@ describe('ZoneCalendar', () => {
|
||||||
cy.dataCy('ZoneEventExclusionDeleteBtn').click();
|
cy.dataCy('ZoneEventExclusionDeleteBtn').click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(
|
||||||
|
'should not exclude an event if there are tickets for that zone and day',
|
||||||
|
{ testIsoaltion: true },
|
||||||
|
() => {
|
||||||
|
cy.visit(`/#/zone/3/events`);
|
||||||
|
cy.get('.q-mb-sm > .q-radio__inner').click();
|
||||||
|
cy.get(
|
||||||
|
'.q-current-day > .q-calendar-month__day--content > [data-cy="ZoneCalendarDay"]',
|
||||||
|
).click();
|
||||||
|
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||||
|
cy.checkNotification(
|
||||||
|
'Can not close this zone because there are tickets programmed for that day',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -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,27 +26,8 @@ describe('ZoneDeliveryDays', () => {
|
||||||
});
|
});
|
||||||
}).as('events');
|
}).as('events');
|
||||||
|
|
||||||
cy.dataCy('ZoneDeliveryDaysPostcodeSelect').type(postcode);
|
cy.selectOption('[data-cy="ZoneDeliveryDaysPostcodeSelect"]', postcode);
|
||||||
cy.get('.q-menu .q-item').contains(postcode).click();
|
cy.selectOption('[data-cy="ZoneDeliveryDaysAgencySelect"]', agency);
|
||||||
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) => {
|
||||||
|
|
Loading…
Reference in New Issue