Merge branch 'dev' into Fix-VnTableFilterTranslations
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
39917e656e
|
@ -55,6 +55,7 @@ const onDataSaved = (data) => {
|
|||
v-model.number="data.quantity"
|
||||
type="number"
|
||||
autofocus
|
||||
data-cy="regularizeStockInput"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
|
|
@ -141,13 +141,16 @@ const handleInsertMode = (e) => {
|
|||
<QIcon
|
||||
name="close"
|
||||
size="xs"
|
||||
v-if="
|
||||
hover &&
|
||||
value &&
|
||||
!$attrs.disabled &&
|
||||
!$attrs.readonly &&
|
||||
$props.clearable
|
||||
"
|
||||
:style="{
|
||||
visibility:
|
||||
hover &&
|
||||
value &&
|
||||
!$attrs.disabled &&
|
||||
!$attrs.readonly &&
|
||||
$props.clearable
|
||||
? 'visible'
|
||||
: 'hidden',
|
||||
}"
|
||||
@click="
|
||||
() => {
|
||||
value = null;
|
||||
|
|
|
@ -113,8 +113,15 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
|
||||
toRefs($props);
|
||||
const {
|
||||
optionLabel,
|
||||
optionValue,
|
||||
optionCaption,
|
||||
optionFilter,
|
||||
optionFilterValue,
|
||||
options,
|
||||
modelValue,
|
||||
} = toRefs($props);
|
||||
const myOptions = ref([]);
|
||||
const myOptionsOriginal = ref([]);
|
||||
const vnSelectRef = ref();
|
||||
|
@ -198,10 +205,10 @@ function filter(val, options) {
|
|||
}
|
||||
|
||||
if (!row) return;
|
||||
const id = row[$props.optionValue];
|
||||
const id = String(row[$props.optionValue]);
|
||||
const optionLabel = String(row[$props.optionLabel]).toLowerCase();
|
||||
|
||||
return id == search || optionLabel.includes(search);
|
||||
return id.includes(search) || optionLabel.includes(search);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -321,6 +328,11 @@ function handleKeyDown(event) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCaption(opt) {
|
||||
if (optionCaption.value === false) return;
|
||||
return opt[optionCaption.value] || opt[optionValue.value];
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -391,8 +403,8 @@ function handleKeyDown(event) {
|
|||
<QItemLabel>
|
||||
{{ opt[optionLabel] }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption v-if="optionCaption !== false">
|
||||
{{ `#${opt[optionCaption] || opt[optionValue]}` }}
|
||||
<QItemLabel caption v-if="getCaption(opt)">
|
||||
{{ `#${getCaption(opt)}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -51,6 +51,7 @@ const url = computed(() => {
|
|||
option-value="id"
|
||||
option-label="nickname"
|
||||
:fields="['id', 'name', 'nickname', 'code']"
|
||||
:filter-options="['id', 'name', 'nickname', 'code']"
|
||||
sort-by="nickname ASC"
|
||||
>
|
||||
<template #prepend v-if="$props.hasAvatar">
|
||||
|
@ -71,7 +72,7 @@ const url = computed(() => {
|
|||
{{ scope.opt.nickname }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption v-else>
|
||||
{{ scope.opt.nickname }}, {{ scope.opt.code }}
|
||||
#{{ scope.opt.id }}, {{ scope.opt.nickname }}, {{ scope.opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
import { describe, it, expect } from 'vitest';
|
||||
import VnJsonValue from 'src/components/common/VnJsonValue.vue';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
|
||||
const buildComponent = (props) => {
|
||||
return createWrapper(VnJsonValue, {
|
||||
props,
|
||||
}).wrapper;
|
||||
};
|
||||
|
||||
describe('VnJsonValue', () => {
|
||||
it('renders null value correctly', async () => {
|
||||
const wrapper = buildComponent({ value: null });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('∅');
|
||||
expect(span.classes()).toContain('json-null');
|
||||
});
|
||||
|
||||
it('renders boolean true correctly', async () => {
|
||||
const wrapper = buildComponent({ value: true });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('✓');
|
||||
expect(span.classes()).toContain('json-true');
|
||||
});
|
||||
|
||||
it('renders boolean false correctly', async () => {
|
||||
const wrapper = buildComponent({ value: false });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('✗');
|
||||
expect(span.classes()).toContain('json-false');
|
||||
});
|
||||
|
||||
it('renders a short string correctly', async () => {
|
||||
const wrapper = buildComponent({ value: 'Hello' });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('Hello');
|
||||
expect(span.classes()).toContain('json-string');
|
||||
});
|
||||
|
||||
it('renders a long string correctly with ellipsis', async () => {
|
||||
const longString = 'a'.repeat(600);
|
||||
const wrapper = buildComponent({ value: longString });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toContain('...');
|
||||
expect(span.text().length).toBeLessThanOrEqual(515);
|
||||
expect(span.attributes('title')).toBe(longString);
|
||||
expect(span.classes()).toContain('json-string');
|
||||
});
|
||||
|
||||
it('renders a number correctly', async () => {
|
||||
const wrapper = buildComponent({ value: 123.4567 });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('123.457');
|
||||
expect(span.classes()).toContain('json-number');
|
||||
});
|
||||
|
||||
it('renders an integer correctly', async () => {
|
||||
const wrapper = buildComponent({ value: 42 });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('42');
|
||||
expect(span.classes()).toContain('json-number');
|
||||
});
|
||||
|
||||
it('renders a date correctly', async () => {
|
||||
const date = new Date('2023-01-01');
|
||||
const wrapper = buildComponent({ value: date });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('2023-01-01');
|
||||
expect(span.classes()).toContain('json-object');
|
||||
});
|
||||
|
||||
it('renders an object correctly', async () => {
|
||||
const obj = { key: 'value' };
|
||||
const wrapper = buildComponent({ value: obj });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe(obj.toString());
|
||||
expect(span.classes()).toContain('json-object');
|
||||
});
|
||||
|
||||
it('renders an array correctly', async () => {
|
||||
const arr = [1, 2, 3];
|
||||
const wrapper = buildComponent({ value: arr });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe(arr.toString());
|
||||
expect(span.classes()).toContain('json-object');
|
||||
});
|
||||
|
||||
it('updates value when prop changes', async () => {
|
||||
const wrapper = buildComponent({ value: true });
|
||||
await wrapper.setProps({ value: 123 });
|
||||
const span = wrapper.find('span');
|
||||
expect(span.text()).toBe('123');
|
||||
expect(span.classes()).toContain('json-number');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,107 @@
|
|||
import { describe, it, expect, vi, beforeAll, afterEach, beforeEach } from 'vitest';
|
||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||
|
||||
describe('VnNotes', () => {
|
||||
let vm;
|
||||
let wrapper;
|
||||
let spyFetch;
|
||||
let postMock;
|
||||
let expectedBody;
|
||||
const mockData= {name: 'Tony', lastName: 'Stark', text: 'Test Note', observationTypeFk: 1};
|
||||
|
||||
function generateExpectedBody() {
|
||||
expectedBody = {...vm.$props.body, ...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk }};
|
||||
}
|
||||
|
||||
async function setTestParams(text, observationType, type){
|
||||
vm.newNote.text = text;
|
||||
vm.newNote.observationTypeFk = observationType;
|
||||
wrapper.setProps({ selectType: type });
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
vi.spyOn(axios, 'get').mockReturnValue({ data: [] });
|
||||
|
||||
wrapper = createWrapper(VnNotes, {
|
||||
propsData: {
|
||||
url: '/test',
|
||||
body: { name: 'Tony', lastName: 'Stark' },
|
||||
}
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
postMock = vi.spyOn(axios, 'post').mockResolvedValue(mockData);
|
||||
spyFetch = vi.spyOn(vm.vnPaginateRef, 'fetch').mockImplementation(() => vi.fn());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
expectedBody = {};
|
||||
});
|
||||
|
||||
describe('insert', () => {
|
||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is null', async () => {
|
||||
await setTestParams( null, null, true );
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).not.toHaveBeenCalled();
|
||||
expect(spyFetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is empty', async () => {
|
||||
await setTestParams( "", null, false );
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).not.toHaveBeenCalled();
|
||||
expect(spyFetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is true', async () => {
|
||||
await setTestParams( "Test Note", null, true );
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).not.toHaveBeenCalled();
|
||||
expect(spyFetch).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is false', async () => {
|
||||
await setTestParams( "Test Note", null, false );
|
||||
|
||||
generateExpectedBody();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
||||
expect(spyFetch).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is setted and selectType is false', async () => {
|
||||
await setTestParams( "Test Note", 1, false );
|
||||
|
||||
generateExpectedBody();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
||||
expect(spyFetch).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call axios.post and vnPaginateRef.fetch when newNote is valid', async () => {
|
||||
await setTestParams( "Test Note", 1, true );
|
||||
|
||||
generateExpectedBody();
|
||||
|
||||
await vm.insert();
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
||||
expect(spyFetch).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,14 +1,16 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { onMounted, ref, computed, watch } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const state = useStateStore();
|
||||
const route = useRoute();
|
||||
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
|
@ -83,6 +85,17 @@ if (props.redirect)
|
|||
};
|
||||
let arrayData = useArrayData(props.dataKey, arrayDataProps);
|
||||
let store = arrayData.store;
|
||||
const to = computed(() => {
|
||||
const url = { path: route.path, query: { ...(route.query ?? {}) } };
|
||||
const searchUrl = arrayData.store.searchUrl;
|
||||
const currentFilter = {
|
||||
...arrayData.store.currentFilter,
|
||||
search: searchText.value || undefined,
|
||||
};
|
||||
|
||||
if (searchUrl) url.query[searchUrl] = JSON.stringify(currentFilter);
|
||||
return url;
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.dataKey,
|
||||
|
@ -132,23 +145,32 @@ async function search() {
|
|||
<template>
|
||||
<Teleport to="#searchbar" v-if="state.isHeaderMounted()">
|
||||
<QForm @submit="search" id="searchbarForm">
|
||||
<RouterLink
|
||||
:to="to"
|
||||
@click="
|
||||
!$event.shiftKey && !$event.ctrlKey && search();
|
||||
$refs.input.focus();
|
||||
"
|
||||
>
|
||||
<QIcon
|
||||
v-if="!quasar.platform.is.mobile"
|
||||
class="cursor-pointer"
|
||||
name="search"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>{{ t('link') }}</QTooltip>
|
||||
</QIcon>
|
||||
</RouterLink>
|
||||
<VnInput
|
||||
id="searchbar"
|
||||
ref="input"
|
||||
v-model.trim="searchText"
|
||||
:placeholder="t(props.label)"
|
||||
dense
|
||||
standout
|
||||
autofocus
|
||||
data-cy="vnSearchBar"
|
||||
data-cy="vn-searchbar"
|
||||
borderless
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon
|
||||
v-if="!quasar.platform.is.mobile"
|
||||
class="cursor-pointer"
|
||||
name="search"
|
||||
@click="search"
|
||||
/>
|
||||
</template>
|
||||
<template #append>
|
||||
<QIcon
|
||||
v-if="props.info && $q.screen.gt.xs"
|
||||
|
@ -173,20 +195,52 @@ async function search() {
|
|||
.q-field {
|
||||
transition: width 0.36s;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
:deep(.q-field__native) {
|
||||
padding-top: 10px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
:deep(.q-field--dark .q-field__native:focus) {
|
||||
color: black;
|
||||
}
|
||||
|
||||
:deep(.q-field--focused) {
|
||||
.q-icon {
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
|
||||
.cursor-info {
|
||||
cursor: help;
|
||||
}
|
||||
#searchbar {
|
||||
.q-field--standout.q-field--highlighted .q-field__control {
|
||||
|
||||
.q-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 4px;
|
||||
padding: 0 5px;
|
||||
background-color: var(--vn-search-color);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--vn-search-color-hover);
|
||||
}
|
||||
&:focus-within {
|
||||
background-color: white;
|
||||
color: black;
|
||||
.q-field__native,
|
||||
|
||||
.q-icon {
|
||||
color: black !important;
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.q-icon {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
link: click to search, ctrl + click to open in a new tab, shift + click to open in a new window
|
||||
es:
|
||||
link: clic para buscar, ctrl + clic para abrir en una nueva pestaña, shift + clic para abrir en una nueva ventana
|
||||
</i18n>
|
||||
|
|
|
@ -76,26 +76,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
|
||||
cancelRequest();
|
||||
canceller = new AbortController();
|
||||
|
||||
const filter = {
|
||||
limit: store.limit,
|
||||
};
|
||||
let userParams = { ...store.userParams };
|
||||
|
||||
Object.assign(filter, store.userFilter);
|
||||
|
||||
let where;
|
||||
if (filter?.where || store.filter?.where)
|
||||
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
||||
Object.assign(filter, store.filter);
|
||||
filter.where = where;
|
||||
const params = { filter };
|
||||
|
||||
Object.assign(params, userParams);
|
||||
if (params.filter) params.filter.skip = store.skip;
|
||||
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
||||
if (store.order?.length) params.filter.order = [...store.order];
|
||||
else delete params.filter.order;
|
||||
const { params, limit } = getCurrentFilter();
|
||||
|
||||
store.currentFilter = JSON.parse(JSON.stringify(params));
|
||||
delete store.currentFilter.filter.include;
|
||||
|
@ -121,7 +102,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
params,
|
||||
});
|
||||
|
||||
const { limit } = filter;
|
||||
store.hasMoreData = limit && response.data.length >= limit;
|
||||
|
||||
processData(response.data, { map: !!store.mapKey, append });
|
||||
|
@ -291,6 +271,31 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
router.replace(newUrl);
|
||||
}
|
||||
|
||||
function getCurrentFilter() {
|
||||
const filter = {
|
||||
limit: store.limit,
|
||||
};
|
||||
|
||||
let userParams = { ...store.userParams };
|
||||
|
||||
Object.assign(filter, store.userFilter);
|
||||
|
||||
let where;
|
||||
if (filter?.where || store.filter?.where)
|
||||
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
||||
Object.assign(filter, store.filter);
|
||||
filter.where = where;
|
||||
const params = { filter };
|
||||
|
||||
Object.assign(params, userParams);
|
||||
if (params.filter) params.filter.skip = store.skip;
|
||||
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
||||
if (store.order?.length) params.filter.order = [...store.order];
|
||||
else delete params.filter.order;
|
||||
|
||||
return { filter, params, limit: filter.limit };
|
||||
}
|
||||
|
||||
function processData(data, { map = true, append = true }) {
|
||||
if (!append) {
|
||||
store.data = [];
|
||||
|
@ -323,6 +328,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
fetch,
|
||||
applyFilter,
|
||||
addFilter,
|
||||
getCurrentFilter,
|
||||
addFilterWhere,
|
||||
addOrder,
|
||||
deleteOrder,
|
||||
|
|
|
@ -10,6 +10,8 @@ body.body--light {
|
|||
--vn-text-color: black;
|
||||
--vn-label-color: #5f5f5f;
|
||||
--vn-accent-color: #e7e3e3;
|
||||
--vn-search-color: #d4d4d4;
|
||||
--vn-search-color-hover: #cfcfcf;
|
||||
--vn-empty-tag: #acacac;
|
||||
--vn-black-text-color: black;
|
||||
--vn-text-color-contrast: white;
|
||||
|
@ -28,6 +30,8 @@ body.body--dark {
|
|||
--vn-text-color: white;
|
||||
--vn-label-color: #a8a8a8;
|
||||
--vn-accent-color: #424242;
|
||||
--vn-search-color: #4b4b4b;
|
||||
--vn-search-color-hover: #5b5b5b;
|
||||
--vn-empty-tag: #2d2d2d;
|
||||
--vn-black-text-color: black;
|
||||
--vn-text-color-contrast: black;
|
||||
|
|
|
@ -93,16 +93,7 @@ defineExpose({ states });
|
|||
outlined
|
||||
rounded
|
||||
dense
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
||||
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('claim.responsible')"
|
||||
v-model="params.claimResponsibleFk"
|
||||
|
|
|
@ -123,6 +123,7 @@ const companiesOptions = ref([]);
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
:fields="['id', 'name', 'nickname']"
|
||||
:filter-options="['id', 'name', 'nickname']"
|
||||
sort-by="nickname"
|
||||
hide-selected
|
||||
dense
|
||||
|
@ -132,9 +133,12 @@ const companiesOptions = ref([]);
|
|||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
scope.opt?.name + ': ' + scope.opt?.nickname
|
||||
}}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name}}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
|
|
@ -69,12 +69,14 @@ const tagValues = ref([]);
|
|||
use-input
|
||||
@update:model-value="searchFn()"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name}}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.nickname }}
|
||||
{{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -68,13 +68,26 @@ function handleDaysAgo(params, daysAgo) {
|
|||
<VnSelect
|
||||
v-model="params.supplierFk"
|
||||
url="Suppliers"
|
||||
:fields="['id', 'nickname']"
|
||||
:fields="['id', 'nickname', 'name']"
|
||||
:label="getLocale('supplierFk')"
|
||||
option-label="nickname"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name}}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
|
|
@ -165,18 +165,18 @@ const cols = computed(() => [
|
|||
<VnSelect
|
||||
v-model="data.supplierFk"
|
||||
url="Suppliers"
|
||||
:fields="['id', 'nickname']"
|
||||
:fields="['id', 'nickname', 'name']"
|
||||
:label="t('globals.supplier')"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:filter-options="['id', 'name']"
|
||||
:filter-options="['id', 'name', 'nickname']"
|
||||
:required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.nickname }}</QItemLabel>
|
||||
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
|
||||
<QItemLabel caption> #{{ scope.opt?.id }}, {{ scope.opt?.name }} </QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
|
|
@ -101,17 +101,7 @@ onMounted(async () => {
|
|||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
#{{ scope.opt?.id }} {{ scope.opt?.name }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('invoiceOutSerialType')"
|
||||
v-model="formData.serialType"
|
||||
|
|
|
@ -52,6 +52,7 @@ const entityId = computed(() => {
|
|||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
data-cy="AddGenusSelectDialog"
|
||||
>
|
||||
<template #form>
|
||||
<CreateGenusForm
|
||||
|
@ -68,6 +69,7 @@ const entityId = computed(() => {
|
|||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
data-cy="AddSpeciesSelectDialog"
|
||||
>
|
||||
<template #form>
|
||||
<CreateSpecieForm
|
||||
|
|
|
@ -107,7 +107,7 @@ const submitTags = async (data) => {
|
|||
@on-fetch="onItemTagsFetched"
|
||||
>
|
||||
<template #body="{ rows, validate }">
|
||||
<QCard class="q-px-lg q-pt-md q-pb-sm">
|
||||
<QCard class="q-px-lg q-pt-md q-pb-sm" data-cy="itemTags">
|
||||
<VnRow
|
||||
v-for="(row, index) in rows"
|
||||
:key="index"
|
||||
|
|
|
@ -35,6 +35,7 @@ const editTableCellDialogRef = ref(null);
|
|||
const user = state.getUser();
|
||||
const fixedPrices = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const hasSelectedRows = computed(() => rowsSelected.value.length > 0);
|
||||
const rowsSelected = ref([]);
|
||||
const itemFixedPriceFilterRef = ref();
|
||||
|
||||
|
@ -368,9 +369,9 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</template>
|
||||
</RightMenu>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<template #st-actions>
|
||||
<QBtn
|
||||
v-if="rowsSelected.length"
|
||||
:disable="!hasSelectedRows"
|
||||
@click="openEditTableCellDialog()"
|
||||
color="primary"
|
||||
icon="edit"
|
||||
|
@ -380,13 +381,13 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:disable="!hasSelectedRows"
|
||||
:label="tMobile('globals.remove')"
|
||||
color="primary"
|
||||
icon="delete"
|
||||
flat
|
||||
@click="(row) => confirmRemove(row, true)"
|
||||
:title="t('globals.remove')"
|
||||
v-if="rowsSelected.length"
|
||||
/>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, onBeforeMount } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
@ -15,6 +15,9 @@ import ItemTypeDescriptorProxy from './ItemType/Card/ItemTypeDescriptorProxy.vue
|
|||
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import ItemListFilter from './ItemListFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const entityId = computed(() => route.params.id);
|
||||
const { openCloneDialog } = cloneItem();
|
||||
|
@ -22,7 +25,9 @@ const { viewSummary } = useSummaryDialog();
|
|||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const route = useRoute();
|
||||
|
||||
const validPriorities = ref([]);
|
||||
const defaultTag = ref();
|
||||
const defaultPriority = ref();
|
||||
const itemFilter = {
|
||||
include: [
|
||||
{
|
||||
|
@ -90,7 +95,6 @@ const columns = computed(() => [
|
|||
label: t('globals.description'),
|
||||
name: 'description',
|
||||
align: 'left',
|
||||
create: true,
|
||||
columnFilter: {
|
||||
name: 'search',
|
||||
},
|
||||
|
@ -132,13 +136,23 @@ const columns = computed(() => [
|
|||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
label: t('item.list.typeName'),
|
||||
name: 'typeName',
|
||||
align: 'left',
|
||||
component: 'select',
|
||||
columnFilter: {
|
||||
name: 'typeFk',
|
||||
attrs: {
|
||||
url: 'ItemTypes',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
}
|
||||
},
|
||||
{
|
||||
label: t('item.list.category'),
|
||||
|
@ -161,6 +175,11 @@ const columns = computed(() => [
|
|||
name: 'intrastat',
|
||||
align: 'left',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Intrastats',
|
||||
optionValue: 'description',
|
||||
optionLabel: 'description',
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'intrastat',
|
||||
attrs: {
|
||||
|
@ -172,7 +191,6 @@ const columns = computed(() => [
|
|||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
|
@ -198,7 +216,6 @@ const columns = computed(() => [
|
|||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
|
@ -297,12 +314,21 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const { data } = await axios.get('ItemConfigs');
|
||||
defaultTag.value = data[0].defaultTag;
|
||||
defaultPriority.value = data[0].defaultPriority;
|
||||
data.forEach((priority) => {
|
||||
validPriorities.value = priority.validPriorities;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="ItemList"
|
||||
:label="t('item.searchbar.label')"
|
||||
:info="t('You can search by id')"
|
||||
:info="t('item.searchbar.info')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
|
@ -310,15 +336,18 @@ const columns = computed(() => [
|
|||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
v-if="defaultTag"
|
||||
ref="tableRef"
|
||||
data-key="ItemList"
|
||||
url="Items/filter"
|
||||
:create="{
|
||||
urlCreate: 'Items',
|
||||
title: t('Create Item'),
|
||||
onDataSaved: () => tableRef.redirect(),
|
||||
urlCreate: 'Items/new',
|
||||
title: t('item.list.newItem'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(`${id}/basic-data`),
|
||||
formInitialData: {
|
||||
editorFk: entityId,
|
||||
tag: defaultTag,
|
||||
priority: defaultPriority,
|
||||
},
|
||||
}"
|
||||
:order="['isActive DESC', 'name', 'id']"
|
||||
|
@ -364,6 +393,96 @@ const columns = computed(() => [
|
|||
</div>
|
||||
<FetchedTags :item="row" :columns="3" />
|
||||
</template>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
v-model="data.provisionalName"
|
||||
:label="t('globals.description')"
|
||||
:is-required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
url="Tags"
|
||||
v-model="data.tag"
|
||||
:label="t('globals.tag')"
|
||||
:fields="['id', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
:sort-by="['name ASC']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
:options="validPriorities"
|
||||
v-model="data.priority"
|
||||
:label="t('item.create.priority')"
|
||||
:is-required="true"
|
||||
/>
|
||||
<VnSelect
|
||||
url="ItemTypes"
|
||||
v-model="data.typeFk"
|
||||
:label="t('item.list.typeName')"
|
||||
:fields="['id', 'code', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
url="Intrastats"
|
||||
v-model="data.intrastatFk"
|
||||
:label="t('globals.intrastat')"
|
||||
:fields="['id', 'description']"
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.description }}</QItemLabel>
|
||||
<QItemLabel caption> #{{ scope.opt?.id }} </QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
url="Origins"
|
||||
v-model="data.originFk"
|
||||
:label="t('globals.origin')"
|
||||
:fields="['id', 'code', 'name']"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
:is-required="true"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.code }} #{{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -199,17 +199,7 @@ onMounted(async () => {
|
|||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
t(`params.${scope.opt?.name}`)
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -265,6 +255,7 @@ onMounted(async () => {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
:fields="['id', 'name', 'nickname']"
|
||||
:filter-options="['id', 'name', 'nickname']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
dense
|
||||
|
@ -274,9 +265,12 @@ onMounted(async () => {
|
|||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
scope.opt?.name + ': ' + scope.opt?.nickname
|
||||
}}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name}}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
@ -375,6 +369,7 @@ onMounted(async () => {
|
|||
:model-value="fieldFilter.selectedField"
|
||||
:options="moreFields"
|
||||
option-label="label"
|
||||
option-value="label"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
|
|
|
@ -149,7 +149,6 @@ onMounted(async () => {
|
|||
:label="t('params.requesterFk')"
|
||||
v-model="params.requesterFk"
|
||||
@update:model-value="searchFn()"
|
||||
:fields="['id', 'name']"
|
||||
:params="{ departmentCodes: ['VT'] }"
|
||||
hide-selected
|
||||
dense
|
||||
|
|
|
@ -107,6 +107,7 @@ item:
|
|||
scopeDays: Scope days
|
||||
searchbar:
|
||||
label: Search item
|
||||
info: You can search by id
|
||||
descriptor:
|
||||
item: Item
|
||||
buyer: Buyer
|
||||
|
@ -139,6 +140,7 @@ item:
|
|||
stemMultiplier: Multiplier
|
||||
producer: Producer
|
||||
landed: Landed
|
||||
newItem: New item
|
||||
basicData:
|
||||
type: Type
|
||||
reference: Reference
|
||||
|
|
|
@ -109,6 +109,7 @@ item:
|
|||
scopeDays: Días en adelante
|
||||
searchbar:
|
||||
label: Buscar artículo
|
||||
info: Puedes buscar por id
|
||||
descriptor:
|
||||
item: Artículo
|
||||
buyer: Comprador
|
||||
|
@ -141,6 +142,7 @@ item:
|
|||
stemMultiplier: Multiplicador
|
||||
producer: Productor
|
||||
landed: F. entrega
|
||||
newItem: Nuevo artículo
|
||||
basicData:
|
||||
type: Tipo
|
||||
reference: Referencia
|
||||
|
|
|
@ -110,15 +110,13 @@ const columns = computed(() => [
|
|||
name: 'salesPersonFk',
|
||||
field: 'userName',
|
||||
align: 'left',
|
||||
optionFilter: 'firstName',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
url: 'Workers/search?departmentCodes=["VT"]',
|
||||
fields: ['id', 'name', 'nickname', 'code'],
|
||||
sortBy: 'nickname ASC',
|
||||
where: { role: 'salesPerson' },
|
||||
useLike: false,
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -97,6 +97,7 @@ const sourceList = ref([]);
|
|||
v-model="params.sourceApp"
|
||||
:options="sourceList"
|
||||
option-label="value"
|
||||
option-value="value"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
|
|
|
@ -101,7 +101,7 @@ const getGroupedStates = (data) => {
|
|||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="states">
|
||||
<QSelect
|
||||
<VnSelect
|
||||
:label="t('State')"
|
||||
v-model="params.stateFk"
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -122,7 +122,7 @@ const getGroupedStates = (data) => {
|
|||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="groupedStates">
|
||||
<QSelect
|
||||
<VnSelect
|
||||
:label="t('Grouped state')"
|
||||
v-model="params.groupedStates"
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -217,7 +217,7 @@ const getGroupedStates = (data) => {
|
|||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="provinces">
|
||||
<QSelect
|
||||
<VnSelect
|
||||
:label="t('Province')"
|
||||
v-model="params.provinceFk"
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -238,7 +238,7 @@ const getGroupedStates = (data) => {
|
|||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="agencies">
|
||||
<QSelect
|
||||
<VnSelect
|
||||
:label="t('Agency')"
|
||||
v-model="params.agencyModeFk"
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -259,7 +259,7 @@ const getGroupedStates = (data) => {
|
|||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="warehouses">
|
||||
<QSelect
|
||||
<VnSelect
|
||||
:label="t('Warehouse')"
|
||||
v-model="params.warehouseFk"
|
||||
@update:model-value="searchFn()"
|
||||
|
|
|
@ -221,7 +221,20 @@ warehouses();
|
|||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name}}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id } , ${ scope.opt?.nickname}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -232,6 +245,7 @@ warehouses();
|
|||
:options="continentsOptions"
|
||||
option-value="code"
|
||||
option-label="name"
|
||||
:filter-options="['code', 'name']"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
|
|
|
@ -140,10 +140,10 @@ en:
|
|||
Id: Contains
|
||||
ref: Reference
|
||||
agency: Agency
|
||||
warehouseInFk: W. In
|
||||
warehouseInFk: Warehouse In
|
||||
shipped: Shipped
|
||||
shipmentHour: Shipment Hour
|
||||
warehouseOut: W. Out
|
||||
warehouseOut: Warehouse Out
|
||||
landed: Landed
|
||||
landingHour: Landing Hour
|
||||
totalEntries: Σ
|
||||
|
@ -156,7 +156,7 @@ es:
|
|||
warehouseInFk: Alm.Entrada
|
||||
shipped: F.Envío
|
||||
shipmentHour: Hora de envío
|
||||
warehouseOut: Alm.Entrada
|
||||
warehouseOut: Alm.Salida
|
||||
landed: F.Entrega
|
||||
landingHour: Hora de entrega
|
||||
totalEntries: Σ
|
||||
|
|
|
@ -208,13 +208,30 @@ const getWorkedHours = async (from, to) => {
|
|||
};
|
||||
|
||||
const getAbsences = async () => {
|
||||
const params = {
|
||||
workerFk: route.params.id,
|
||||
businessFk: null,
|
||||
year: startOfWeek.value.getFullYear(),
|
||||
const startYear = startOfWeek.value.getFullYear();
|
||||
const endYear = endOfWeek.value.getFullYear();
|
||||
const defaultParams = { workerFk: route.params.id, businessFk: null };
|
||||
|
||||
const startData = (
|
||||
await axios.get('Calendars/absences', {
|
||||
params: { ...defaultParams, year: startYear },
|
||||
})
|
||||
).data;
|
||||
|
||||
let endData;
|
||||
if (startYear !== endYear) {
|
||||
endData = (
|
||||
await axios.get('Calendars/absences', {
|
||||
params: { ...defaultParams, year: endYear },
|
||||
})
|
||||
).data;
|
||||
}
|
||||
|
||||
const data = {
|
||||
holidays: [...(startData?.holidays || []), ...(endData?.holidays || [])],
|
||||
absences: [...(startData?.absences || []), ...(endData?.absences || [])],
|
||||
};
|
||||
|
||||
const { data } = await axios.get('Calendars/absences', { params });
|
||||
if (data) addEvents(data);
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ describe('OrderCatalog', () => {
|
|||
}
|
||||
});
|
||||
cy.get(
|
||||
'[data-cy="vnSearchBar"] > .q-field > .q-field__inner > .q-field__control'
|
||||
'[data-cy="vn-searchbar"] > .q-field > .q-field__inner > .q-field__control'
|
||||
).type('{enter}');
|
||||
cy.get(':nth-child(1) > [data-cy="catalogFilterCategory"]').click();
|
||||
cy.dataCy('catalogFilterValueDialogBtn').last().click();
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Item shelving', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/list`);
|
||||
cy.typeSearchbar('1{enter}');
|
||||
});
|
||||
|
||||
it('should throw an error if the barcode exists', () => {
|
||||
cy.get('[href="#/item/1/barcode"]').click();
|
||||
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.dataCy('Code_input').eq(3).type('1111111111');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification('Codes can not be repeated');
|
||||
});
|
||||
|
||||
it('should create a new barcode', () => {
|
||||
cy.get('[href="#/item/1/barcode"]').click();
|
||||
cy.get('.q-card > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.dataCy('Code_input').eq(3).type('1231231231');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,31 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Item botanical', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/1/botanical`);
|
||||
});
|
||||
|
||||
it('should modify the botanical', () => {
|
||||
cy.dataCy('AddGenusSelectDialog').type('Abies');
|
||||
cy.get('.q-menu .q-item').contains('Abies').click();
|
||||
cy.dataCy('AddSpeciesSelectDialog').type('dealbata');
|
||||
cy.get('.q-menu .q-item').contains('dealbata').click();
|
||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
|
||||
it('should create a new Genus', () => {
|
||||
cy.dataCy('Genus_icon').click();
|
||||
cy.dataCy('Latin genus name_input').type('Test');
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('Data created');
|
||||
});
|
||||
|
||||
it('should create a new specie', () => {
|
||||
cy.dataCy('Species_icon').click();
|
||||
cy.dataCy('Latin species name_input').type('Test specie');
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('Data created');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,34 @@
|
|||
/// <reference types="cypress" />
|
||||
|
||||
describe('Item list', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/list`);
|
||||
cy.typeSearchbar('{enter}');
|
||||
});
|
||||
|
||||
it('should filter the items and redirect to the summary', () => {
|
||||
cy.dataCy('Category_select').type('Plant');
|
||||
cy.get('.q-menu .q-item').contains('Plant').click();
|
||||
cy.dataCy('Type_select').type('Anthurium');
|
||||
cy.get('.q-menu .q-item').contains('Anthurium').click();
|
||||
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
|
||||
});
|
||||
|
||||
it('should create an item', () => {
|
||||
const data = {
|
||||
Description: { val: `Test item` },
|
||||
Type: { val: `Crisantemo`, type: 'select' },
|
||||
Intrastat: { val: `Coral y materiales similares`, type: 'select' },
|
||||
Origin: { val: `SPA`, type: 'select' },
|
||||
};
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
cy.fillInForm(data);
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('Data created');
|
||||
cy.get(
|
||||
':nth-child(2) > .q-drawer > .q-drawer__content > .q-scrollarea > .q-scrollarea__container > .q-scrollarea__content'
|
||||
).should('be.visible');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,24 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Item summary', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/1/summary`);
|
||||
});
|
||||
|
||||
it('should clone the item', () => {
|
||||
cy.dataCy('descriptor-more-opts').click();
|
||||
cy.get('.q-menu > .q-list > :nth-child(2) > .q-item__section').click();
|
||||
cy.dataCy('VnConfirm_confirm').click();
|
||||
cy.waitForElement('[data-cy="itemTags"]');
|
||||
cy.dataCy('itemTags').should('be.visible');
|
||||
});
|
||||
|
||||
it('should regularize stock', () => {
|
||||
cy.dataCy('descriptor-more-opts').click();
|
||||
cy.get('.q-menu > .q-list > :nth-child(1) > .q-item__section').click();
|
||||
cy.dataCy('regularizeStockInput').type('10');
|
||||
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
|
||||
cy.checkNotification('Data created');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,39 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Item tag', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/1/tags`);
|
||||
});
|
||||
|
||||
it('should throw an error adding an existent tag', () => {
|
||||
cy.get('.q-page').should('be.visible');
|
||||
cy.get('.q-page-sticky > div').click();
|
||||
cy.get('.q-page-sticky > div').click();
|
||||
cy.dataCy('Tag_select').eq(7).type('Tallos');
|
||||
cy.get('.q-menu .q-item').contains('Tallos').click();
|
||||
cy.get(
|
||||
':nth-child(8) > [label="Value"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Value_input"]'
|
||||
).type('1');
|
||||
+cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification("The tag or priority can't be repeated for an item");
|
||||
});
|
||||
|
||||
it('should add a new tag', () => {
|
||||
cy.get('.q-page').should('be.visible');
|
||||
cy.get('.q-page-sticky > div').click();
|
||||
cy.get('.q-page-sticky > div').click();
|
||||
cy.dataCy('Tag_select').eq(7).click();
|
||||
cy.get('.q-menu .q-item').contains('Ancho de la base').click();
|
||||
cy.get(
|
||||
':nth-child(8) > [label="Value"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Value_input"]'
|
||||
).type('50');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification('Data saved');
|
||||
cy.get(
|
||||
'[data-cy="itemTags"] > :nth-child(7) > .justify-center > .q-icon'
|
||||
).click();
|
||||
cy.dataCy('VnConfirm_confirm').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Item tax', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/1/tax`);
|
||||
});
|
||||
|
||||
it('should modify the tax for Spain', () => {
|
||||
cy.dataCy('Class_select').eq(1).type('General VAT{enter}');
|
||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||
cy.checkNotification('Data saved');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,40 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Item type', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/item/item-type`);
|
||||
});
|
||||
|
||||
it('should throw an error if the code already exists', () => {
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
cy.get(
|
||||
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Code_input"]'
|
||||
).type('ALS');
|
||||
cy.get(
|
||||
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Name_input"]'
|
||||
).type('Alstroemeria');
|
||||
cy.dataCy('Worker_select').type('employeeNick');
|
||||
cy.get('.q-menu .q-item').contains('employeeNick').click();
|
||||
cy.dataCy('ItemCategory_select').type('Artificial');
|
||||
cy.get('.q-menu .q-item').contains('Artificial').click();
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('An item type with the same code already exists');
|
||||
});
|
||||
|
||||
it('should create a new type', () => {
|
||||
cy.dataCy('vnTableCreateBtn').click();
|
||||
cy.get(
|
||||
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Code_input"]'
|
||||
).type('LIL');
|
||||
cy.get(
|
||||
'div.fit > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="Name_input"]'
|
||||
).type('Lilium');
|
||||
cy.dataCy('Worker_select').type('buyerNick');
|
||||
cy.get('.q-menu .q-item').contains('buyerNick').click();
|
||||
cy.dataCy('ItemCategory_select').type('Flower');
|
||||
cy.get('.q-menu .q-item').contains('Flower').click();
|
||||
cy.dataCy('FormModelPopup_save').click();
|
||||
cy.checkNotification('Data created');
|
||||
});
|
||||
});
|
|
@ -9,9 +9,9 @@ describe('TicketList', () => {
|
|||
});
|
||||
|
||||
const searchResults = (search) => {
|
||||
cy.dataCy('vnSearchBar').find('input').focus();
|
||||
if (search) cy.dataCy('vnSearchBar').find('input').type(search);
|
||||
cy.dataCy('vnSearchBar').find('input').type('{enter}');
|
||||
cy.dataCy('vn-searchbar').find('input').focus();
|
||||
if (search) cy.dataCy('vn-searchbar').find('input').type(search);
|
||||
cy.dataCy('vn-searchbar').find('input').type('{enter}');
|
||||
cy.dataCy('ticketListTable').should('exist');
|
||||
cy.get(firstRow).should('exist');
|
||||
};
|
||||
|
|
|
@ -16,17 +16,17 @@ describe('VnSearchBar', () => {
|
|||
});
|
||||
|
||||
it('should stay on the list page if there are several results or none', () => {
|
||||
cy.writeSearchbar('salesA{enter}');
|
||||
cy.typeSearchbar('salesA{enter}');
|
||||
checkTableLength(2);
|
||||
|
||||
cy.clearSearchbar();
|
||||
cy.writeSearchbar('0{enter}');
|
||||
cy.typeSearchbar('0{enter}');
|
||||
checkTableLength(0);
|
||||
});
|
||||
|
||||
const searchAndCheck = (searchTerm, expectedText) => {
|
||||
cy.clearSearchbar();
|
||||
cy.writeSearchbar(`${searchTerm}{enter}`);
|
||||
cy.typeSearchbar(`${searchTerm}{enter}`);
|
||||
cy.get(idGap).should('have.text', expectedText);
|
||||
};
|
||||
|
||||
|
|
|
@ -274,15 +274,11 @@ Cypress.Commands.add('openLeftMenu', (element) => {
|
|||
|
||||
Cypress.Commands.add('clearSearchbar', (element) => {
|
||||
if (element) cy.waitForElement(element);
|
||||
cy.get(
|
||||
'#searchbar > form > div:nth-child(1) > label > div:nth-child(1) input'
|
||||
).clear();
|
||||
cy.get('[data-cy="vn-searchbar"]').clear();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('writeSearchbar', (value) => {
|
||||
cy.get('#searchbar > form > div:nth-child(1) > label > div:nth-child(1) input').type(
|
||||
value
|
||||
);
|
||||
cy.get('[data-cy="vn-searchbar"]').type(value);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('validateContent', (selector, expectedValue) => {
|
||||
|
|
Loading…
Reference in New Issue