diff --git a/package.json b/package.json
index 19b4c7a6f..b7b04287d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-front",
- "version": "25.16.0",
+ "version": "25.18.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",
@@ -89,4 +89,4 @@
"vite": "^6.0.11",
"vitest": "^0.31.1"
}
-}
+}
\ No newline at end of file
diff --git a/src/App.vue b/src/App.vue
index 27cc34c38..0217c45c2 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,6 +2,7 @@
import { onMounted } from 'vue';
import { useQuasar, Dark } from 'quasar';
import { useI18n } from 'vue-i18n';
+import VnScroll from './components/common/VnScroll.vue';
const quasar = useQuasar();
const { availableLocales, locale, fallbackLocale } = useI18n();
@@ -38,6 +39,7 @@ quasar.iconMapFn = (iconName) => {
+
+
diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue
index 32a8db16f..0afe59877 100644
--- a/src/components/common/VnSelect.vue
+++ b/src/components/common/VnSelect.vue
@@ -54,6 +54,10 @@ const $props = defineProps({
type: [Array],
default: () => [],
},
+ filterFn: {
+ type: Function,
+ default: null,
+ },
exprBuilder: {
type: Function,
default: null,
@@ -62,16 +66,12 @@ const $props = defineProps({
type: Boolean,
default: true,
},
- defaultFilter: {
- type: Boolean,
- default: true,
- },
fields: {
type: Array,
default: null,
},
include: {
- type: [Object, Array],
+ type: [Object, Array, String],
default: null,
},
where: {
@@ -79,7 +79,7 @@ const $props = defineProps({
default: null,
},
sortBy: {
- type: String,
+ type: [String, Array],
default: null,
},
limit: {
@@ -152,10 +152,22 @@ const value = computed({
},
});
+const arrayDataKey =
+ $props.dataKey ??
+ ($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
+
+const arrayData = useArrayData(arrayDataKey, {
+ url: $props.url,
+ searchUrl: false,
+ mapKey: $attrs['map-key'],
+});
+
const computedSortBy = computed(() => {
return $props.sortBy || $props.optionLabel + ' ASC';
});
+const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
+
watch(options, (newValue) => {
setOptions(newValue);
});
@@ -174,16 +186,6 @@ onMounted(() => {
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
});
-const arrayDataKey =
- $props.dataKey ??
- ($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
-
-const arrayData = useArrayData(arrayDataKey, {
- url: $props.url,
- searchUrl: false,
- mapKey: $attrs['map-key'],
-});
-
function findKeyInOptions() {
if (!$props.options) return;
return filter($props.modelValue, $props.options)?.length;
@@ -252,43 +254,41 @@ async function fetchFilter(val) {
}
async function filterHandler(val, update) {
- if (isLoading.value) return update();
- if (!val && lastVal.value === val) {
- lastVal.value = val;
- return update();
- }
- lastVal.value = val;
let newOptions;
- if (!$props.defaultFilter) return update();
- if (
- $props.url &&
- ($props.limit || (!$props.limit && Object.keys(myOptions.value).length === 0))
- ) {
- newOptions = await fetchFilter(val);
- } else newOptions = filter(val, myOptionsOriginal.value);
- update(
- () => {
- if ($props.noOne && noOneText.toLowerCase().includes(val.toLowerCase()))
- newOptions.unshift(noOneOpt.value);
+ if ($props.filterFn) update($props.filterFn(val));
+ else if (!val && lastVal.value === val) update();
+ else {
+ const makeRequest =
+ ($props.url && $props.limit) ||
+ (!$props.limit && Object.keys(myOptions.value).length === 0);
+ newOptions = makeRequest
+ ? await fetchFilter(val)
+ : filter(val, myOptionsOriginal.value);
- myOptions.value = newOptions;
- },
- (ref) => {
- if (val !== '' && ref.options.length > 0) {
- ref.setOptionIndex(-1);
- ref.moveOptionSelection(1, true);
- }
- },
- );
+ update(
+ () => {
+ if ($props.noOne && noOneText.toLowerCase().includes(val.toLowerCase()))
+ newOptions.unshift(noOneOpt.value);
+
+ myOptions.value = newOptions;
+ },
+ (ref) => {
+ if (val !== '' && ref.options.length > 0) {
+ ref.setOptionIndex(-1);
+ ref.moveOptionSelection(1, true);
+ }
+ },
+ );
+ }
+
+ lastVal.value = val;
}
function nullishToTrue(value) {
return value ?? true;
}
-const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
-
async function onScroll({ to, direction, from, index }) {
const lastIndex = myOptions.value.length - 1;
diff --git a/src/components/common/VnSmsDialog.vue b/src/components/common/VnSmsDialog.vue
index 8851a33b2..ada2d02fa 100644
--- a/src/components/common/VnSmsDialog.vue
+++ b/src/components/common/VnSmsDialog.vue
@@ -232,7 +232,7 @@ fr:
pt: Portugais
pt:
Send SMS: Enviar SMS
- CustomerDefaultLanguage: Este cliente utiliza o {locale} como seu idioma padrão
+ CustomerDefaultLanguage: Este cliente utiliza o {locale} como seu idioma padrão
Language: Linguagem
Phone: Móvel
Subject: Assunto
diff --git a/src/components/common/__tests__/VnDiscount.spec.js b/src/components/common/__tests__/VnDiscount.spec.js
index 5d5be61ac..34c4ff630 100644
--- a/src/components/common/__tests__/VnDiscount.spec.js
+++ b/src/components/common/__tests__/VnDiscount.spec.js
@@ -4,7 +4,7 @@ import VnDiscount from 'components/common/vnDiscount.vue';
describe('VnDiscount', () => {
let vm;
-
+
beforeAll(() => {
vm = createWrapper(VnDiscount, {
props: {
@@ -12,7 +12,9 @@ describe('VnDiscount', () => {
price: 100,
quantity: 2,
discount: 10,
- }
+ mana: 10,
+ promise: vi.fn(),
+ },
}).vm;
});
@@ -21,8 +23,8 @@ describe('VnDiscount', () => {
});
describe('total', () => {
- it('should calculate total correctly', () => {
+ it('should calculate total correctly', () => {
expect(vm.total).toBe(180);
});
});
-});
\ No newline at end of file
+});
diff --git a/src/components/common/__tests__/VnDms.spec.js b/src/components/common/__tests__/VnDms.spec.js
index 66d946db3..86f12169b 100644
--- a/src/components/common/__tests__/VnDms.spec.js
+++ b/src/components/common/__tests__/VnDms.spec.js
@@ -41,10 +41,12 @@ describe('VnDms', () => {
companyFk: 2,
dmsTypeFk: 3,
description: 'This is a test description',
- files: {
- name: 'example.txt',
- content: new Blob(['file content'], { type: 'text/plain' }),
- },
+ files: [
+ {
+ name: 'example.txt',
+ content: new Blob(['file content'], { type: 'text/plain' }),
+ },
+ ],
};
const expectedBody = {
@@ -83,7 +85,7 @@ describe('VnDms', () => {
it('should map DMS data correctly and add file to FormData', () => {
const [formData, params] = vm.mapperDms(data);
- expect(formData.get('example.txt')).toBe(data.files);
+ expect([formData.get('example.txt')]).toStrictEqual(data.files);
expect(expectedBody).toEqual(params.params);
});
diff --git a/src/components/common/__tests__/VnInput.spec.js b/src/components/common/__tests__/VnInput.spec.js
index 13f9ed804..8eb2c50c8 100644
--- a/src/components/common/__tests__/VnInput.spec.js
+++ b/src/components/common/__tests__/VnInput.spec.js
@@ -2,7 +2,6 @@ import { createWrapper } from 'app/test/vitest/helper';
import { vi, describe, expect, it } from 'vitest';
import VnInput from 'src/components/common/VnInput.vue';
-
describe('VnInput', () => {
let vm;
let wrapper;
@@ -11,26 +10,28 @@ describe('VnInput', () => {
function generateWrapper(value, isOutlined, emptyToNull, insertable) {
wrapper = createWrapper(VnInput, {
props: {
- modelValue: value,
- isOutlined, emptyToNull, insertable,
- maxlength: 101
+ modelValue: value,
+ isOutlined,
+ emptyToNull,
+ insertable,
+ maxlength: 101,
},
attrs: {
label: 'test',
required: true,
maxlength: 101,
maxLength: 10,
- 'max-length':20
+ 'max-length': 20,
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
input = wrapper.find('[data-cy="test_input"]');
- };
+ }
describe('value', () => {
it('should emit update:modelValue when value changes', async () => {
- generateWrapper('12345', false, false, true)
+ generateWrapper('12345', false, false, true);
await input.setValue('123');
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['123']);
@@ -46,37 +47,36 @@ describe('VnInput', () => {
describe('styleAttrs', () => {
it('should return empty styleAttrs when isOutlined is false', async () => {
generateWrapper('123', false, false, false);
- expect(vm.styleAttrs).toEqual({});
+ expect(vm.styleAttrs).toEqual({});
});
- it('should set styleAttrs when isOutlined is true', async () => {
+ it('should set styleAttrs when isOutlined is true', async () => {
generateWrapper('123', true, false, false);
expect(vm.styleAttrs.outlined).toBe(true);
});
});
- describe('handleKeydown', () => {
+ describe('handleKeydown', () => {
it('should do nothing when "Backspace" key is pressed', async () => {
generateWrapper('12345', false, false, true);
await input.trigger('keydown', { key: 'Backspace' });
expect(wrapper.emitted('update:modelValue')).toBeUndefined();
const spyhandler = vi.spyOn(vm, 'handleInsertMode');
expect(spyhandler).not.toHaveBeenCalled();
-
});
-
+
/*
TODO: #8399 REDMINE
*/
it.skip('handleKeydown respects insertable behavior', async () => {
const expectedValue = '12345';
generateWrapper('1234', false, false, true);
- vm.focus()
+ vm.focus();
await input.trigger('keydown', { key: '5' });
await vm.$nextTick();
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
- expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue ]);
- expect(vm.value).toBe( expectedValue);
+ expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue]);
+ expect(vm.value).toBe(expectedValue);
});
});
@@ -86,6 +86,6 @@ describe('VnInput', () => {
const focusSpy = vi.spyOn(input.element, 'focus');
vm.focus();
expect(focusSpy).toHaveBeenCalled();
- });
+ });
});
});
diff --git a/src/components/common/__tests__/VnInputDateTime.spec.js b/src/components/common/__tests__/VnInputDateTime.spec.js
new file mode 100644
index 000000000..adff1dbc4
--- /dev/null
+++ b/src/components/common/__tests__/VnInputDateTime.spec.js
@@ -0,0 +1,81 @@
+import { createWrapper } from 'app/test/vitest/helper.js';
+import { describe, it, expect, beforeAll } from 'vitest';
+import VnInputDateTime from 'components/common/VnInputDateTime.vue';
+import vnDateBoot from 'src/boot/vnDate';
+
+let vm;
+let wrapper;
+
+beforeAll(() => {
+ // Initialize the vnDate boot
+ vnDateBoot();
+});
+function generateWrapper(date, outlined, showEvent) {
+ wrapper = createWrapper(VnInputDateTime, {
+ props: {
+ modelValue: date,
+ isOutlined: outlined,
+ showEvent: showEvent,
+ },
+ });
+ wrapper = wrapper.wrapper;
+ vm = wrapper.vm;
+}
+
+describe('VnInputDateTime', () => {
+ describe('selectedDate', () => {
+ it('formats a valid datetime correctly', async () => {
+ generateWrapper('2023-12-25T10:30:00', false, true);
+ await vm.$nextTick();
+ expect(vm.selectedDate).toBe('25-12-2023 10:30');
+ });
+
+ it('handles null date value', async () => {
+ generateWrapper(null, false, true);
+ await vm.$nextTick();
+ expect(vm.selectedDate).not.toBe(null);
+ });
+
+ it('updates the model value when a new datetime is set', async () => {
+ vm.selectedDate = '31-12-2023 15:45';
+ await vm.$nextTick();
+ expect(wrapper.emitted()['update:modelValue']).toBeTruthy();
+ });
+ });
+
+ describe('styleAttrs', () => {
+ it('should return empty styleAttrs when isOutlined is false', async () => {
+ generateWrapper('2023-12-25T10:30:00', false, true);
+ await vm.$nextTick();
+ expect(vm.styleAttrs).toEqual({});
+ });
+
+ it('should set styleAttrs when isOutlined is true', async () => {
+ generateWrapper('2023-12-25T10:30:00', true, true);
+ await vm.$nextTick();
+ expect(vm.styleAttrs).toEqual({
+ dense: true,
+ outlined: true,
+ rounded: true,
+ });
+ });
+ });
+
+ describe('component rendering', () => {
+ it('should render date and time icons', async () => {
+ generateWrapper('2023-12-25T10:30:00', false, true);
+ await vm.$nextTick();
+ const icons = wrapper.findAllComponents({ name: 'QIcon' });
+ expect(icons.length).toBe(2);
+ expect(icons[0].props('name')).toBe('today');
+ expect(icons[1].props('name')).toBe('access_time');
+ });
+
+ it('should render popup proxies for date and time', async () => {
+ generateWrapper('2023-12-25T10:30:00', false, true);
+ await vm.$nextTick();
+ const popups = wrapper.findAllComponents({ name: 'QPopupProxy' });
+ expect(popups.length).toBe(2);
+ });
+ });
+});
diff --git a/src/components/common/__tests__/VnLog.spec.js b/src/components/common/__tests__/VnLog.spec.js
index fcb516cc5..399b78a1d 100644
--- a/src/components/common/__tests__/VnLog.spec.js
+++ b/src/components/common/__tests__/VnLog.spec.js
@@ -90,8 +90,10 @@ describe('VnLog', () => {
vm = createWrapper(VnLog, {
global: {
- stubs: [],
- mocks: {},
+ stubs: ['FetchData', 'vue-i18n'],
+ mocks: {
+ fetch: vi.fn(),
+ },
},
propsData: {
model: 'Claim',
diff --git a/src/components/common/__tests__/VnNotes.spec.js b/src/components/common/__tests__/VnNotes.spec.js
index e0514cc7b..0d256a736 100644
--- a/src/components/common/__tests__/VnNotes.spec.js
+++ b/src/components/common/__tests__/VnNotes.spec.js
@@ -26,7 +26,7 @@ describe('VnNotes', () => {
) {
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
wrapper = createWrapper(VnNotes, {
- propsData: options,
+ propsData: { ...defaultOptions, ...options },
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
diff --git a/src/components/ui/EntityDescriptor.vue b/src/components/ui/EntityDescriptor.vue
index a5dced551..e6adaa5f7 100644
--- a/src/components/ui/EntityDescriptor.vue
+++ b/src/components/ui/EntityDescriptor.vue
@@ -44,7 +44,8 @@ onBeforeMount(async () => {
});
// It enables to load data only once if the module is the same as the dataKey
- if (!isSameDataKey.value || !route.params.id) await getData();
+ if (!isSameDataKey.value || !route.params.id || $props.id !== route.params.id)
+ await getData();
watch(
() => [$props.url, $props.filter],
async () => {
@@ -58,7 +59,8 @@ async function getData() {
store.filter = $props.filter ?? {};
isLoading.value = true;
try {
- const { data } = await arrayData.fetch({ append: false, updateRouter: false });
+ await arrayData.fetch({ append: false, updateRouter: false });
+ const { data } = store;
state.set($props.dataKey, data);
emit('onFetch', data);
} finally {
diff --git a/src/components/ui/VnDescriptor.vue b/src/components/ui/VnDescriptor.vue
index 994233eb0..69fd5af6b 100644
--- a/src/components/ui/VnDescriptor.vue
+++ b/src/components/ui/VnDescriptor.vue
@@ -6,6 +6,7 @@ import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useRoute, useRouter } from 'vue-router';
import { useClipboard } from 'src/composables/useClipboard';
import VnMoreOptions from './VnMoreOptions.vue';
+import { getValueFromPath } from 'src/composables/getValueFromPath';
const entity = defineModel({ type: Object, default: null });
const $props = defineProps({
@@ -56,18 +57,6 @@ const routeName = computed(() => {
return `${routeName}Summary`;
});
-function getValueFromPath(path) {
- if (!path) return;
- const keys = path.toString().split('.');
- let current = entity.value;
-
- for (const key of keys) {
- if (current[key] === undefined) return undefined;
- else current = current[key];
- }
- return current;
-}
-
function copyIdText(id) {
copyText(id, {
component: {
@@ -170,10 +159,10 @@ const toModule = computed(() => {
- {{ getValueFromPath(title) ?? title }}
+ {{ getValueFromPath(entity, title) ?? title }}
{
class="subtitle"
:data-cy="`${$attrs['data-cy'] ?? 'vnDescriptor'}_subtitle`"
>
- #{{ getValueFromPath(subtitle) ?? entity.id }}
+ #{{ getValueFromPath(entity, subtitle) ?? entity.id }}
{
color="primary"
style="position: fixed; z-index: 1; right: 0; bottom: 0"
icon="search"
+ data-cy="vnFilterPanel_search"
@click="search()"
>
@@ -229,6 +230,7 @@ const getLocale = (label) => {
{
$props.value);
- {{ label }}
+ {{ tooltip }}
+
+ {{ label }}
+
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index 8fbfb067f..b232e6c05 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -2,7 +2,9 @@
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData';
+import { useAttrs } from 'vue';
+const attrs = useAttrs();
const { t } = useI18n();
const props = defineProps({
@@ -67,7 +69,7 @@ const props = defineProps({
default: null,
},
searchUrl: {
- type: String,
+ type: [String, Boolean],
default: null,
},
disableInfiniteScroll: {
@@ -75,7 +77,7 @@ const props = defineProps({
default: false,
},
mapKey: {
- type: String,
+ type: [String, Boolean],
default: '',
},
keyData: {
@@ -220,7 +222,7 @@ defineExpose({
-
+
-import { ref } from 'vue';
-import { useI18n } from 'vue-i18n';
-
-const { t } = useI18n();
-const props = defineProps({
- usesMana: {
- type: Boolean,
- required: true,
- },
- manaCode: {
- type: String,
- required: true,
- },
- manaVal: {
- type: String,
- default: 'mana',
- },
- manaLabel: {
- type: String,
- default: 'Promotion mana',
- },
- manaClaimVal: {
- type: String,
- default: 'manaClaim',
- },
- claimLabel: {
- type: String,
- default: 'Claim mana',
- },
-});
-
-const manaCode = ref(props.manaCode);
-
-
-
-
-
-
-
-
-
- es:
- Promotion mana: Maná promoción
- Claim mana: Maná reclamación
-
diff --git a/src/components/ui/__tests__/CardSummary.spec.js b/src/components/ui/__tests__/CardSummary.spec.js
index ff6f60697..16b903eba 100644
--- a/src/components/ui/__tests__/CardSummary.spec.js
+++ b/src/components/ui/__tests__/CardSummary.spec.js
@@ -23,10 +23,15 @@ describe('CardSummary', () => {
beforeEach(() => {
wrapper = createWrapper(CardSummary, {
+ global: {
+ mocks: {
+ validate: vi.fn(),
+ },
+ },
propsData: {
dataKey: 'cardSummaryKey',
url: 'cardSummaryUrl',
- filter: 'cardFilter',
+ filter: { key: 'cardFilter' },
},
});
vm = wrapper.vm;
@@ -50,7 +55,7 @@ describe('CardSummary', () => {
it('should set correct props to the store', () => {
expect(vm.store.url).toEqual('cardSummaryUrl');
- expect(vm.store.filter).toEqual('cardFilter');
+ expect(vm.store.filter).toEqual({ key: 'cardFilter' });
});
it('should respond to prop changes and refetch data', async () => {
diff --git a/src/components/ui/__tests__/VnSearchbar.spec.js b/src/components/ui/__tests__/VnSearchbar.spec.js
index 25649194d..64014e8d8 100644
--- a/src/components/ui/__tests__/VnSearchbar.spec.js
+++ b/src/components/ui/__tests__/VnSearchbar.spec.js
@@ -7,7 +7,7 @@ describe('VnSearchbar', () => {
let wrapper;
let applyFilterSpy;
const searchText = 'Bolas de madera';
- const userParams = {staticKey: 'staticValue'};
+ const userParams = { staticKey: 'staticValue' };
beforeEach(async () => {
wrapper = createWrapper(VnSearchbar, {
@@ -23,8 +23,9 @@ describe('VnSearchbar', () => {
vm.searchText = searchText;
vm.arrayData.store.userParams = userParams;
- applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {});
-
+ applyFilterSpy = vi
+ .spyOn(vm.arrayData, 'applyFilter')
+ .mockImplementation(() => {});
});
afterEach(() => {
@@ -32,7 +33,9 @@ describe('VnSearchbar', () => {
});
it('search resets pagination and applies filter', async () => {
- const resetPaginationSpy = vi.spyOn(vm.arrayData, 'resetPagination').mockImplementation(() => {});
+ const resetPaginationSpy = vi
+ .spyOn(vm.arrayData, 'resetPagination')
+ .mockImplementation(() => {});
await vm.search();
expect(resetPaginationSpy).toHaveBeenCalled();
@@ -48,7 +51,7 @@ describe('VnSearchbar', () => {
expect(applyFilterSpy).toHaveBeenCalledWith({
params: { staticKey: 'staticValue', search: searchText },
- filter: {skip: 0},
+ filter: { skip: 0 },
});
});
@@ -68,4 +71,4 @@ describe('VnSearchbar', () => {
});
expect(vm.to.query.searchParam).toBe(expectedQuery);
});
-});
\ No newline at end of file
+});
diff --git a/src/components/ui/__tests__/VnSms.spec.js b/src/components/ui/__tests__/VnSms.spec.js
index 4f4fd7d49..b71d8ccb0 100644
--- a/src/components/ui/__tests__/VnSms.spec.js
+++ b/src/components/ui/__tests__/VnSms.spec.js
@@ -1,5 +1,4 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
-import axios from 'axios';
import { createWrapper } from 'app/test/vitest/helper';
import VnSms from 'src/components/ui/VnSms.vue';
@@ -12,6 +11,9 @@ describe('VnSms', () => {
stubs: ['VnPaginate'],
mocks: {},
},
+ propsData: {
+ url: 'SmsUrl',
+ },
}).vm;
});
diff --git a/src/composables/__tests__/useArrayData.spec.js b/src/composables/__tests__/useArrayData.spec.js
index a3fbbdd5d..74be8ccff 100644
--- a/src/composables/__tests__/useArrayData.spec.js
+++ b/src/composables/__tests__/useArrayData.spec.js
@@ -4,6 +4,8 @@ import { useArrayData } from 'composables/useArrayData';
import { useRouter } from 'vue-router';
import * as vueRouter from 'vue-router';
import { setActivePinia, createPinia } from 'pinia';
+import { defineComponent, h } from 'vue';
+import { mount } from '@vue/test-utils';
describe('useArrayData', () => {
const filter = '{"limit":20,"skip":0}';
@@ -43,7 +45,7 @@ describe('useArrayData', () => {
it('should fetch and replace url with new params', async () => {
vi.spyOn(axios, 'get').mockResolvedValueOnce({ data: [] });
- const arrayData = useArrayData('ArrayData', {
+ const arrayData = mountArrayData('ArrayData', {
url: 'mockUrl',
searchUrl: 'params',
});
@@ -72,7 +74,7 @@ describe('useArrayData', () => {
data: [{ id: 1 }],
});
- const arrayData = useArrayData('ArrayData', {
+ const arrayData = mountArrayData('ArrayData', {
url: 'mockUrl',
navigate: {},
});
@@ -94,7 +96,7 @@ describe('useArrayData', () => {
],
});
- const arrayData = useArrayData('ArrayData', {
+ const arrayData = mountArrayData('ArrayData', {
url: 'mockUrl',
oneRecord: true,
});
@@ -107,3 +109,17 @@ describe('useArrayData', () => {
});
});
});
+
+function mountArrayData(...args) {
+ let arrayData;
+
+ const TestComponent = defineComponent({
+ setup() {
+ arrayData = useArrayData(...args);
+ return () => h('div');
+ },
+ });
+
+ const asd = mount(TestComponent);
+ return arrayData;
+}
diff --git a/src/composables/__tests__/useSession.spec.js b/src/composables/__tests__/useSession.spec.js
index e86847b70..eb390e096 100644
--- a/src/composables/__tests__/useSession.spec.js
+++ b/src/composables/__tests__/useSession.spec.js
@@ -64,88 +64,84 @@ describe('session', () => {
});
});
- describe(
- 'login',
- () => {
- const expectedUser = {
- id: 999,
- name: `T'Challa`,
- nickname: 'Black Panther',
- lang: 'en',
- userConfig: {
- darkMode: false,
+ describe('login', () => {
+ const expectedUser = {
+ id: 999,
+ name: `T'Challa`,
+ nickname: 'Black Panther',
+ lang: 'en',
+ userConfig: {
+ darkMode: false,
+ },
+ worker: { department: { departmentFk: 155 } },
+ };
+ const rolesData = [
+ {
+ role: {
+ name: 'salesPerson',
},
- worker: { department: { departmentFk: 155 } },
- };
- const rolesData = [
- {
- role: {
- name: 'salesPerson',
- },
+ },
+ {
+ role: {
+ name: 'admin',
},
- {
- role: {
- name: 'admin',
- },
- },
- ];
- beforeEach(() => {
- vi.spyOn(axios, 'get').mockImplementation((url) => {
- if (url === 'VnUsers/acls') return Promise.resolve({ data: [] });
- return Promise.resolve({
- data: { roles: rolesData, user: expectedUser },
- });
+ },
+ ];
+ beforeEach(() => {
+ vi.spyOn(axios, 'get').mockImplementation((url) => {
+ if (url === 'VnUsers/acls') return Promise.resolve({ data: [] });
+ return Promise.resolve({
+ data: { roles: rolesData, user: expectedUser },
});
});
+ });
- it('should fetch the user roles and then set token in the sessionStorage', async () => {
- const expectedRoles = ['salesPerson', 'admin'];
- const expectedToken = 'mySessionToken';
- const expectedTokenMultimedia = 'mySessionTokenMultimedia';
- const keepLogin = false;
+ it('should fetch the user roles and then set token in the sessionStorage', async () => {
+ const expectedRoles = ['salesPerson', 'admin'];
+ const expectedToken = 'mySessionToken';
+ const expectedTokenMultimedia = 'mySessionTokenMultimedia';
+ const keepLogin = false;
- await session.login({
- token: expectedToken,
- tokenMultimedia: expectedTokenMultimedia,
- keepLogin,
- });
-
- const roles = state.getRoles();
- const localToken = localStorage.getItem('token');
- const sessionToken = sessionStorage.getItem('token');
-
- expect(roles.value).toEqual(expectedRoles);
- expect(localToken).toBeNull();
- expect(sessionToken).toEqual(expectedToken);
-
- await session.destroy(); // this clears token and user for any other test
+ await session.login({
+ token: expectedToken,
+ tokenMultimedia: expectedTokenMultimedia,
+ keepLogin,
});
- it('should fetch the user roles and then set token in the localStorage', async () => {
- const expectedRoles = ['salesPerson', 'admin'];
- const expectedToken = 'myLocalToken';
- const expectedTokenMultimedia = 'myLocalTokenMultimedia';
- const keepLogin = true;
+ const roles = state.getRoles();
+ const localToken = localStorage.getItem('token');
+ const sessionToken = sessionStorage.getItem('token');
- await session.login({
- token: expectedToken,
- tokenMultimedia: expectedTokenMultimedia,
- keepLogin,
- });
+ expect(roles.value).toEqual(expectedRoles);
+ expect(localToken).toBeNull();
+ expect(sessionToken).toEqual(expectedToken);
- const roles = state.getRoles();
- const localToken = localStorage.getItem('token');
- const sessionToken = sessionStorage.getItem('token');
+ await session.destroy(); // this clears token and user for any other test
+ });
- expect(roles.value).toEqual(expectedRoles);
- expect(localToken).toEqual(expectedToken);
- expect(sessionToken).toBeNull();
+ it('should fetch the user roles and then set token in the localStorage', async () => {
+ const expectedRoles = ['salesPerson', 'admin'];
+ const expectedToken = 'myLocalToken';
+ const expectedTokenMultimedia = 'myLocalTokenMultimedia';
+ const keepLogin = true;
- await session.destroy(); // this clears token and user for any other test
+ await session.login({
+ token: expectedToken,
+ tokenMultimedia: expectedTokenMultimedia,
+ keepLogin,
});
- },
- {},
- );
+
+ const roles = state.getRoles();
+ const localToken = localStorage.getItem('token');
+ const sessionToken = sessionStorage.getItem('token');
+
+ expect(roles.value).toEqual(expectedRoles);
+ expect(localToken).toEqual(expectedToken);
+ expect(sessionToken).toBeNull();
+
+ await session.destroy(); // this clears token and user for any other test
+ });
+ });
describe('RenewToken', () => {
const expectedToken = 'myToken';
diff --git a/src/composables/getValueFromPath.js b/src/composables/getValueFromPath.js
new file mode 100644
index 000000000..2c94379cc
--- /dev/null
+++ b/src/composables/getValueFromPath.js
@@ -0,0 +1,11 @@
+export function getValueFromPath(root, path) {
+ if (!root || !path) return;
+ const keys = path.toString().split('.');
+ let current = root;
+
+ for (const key of keys) {
+ if (current[key] === undefined) return undefined;
+ else current = current[key];
+ }
+ return current;
+}
\ No newline at end of file
diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss
index 45d18af7e..c443c5826 100644
--- a/src/css/quasar.variables.scss
+++ b/src/css/quasar.variables.scss
@@ -18,6 +18,7 @@ $positive: #c8e484;
$negative: #fb5252;
$info: #84d0e2;
$warning: #f4b974;
+$neutral: #b0b0b0;
// Pendiente de cuadrar con la base de datos
$success: $positive;
$alert: $negative;
@@ -51,3 +52,6 @@ $width-xl: 1600px;
.bg-alert {
background-color: $negative;
}
+.bg-neutral {
+ background-color: $neutral;
+}
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index 4f4d1d5f7..de5a27ff2 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -6,6 +6,7 @@ globals:
quantity: Quantity
entity: Entity
preview: Preview
+ scrollToTop: Go up
user: User
details: Details
collapseMenu: Collapse lateral menu
@@ -19,6 +20,7 @@ globals:
logOut: Log out
date: Date
dataSaved: Data saved
+ openDetail: Open detail
dataDeleted: Data deleted
delete: Delete
search: Search
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 9c808e046..84ba150c4 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -6,6 +6,7 @@ globals:
quantity: Cantidad
entity: Entidad
preview: Vista previa
+ scrollToTop: Ir arriba
user: Usuario
details: Detalles
collapseMenu: Contraer menú lateral
@@ -20,10 +21,11 @@ globals:
date: Fecha
dataSaved: Datos guardados
dataDeleted: Datos eliminados
+ dataCreated: Datos creados
+ openDetail: Ver detalle
delete: Eliminar
search: Buscar
changes: Cambios
- dataCreated: Datos creados
add: Añadir
create: Crear
edit: Modificar
diff --git a/src/pages/Claim/Card/ClaimDescriptor.vue b/src/pages/Claim/Card/ClaimDescriptor.vue
index 76ede81ed..3728a18c0 100644
--- a/src/pages/Claim/Card/ClaimDescriptor.vue
+++ b/src/pages/Claim/Card/ClaimDescriptor.vue
@@ -28,14 +28,8 @@ const entityId = computed(() => {
return $props.id || route.params.id;
});
-const STATE_COLOR = {
- pending: 'warning',
- incomplete: 'info',
- resolved: 'positive',
- canceled: 'negative',
-};
-function stateColor(code) {
- return STATE_COLOR[code];
+function stateColor(entity) {
+ return entity?.claimState?.classColor;
}
onMounted(async () => {
@@ -57,9 +51,8 @@ onMounted(async () => {
{{ entity.claimState.description }}
diff --git a/src/pages/Claim/Card/ClaimPhoto.vue b/src/pages/Claim/Card/ClaimPhoto.vue
index 4ced7e862..f02038afe 100644
--- a/src/pages/Claim/Card/ClaimPhoto.vue
+++ b/src/pages/Claim/Card/ClaimPhoto.vue
@@ -23,7 +23,7 @@ const claimDms = ref([
]);
const client = ref({});
const inputFile = ref();
-const files = ref({});
+const files = ref([]);
const spinnerRef = ref();
const claimDmsRef = ref();
const dmsType = ref({});
@@ -255,9 +255,8 @@ function onDrag() {
icon="add"
color="primary"
>
- state.code === code);
+ return claimState?.classColor;
}
const developmentColumns = ref([
@@ -188,7 +182,7 @@ function claimUrl(section) {
(claimStates = data)"
auto-load
/>
@@ -346,17 +340,18 @@ function claimUrl(section) {
- {{
- t(col.value)
- }}
- {{
- t(col.value)
- }}
-
+
+ {{
+ dashIfEmpty(col.field(props.row))
+ }}
+
+
+
+ {{ dashIfEmpty(col.field(props.row)) }}
+
diff --git a/src/pages/Claim/Card/__tests__/ClaimLines.spec.js b/src/pages/Claim/Card/__tests__/ClaimLines.spec.js
index d975fb514..1ed5cccab 100644
--- a/src/pages/Claim/Card/__tests__/ClaimLines.spec.js
+++ b/src/pages/Claim/Card/__tests__/ClaimLines.spec.js
@@ -52,7 +52,7 @@ describe('ClaimLines', () => {
expectedData,
{
signal: canceller.signal,
- }
+ },
);
});
});
@@ -69,7 +69,7 @@ describe('ClaimLines', () => {
expect.objectContaining({
message: 'Discount updated',
type: 'positive',
- })
+ }),
);
});
});
diff --git a/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js b/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js
index 2a5176d0a..cec4b1681 100644
--- a/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js
+++ b/src/pages/Claim/Card/__tests__/ClaimLinesImport.spec.js
@@ -14,6 +14,9 @@ describe('ClaimLinesImport', () => {
fetch: vi.fn(),
},
},
+ propsData: {
+ ticketId: 1,
+ },
}).vm;
});
@@ -40,7 +43,7 @@ describe('ClaimLinesImport', () => {
expect.objectContaining({
message: 'Lines added to claim',
type: 'positive',
- })
+ }),
);
expect(vm.canceller).toEqual(null);
});
diff --git a/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js b/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js
index b14338b5c..bf3548af3 100644
--- a/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js
+++ b/src/pages/Claim/Card/__tests__/ClaimPhoto.spec.js
@@ -41,10 +41,10 @@ describe('ClaimPhoto', () => {
await vm.deleteDms({ index: 0 });
expect(axios.post).toHaveBeenCalledWith(
- `ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`
+ `ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`,
);
expect(vm.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({ type: 'positive' })
+ expect.objectContaining({ type: 'positive' }),
);
});
});
@@ -63,7 +63,7 @@ describe('ClaimPhoto', () => {
data: { index: 1 },
promise: vm.deleteDms,
},
- })
+ }),
);
});
});
@@ -102,10 +102,10 @@ describe('ClaimPhoto', () => {
new FormData(),
expect.objectContaining({
params: expect.objectContaining({ hasFile: false }),
- })
+ }),
);
expect(vm.quasar.notify).toHaveBeenCalledWith(
- expect.objectContaining({ type: 'positive' })
+ expect.objectContaining({ type: 'positive' }),
);
expect(vm.claimDmsRef.fetch).toHaveBeenCalledOnce();
diff --git a/src/pages/Claim/ClaimList.vue b/src/pages/Claim/ClaimList.vue
index e0d9928f9..d6a77bafe 100644
--- a/src/pages/Claim/ClaimList.vue
+++ b/src/pages/Claim/ClaimList.vue
@@ -101,7 +101,10 @@ const columns = computed(() => [
name: 'stateCode',
chip: {
condition: () => true,
- color: ({ stateCode }) => STATE_COLOR[stateCode] ?? 'bg-grey',
+ color: ({ stateCode }) => {
+ const state = states.value?.find(({ code }) => code === stateCode);
+ return `bg-${state.classColor}`;
+ },
},
columnFilter: {
name: 'claimStateFk',
@@ -131,12 +134,6 @@ const columns = computed(() => [
],
},
]);
-
-const STATE_COLOR = {
- pending: 'bg-warning',
- loses: 'bg-negative',
- resolved: 'bg-positive',
-};
diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue
index 4855fadc0..13c337ab0 100644
--- a/src/pages/Customer/Card/CustomerBalance.vue
+++ b/src/pages/Customer/Card/CustomerBalance.vue
@@ -131,6 +131,7 @@ const columns = computed(() => [
name: 'isConciliate',
label: t('Conciliated'),
cardVisible: true,
+ component: 'checkbox',
},
{
align: 'left',
diff --git a/src/pages/Customer/Card/CustomerConsumption.vue b/src/pages/Customer/Card/CustomerConsumption.vue
index f3949bb32..db7236a3d 100644
--- a/src/pages/Customer/Card/CustomerConsumption.vue
+++ b/src/pages/Customer/Card/CustomerConsumption.vue
@@ -18,7 +18,7 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
-const arrayData = useArrayData('Client');
+const arrayData = useArrayData('Customer');
const { t } = useI18n();
const route = useRoute();
const campaignList = ref();
@@ -260,7 +260,7 @@ const updateDateParams = (value, params) => {
:label="t('globals.campaign')"
:filled="true"
class="q-px-sm q-pt-none fit"
- :option-label="(opt) => t(opt.code)"
+ :option-label="(opt) => t(opt.code ?? '')"
:fields="['id', 'code', 'dated', 'scopeDays']"
@update:model-value="(data) => updateDateParams(data, params)"
dense
diff --git a/src/pages/Customer/Card/CustomerDescriptor.vue b/src/pages/Customer/Card/CustomerDescriptor.vue
index c7461f890..8b4e025a2 100644
--- a/src/pages/Customer/Card/CustomerDescriptor.vue
+++ b/src/pages/Customer/Card/CustomerDescriptor.vue
@@ -39,7 +39,7 @@ const route = useRoute();
const { t } = useI18n();
const entityId = computed(() => {
- return $props.id || route.params.id;
+ return Number($props.id || route.params.id);
});
const data = ref(useCardDescription());
diff --git a/src/pages/Customer/Card/CustomerDescriptorProxy.vue b/src/pages/Customer/Card/CustomerDescriptorProxy.vue
index 9f67d02ec..f1e4b42b8 100644
--- a/src/pages/Customer/Card/CustomerDescriptorProxy.vue
+++ b/src/pages/Customer/Card/CustomerDescriptorProxy.vue
@@ -11,7 +11,7 @@ const $props = defineProps({
-
+
diff --git a/src/pages/Customer/Card/CustomerFiscalData.vue b/src/pages/Customer/Card/CustomerFiscalData.vue
index baa728868..f4efd03b6 100644
--- a/src/pages/Customer/Card/CustomerFiscalData.vue
+++ b/src/pages/Customer/Card/CustomerFiscalData.vue
@@ -86,7 +86,7 @@ async function acceptPropagate({ isEqualizated }) {
:required="true"
:rules="validate('client.socialName')"
clearable
- uppercase="true"
+ :uppercase="true"
v-model="data.socialName"
>
diff --git a/src/pages/Customer/Card/CustomerSamples.vue b/src/pages/Customer/Card/CustomerSamples.vue
index 19a7f8759..44fab8e72 100644
--- a/src/pages/Customer/Card/CustomerSamples.vue
+++ b/src/pages/Customer/Card/CustomerSamples.vue
@@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { QBtn, useQuasar } from 'quasar';
-
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { toDateTimeFormat } from 'src/filters/date';
import VnTable from 'src/components/VnTable/VnTable.vue';
@@ -34,7 +33,7 @@ const columns = computed(() => [
},
{
align: 'left',
- format: (row) => row.type.description,
+ format: (row) => row?.type?.description,
label: t('Description'),
name: 'description',
},
@@ -74,12 +73,11 @@ const tableRef = ref();
$props.id || route.params.id);
+const entityId = computed(() => Number($props.id || route.params.id));
const customer = computed(() => summary.value.entity);
const summary = ref();
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
@@ -185,7 +185,7 @@ const sumRisk = ({ clientRisks }) => {
/>
@@ -208,7 +208,8 @@ const sumRisk = ({ clientRisks }) => {
:text="t('customer.summary.consignee')"
/>
{
/>
{
/>
@@ -318,8 +321,9 @@ const sumRisk = ({ clientRisks }) => {
/>
diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue
index c30b11528..48538aa2a 100644
--- a/src/pages/Customer/CustomerFilter.vue
+++ b/src/pages/Customer/CustomerFilter.vue
@@ -72,7 +72,7 @@ const exprBuilder = (param, value) => {
option-value="id"
option-label="name"
url="Departments"
- no-one="true"
+ :no-one="true"
/>
diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue
index b721a6ad9..f5e7485a2 100644
--- a/src/pages/Customer/CustomerList.vue
+++ b/src/pages/Customer/CustomerList.vue
@@ -111,14 +111,11 @@ const columns = computed(() => [
component: 'number',
},
columnField: {
- component: null,
- after: {
- component: markRaw(VnLinkPhone),
- attrs: ({ model }) => {
- return {
- 'phone-number': model,
- };
- },
+ component: markRaw(VnLinkPhone),
+ attrs: ({ model }) => {
+ return {
+ 'phone-number': model,
+ };
},
},
},
diff --git a/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js b/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js
index a9c845cec..238545050 100644
--- a/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js
+++ b/src/pages/Customer/Payments/__tests__/CustomerPayments.spec.js
@@ -32,7 +32,7 @@ describe('CustomerPayments', () => {
expect.objectContaining({
message: 'Payment confirmed',
type: 'positive',
- })
+ }),
);
});
});
diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue
index 1294a5d25..dfa944748 100644
--- a/src/pages/Customer/components/CustomerSamplesCreate.vue
+++ b/src/pages/Customer/components/CustomerSamplesCreate.vue
@@ -41,7 +41,6 @@ const sampleType = ref({ hasPreview: false });
const initialData = reactive({});
const entityId = computed(() => route.params.id);
const customer = computed(() => useArrayData('Customer').store?.data);
-const filterEmailUsers = { where: { userFk: user.value.id } };
const filterClientsAddresses = {
include: [
{ relation: 'province', scope: { fields: ['name'] } },
@@ -73,7 +72,7 @@ onBeforeMount(async () => {
const setEmailUser = (data) => {
optionsEmailUsers.value = data;
- initialData.replyTo = data[0]?.email;
+ initialData.replyTo = data[0]?.notificationEmail;
};
const setClientsAddresses = (data) => {
@@ -182,10 +181,12 @@ const toCustomerSamples = () => {
diff --git a/src/pages/Item/components/ItemProposal.vue b/src/pages/Item/components/ItemProposal.vue
index d2dbea7b3..bd0fdc0c2 100644
--- a/src/pages/Item/components/ItemProposal.vue
+++ b/src/pages/Item/components/ItemProposal.vue
@@ -6,10 +6,12 @@ import { toCurrency } from 'filters/index';
import VnStockValueDisplay from 'src/components/ui/VnStockValueDisplay.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import axios from 'axios';
-import notifyResults from 'src/utils/notifyResults';
+import { displayResults } from 'src/pages/Ticket/Negative/composables/notifyResults';
import FetchData from 'components/FetchData.vue';
+import { useState } from 'src/composables/useState';
const MATCH = 'match';
+const { notifyResults } = displayResults();
const { t } = useI18n();
const $props = defineProps({
@@ -18,14 +20,20 @@ const $props = defineProps({
required: true,
default: () => {},
},
+ filter: {
+ type: Object,
+ required: true,
+ default: () => {},
+ },
replaceAction: {
type: Boolean,
- required: false,
+ required: true,
default: false,
},
+
sales: {
type: Array,
- required: false,
+ required: true,
default: () => [],
},
});
@@ -36,6 +44,8 @@ const proposalTableRef = ref(null);
const sale = computed(() => $props.sales[0]);
const saleFk = computed(() => sale.value.saleFk);
const filter = computed(() => ({
+ where: $props.filter,
+
itemFk: $props.itemLack.itemFk,
sales: saleFk.value,
}));
@@ -228,11 +238,15 @@ async function handleTicketConfig(data) {
url="TicketConfigs"
:filter="{ fields: ['lackAlertPrice'] }"
@on-fetch="handleTicketConfig"
- auto-load
+ >
+
import ItemProposal from './ItemProposal.vue';
import { useDialogPluginComponent } from 'quasar';
-
const $props = defineProps({
itemLack: {
type: Object,
required: true,
default: () => {},
},
+ filter: {
+ type: Object,
+ required: true,
+ default: () => {},
+ },
replaceAction: {
type: Boolean,
required: false,
@@ -31,7 +35,7 @@ defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.h
- {{ $t('Item proposal') }}
+ {{ $t('itemProposal') }}
diff --git a/src/pages/Monitor/MonitorClientsActions.vue b/src/pages/Monitor/MonitorClientsActions.vue
index 821773bbf..a6ac3ab0b 100644
--- a/src/pages/Monitor/MonitorClientsActions.vue
+++ b/src/pages/Monitor/MonitorClientsActions.vue
@@ -8,14 +8,14 @@ import VnRow from 'src/components/ui/VnRow.vue';
class="q-pa-md"
:style="{ 'flex-direction': $q.screen.lt.lg ? 'column' : 'row', gap: '0px' }"
>
-
+
-
+
useOpenURL(`#/order/${id}/summary`);
-
-
- {{ toDateFormat(row.date_send) }}
-
-
+
diff --git a/src/pages/Monitor/Ticket/MonitorTicketFilter.vue b/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
index 1cadd4cb4..1bc194a5c 100644
--- a/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
+++ b/src/pages/Monitor/Ticket/MonitorTicketFilter.vue
@@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import FetchData from 'src/components/FetchData.vue';
import { dateRange } from 'src/filters';
+import VnCheckbox from 'src/components/common/VnCheckbox.vue';
defineProps({ dataKey: { type: String, required: true } });
const { t, te } = useI18n();
@@ -209,7 +210,7 @@ const getLocale = (label) => {
- {
- {
-
import { ref, computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
-import FetchData from 'components/FetchData.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
@@ -168,9 +167,11 @@ const columns = computed(() => [
component: 'select',
name: 'provinceFk',
attrs: {
- options: provinceOpts.value,
- 'option-value': 'id',
- 'option-label': 'name',
+ url: 'Provinces',
+ fields: ['id', 'name'],
+ sortBy: ['name ASC'],
+ optionValue: 'id',
+ optionLabel: 'name',
dense: true,
},
},
@@ -183,9 +184,11 @@ const columns = computed(() => [
component: 'select',
name: 'stateFk',
attrs: {
- options: stateOpts.value,
- 'option-value': 'id',
- 'option-label': 'name',
+ sortBy: ['name ASC'],
+ url: 'States',
+ fields: ['id', 'name'],
+ optionValue: 'id',
+ optionLabel: 'name',
dense: true,
},
},
@@ -212,9 +215,12 @@ const columns = computed(() => [
component: 'select',
name: 'zoneFk',
attrs: {
- options: zoneOpts.value,
- 'option-value': 'id',
- 'option-label': 'name',
+ url: 'Zones',
+ fields: ['id', 'name'],
+ sortBy: ['name ASC'],
+
+ optionValue: 'id',
+ optionLabel: 'name',
dense: true,
},
},
@@ -225,11 +231,12 @@ const columns = computed(() => [
align: 'left',
columnFilter: {
component: 'select',
- url: 'PayMethods',
attrs: {
- options: PayMethodOpts.value,
- optionValue: 'id',
+ url: 'PayMethods',
+ fields: ['id', 'name'],
+ sortBy: ['id ASC'],
optionLabel: 'name',
+ optionValue: 'id',
dense: true,
},
},
@@ -254,7 +261,9 @@ const columns = computed(() => [
columnFilter: {
component: 'select',
attrs: {
- options: DepartmentOpts.value,
+ url: 'Departments',
+ fields: ['id', 'name'],
+ sortBy: ['id ASC'],
dense: true,
},
},
@@ -265,11 +274,12 @@ const columns = computed(() => [
align: 'left',
columnFilter: {
component: 'select',
- url: 'ItemPackingTypes',
attrs: {
- options: ItemPackingTypeOpts.value,
- 'option-value': 'code',
- 'option-label': 'code',
+ url: 'ItemPackingTypes',
+ fields: ['code'],
+ sortBy: ['code ASC'],
+ optionValue: 'code',
+ optionCode: 'code',
dense: true,
},
},
@@ -324,60 +334,6 @@ const totalPriceColor = (ticket) => {
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
- (provinceOpts = data)"
- />
- (stateOpts = data)"
- />
- (zoneOpts = data)"
- />
- (ItemPackingTypeOpts = data)"
- />
- (DepartmentOpts = data)"
- />
- (PayMethodOpts = data)"
- />
diff --git a/src/pages/Order/Card/OrderCatalog.vue b/src/pages/Order/Card/OrderCatalog.vue
index dbb66c0ec..df39fff3c 100644
--- a/src/pages/Order/Card/OrderCatalog.vue
+++ b/src/pages/Order/Card/OrderCatalog.vue
@@ -120,7 +120,6 @@ watch(
:data-key="dataKey"
:tag-value="tagValue"
:tags="tags"
- :initial-catalog-params="catalogParams"
:arrayData
/>
diff --git a/src/pages/Order/Card/OrderDescriptor.vue b/src/pages/Order/Card/OrderDescriptor.vue
index ee66bb57e..434dbb038 100644
--- a/src/pages/Order/Card/OrderDescriptor.vue
+++ b/src/pages/Order/Card/OrderDescriptor.vue
@@ -27,7 +27,7 @@ const getTotalRef = ref();
const total = ref(0);
const entityId = computed(() => {
- return $props.id || route.params.id;
+ return Number($props.id || route.params.id);
});
const orderTotal = computed(() => state.get('orderTotal') ?? 0);
diff --git a/src/pages/Route/Card/RouteSummary.vue b/src/pages/Route/Card/RouteSummary.vue
index 86bdbb5c5..7e345d69a 100644
--- a/src/pages/Route/Card/RouteSummary.vue
+++ b/src/pages/Route/Card/RouteSummary.vue
@@ -233,10 +233,10 @@ const ticketColumns = ref([
-
-
+
+
- {{ value }}
+ {{ row.clientFk }}
diff --git a/src/pages/Route/RouteTickets.vue b/src/pages/Route/RouteTickets.vue
index 5e28bb689..1b9545905 100644
--- a/src/pages/Route/RouteTickets.vue
+++ b/src/pages/Route/RouteTickets.vue
@@ -141,7 +141,7 @@ const setOrderedPriority = async () => {
};
const sortRoutes = async () => {
- await axios.patch(`Routes/${route.params?.id}/guessPriority/`);
+ await axios.patch(`Routes/${route.params?.id}/optimizePriority`);
refreshKey.value++;
};
diff --git a/src/pages/Shelving/Parking/ParkingList.vue b/src/pages/Shelving/Parking/ParkingList.vue
index 7c5058a74..eb5be5747 100644
--- a/src/pages/Shelving/Parking/ParkingList.vue
+++ b/src/pages/Shelving/Parking/ParkingList.vue
@@ -80,7 +80,7 @@ const columns = computed(() => [
{
{
- const needle = val.toLowerCase();
- filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
- (bank) =>
- bank.bic.toLowerCase().startsWith(needle) ||
- bank.name.toLowerCase().includes(needle),
- );
- });
+function bankEntityFilter(val) {
+ const needle = val.toLowerCase();
+ filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
+ (bank) =>
+ bank.bic.toLowerCase().startsWith(needle) ||
+ bank.name.toLowerCase().includes(needle),
+ );
}
@@ -82,7 +80,8 @@ function bankEntityFilter(val, update) {
url="BankEntities"
@on-fetch="
(data) => {
- (bankEntitiesOptions = data), (filteredBankEntitiesOptions = data);
+ bankEntitiesOptions = data;
+ filteredBankEntitiesOptions = data;
}
"
auto-load
@@ -135,10 +134,8 @@ function bankEntityFilter(val, update) {
:label="t('worker.create.bankEntity')"
v-model="row.bankEntityFk"
:options="filteredBankEntitiesOptions"
- :default-filter="false"
- @filter="(val, update) => bankEntityFilter(val, update)"
+ :filter-fn="bankEntityFilter"
option-label="bic"
- option-value="id"
hide-selected
:required="true"
:roles-allowed-to-create="['financial']"
diff --git a/src/pages/Supplier/Card/SupplierDescriptorProxy.vue b/src/pages/Supplier/Card/SupplierDescriptorProxy.vue
index 6311939b8..e4d1d9a13 100644
--- a/src/pages/Supplier/Card/SupplierDescriptorProxy.vue
+++ b/src/pages/Supplier/Card/SupplierDescriptorProxy.vue
@@ -5,7 +5,7 @@ import SupplierSummary from './SupplierSummary.vue';
const $props = defineProps({
id: {
type: Number,
- required: true,
+ default: null,
},
});
diff --git a/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue b/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue
index 76191b099..a58c934f8 100644
--- a/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue
+++ b/src/pages/Ticket/Card/BasicData/TicketBasicDataView.vue
@@ -101,7 +101,7 @@ const onNextStep = async () => {
t('basicData.negativesConfirmMessage'),
submitWithNegatives,
);
- else submit();
+ else await submit();
}
};
diff --git a/src/pages/Ticket/Card/TicketDescriptor.vue b/src/pages/Ticket/Card/TicketDescriptor.vue
index 96920231c..c6c6e6c6b 100644
--- a/src/pages/Ticket/Card/TicketDescriptor.vue
+++ b/src/pages/Ticket/Card/TicketDescriptor.vue
@@ -46,7 +46,7 @@ async function getClaims() {
originalTicket.value = data[0]?.originalTicketFk;
}
async function getProblems() {
- const { data } = await axios.get(`Tickets/${entityId.value}/getTicketProblems`);
+ const { data } = await axios.get(`Tickets/getTicketProblems`, {params: { ids: [entityId.value] }});
if (!data) return;
problems.value = data[0];
}
diff --git a/src/pages/Ticket/Card/TicketDescriptorMenu.vue b/src/pages/Ticket/Card/TicketDescriptorMenu.vue
index f7389b592..30024fb26 100644
--- a/src/pages/Ticket/Card/TicketDescriptorMenu.vue
+++ b/src/pages/Ticket/Card/TicketDescriptorMenu.vue
@@ -28,6 +28,7 @@ const props = defineProps({
onMounted(() => {
restoreTicket();
+ hasDocuware();
});
watch(
diff --git a/src/pages/Ticket/Card/TicketDescriptorProxy.vue b/src/pages/Ticket/Card/TicketDescriptorProxy.vue
index 583ba35e7..8b872733d 100644
--- a/src/pages/Ticket/Card/TicketDescriptorProxy.vue
+++ b/src/pages/Ticket/Card/TicketDescriptorProxy.vue
@@ -1,7 +1,6 @@
-
+
diff --git a/src/pages/Ticket/Card/TicketEditMana.vue b/src/pages/Ticket/Card/TicketEditMana.vue
index 266c82ccd..f8a72caf3 100644
--- a/src/pages/Ticket/Card/TicketEditMana.vue
+++ b/src/pages/Ticket/Card/TicketEditMana.vue
@@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { toCurrency } from 'src/filters';
-import VnUsesMana from 'components/ui/VnUsesMana.vue';
const $props = defineProps({
newPrice: {
@@ -15,23 +14,36 @@ const $props = defineProps({
type: Object,
default: null,
},
+ componentId: {
+ type: Number,
+ default: null,
+ },
});
+const emit = defineEmits(['save', 'cancel', 'update:componentId']);
+
const route = useRoute();
const mana = ref(null);
-const usesMana = ref(false);
-
-const emit = defineEmits(['save', 'cancel']);
+const usesMana = ref([]);
const { t } = useI18n();
const QPopupProxyRef = ref(null);
-const manaCode = ref($props.manaCode);
+
+const componentId = computed({
+ get: () => $props.componentId,
+ set: (val) => emit('update:componentId', val),
+});
const save = (sale = $props.sale) => {
emit('save', sale);
QPopupProxyRef.value.hide();
};
+const cancel = () => {
+ emit('cancel');
+ QPopupProxyRef.value.hide();
+};
+
const getMana = async () => {
const { data } = await axios.get(`Tickets/${route.params.id}/getDepartmentMana`);
mana.value = data;
@@ -39,15 +51,12 @@ const getMana = async () => {
};
const getUsesMana = async () => {
- const { data } = await axios.get('Sales/usesMana');
+ const { data } = await axios.get('Sales/getComponents');
usesMana.value = data;
};
-const cancel = () => {
- emit('cancel');
- QPopupProxyRef.value.hide();
-};
const hasMana = computed(() => typeof mana.value === 'number');
+
defineExpose({ save });
@@ -59,17 +68,29 @@ defineExpose({ save });
>
-
+
+
+
-
-
+
+
+
+
{{ t('New price') }}
-
- {{ toCurrency($props.newPrice) }}
-
+ {{ toCurrency(newPrice) }}
@@ -77,7 +98,6 @@ defineExpose({ save });
@@ -86,7 +106,6 @@ defineExpose({ save });
-
-
-es:
- New price: Nuevo precio
-
diff --git a/src/pages/Ticket/Card/TicketNotes.vue b/src/pages/Ticket/Card/TicketNotes.vue
index feb88bf84..a3e25d63e 100644
--- a/src/pages/Ticket/Card/TicketNotes.vue
+++ b/src/pages/Ticket/Card/TicketNotes.vue
@@ -38,7 +38,9 @@ function handleDelete(row) {
ticketNotesCrudRef.value.remove([row]);
}
-async function handleSave() {
+async function handleSave(e) {
+ if (e.shiftKey && e.key === 'Enter') return;
+ e.preventDefault();
if (!isSaving.value) {
isSaving.value = true;
await ticketNotesCrudRef.value?.saveChanges();
@@ -70,7 +72,7 @@ async function handleSave() {
store.data?.ticketState?.state?.code);
const transfer = ref({
lastActiveTickets: [],
@@ -187,7 +187,7 @@ const getRowUpdateInputEvents = (sale) => {
};
const resetChanges = async () => {
- arrayData.fetch({ append: false });
+ await arrayData.fetch({ append: false });
tableRef.value.CrudModelRef.hasChanges = false;
await tableRef.value.reload();
@@ -308,14 +308,15 @@ const changePrice = async (sale) => {
if (newPrice != null && newPrice != sale.price) {
if (await isSalePrepared(sale)) {
await confirmUpdate(() => updatePrice(sale, newPrice));
- } else updatePrice(sale, newPrice);
+ } else await updatePrice(sale, newPrice);
}
};
const updatePrice = async (sale, newPrice) => {
try {
- await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
- sale.price = newPrice;
- edit.value = { ...DEFAULT_EDIT };
+ await axios.post(`Sales/${sale.id}/updatePrice`, {
+ newPrice: newPrice,
+ componentId: componentId.value,
+ });
notify('globals.dataSaved', 'positive');
resetChanges();
} catch (e) {
@@ -327,28 +328,31 @@ const changeDiscount = async (sale) => {
const newDiscount = edit.value.discount;
if (newDiscount != null && newDiscount != sale.discount) {
if (await isSalePrepared(sale))
- await confirmUpdate(() => updateDiscount([sale], newDiscount));
- else await updateDiscount([sale], newDiscount);
+ await confirmUpdate(() =>
+ updateDiscount([sale], newDiscount, componentId.value),
+ );
+ else await updateDiscount([sale], newDiscount, componentId.value);
}
};
-const updateDiscounts = async (sales, newDiscount) => {
+const updateDiscounts = async (sales, newDiscount, componentId) => {
const salesTracking = await fetchSalesTracking();
const someSaleIsPrepared = salesTracking.some((sale) =>
matchSale(salesTracking, sale),
);
- if (someSaleIsPrepared) await confirmUpdate(() => updateDiscount(sales, newDiscount));
- else updateDiscount(sales, newDiscount);
+ if (someSaleIsPrepared)
+ await confirmUpdate(() => updateDiscount(sales, newDiscount, componentId));
+ else updateDiscount(sales, newDiscount, componentId);
};
-const updateDiscount = async (sales, newDiscount = 0) => {
+const updateDiscount = async (sales, newDiscount, componentId) => {
try {
const salesIds = sales.map(({ id }) => id);
const params = {
salesIds,
- newDiscount,
- manaCode: manaCode.value,
+ newDiscount: newDiscount ?? 0,
+ componentId,
};
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
notify('globals.dataSaved', 'positive');
@@ -769,6 +773,7 @@ watch(
v-model="row.itemFk"
:use-like="false"
@update:model-value="changeItem(row)"
+ autofocus
>
@@ -821,10 +826,11 @@ watch(
ref="editPriceProxyRef"
:sale="row"
:new-price="getNewPrice"
+ v-model:component-id="componentId"
@save="changePrice"
>
editManaProxyRef.save(row)"
+ @keyup.enter.stop="() => editPriceProxyRef.save(row)"
v-model.number="edit.price"
:label="t('basicData.price')"
type="number"
@@ -843,7 +849,7 @@ watch(
ref="editManaProxyRef"
:sale="row"
:new-price="getNewPrice"
- :mana-code="manaCode"
+ v-model:component-id="componentId"
@save="changeDiscount"
>
{
});
if (newDiscount.value != null && hasChanges)
- emit('updateDiscounts', props.sales, newDiscount.value);
+ emit('updateDiscounts', props.sales, newDiscount.value, componentId.value);
btnDropdownRef.value.hide();
};
@@ -206,6 +207,7 @@ const createRefund = async (withWarehouse) => {
ref="editManaProxyRef"
:sale="row"
@save="changeMultipleDiscount"
+ v-model:component-id="componentId"
>
{
const tickets = Array.isArray($props.ticket) ? $props.ticket : [$props.ticket];
- await split(tickets, splitDate.value);
- emit('ticketTransfered', tickets);
+ const results = await split(tickets, splitDate.value);
+ notifyResults(results, 'ticketFk');
+ emit('ticketTransferred', tickets);
};
-
+
diff --git a/src/pages/Ticket/Card/TicketTransfer.vue b/src/pages/Ticket/Card/TicketTransfer.vue
index ffa964c92..c096dee21 100644
--- a/src/pages/Ticket/Card/TicketTransfer.vue
+++ b/src/pages/Ticket/Card/TicketTransfer.vue
@@ -5,7 +5,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import TicketTransferForm from './TicketTransferForm.vue';
import { toDateFormat } from 'src/filters/date.js';
-const emit = defineEmits(['ticketTransfered']);
+const emit = defineEmits(['ticketTransferred']);
const $props = defineProps({
mana: {
diff --git a/src/pages/Ticket/Card/TicketTransferProxy.vue b/src/pages/Ticket/Card/TicketTransferProxy.vue
index 7d5d82f85..af3b13990 100644
--- a/src/pages/Ticket/Card/TicketTransferProxy.vue
+++ b/src/pages/Ticket/Card/TicketTransferProxy.vue
@@ -1,8 +1,8 @@
-
+
{
-
+
diff --git a/src/pages/Zone/Card/ZoneEventExclusionForm.vue b/src/pages/Zone/Card/ZoneEventExclusionForm.vue
index 582a8bbad..89a6e02f8 100644
--- a/src/pages/Zone/Card/ZoneEventExclusionForm.vue
+++ b/src/pages/Zone/Card/ZoneEventExclusionForm.vue
@@ -68,7 +68,7 @@ const arrayData = useArrayData('ZoneEvents');
const exclusionGeoCreate = async () => {
const params = {
zoneFk: parseInt(route.params.id),
- date: dated,
+ date: dated.value,
geoIds: tickedNodes.value,
};
await axios.post('Zones/exclusionGeo', params);
@@ -101,9 +101,17 @@ const exclusionCreate = async () => {
const existsEvent = data.events.find(
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
);
+ const existsGeoEvent = data.geoExclusions.find(
+ (event) => toDateFormat(event.dated) === toDateFormat(dated.value),
+ );
if (existsEvent) {
await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`);
}
+ if (existsGeoEvent) {
+ await axios.delete(
+ `Zones/${existsGeoEvent?.zoneFk}/exclusions/${existsGeoEvent?.zoneExclusionFk}`,
+ );
+ }
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
else await axios.put(`${url}/${props.event?.id}`, body);
@@ -122,8 +130,21 @@ const onSubmit = async () => {
const deleteEvent = async () => {
if (!props.event) return;
- const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
- await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
+ if (!props.event.created) {
+ const filter = {
+ where: {
+ dated: dated.value,
+ },
+ };
+ const params = { filter: JSON.stringify(filter) };
+ const { data: res } = await axios.get(`Zones/${route.params.id}/exclusions`, {
+ params,
+ });
+ if (res) await axios.delete(`Zones/${route.params.id}/exclusions/${res[0].id}`);
+ } else {
+ const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
+ await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
+ }
await refetchEvents();
};
@@ -135,7 +156,7 @@ const refetchEvents = async () => {
};
onMounted(() => {
- if (props.event) {
+ if (props.event && props.event.dated) {
dated.value = props.event?.dated;
excludeType.value =
props.eventType === 'geoExclusion' ? 'specificLocations' : 'all';
diff --git a/src/pages/Zone/Card/ZoneEventInclusionForm.vue b/src/pages/Zone/Card/ZoneEventInclusionForm.vue
index 8b02c2d84..fad51765c 100644
--- a/src/pages/Zone/Card/ZoneEventInclusionForm.vue
+++ b/src/pages/Zone/Card/ZoneEventInclusionForm.vue
@@ -56,6 +56,7 @@ const isNew = computed(() => props.isNewMode);
const eventInclusionFormData = ref({ wdays: [] });
const dated = ref(props.date || Date.vnNew());
const _inclusionType = ref('indefinitely');
+const hasDeletedEvent = ref(false);
const inclusionType = computed({
get: () => _inclusionType.value,
set: (val) => {
@@ -84,7 +85,7 @@ const createEvent = async () => {
}
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
- for (const id of zoneIds) {
+ for (const zoneId of zoneIds) {
let today = eventInclusionFormData.value.dated
? moment(eventInclusionFormData.value.dated)
: moment(dated.value);
@@ -92,7 +93,7 @@ const createEvent = async () => {
const { data } = await axios.get(`Zones/getEventsFiltered`, {
params: {
- zoneFk: id,
+ zoneFk: zoneId,
started: today,
ended: lastDay,
},
@@ -106,15 +107,19 @@ const createEvent = async () => {
await axios.delete(
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
);
+ await refetchEvents();
+ hasDeletedEvent.value = true;
}
- if (isNew.value)
- await axios.post(`Zones/${id}/events`, eventInclusionFormData.value);
+ delete eventInclusionFormData.value.id;
+ if (isNew.value || hasDeletedEvent.value)
+ await axios.post(`Zones/${zoneId}/events`, eventInclusionFormData.value);
else
await axios.put(
- `Zones/${id}/events/${props.event?.id}`,
+ `Zones/${zoneId}/events/${props.event?.id}`,
eventInclusionFormData.value,
);
+ hasDeletedEvent.value = false;
}
quasar.notify({
message: t('globals.dataSaved'),
diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue
index 8d7c4a165..355eb900e 100644
--- a/src/pages/Zone/ZoneList.vue
+++ b/src/pages/Zone/ZoneList.vue
@@ -93,6 +93,7 @@ const columns = computed(() => [
optionLabel: 'name',
optionValue: 'id',
},
+ columnClass: 'expand',
},
{
align: 'left',
@@ -247,74 +248,70 @@ const closeEventForm = () => {
-
-
-
-
- {{ dashIfEmpty(formatRow(row)) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ {{ dashIfEmpty(formatRow(row)) }}
+
+
+
+
+
+
+
+
+
+
+
@@ -333,24 +330,6 @@ const closeEventForm = () => {
/>
-
-
-
es:
Search zone: Buscar zona
diff --git a/src/router/modules/ticket.js b/src/router/modules/ticket.js
index bfcb78787..d80997257 100644
--- a/src/router/modules/ticket.js
+++ b/src/router/modules/ticket.js
@@ -113,7 +113,7 @@ const ticketCard = {
name: 'TicketExpedition',
meta: {
title: 'expedition',
- icon: 'vn:package',
+ icon: 'view_in_ar',
},
component: () => import('src/pages/Ticket/Card/TicketExpedition.vue'),
},
@@ -168,7 +168,7 @@ const ticketCard = {
name: 'TicketBoxing',
meta: {
title: 'boxing',
- icon: 'view_in_ar',
+ icon: 'videocam',
},
component: () => import('src/pages/Ticket/Card/TicketBoxing.vue'),
},
diff --git a/src/stores/__tests__/useStateQueryStore.spec.js b/src/stores/__tests__/useStateQueryStore.spec.js
index ab3afb007..7bdb87ced 100644
--- a/src/stores/__tests__/useStateQueryStore.spec.js
+++ b/src/stores/__tests__/useStateQueryStore.spec.js
@@ -1,22 +1,23 @@
import { describe, expect, it, beforeEach, beforeAll } from 'vitest';
-import { createWrapper } from 'app/test/vitest/helper';
+import { setActivePinia, createPinia } from 'pinia';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
describe('useStateQueryStore', () => {
- beforeAll(() => {
- createWrapper({}, {});
- });
-
- const stateQueryStore = useStateQueryStore();
- const { add, isLoading, remove, reset } = useStateQueryStore();
+ let stateQueryStore;
+ let add, isLoading, remove, reset;
const firstQuery = { url: 'myQuery' };
function getQueries() {
return stateQueryStore.queries;
}
+ beforeAll(() => {
+ setActivePinia(createPinia());
+ });
beforeEach(() => {
+ stateQueryStore = useStateQueryStore();
+ ({ add, isLoading, remove, reset } = useStateQueryStore());
reset();
expect(getQueries().size).toBeFalsy();
});
diff --git a/src/utils/notifyResults.js b/src/utils/notifyResults.js
deleted file mode 100644
index e87ad6c6f..000000000
--- a/src/utils/notifyResults.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import { Notify } from 'quasar';
-
-export default function (results, key) {
- results.forEach((result, index) => {
- if (result.status === 'fulfilled') {
- const data = JSON.parse(result.value.config.data);
- Notify.create({
- type: 'positive',
- message: `Operación (${index + 1}) ${data[key]} completada con éxito.`,
- });
- } else {
- const data = JSON.parse(result.reason.config.data);
- Notify.create({
- type: 'negative',
- message: `Operación (${index + 1}) ${data[key]} fallida: ${result.reason.message}`,
- });
- }
- });
-}
diff --git a/test/cypress/integration/claim/claimAction.spec.js b/test/cypress/integration/claim/claimAction.spec.js
index 8f406ad2f..674313a5a 100644
--- a/test/cypress/integration/claim/claimAction.spec.js
+++ b/test/cypress/integration/claim/claimAction.spec.js
@@ -1,12 +1,11 @@
///
-describe.skip('ClaimAction', () => {
+describe('ClaimAction', () => {
const claimId = 1;
const firstRow = 'tbody > :nth-child(1)';
const destinationRow = '.q-item__section > .q-field';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/action`);
});
@@ -16,13 +15,13 @@ describe.skip('ClaimAction', () => {
});
// https://redmine.verdnatura.es/issues/8756
- xit('should change destination', () => {
+ it.skip('should change destination', () => {
const rowData = [true, null, null, 'Bueno'];
cy.fillRow(firstRow, rowData);
});
// https://redmine.verdnatura.es/issues/8756
- xit('should change destination from other button', () => {
+ it.skip('should change destination from other button', () => {
const rowData = [true];
cy.fillRow(firstRow, rowData);
@@ -36,7 +35,7 @@ describe.skip('ClaimAction', () => {
});
// https://redmine.verdnatura.es/issues/8756
- xit('should remove the line', () => {
+ it.skip('should remove the line', () => {
cy.fillRow(firstRow, [true]);
cy.removeCard();
cy.clickConfirm();
diff --git a/test/cypress/integration/claim/claimDevelopment.spec.js b/test/cypress/integration/claim/claimDevelopment.spec.js
index 097d870df..ed1e7c0a5 100755
--- a/test/cypress/integration/claim/claimDevelopment.spec.js
+++ b/test/cypress/integration/claim/claimDevelopment.spec.js
@@ -1,5 +1,5 @@
///
-describe.skip('ClaimDevelopment', () => {
+describe('ClaimDevelopment', () => {
const claimId = 1;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const thirdRow = 'tbody > :nth-child(3)';
@@ -7,7 +7,6 @@ describe.skip('ClaimDevelopment', () => {
const newReason = 'Calor';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/development`);
cy.waitForElement('tbody');
diff --git a/test/cypress/integration/customer/clientList.spec.js b/test/cypress/integration/customer/clientList.spec.js
index caf94b8bd..7b1da6d89 100644
--- a/test/cypress/integration/customer/clientList.spec.js
+++ b/test/cypress/integration/customer/clientList.spec.js
@@ -1,5 +1,5 @@
///
-describe.skip('Client list', () => {
+describe('Client list', () => {
beforeEach(() => {
cy.login('developer');
cy.visit('/#/customer/list', {
diff --git a/test/cypress/integration/entry/commands.js b/test/cypress/integration/entry/commands.js
index 4d4a8f980..87e3c3bfa 100644
--- a/test/cypress/integration/entry/commands.js
+++ b/test/cypress/integration/entry/commands.js
@@ -7,7 +7,7 @@ Cypress.Commands.add('selectTravel', (warehouse = '1') => {
});
Cypress.Commands.add('deleteEntry', () => {
- cy.get('[data-cy="descriptor-more-opts"]').should('be.visible').click();
+ cy.dataCy('descriptor-more-opts').should('be.visible').click();
cy.waitForElement('div[data-cy="delete-entry"]').click();
});
diff --git a/test/cypress/integration/entry/entryCard/entryBasicData.spec.js b/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
index ba689b8c7..11643c566 100644
--- a/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryBasicData.spec.js
@@ -1,8 +1,7 @@
import '../commands.js';
-describe('EntryBasicData', () => {
+describe.skip('EntryBasicData', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js b/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
index 8185866db..d6f2b2543 100644
--- a/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryDescriptor.spec.js
@@ -1,7 +1,6 @@
import '../commands.js';
describe('EntryDescriptor', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryCard/entryDms.spec.js b/test/cypress/integration/entry/entryCard/entryDms.spec.js
index f3f0ef20b..640b70907 100644
--- a/test/cypress/integration/entry/entryCard/entryDms.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryDms.spec.js
@@ -1,7 +1,6 @@
import '../commands.js';
describe('EntryDms', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryCard/entryLock.spec.js b/test/cypress/integration/entry/entryCard/entryLock.spec.js
index 6ba4392ae..957c67cc6 100644
--- a/test/cypress/integration/entry/entryCard/entryLock.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryLock.spec.js
@@ -1,7 +1,6 @@
import '../commands.js';
describe('EntryLock', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryCard/entryNotes.spec.js b/test/cypress/integration/entry/entryCard/entryNotes.spec.js
index 544ac23b0..80c9fd38d 100644
--- a/test/cypress/integration/entry/entryCard/entryNotes.spec.js
+++ b/test/cypress/integration/entry/entryCard/entryNotes.spec.js
@@ -2,7 +2,6 @@ import '../commands.js';
describe('EntryNotes', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryList.spec.js b/test/cypress/integration/entry/entryList.spec.js
index bad47615f..fc76f6d87 100644
--- a/test/cypress/integration/entry/entryList.spec.js
+++ b/test/cypress/integration/entry/entryList.spec.js
@@ -2,7 +2,6 @@ import './commands';
describe('EntryList', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/list`);
});
diff --git a/test/cypress/integration/entry/entryStockBought.spec.js b/test/cypress/integration/entry/entryStockBought.spec.js
index 3fad44d91..60019c9f4 100644
--- a/test/cypress/integration/entry/entryStockBought.spec.js
+++ b/test/cypress/integration/entry/entryStockBought.spec.js
@@ -1,6 +1,5 @@
describe('EntryStockBought', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyer');
cy.visit(`/#/entry/stock-Bought`);
});
diff --git a/test/cypress/integration/entry/entrySupplier.spec.js b/test/cypress/integration/entry/entrySupplier.spec.js
index 83deecea5..df90d00d7 100644
--- a/test/cypress/integration/entry/entrySupplier.spec.js
+++ b/test/cypress/integration/entry/entrySupplier.spec.js
@@ -1,6 +1,5 @@
describe('EntrySupplier when is supplier', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('supplier');
cy.visit(`/#/entry/my`, {
onBeforeLoad(win) {
diff --git a/test/cypress/integration/entry/entryWasteRecalc.spec.js b/test/cypress/integration/entry/entryWasteRecalc.spec.js
index b8fcbdb4c..902d5bbc5 100644
--- a/test/cypress/integration/entry/entryWasteRecalc.spec.js
+++ b/test/cypress/integration/entry/entryWasteRecalc.spec.js
@@ -1,7 +1,6 @@
import './commands';
describe('EntryDms', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('buyerBoss');
cy.visit(`/#/entry/waste-recalc`);
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js b/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
index 275fa1358..495e4d43b 100644
--- a/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInCorrective.spec.js
@@ -53,7 +53,7 @@ describe('invoiceInCorrective', () => {
it('should show/hide the section if it is a corrective invoice', () => {
cy.visit('/#/invoice-in/1/summary');
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('not.exist');
- cy.clicDescriptorAction(4);
+ cy.clickDescriptorAction(4);
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
});
});
diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
index 9744486e0..fd6f1c238 100644
--- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
+++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js
@@ -64,17 +64,17 @@ describe('InvoiceInDescriptor', () => {
beforeEach(() => cy.visit('/#/invoice-in/1/summary'));
it('should navigate to the supplier summary', () => {
- cy.clicDescriptorAction(1);
+ cy.clickDescriptorAction(1);
cy.url().should('to.match', /supplier\/\d+\/summary/);
});
it('should navigate to the entry summary', () => {
- cy.clicDescriptorAction(2);
+ cy.clickDescriptorAction(2);
cy.url().should('to.match', /entry\/\d+\/summary/);
});
it('should navigate to the invoiceIn list', () => {
- cy.clicDescriptorAction(3);
+ cy.clickDescriptorAction(3);
cy.url().should('to.match', /invoice-in\/list\?table=\{.*supplierFk.+\}/);
});
});
@@ -84,7 +84,7 @@ describe('InvoiceInDescriptor', () => {
beforeEach(() => cy.visit(`/#/invoice-in/${originalId}/summary`));
- it('should create a correcting invoice and redirect to original invoice', () => {
+ it.skip('should create a correcting invoice and redirect to original invoice', () => {
createCorrective();
redirect(originalId);
});
@@ -93,7 +93,7 @@ describe('InvoiceInDescriptor', () => {
createCorrective();
redirect(originalId);
- cy.clicDescriptorAction(4);
+ cy.clickDescriptorAction(4);
cy.validateVnTableRows({
cols: [
{
@@ -141,7 +141,7 @@ function createCorrective() {
function redirect(subtitle) {
const regex = new RegExp(`InvoiceIns/${subtitle}\\?filter=.*`);
cy.intercept('GET', regex).as('getOriginal');
- cy.clicDescriptorAction(4);
+ cy.clickDescriptorAction(4);
cy.wait('@getOriginal');
cy.validateDescriptor({ subtitle });
}
diff --git a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
index b8b42fa4b..50ea01764 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js
@@ -28,10 +28,10 @@ describe('InvoiceOut list', () => {
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
- it('should open the invoice descriptor from table icon', () => {
+ it.skip('should open the invoice descriptor from table icon', () => {
cy.get(firstSummaryIcon).click();
cy.get('.cardSummary').should('be.visible');
- cy.get('.summaryHeader > div').should('include.text', 'A1111111');
+ cy.get('.summaryHeader > div').should('include.text', 'V10100001');
});
it('should open the client descriptor', () => {
diff --git a/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js b/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js
index e93326f1d..d58eb4a1f 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js
@@ -1,7 +1,6 @@
///
describe.skip('InvoiceOut manual invoice', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/ticket/list`);
cy.get('#searchbar input').type('{enter}');
diff --git a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
index 9c6eef2ed..89f71e940 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutNegativeBases.spec.js
@@ -4,7 +4,6 @@ describe('InvoiceOut negative bases', () => {
`:nth-child(1) > [data-col-field="${opt}"] > .no-padding > .link`;
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/negative-bases`);
});
diff --git a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
index 49eed32c7..029165bb8 100644
--- a/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
+++ b/test/cypress/integration/invoiceOut/invoiceOutSummary.spec.js
@@ -15,7 +15,7 @@ describe('InvoiceOut summary', () => {
cy.login('developer');
cy.visit(`/#/invoice-out/1/summary`);
});
- it('open the descriptors', () => {
+ it.skip('open the descriptors', () => {
cy.get(firstRowDescriptors(1)).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1');
@@ -30,7 +30,7 @@ describe('InvoiceOut summary', () => {
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
- it('should open the ticket list', () => {
+ it.skip('should open the ticket list', () => {
cy.get(toTicketList).click();
cy.get('[data-col-field="stateFk"]').each(($el) => {
cy.wrap($el).contains('T1111111');
diff --git a/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js b/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
index 75c08dd73..c6f75ef5f 100644
--- a/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
+++ b/test/cypress/integration/invoiceOut/invvoiceOutGlobal.spec.js
@@ -1,7 +1,6 @@
///
describe('InvoiceOut global invoicing', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('administrative');
cy.visit(`/#/invoice-out/global-invoicing`);
});
@@ -17,7 +16,7 @@ describe('InvoiceOut global invoicing', () => {
cy.dataCy('InvoiceOutGlobalPrinterSelect').type('printer1');
cy.get('.q-menu .q-item').contains('printer1').click();
cy.get(
- '[label="Invoice date"] > .q-field > .q-field__inner > .q-field__control'
+ '[label="Invoice date"] > .q-field > .q-field__inner > .q-field__control',
).click();
cy.get(':nth-child(5) > div > .q-btn > .q-btn__content > .block').click();
cy.get('.q-date__years-content > :nth-child(2) > .q-btn').click();
diff --git a/test/cypress/integration/item/itemBarcodes.spec.js b/test/cypress/integration/item/itemBarcodes.spec.js
index 1f6698f9c..746cfa0f1 100644
--- a/test/cypress/integration/item/itemBarcodes.spec.js
+++ b/test/cypress/integration/item/itemBarcodes.spec.js
@@ -1,7 +1,6 @@
///
describe('ItemBarcodes', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/barcode`);
});
diff --git a/test/cypress/integration/item/itemBotanical.spec.js b/test/cypress/integration/item/itemBotanical.spec.js
index 6105ef179..420181b0d 100644
--- a/test/cypress/integration/item/itemBotanical.spec.js
+++ b/test/cypress/integration/item/itemBotanical.spec.js
@@ -1,7 +1,6 @@
///
describe('Item botanical', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/botanical`);
});
diff --git a/test/cypress/integration/item/itemList.spec.js b/test/cypress/integration/item/itemList.spec.js
index 10e388580..7950f2bda 100644
--- a/test/cypress/integration/item/itemList.spec.js
+++ b/test/cypress/integration/item/itemList.spec.js
@@ -1,8 +1,7 @@
///
-describe.skip('Item list', () => {
+describe('Item list', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/list`);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/item/itemSummary.spec.js b/test/cypress/integration/item/itemSummary.spec.js
index 8d67c8e3c..65b4c8629 100644
--- a/test/cypress/integration/item/itemSummary.spec.js
+++ b/test/cypress/integration/item/itemSummary.spec.js
@@ -1,7 +1,6 @@
///
describe('Item summary', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/summary`);
});
diff --git a/test/cypress/integration/item/itemTag.spec.js b/test/cypress/integration/item/itemTag.spec.js
index 425eaffe6..65d339151 100644
--- a/test/cypress/integration/item/itemTag.spec.js
+++ b/test/cypress/integration/item/itemTag.spec.js
@@ -1,6 +1,5 @@
describe('Item tag', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/tags`);
cy.get('.q-page').should('be.visible');
diff --git a/test/cypress/integration/item/itemTax.spec.js b/test/cypress/integration/item/itemTax.spec.js
index 6ff147135..971e3a732 100644
--- a/test/cypress/integration/item/itemTax.spec.js
+++ b/test/cypress/integration/item/itemTax.spec.js
@@ -1,7 +1,6 @@
///
describe('Item tax', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/1/tax`);
});
diff --git a/test/cypress/integration/item/itemType.spec.js b/test/cypress/integration/item/itemType.spec.js
index 466a49708..180a12a0f 100644
--- a/test/cypress/integration/item/itemType.spec.js
+++ b/test/cypress/integration/item/itemType.spec.js
@@ -6,7 +6,6 @@ describe('Item type', () => {
const type = 'Flower';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/item/item-type`);
});
diff --git a/test/cypress/integration/login/logout.spec.js b/test/cypress/integration/login/logout.spec.js
index 9f022617d..b17e42794 100644
--- a/test/cypress/integration/login/logout.spec.js
+++ b/test/cypress/integration/login/logout.spec.js
@@ -1,5 +1,5 @@
///
-describe.skip('Logout', () => {
+describe('Logout', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/dashboard`);
diff --git a/test/cypress/integration/monitor/clientActions.spec.js b/test/cypress/integration/monitor/clientActions.spec.js
new file mode 100644
index 000000000..80f4de379
--- /dev/null
+++ b/test/cypress/integration/monitor/clientActions.spec.js
@@ -0,0 +1,47 @@
+///
+
+describe('Monitor Clients actions', () => {
+ beforeEach(() => {
+ cy.login('salesPerson');
+ cy.intercept('GET', '**/Departments**').as('departments');
+ cy.visit('/#/monitor/clients-actions');
+ cy.waitForElement('.q-page');
+ cy.wait('@departments').then((xhr) => {
+ cy.window().then((win) => {
+ const user = JSON.parse(win.sessionStorage.getItem('user'));
+ const { where } = JSON.parse(xhr.request.query.filter);
+ expect(where.id.like).to.include(user.departmentFk.toString());
+ });
+ });
+ cy.intercept('GET', '**/SalesMonitors/ordersFilter*').as('ordersFilter');
+ cy.intercept('GET', '**/SalesMonitors/clientsFilter*').as('clientsFilter');
+ });
+ it('Should filter by field', () => {
+ cy.get('.q-page').should('be.visible');
+ cy.dataCy('clientsOnWebsite')
+ .find('[data-cy="column-filter-departmentFk"] [data-cy="_select"]')
+ .click();
+ cy.dataCy('recentOrderActions').within(() => {
+ cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
+ });
+ cy.checkVisibleDescriptor('Customer');
+
+ cy.dataCy('recentOrderActions').within(() => {
+ cy.getRowCol('departmentFk', 2)
+ .find('span')
+ .should('have.class', 'link')
+ .click();
+ });
+
+ cy.checkVisibleDescriptor('Department');
+
+ cy.dataCy('clientsOnWebsite')
+ .find('.q-ml-md')
+ .should('have.text', 'Clients on website');
+ cy.dataCy('recentOrderActions')
+ .find('.q-ml-md')
+ .should('have.text', 'Recent order actions');
+ cy.dataCy('From_inputDate').should('have.value', '01/01/2001');
+ cy.dataCy('To_inputDate').should('have.value', '01/01/2001');
+ });
+});
diff --git a/test/cypress/integration/monitor/monitorTicket.spec.js b/test/cypress/integration/monitor/monitorTicket.spec.js
new file mode 100644
index 000000000..72c6bf936
--- /dev/null
+++ b/test/cypress/integration/monitor/monitorTicket.spec.js
@@ -0,0 +1,69 @@
+///
+describe('Monitor Tickets Table', () => {
+ beforeEach(() => {
+ cy.viewport(1920, 1080);
+ cy.login('salesPerson');
+ cy.visit('/#/monitor/tickets');
+ cy.waitForElement('.q-page');
+ cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
+ cy.openRightMenu();
+ });
+ it('should open new tab when ctrl+click on client link', () => {
+ cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
+
+ cy.window().then((win) => {
+ cy.stub(win, 'open').as('windowOpen');
+ });
+
+ cy.getRowCol('provinceFk').click({ ctrlKey: true });
+ cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
+ });
+ it('should open the descriptorProxy and SummaryPopup', () => {
+ cy.getRowCol('totalProblems');
+
+ cy.getRowCol('id').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Ticket');
+
+ cy.getRowCol('zoneFk').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Zone');
+
+ cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Customer');
+
+ cy.getRowCol('departmentFk').find('span').should('have.class', 'link').click();
+ cy.checkVisibleDescriptor('Department');
+
+ cy.getRowCol('shippedDate').find('.q-badge');
+ cy.tableActions().click({ ctrlKey: true });
+ cy.tableActions(1).click();
+ cy.get('.summaryHeader').should('exist');
+ });
+
+ it('clear scopeDays', () => {
+ cy.get('[data-cy="Days onward_input"]').clear().type('2');
+ cy.searchInFilterPanel();
+ cy.get('.q-chip__content > span').should('have.text', '"2"');
+ cy.waitSpinner();
+ checkScopeDays(2);
+ cy.get('[data-cy="Days onward_input"]').clear();
+ cy.searchInFilterPanel();
+ cy.get('.q-chip__content > span').should('have.text', '"0"');
+ cy.waitSpinner();
+ checkScopeDays(0);
+ });
+});
+
+function checkScopeDays(scopeDays) {
+ cy.url().then((url) => {
+ const urlParams = new URLSearchParams(url.split('?')[1]);
+ const saleMonitorTickets = JSON.parse(
+ decodeURIComponent(urlParams.get('saleMonitorTickets')),
+ );
+ expect(saleMonitorTickets.scopeDays).to.equal(scopeDays);
+ const fromDate = new Date(saleMonitorTickets.from);
+ const toDate = new Date(saleMonitorTickets.to);
+ expect(toDate.getDate() - fromDate.getDate()).to.equal(
+ saleMonitorTickets.scopeDays,
+ );
+ });
+}
diff --git a/test/cypress/integration/order/orderCatalog.spec.js b/test/cypress/integration/order/orderCatalog.spec.js
index 050dd396c..4f6371f32 100644
--- a/test/cypress/integration/order/orderCatalog.spec.js
+++ b/test/cypress/integration/order/orderCatalog.spec.js
@@ -2,7 +2,7 @@
describe('OrderCatalog', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 720);
+ cy.viewport(1920, 1080);
cy.visit('/#/order/8/catalog');
});
@@ -34,7 +34,7 @@ describe('OrderCatalog', () => {
searchByCustomTagInput('Silver');
});
- it.skip('filters by custom value dialog', () => {
+ it('filters by custom value dialog', () => {
Cypress.on('uncaught:exception', (err) => {
if (err.message.includes('canceled')) {
return false;
diff --git a/test/cypress/integration/order/orderList.spec.js b/test/cypress/integration/order/orderList.spec.js
index ee011ea05..56c4b6a32 100644
--- a/test/cypress/integration/order/orderList.spec.js
+++ b/test/cypress/integration/order/orderList.spec.js
@@ -6,20 +6,20 @@ describe('OrderList', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/order/list');
});
it('create order', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
- cy.selectOption(clientCreateSelect, 1101);
- cy.get(addressCreateSelect).click();
+ cy.selectOption('[data-cy="Client_select"]', 1101);
+ cy.dataCy('landedDate').find('input').type('06/01/2001');
+ cy.get('[data-cy="Address_select"]').click();
cy.get(
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
).should('have.text', 'star');
- cy.dataCy('landedDate').find('input').type('06/01/2001');
- cy.selectOption(agencyCreateSelect, 1);
-
+ cy.get('.q-menu > div> .q-item:nth-child(1)').click();
+ cy.get('.q-card [data-cy="Agency_select"]').click();
+ cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale');
diff --git a/test/cypress/integration/route/agency/agencyModes.spec.js b/test/cypress/integration/route/agency/agencyModes.spec.js
index 3f5784997..edf7f8819 100644
--- a/test/cypress/integration/route/agency/agencyModes.spec.js
+++ b/test/cypress/integration/route/agency/agencyModes.spec.js
@@ -2,7 +2,6 @@ describe('Agency modes', () => {
const name = 'inhouse pickup';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/1/modes`);
});
diff --git a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
index 79dcd6f70..d73ba1491 100644
--- a/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
+++ b/test/cypress/integration/route/agency/agencyWorkCenter.spec.js
@@ -13,7 +13,6 @@ describe('AgencyWorkCenter', () => {
};
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency/11/workCenter`);
});
diff --git a/test/cypress/integration/route/cmr/cmrList.spec.js b/test/cypress/integration/route/cmr/cmrList.spec.js
index d33508e3a..a25a0c10a 100644
--- a/test/cypress/integration/route/cmr/cmrList.spec.js
+++ b/test/cypress/integration/route/cmr/cmrList.spec.js
@@ -24,7 +24,6 @@ describe('Cmr list', () => {
};
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/route/cmr');
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/roadMap/roadmapList.spec.js b/test/cypress/integration/route/roadMap/roadmapList.spec.js
index 35c0c2b02..bacf130a7 100644
--- a/test/cypress/integration/route/roadMap/roadmapList.spec.js
+++ b/test/cypress/integration/route/roadMap/roadmapList.spec.js
@@ -27,7 +27,6 @@ describe('RoadMap', () => {
const summaryUrl = '/summary';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/roadmap`);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/routeAutonomous.spec.js b/test/cypress/integration/route/routeAutonomous.spec.js
index d77584c04..0e25be7a4 100644
--- a/test/cypress/integration/route/routeAutonomous.spec.js
+++ b/test/cypress/integration/route/routeAutonomous.spec.js
@@ -1,4 +1,4 @@
-describe.skip('RouteAutonomous', () => {
+describe('RouteAutonomous', () => {
const getLinkSelector = (colField) =>
`tr:first-child > [data-col-field="${colField}"] > .no-padding > .link`;
@@ -32,7 +32,6 @@ describe.skip('RouteAutonomous', () => {
const dataSaved = 'Data saved';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/agency-term`);
cy.typeSearchbar('{enter}');
@@ -45,7 +44,7 @@ describe.skip('RouteAutonomous', () => {
.should('have.length.greaterThan', 0);
});
- it('Should create invoice in to selected route', () => {
+ it.skip('Should create invoice in to selected route', () => {
cy.get(selectors.firstRowCheckbox).click();
cy.get(selectors.createInvoiceBtn).click();
cy.dataCy(selectors.reference).type(data.reference);
@@ -69,7 +68,7 @@ describe.skip('RouteAutonomous', () => {
cy.url().should('include', summaryUrl);
});
- describe('Received pop-ups', () => {
+ describe.skip('Received pop-ups', () => {
it('Should redirect to invoice in summary from the received descriptor pop-up', () => {
cy.get(selectors.received).click();
cy.validateContent(selectors.descriptorTitle, data.reference);
diff --git a/test/cypress/integration/route/routeExtendedList.spec.js b/test/cypress/integration/route/routeExtendedList.spec.js
index 97735ca4b..83ecac122 100644
--- a/test/cypress/integration/route/routeExtendedList.spec.js
+++ b/test/cypress/integration/route/routeExtendedList.spec.js
@@ -75,7 +75,6 @@ describe.skip('Route extended list', () => {
}
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(url);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/routeList.spec.js b/test/cypress/integration/route/routeList.spec.js
index f08c267a4..309f8d023 100644
--- a/test/cypress/integration/route/routeList.spec.js
+++ b/test/cypress/integration/route/routeList.spec.js
@@ -26,8 +26,8 @@ describe('Route', () => {
const summaryUrl = '/summary';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
+ cy.viewport(1920, 1080);
cy.visit(`/#/route/list`);
cy.typeSearchbar('{enter}');
});
diff --git a/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js b/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js
index 3e9c816c4..39332b2e0 100644
--- a/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js
+++ b/test/cypress/integration/route/vehicle/vehicleDescriptor.spec.js
@@ -1,6 +1,5 @@
describe('Vehicle', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('deliveryAssistant');
cy.visit(`/#/route/vehicle/7/summary`);
});
diff --git a/test/cypress/integration/route/vehicle/vehicleList.spec.js b/test/cypress/integration/route/vehicle/vehicleList.spec.js
index 2b3c9cdbc..c30f87c6d 100644
--- a/test/cypress/integration/route/vehicle/vehicleList.spec.js
+++ b/test/cypress/integration/route/vehicle/vehicleList.spec.js
@@ -21,7 +21,6 @@ describe('Vehicle list', () => {
const summaryUrl = '/summary';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/vehicle/list`);
cy.typeSearchbar('{enter}');
diff --git a/test/cypress/integration/route/vehicle/vehicleNotes.spec.js b/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
index cd92cc4af..17b870305 100644
--- a/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
+++ b/test/cypress/integration/route/vehicle/vehicleNotes.spec.js
@@ -10,7 +10,6 @@ describe('Vehicle Notes', () => {
const newNoteText = 'probando';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/vehicle/1/notes`);
});
diff --git a/test/cypress/integration/shelving/parking/parkingBasicData.spec.js b/test/cypress/integration/shelving/parking/parkingBasicData.spec.js
index 81c158684..e3f454058 100644
--- a/test/cypress/integration/shelving/parking/parkingBasicData.spec.js
+++ b/test/cypress/integration/shelving/parking/parkingBasicData.spec.js
@@ -6,9 +6,7 @@ describe('ParkingBasicData', () => {
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/shelving/parking/1/basic-data`);
- cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should(
- 'not.be.visible',
- );
+ cy.get('[data-cy="navBar-spinner"]', { timeout: 10000 }).should('not.be.visible');
});
it('should give an error if the code aldready exists', () => {
diff --git a/test/cypress/integration/shelving/parking/parkingList.spec.js b/test/cypress/integration/shelving/parking/parkingList.spec.js
index 7372da164..44b5fd9bc 100644
--- a/test/cypress/integration/shelving/parking/parkingList.spec.js
+++ b/test/cypress/integration/shelving/parking/parkingList.spec.js
@@ -5,7 +5,6 @@ describe('ParkingList', () => {
const summaryHeader = '.header-link';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/parking/list`);
});
diff --git a/test/cypress/integration/shelving/shelvingBasicData.spec.js b/test/cypress/integration/shelving/shelvingBasicData.spec.js
index d7b0dc692..e9ff7f696 100644
--- a/test/cypress/integration/shelving/shelvingBasicData.spec.js
+++ b/test/cypress/integration/shelving/shelvingBasicData.spec.js
@@ -3,7 +3,6 @@ describe('ShelvingList', () => {
const parking =
'.q-card > :nth-child(1) > .q-select > .q-field__inner > .q-field__control > .q-field__control-container';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/1/basic-data`);
});
diff --git a/test/cypress/integration/shelving/shelvingList.spec.js b/test/cypress/integration/shelving/shelvingList.spec.js
index 20b72e419..7a878141a 100644
--- a/test/cypress/integration/shelving/shelvingList.spec.js
+++ b/test/cypress/integration/shelving/shelvingList.spec.js
@@ -1,7 +1,6 @@
///
describe('ShelvingList', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/shelving/list`);
});
diff --git a/test/cypress/integration/supplier/SupplierBalance.spec.js b/test/cypress/integration/supplier/SupplierBalance.spec.js
index e4a3ee65c..575624283 100644
--- a/test/cypress/integration/supplier/SupplierBalance.spec.js
+++ b/test/cypress/integration/supplier/SupplierBalance.spec.js
@@ -1,6 +1,5 @@
describe('Supplier Balance', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/supplier/1/balance`);
});
diff --git a/test/cypress/integration/ticket/ticketDescriptor.spec.js b/test/cypress/integration/ticket/ticketDescriptor.spec.js
index b5c95c463..6c3ad704e 100644
--- a/test/cypress/integration/ticket/ticketDescriptor.spec.js
+++ b/test/cypress/integration/ticket/ticketDescriptor.spec.js
@@ -9,7 +9,6 @@ describe('Ticket descriptor', () => {
const weightValue = '[data-cy="vnLvWeight"]';
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
});
it('should clone the ticket without warehouse', () => {
diff --git a/test/cypress/integration/ticket/ticketExpedition.spec.js b/test/cypress/integration/ticket/ticketExpedition.spec.js
index 95ec330dc..c6b633de8 100644
--- a/test/cypress/integration/ticket/ticketExpedition.spec.js
+++ b/test/cypress/integration/ticket/ticketExpedition.spec.js
@@ -5,7 +5,6 @@ describe('Ticket expedtion', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
});
it('should change the state', () => {
diff --git a/test/cypress/integration/ticket/ticketFilter.spec.js b/test/cypress/integration/ticket/ticketFilter.spec.js
index 2e5a3f3ce..60ad7f287 100644
--- a/test/cypress/integration/ticket/ticketFilter.spec.js
+++ b/test/cypress/integration/ticket/ticketFilter.spec.js
@@ -2,7 +2,6 @@
describe('TicketFilter', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/list');
});
diff --git a/test/cypress/integration/ticket/ticketList.spec.js b/test/cypress/integration/ticket/ticketList.spec.js
index e18025319..302707601 100644
--- a/test/cypress/integration/ticket/ticketList.spec.js
+++ b/test/cypress/integration/ticket/ticketList.spec.js
@@ -2,7 +2,6 @@
describe('TicketList', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/list', false);
});
diff --git a/test/cypress/integration/ticket/ticketNotes.spec.js b/test/cypress/integration/ticket/ticketNotes.spec.js
index df1ff9137..f1bd48f61 100644
--- a/test/cypress/integration/ticket/ticketNotes.spec.js
+++ b/test/cypress/integration/ticket/ticketNotes.spec.js
@@ -2,7 +2,6 @@
describe('TicketNotes', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/observation');
});
diff --git a/test/cypress/integration/ticket/ticketRequest.spec.js b/test/cypress/integration/ticket/ticketRequest.spec.js
index 3b237826e..dc408c3a1 100644
--- a/test/cypress/integration/ticket/ticketRequest.spec.js
+++ b/test/cypress/integration/ticket/ticketRequest.spec.js
@@ -2,7 +2,6 @@
describe('TicketRequest', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit('/#/ticket/31/request');
});
diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js
index f433f0d11..6b2104392 100644
--- a/test/cypress/integration/ticket/ticketSale.spec.js
+++ b/test/cypress/integration/ticket/ticketSale.spec.js
@@ -2,9 +2,9 @@
const firstRow = 'tbody > :nth-child(1)';
describe('TicketSale', () => {
- describe('#23', () => {
+ describe.skip('Ticket #23', () => {
beforeEach(() => {
- cy.login('salesBoss');
+ cy.login('claimManager');
cy.viewport(1920, 1080);
cy.visit('/#/ticket/23/sale');
});
@@ -15,6 +15,8 @@ describe('TicketSale', () => {
cy.get('[data-col-field="price"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
+ cy.get('[data-cy="componentOption-37"]').click();
+
cy.waitForElement('[data-cy="Price_input"]');
cy.dataCy('Price_input').clear().type(price);
cy.intercept('POST', /\/api\/Sales\/\d+\/updatePrice/).as('updatePrice');
@@ -33,6 +35,7 @@ describe('TicketSale', () => {
cy.get('[data-col-field="discount"]').find('.q-btn').click();
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
cy.dataCy('ticketEditManaProxy').should('exist');
+ cy.get('[data-cy="componentOption-37"]').click();
cy.waitForElement('[data-cy="Disc_input"]');
cy.dataCy('Disc_input').clear().type(discount);
cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
@@ -83,8 +86,7 @@ describe('TicketSale', () => {
});
describe('#24 add claim', () => {
beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
+ cy.login('salesPerson');
cy.visit('/#/ticket/24/sale');
});
@@ -102,8 +104,7 @@ describe('TicketSale', () => {
});
describe('#31 free ticket', () => {
beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
+ cy.login('claimManager');
cy.visit('/#/ticket/31/sale');
});
@@ -139,14 +140,15 @@ describe('TicketSale', () => {
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
});
- it.only('should update discount when "Update discount" is clicked', () => {
+ it('should update discount when "Update discount" is clicked', () => {
const discount = Number((Math.random() * 99 + 1).toFixed(2));
selectFirstRow();
cy.dataCy('ticketSaleMoreActionsDropdown').click();
cy.waitForElement('[data-cy="updateDiscountItem"]');
- cy.dataCy('updateDiscountItem').should('exist');
cy.dataCy('updateDiscountItem').click();
+ cy.waitForElement('[data-cy="componentOption-37"]');
+ cy.get('[data-cy="componentOption-37"]').click();
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
@@ -191,8 +193,7 @@ describe('TicketSale', () => {
});
describe('#32 transfer', () => {
beforeEach(() => {
- cy.login('developer');
- cy.viewport(1920, 1080);
+ cy.login('salesPerson');
cy.visit('/#/ticket/32/sale');
});
it('transfer sale to a new ticket', () => {
diff --git a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
index 8e37d8c9c..347dae7df 100644
--- a/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
+++ b/test/cypress/integration/vnComponent/VnBreadcrumbs.spec.js
@@ -2,7 +2,6 @@
describe('VnBreadcrumbs', () => {
const lastBreadcrumb = '.q-breadcrumbs--last > .q-breadcrumbs__el';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/');
});
diff --git a/test/cypress/integration/vnComponent/VnDescriptor.commands.js b/test/cypress/integration/vnComponent/VnDescriptor.commands.js
new file mode 100644
index 000000000..f03db8244
--- /dev/null
+++ b/test/cypress/integration/vnComponent/VnDescriptor.commands.js
@@ -0,0 +1,6 @@
+Cypress.Commands.add('checkVisibleDescriptor', (alias) =>
+ cy
+ .get(`[data-cy="${alias}Descriptor"] [data-cy="vnDescriptor"] > .header`)
+ .should('exist')
+ .and('be.visible'),
+);
diff --git a/test/cypress/integration/vnComponent/VnShortcut.spec.js b/test/cypress/integration/vnComponent/VnShortcut.spec.js
index cc5cacbe4..83249d15e 100644
--- a/test/cypress/integration/vnComponent/VnShortcut.spec.js
+++ b/test/cypress/integration/vnComponent/VnShortcut.spec.js
@@ -1,6 +1,6 @@
///
// https://redmine.verdnatura.es/issues/8848
-describe.skip('VnShortcuts', () => {
+describe('VnShortcuts', () => {
const modules = {
item: 'a',
customer: 'c',
diff --git a/test/cypress/integration/vnComponent/vnTable.commands.js b/test/cypress/integration/vnComponent/vnTable.commands.js
index 6c7e71e13..316fc12f1 100644
--- a/test/cypress/integration/vnComponent/vnTable.commands.js
+++ b/test/cypress/integration/vnComponent/vnTable.commands.js
@@ -2,9 +2,7 @@ Cypress.Commands.add('getRow', (index = 1) =>
cy.get(`.vnTable .q-virtual-scroll__content tr:nth-child(${index})`),
);
Cypress.Commands.add('getRowCol', (field, index = 1) =>
- cy.get(
- `.vnTable .q-virtual-scroll__content > :nth-child(${index}) > [data-col-field="${field}"]`,
- ),
+ cy.getRow(index).find(`[data-col-field="${field}"]`),
);
Cypress.Commands.add('vnTableCreateBtn', () =>
@@ -14,3 +12,9 @@ Cypress.Commands.add('vnTableCreateBtn', () =>
Cypress.Commands.add('waitTableScrollLoad', () =>
cy.waitForElement('[data-q-vs-anchor]'),
);
+
+Cypress.Commands.add('tableActions', (n = 0, child = 1) =>
+ cy.get(
+ `:nth-child(${child}) > .q-table--col-auto-width > [data-cy="tableAction-${n}"] > .q-btn__content > .q-icon`,
+ ),
+);
diff --git a/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
index 915927a6d..3b5d05c6f 100644
--- a/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
+++ b/test/cypress/integration/wagon/wagonType/wagonTypeCreate.spec.js
@@ -1,6 +1,5 @@
describe('WagonTypeCreate', () => {
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/wagon/type/list');
cy.waitForElement('.q-page', 6000);
diff --git a/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
index 36dd83411..b185b61b4 100644
--- a/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
+++ b/test/cypress/integration/wagon/wagonType/wagonTypeEdit.spec.js
@@ -2,7 +2,6 @@ describe('WagonTypeEdit', () => {
const trayColorRow =
'.q-select > .q-field__inner > .q-field__control > .q-field__control-container';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/wagon/type/1/edit');
});
@@ -11,7 +10,7 @@ describe('WagonTypeEdit', () => {
cy.get('.q-card');
cy.get('input').first().type(' changed');
cy.get('div.q-checkbox__bg').first().click();
- cy.get('.q-btn--standard').click();
+ cy.dataCy('saveDefaultBtn').click();
});
it('should delete a tray', () => {
diff --git a/test/cypress/integration/worker/workerBusiness.spec.js b/test/cypress/integration/worker/workerBusiness.spec.js
index 46da28cd6..1650b66c7 100644
--- a/test/cypress/integration/worker/workerBusiness.spec.js
+++ b/test/cypress/integration/worker/workerBusiness.spec.js
@@ -1,4 +1,4 @@
-describe.skip('WorkerBusiness', () => {
+describe('WorkerBusiness', () => {
const saveBtn = '.q-mt-lg > .q-btn--standard';
const contributionCode = `Representantes de comercio`;
const contractType = `INDEFINIDO A TIEMPO COMPLETO`;
diff --git a/test/cypress/integration/worker/workerPit.spec.js b/test/cypress/integration/worker/workerPit.spec.js
index 04f232648..cee4560dc 100644
--- a/test/cypress/integration/worker/workerPit.spec.js
+++ b/test/cypress/integration/worker/workerPit.spec.js
@@ -4,7 +4,6 @@ describe('WorkerPit', () => {
const savePIT = '#st-actions > .q-btn-group > .q-btn--standard';
beforeEach(() => {
- cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/worker/1107/pit`);
});
diff --git a/test/cypress/integration/zone/zoneDeliveryDays.spec.js b/test/cypress/integration/zone/zoneDeliveryDays.spec.js
index a89def12d..6d19edb77 100644
--- a/test/cypress/integration/zone/zoneDeliveryDays.spec.js
+++ b/test/cypress/integration/zone/zoneDeliveryDays.spec.js
@@ -4,7 +4,6 @@ describe('ZoneDeliveryDays', () => {
const submitForm = '.q-form > .q-btn > .q-btn__content';
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit(`/#/zone/delivery-days`);
});
diff --git a/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js b/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js
index 576b2ea70..1c28e732c 100644
--- a/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js
+++ b/test/cypress/integration/zone/zoneUpcomingDeliveries.spec.js
@@ -4,7 +4,6 @@ describe('ZoneUpcomingDeliveries', () => {
beforeEach(() => {
cy.login('developer');
- cy.viewport(1920, 1080);
cy.visit(`/#/zone/upcoming-deliveries`);
});
diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js
index c92bfad85..6d9fb7b22 100755
--- a/test/cypress/support/commands.js
+++ b/test/cypress/support/commands.js
@@ -78,20 +78,21 @@ Cypress.Commands.add('waitForElement', (element) => {
Cypress.Commands.add('getValue', (selector) => {
cy.get(selector).then(($el) => {
if ($el.find('.q-checkbox__inner').length > 0) {
- return cy.get(selector + '.q-checkbox__inner');
+ return cy.get(`${selector}.q-checkbox__inner`);
}
// Si es un QSelect
if ($el.find('.q-select__dropdown-icon').length) {
return cy
.get(
- selector +
- '> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input',
+ `${
+ selector
+ }> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input`,
)
.invoke('val');
}
// Si es un QSelect
if ($el.find('span').length) {
- return cy.get(selector + ' span').then(($span) => {
+ return cy.get(`${selector} span`).then(($span) => {
return $span[0].innerText;
});
}
@@ -100,10 +101,15 @@ Cypress.Commands.add('getValue', (selector) => {
});
});
-Cypress.Commands.add('waitSpinner', () => {
+Cypress.Commands.add('waitSpinner', (_spinner = 'navBar') => {
+ const spinners = {
+ navBar: '[data-cy="navBar-spinner"]',
+ filterPanel: '[data-cy="filterPanel-spinner"]',
+ };
+ const spinner = spinners[_spinner];
cy.get('body').then(($body) => {
- if ($body.find('[data-cy="loading-spinner"]').length) {
- cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
+ if ($body.find(spinner).length) {
+ cy.get(spinner).should('not.be.visible');
}
});
});
@@ -142,7 +148,7 @@ function selectItem(selector, option, ariaControl, hasWrite = true) {
function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
// Se intenta obtener la lista de opciones del desplegable de manera recursiva
return cy
- .get('#' + ariaControl, { timeout })
+ .get(`#${ariaControl}`, { timeout })
.should('exist')
.find('.q-item')
.should('exist')
@@ -352,11 +358,21 @@ Cypress.Commands.add('openListSummary', (row) => {
cy.get('.card-list-body .actions .q-btn:nth-child(2)').eq(row).click();
});
-Cypress.Commands.add('openRightMenu', (element) => {
- if (element) cy.waitForElement(element);
- cy.get('[data-cy="toggle-right-drawer"]').click();
+Cypress.Commands.add('openRightMenu', (element = 'toggle-right-drawer') => {
+ if (element) cy.waitForElement(`[data-cy="${element}"]`);
+ cy.dataCy(element).click();
});
+Cypress.Commands.add('cleanFilterPanel', (element = 'clearFilters') => {
+ cy.get('#filterPanelForm').scrollIntoView();
+ if (element) cy.waitForElement(`[data-cy="${element}"]`);
+ cy.dataCy(element).click();
+});
+
+Cypress.Commands.add('searchInFilterPanel', (element = 'vnFilterPanel_search') => {
+ if (element) cy.waitForElement(`[data-cy="${element}"]`);
+ cy.dataCy(element).click();
+});
Cypress.Commands.add('openLeftMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
@@ -454,9 +470,9 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
cy.waitForElement('[data-cy="descriptor_actions"]');
- cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should('not.be.visible');
+ cy.waitSpinner();
cy.get('.q-btn')
- .filter((index, el) => Cypress.$(el).find('.q-icon.' + iconClass).length > 0)
+ .filter((index, el) => Cypress.$(el).find(`.q-icon.${iconClass}`).length > 0)
.then(($btn) => {
cy.wrap($btn).click();
});
@@ -591,7 +607,7 @@ Cypress.Commands.add('validatePdfDownload', (match, trigger) => {
});
});
-Cypress.Commands.add('clicDescriptorAction', (index = 1) => {
+Cypress.Commands.add('clickDescriptorAction', (index = 1) => {
cy.get(`[data-cy="descriptor_actions"] .q-btn:nth-of-type(${index})`).click();
});
diff --git a/test/cypress/support/index.js b/test/cypress/support/index.js
index b0f0fb3b1..e9042c8fc 100644
--- a/test/cypress/support/index.js
+++ b/test/cypress/support/index.js
@@ -68,6 +68,7 @@ const waitForApiReady = (url, maxRetries = 20, delay = 1000) => {
};
before(() => {
+ cy.viewport(1920, 1080);
waitForApiReady('/api/Applications/status');
});
diff --git a/test/vitest/helper.js b/test/vitest/helper.js
index be0029ee8..f70325254 100644
--- a/test/vitest/helper.js
+++ b/test/vitest/helper.js
@@ -4,6 +4,7 @@ import { createTestingPinia } from '@pinia/testing';
import { vi } from 'vitest';
import { i18n } from 'src/boot/i18n';
import { Notify, Dialog } from 'quasar';
+import keyShortcut from 'src/boot/keyShortcut';
import * as useValidator from 'src/composables/useValidator';
installQuasarPlugin({
@@ -16,6 +17,26 @@ const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false });
const mockPush = vi.fn();
const mockReplace = vi.fn();
+vi.mock('vue', async (importOriginal) => {
+ const actual = await importOriginal();
+ return {
+ ...actual,
+ inject: vi.fn((key) => {
+ if (key === 'app') {
+ return {};
+ }
+ return actual.inject(key);
+ }),
+ onMounted: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onBeforeMount: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onUpdated: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onUnmounted: vi.fn((fn) => (fn && typeof fn === 'function' ? fn() : undefined)),
+ onBeforeUnmount: vi.fn((fn) =>
+ fn && typeof fn === 'function' ? fn() : undefined,
+ ),
+ };
+});
+
vi.mock('vue-router', () => ({
useRouter: () => ({
push: mockPush,
@@ -87,6 +108,10 @@ export function createWrapper(component, options) {
const defaultOptions = {
global: {
plugins: [i18n, pinia],
+ directives: {
+ shortcut: keyShortcut,
+ },
+ stubs: ['useState', 'arrayData', 'useStateStore', 'vue-i18n', 'RouterLink'],
},
mocks: {
t: (tKey) => tKey,
@@ -94,15 +119,11 @@ export function createWrapper(component, options) {
},
};
- const mountOptions = Object.assign({}, defaultOptions);
-
- if (options instanceof Object) {
- Object.assign(mountOptions, options);
-
- if (options.global) {
- mountOptions.global.plugins = defaultOptions.global.plugins;
- }
- }
+ const mountOptions = {
+ ...defaultOptions,
+ ...options,
+ global: { ...defaultOptions.global, ...options?.global },
+ };
const wrapper = mount(component, mountOptions);
const vm = wrapper.vm;
diff --git a/test/vitest/setup-file.js b/test/vitest/setup-file.js
index 0ba9e53c2..6b49d958f 100644
--- a/test/vitest/setup-file.js
+++ b/test/vitest/setup-file.js
@@ -1,5 +1,26 @@
-// This file will be run before each test file, don't delete or vitest will not work.
-import { vi } from 'vitest';
+import { afterAll, beforeAll, vi } from 'vitest';
+
+let vueWarnings = [];
+
+const originalConsoleWarn = console.warn;
+
+beforeAll(() => {
+ console.warn = (...args) => {
+ vueWarnings.push(args.join(' '));
+ };
+});
+
+afterEach(() => {
+ if (vueWarnings.length > 0) {
+ const allWarnings = vueWarnings.join('\n');
+ vueWarnings = [];
+ throw new Error(`Vue warnings detected during test:\n${allWarnings}`);
+ }
+});
+
+afterAll(() => {
+ console.warn = originalConsoleWarn;
+});
vi.mock('axios');
vi.mock('vue-router', () => ({