Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6695-jenkins_e2e_parallel
This commit is contained in:
commit
8a99da0fba
38
CHANGELOG.md
38
CHANGELOG.md
|
@ -1,3 +1,41 @@
|
||||||
|
# Version 25.08 - 2025-03-04
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- feat: add order for table (origin/8681_ticketAdvance_updates) by:Javier Segarra
|
||||||
|
- feat: detect when is descriptor proxy by:Javier Segarra
|
||||||
|
- feat: refs #7356 update CrudModel by:Javier Segarra
|
||||||
|
- feat: refs #8242 remove teleport by:Javier Segarra
|
||||||
|
- feat: refs #8242 use stateStore by:Javier Segarra
|
||||||
|
- fix: fixed negative bases style by:Jon
|
||||||
|
- fix: fixed style when clicking on icons by:Jon
|
||||||
|
- refactor: refs #6897 remove debug logs and unused style (origin/6897-fixSomeCaus) by:pablone
|
||||||
|
- style: refs #7356 eslint format by:Javier Segarra
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- perf: refs #7356 minor changes (origin/7356_ticketService) by:Javier Segarra
|
||||||
|
- refactor: refs #6897 remove debug logs and unused style (origin/6897-fixSomeCaus) by:pablone
|
||||||
|
- refactor: refs #6897 update component props and attributes for consistency and improved functionality (origin/6897-fixMinorIssues) by:pablone
|
||||||
|
- refactor: refs #6897 update component props and improve UI handling in Entry pages by:pablone
|
||||||
|
- refactor: refs #6897 update VnTable components for improved value handling and UI adjustments (origin/6897-minorFixes) by:pablone
|
||||||
|
- refactor: refs #8697 simplify date handling in ItemDiary component by:pablone
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- fix: add datakey by:Javier Segarra
|
||||||
|
- fix: fixed account descriptor menu and created e2e by:Jon
|
||||||
|
- fix: fixed negative bases style by:Jon
|
||||||
|
- fix: fixed style when clicking on icons by:Jon
|
||||||
|
- fix: refs #6553 workerBusiness (origin/6553-fixWorkerBusinessV2) by:carlossa
|
||||||
|
- fix: refs #6553 workerBusiness v3 by:carlossa
|
||||||
|
- fix: refs #6897 prevent default event behavior in autocompleteExpense function by:pablone
|
||||||
|
- fix: refs #7356 chaining params by:Javier Segarra
|
||||||
|
- fix: refs #7356 ticketService by:Javier Segarra
|
||||||
|
- fix: refs #8242 workerDepartmentTree bug (origin/8242_leftMenu_responsive) by:Javier Segarra
|
||||||
|
- fix: workerBasicData by:carlossa
|
||||||
|
- Revert "revert 1015acefb7e400be2d8b5958dba69b4d98276b34" (origin/fix_revert_revert, fix_revert_revert) by:alexm
|
||||||
|
|
||||||
# Version 25.06 - 2025-02-18
|
# Version 25.06 - 2025-02-18
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -94,7 +94,7 @@ pipeline {
|
||||||
parallel {
|
parallel {
|
||||||
stage('Unit') {
|
stage('Unit') {
|
||||||
steps {
|
steps {
|
||||||
sh 'pnpm run test:unit:ci'
|
sh 'pnpm run test:front:ci'
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
|
|
@ -23,7 +23,7 @@ quasar dev
|
||||||
### Run unit tests
|
### Run unit tests
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm run test:unit
|
pnpm run test:front
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run e2e tests
|
### Run e2e tests
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
"test:e2e:parallel": "bash ./test/cypress/cypressParallel.sh",
|
"test:e2e:parallel": "bash ./test/cypress/cypressParallel.sh",
|
||||||
"test:e2e:summary": "bash ./test/cypress/summary.sh",
|
"test:e2e:summary": "bash ./test/cypress/summary.sh",
|
||||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||||
"test:unit": "vitest",
|
"test:front": "vitest",
|
||||||
"test:unit:ci": "vitest run",
|
"test:front:ci": "vitest run",
|
||||||
"commitlint": "commitlint --edit",
|
"commitlint": "commitlint --edit",
|
||||||
"prepare": "npx husky install",
|
"prepare": "npx husky install",
|
||||||
"addReferenceTag": "node .husky/addReferenceTag.js",
|
"addReferenceTag": "node .husky/addReferenceTag.js",
|
||||||
|
|
|
@ -184,8 +184,11 @@ async function saveChanges(data) {
|
||||||
if ($props.beforeSaveFn) {
|
if ($props.beforeSaveFn) {
|
||||||
changes = await $props.beforeSaveFn(changes, getChanges);
|
changes = await $props.beforeSaveFn(changes, getChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (changes?.creates?.length === 0 && changes?.updates?.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
|
|
|
@ -124,7 +124,7 @@ const selectTravel = ({ id }) => {
|
||||||
<FetchData
|
<FetchData
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
@on-fetch="(data) => (agenciesOptions = data)"
|
@on-fetch="(data) => (agenciesOptions = data)"
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
|
|
@ -18,14 +18,25 @@ defineProps({ row: { type: Object, required: true } });
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</router-link>
|
</router-link>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="row?.risk"
|
v-if="row?.reserved"
|
||||||
|
color="primary"
|
||||||
|
name="vn:reserva"
|
||||||
|
size="xs"
|
||||||
|
data-cy="ticketSaleReservedIcon"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('ticketSale.reserved') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="row?.hasRisk"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||||
size="xs"
|
size="xs"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ $t('salesTicketsTable.risk') }}:
|
{{ $t('salesTicketsTable.risk') }}:
|
||||||
{{ toCurrency(row.risk - row.credit) }}
|
{{ toCurrency(row.risk - (row.credit ?? 0)) }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -67,12 +78,7 @@ defineProps({ row: { type: Object, required: true } });
|
||||||
>
|
>
|
||||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon v-if="row?.isTaxDataChecked" name="vn:no036" color="primary" size="xs">
|
||||||
v-if="row?.isTaxDataChecked !== 0"
|
|
||||||
name="vn:no036"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="row?.isFreezed" name="vn:frozen" color="primary" size="xs">
|
<QIcon v-if="row?.isFreezed" name="vn:frozen" color="primary" size="xs">
|
||||||
|
|
|
@ -55,6 +55,10 @@ const $props = defineProps({
|
||||||
type: [Function, Boolean],
|
type: [Function, Boolean],
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
rowCtrlClick: {
|
||||||
|
type: [Function, Boolean],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
redirect: {
|
redirect: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -681,6 +685,7 @@ const rowCtrlClickFunction = computed(() => {
|
||||||
@update:selected="emit('update:selected', $event)"
|
@update:selected="emit('update:selected', $event)"
|
||||||
@selection="(details) => handleSelection(details, rows)"
|
@selection="(details) => handleSelection(details, rows)"
|
||||||
:hide-selected-banner="true"
|
:hide-selected-banner="true"
|
||||||
|
:data-cy="$props.dataCy ?? 'vnTable'"
|
||||||
>
|
>
|
||||||
<template #top-left v-if="!$props.withoutHeader">
|
<template #top-left v-if="!$props.withoutHeader">
|
||||||
<slot name="top-left"> </slot>
|
<slot name="top-left"> </slot>
|
||||||
|
|
|
@ -30,8 +30,8 @@ describe('CrudModel', () => {
|
||||||
saveFn: '',
|
saveFn: '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
wrapper=wrapper.wrapper;
|
wrapper = wrapper.wrapper;
|
||||||
vm=wrapper.vm;
|
vm = wrapper.vm;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -143,14 +143,14 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true if object is empty', async () => {
|
it('should return true if object is empty', async () => {
|
||||||
dummyObj ={};
|
dummyObj = {};
|
||||||
result = vm.isEmpty(dummyObj);
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false if object is not empty', async () => {
|
it('should return false if object is not empty', async () => {
|
||||||
dummyObj = {a:1, b:2, c:3};
|
dummyObj = { a: 1, b: 2, c: 3 };
|
||||||
result = vm.isEmpty(dummyObj);
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
expect(result).toBe(false);
|
expect(result).toBe(false);
|
||||||
|
@ -164,20 +164,22 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false if array is not empty', async () => {
|
it('should return false if array is not empty', async () => {
|
||||||
dummyArray = [1,2,3];
|
dummyArray = [1, 2, 3];
|
||||||
result = vm.isEmpty(dummyArray);
|
result = vm.isEmpty(dummyArray);
|
||||||
|
|
||||||
expect(result).toBe(false);
|
expect(result).toBe(false);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('resetData()', () => {
|
describe('resetData()', () => {
|
||||||
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
||||||
data = [{
|
data = [
|
||||||
name: 'Tony',
|
{
|
||||||
lastName: 'Stark',
|
name: 'Tony',
|
||||||
age: 42,
|
lastName: 'Stark',
|
||||||
}];
|
age: 42,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
vm.resetData(data);
|
vm.resetData(data);
|
||||||
|
|
||||||
|
@ -210,11 +212,13 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('saveChanges()', () => {
|
describe('saveChanges()', () => {
|
||||||
data = [{
|
data = [
|
||||||
name: 'Tony',
|
{
|
||||||
lastName: 'Stark',
|
name: 'Tony',
|
||||||
age: 42,
|
lastName: 'Stark',
|
||||||
}];
|
age: 42,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
it('should call saveFn if exists', async () => {
|
it('should call saveFn if exists', async () => {
|
||||||
await wrapper.setProps({ saveFn: vi.fn() });
|
await wrapper.setProps({ saveFn: vi.fn() });
|
||||||
|
@ -229,13 +233,15 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should use default url if there's not saveFn", async () => {
|
it("should use default url if there's not saveFn", async () => {
|
||||||
const postMock =vi.spyOn(axios, 'post');
|
const postMock = vi.spyOn(axios, 'post');
|
||||||
|
|
||||||
vm.formData = [{
|
vm.formData = [
|
||||||
name: 'Bruce',
|
{
|
||||||
lastName: 'Wayne',
|
name: 'Bruce',
|
||||||
age: 45,
|
lastName: 'Wayne',
|
||||||
}]
|
age: 45,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
await vm.saveChanges(data);
|
await vm.saveChanges(data);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount } from 'vue';
|
import { onBeforeMount } from 'vue';
|
||||||
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
import { useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import useCardSize from 'src/composables/useCardSize';
|
import useCardSize from 'src/composables/useCardSize';
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
|
||||||
import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -27,7 +26,13 @@ const arrayData = useArrayData(props.dataKey, {
|
||||||
oneRecord: true,
|
oneRecord: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeRouteLeave(() => {
|
||||||
|
stateStore.cardDescriptorChangeValue(null);
|
||||||
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
stateStore.cardDescriptorChangeValue(props.descriptor);
|
||||||
|
|
||||||
const route = router.currentRoute.value;
|
const route = router.currentRoute.value;
|
||||||
try {
|
try {
|
||||||
await fetch(route.params.id);
|
await fetch(route.params.id);
|
||||||
|
@ -62,11 +67,6 @@ function hasRouteParam(params, valueToCheck = ':addressId') {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Teleport to="#left-panel" v-if="stateStore.isHeaderMounted()">
|
|
||||||
<component :is="descriptor" />
|
|
||||||
<QSeparator />
|
|
||||||
<LeftMenu source="card" />
|
|
||||||
</Teleport>
|
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<div :class="[useCardSize(), $attrs.class]">
|
<div :class="[useCardSize(), $attrs.class]">
|
||||||
<RouterView :key="$route.path" />
|
<RouterView :key="$route.path" />
|
||||||
|
|
|
@ -641,15 +641,7 @@ watch(
|
||||||
>
|
>
|
||||||
{{ prop.nameI18n }}:
|
{{ prop.nameI18n }}:
|
||||||
</span>
|
</span>
|
||||||
<VnJsonValue :value="prop.val.val" />
|
|
||||||
<span
|
|
||||||
v-if="prop.val.id"
|
|
||||||
class="id-value"
|
|
||||||
>
|
|
||||||
#{{ prop.val.id }}
|
|
||||||
</span>
|
|
||||||
<span v-if="log.action == 'update'">
|
<span v-if="log.action == 'update'">
|
||||||
←
|
|
||||||
<VnJsonValue
|
<VnJsonValue
|
||||||
:value="prop.old.val"
|
:value="prop.old.val"
|
||||||
/>
|
/>
|
||||||
|
@ -659,6 +651,26 @@ watch(
|
||||||
>
|
>
|
||||||
#{{ prop.old.id }}
|
#{{ prop.old.id }}
|
||||||
</span>
|
</span>
|
||||||
|
→
|
||||||
|
<VnJsonValue
|
||||||
|
:value="prop.val.val"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
v-if="prop.val.id"
|
||||||
|
class="id-value"
|
||||||
|
>
|
||||||
|
#{{ prop.val.id }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span v-else="prop.old.val">
|
||||||
|
<VnJsonValue
|
||||||
|
:value="prop.val.val"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
v-if="prop.old.id"
|
||||||
|
class="id-value"
|
||||||
|
>#{{ prop.old.id }}</span
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -12,7 +12,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
onMounted(
|
onMounted(
|
||||||
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
|
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false),
|
||||||
);
|
);
|
||||||
|
|
||||||
const teleportRef = ref({});
|
const teleportRef = ref({});
|
||||||
|
@ -35,8 +35,14 @@ onMounted(() => {
|
||||||
<template>
|
<template>
|
||||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<div id="left-panel" ref="teleportRef"></div>
|
<div id="left-panel" ref="teleportRef">
|
||||||
<LeftMenu v-if="!hasContent" />
|
<template v-if="stateStore.cardDescriptor">
|
||||||
|
<component :is="stateStore.cardDescriptor" />
|
||||||
|
<QSeparator />
|
||||||
|
<LeftMenu source="card" />
|
||||||
|
</template>
|
||||||
|
<template v-else> <LeftMenu /></template>
|
||||||
|
</div>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPageContainer>
|
<QPageContainer>
|
||||||
|
|
|
@ -302,6 +302,8 @@ defineExpose({ opts: myOptions, vnSelectRef });
|
||||||
|
|
||||||
function handleKeyDown(event) {
|
function handleKeyDown(event) {
|
||||||
if (event.key === 'Tab' && !event.shiftKey) {
|
if (event.key === 'Tab' && !event.shiftKey) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
const inputValue = vnSelectRef.value?.inputValue;
|
const inputValue = vnSelectRef.value?.inputValue;
|
||||||
|
|
||||||
if (inputValue) {
|
if (inputValue) {
|
||||||
|
|
|
@ -18,20 +18,16 @@ import VnInput from 'components/common/VnInput.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch']);
|
const emit = defineEmits(['onFetch']);
|
||||||
|
|
||||||
const originalAttrs = useAttrs();
|
const $attrs = useAttrs();
|
||||||
|
|
||||||
const $attrs = computed(() => {
|
|
||||||
const { style, ...rest } = originalAttrs;
|
|
||||||
return rest;
|
|
||||||
});
|
|
||||||
|
|
||||||
const isRequired = computed(() => {
|
const isRequired = computed(() => {
|
||||||
return Object.keys($attrs).includes('required')
|
return Object.keys($attrs).includes('required');
|
||||||
});
|
});
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
url: { type: String, default: null },
|
url: { type: String, default: null },
|
||||||
saveUrl: {type: String, default: null},
|
saveUrl: { type: String, default: null },
|
||||||
|
userFilter: { type: Object, default: () => {} },
|
||||||
filter: { type: Object, default: () => {} },
|
filter: { type: Object, default: () => {} },
|
||||||
body: { type: Object, default: () => {} },
|
body: { type: Object, default: () => {} },
|
||||||
addNote: { type: Boolean, default: false },
|
addNote: { type: Boolean, default: false },
|
||||||
|
@ -65,7 +61,7 @@ async function insert() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmAndUpdate() {
|
function confirmAndUpdate() {
|
||||||
if(!newNote.text && originalText)
|
if (!newNote.text && originalText)
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
component: VnConfirm,
|
component: VnConfirm,
|
||||||
|
@ -88,11 +84,17 @@ async function update() {
|
||||||
...body,
|
...body,
|
||||||
...{ notes: newNote.text },
|
...{ notes: newNote.text },
|
||||||
};
|
};
|
||||||
await axios.patch(`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`, newBody);
|
await axios.patch(
|
||||||
|
`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`,
|
||||||
|
newBody,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeRouteLeave((to, from, next) => {
|
onBeforeRouteLeave((to, from, next) => {
|
||||||
if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput)
|
if (
|
||||||
|
(newNote.text && !$props.justInput) ||
|
||||||
|
(newNote.text !== originalText && $props.justInput)
|
||||||
|
)
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: VnConfirm,
|
component: VnConfirm,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -104,12 +106,11 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
else next();
|
else next();
|
||||||
});
|
});
|
||||||
|
|
||||||
function fetchData([ data ]) {
|
function fetchData([data]) {
|
||||||
newNote.text = data?.notes;
|
newNote.text = data?.notes;
|
||||||
originalText = data?.notes;
|
originalText = data?.notes;
|
||||||
emit('onFetch', data);
|
emit('onFetch', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -179,7 +180,8 @@ function fetchData([ data ]) {
|
||||||
:url="$props.url"
|
:url="$props.url"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
:limit="0"
|
:limit="0"
|
||||||
:user-filter="$props.filter"
|
:user-filter="userFilter"
|
||||||
|
:filter="filter"
|
||||||
auto-load
|
auto-load
|
||||||
ref="vnPaginateRef"
|
ref="vnPaginateRef"
|
||||||
class="show"
|
class="show"
|
||||||
|
@ -218,7 +220,7 @@ function fetchData([ data ]) {
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
observationTypes.find(
|
observationTypes.find(
|
||||||
(ot) => ot.id === note.observationTypeFk
|
(ot) => ot.id === note.observationTypeFk,
|
||||||
)?.description
|
)?.description
|
||||||
}}
|
}}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, useAttrs } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
|
@ -7,7 +7,6 @@ import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const $attrs = useAttrs();
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: { type: [Number, String], default: null },
|
id: { type: [Number, String], default: null },
|
||||||
|
@ -15,24 +14,21 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
const claimId = computed(() => $props.id || route.params.id);
|
const claimId = computed(() => $props.id || route.params.id);
|
||||||
|
|
||||||
const claimFilter = computed(() => {
|
const claimFilter = {
|
||||||
return {
|
fields: ['id', 'created', 'workerFk', 'text'],
|
||||||
where: { claimFk: claimId.value },
|
include: {
|
||||||
fields: ['id', 'created', 'workerFk', 'text'],
|
relation: 'worker',
|
||||||
include: {
|
scope: {
|
||||||
relation: 'worker',
|
fields: ['id', 'firstName', 'lastName'],
|
||||||
scope: {
|
include: {
|
||||||
fields: ['id', 'firstName', 'lastName'],
|
relation: 'user',
|
||||||
include: {
|
scope: {
|
||||||
relation: 'user',
|
fields: ['id', 'nickname', 'name'],
|
||||||
scope: {
|
|
||||||
fields: ['id', 'nickname', 'name'],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
claimFk: claimId.value,
|
claimFk: claimId.value,
|
||||||
|
@ -43,7 +39,8 @@ const body = {
|
||||||
<VnNotes
|
<VnNotes
|
||||||
url="claimObservations"
|
url="claimObservations"
|
||||||
:add-note="$props.addNote"
|
:add-note="$props.addNote"
|
||||||
:filter="claimFilter"
|
:user-filter="claimFilter"
|
||||||
|
:filter="{ where: { claimFk: claimId } }"
|
||||||
:body="body"
|
:body="body"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
style="overflow-y: auto"
|
style="overflow-y: auto"
|
||||||
|
|
|
@ -1,28 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const noteFilter = computed(() => {
|
|
||||||
return {
|
|
||||||
order: 'created DESC',
|
|
||||||
where: {
|
|
||||||
clientFk: `${route.params.id}`,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnNotes
|
<VnNotes
|
||||||
url="clientObservations"
|
url="clientObservations"
|
||||||
:add-note="true"
|
:add-note="true"
|
||||||
:filter="noteFilter"
|
:filter="{ where: { clientFk: $route.params.id } }"
|
||||||
:body="{ clientFk: route.params.id }"
|
:body="{ clientFk: $route.params.id }"
|
||||||
style="overflow-y: auto"
|
style="overflow-y: auto"
|
||||||
:select-type="true"
|
:select-type="true"
|
||||||
required
|
required
|
||||||
|
order="created DESC"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -325,7 +325,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-max">
|
<QCard class="vn-max">
|
||||||
<VnTitle :text="t('Latest tickets')" />
|
<VnTitle :text="t('Latest tickets')" />
|
||||||
<CustomerSummaryTable />
|
<CustomerSummaryTable :id="entityId" />
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
|
|
|
@ -20,7 +20,12 @@ const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const $props = defineProps({
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -43,7 +48,7 @@ const filter = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
where: { clientFk: route.params.id },
|
where: { clientFk: $props.id ?? route.params.id },
|
||||||
order: ['shipped DESC', 'id'],
|
order: ['shipped DESC', 'id'],
|
||||||
limit: 30,
|
limit: 30,
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,9 +17,9 @@ describe('getAddresses', () => {
|
||||||
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
|
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
|
||||||
params: {
|
params: {
|
||||||
filter: JSON.stringify({
|
filter: JSON.stringify({
|
||||||
fields: ['nickname', 'street', 'city', 'id'],
|
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
|
||||||
where: { isActive: true },
|
where: { isActive: true },
|
||||||
order: 'nickname ASC',
|
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,12 +4,12 @@ export async function getAddresses(clientId, _filter = {}) {
|
||||||
if (!clientId) return;
|
if (!clientId) return;
|
||||||
const filter = {
|
const filter = {
|
||||||
..._filter,
|
..._filter,
|
||||||
fields: ['nickname', 'street', 'city', 'id'],
|
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
|
||||||
where: { isActive: true },
|
where: { isActive: true },
|
||||||
order: 'nickname ASC',
|
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
||||||
};
|
};
|
||||||
const params = { filter: JSON.stringify(filter) };
|
const params = { filter: JSON.stringify(filter) };
|
||||||
return await axios.get(`Clients/${clientId}/addresses`, {
|
return await axios.get(`Clients/${clientId}/addresses`, {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
|
@ -656,7 +656,6 @@ onMounted(() => {
|
||||||
:without-header="!editableMode"
|
:without-header="!editableMode"
|
||||||
:with-filters="editableMode"
|
:with-filters="editableMode"
|
||||||
:right-search="editableMode"
|
:right-search="editableMode"
|
||||||
:right-search-icon="true"
|
|
||||||
:row-click="false"
|
:row-click="false"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:beforeSaveFn="beforeSave"
|
:beforeSaveFn="beforeSave"
|
||||||
|
|
|
@ -145,6 +145,7 @@ const entryFilterPanel = ref();
|
||||||
v-model="params.agencyModeId"
|
v-model="params.agencyModeId"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
|
sort-by="name ASC"
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
hide-selected
|
hide-selected
|
||||||
dense
|
dense
|
||||||
|
|
|
@ -158,15 +158,10 @@ const getBadgeAttrs = (_date) => {
|
||||||
|
|
||||||
const scrollToToday = async () => {
|
const scrollToToday = async () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`);
|
const todayCell = document.querySelector(
|
||||||
if (todayCell) {
|
`td[data-date="${date.formatDate(today, 'YYYY-MM-DD')}"]`,
|
||||||
todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
);
|
||||||
}
|
if (todayCell) todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||||
};
|
|
||||||
|
|
||||||
const formatDateForAttribute = (dateValue) => {
|
|
||||||
if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD');
|
|
||||||
return dateValue;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function updateWarehouse(warehouseFk) {
|
async function updateWarehouse(warehouseFk) {
|
||||||
|
@ -242,7 +237,7 @@ async function updateWarehouse(warehouseFk) {
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-date="{ row }">
|
<template #body-cell-date="{ row }">
|
||||||
<QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
|
<QTd @click.stop :data-date="row?.shipped.substring(0, 10)">
|
||||||
<QBadge
|
<QBadge
|
||||||
v-bind="getBadgeAttrs(row.shipped)"
|
v-bind="getBadgeAttrs(row.shipped)"
|
||||||
class="q-ma-none"
|
class="q-ma-none"
|
||||||
|
|
|
@ -17,6 +17,7 @@ import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
||||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
||||||
import { useStateStore } from 'src/stores/useStateStore';
|
import { useStateStore } from 'src/stores/useStateStore';
|
||||||
|
import useOpenURL from 'src/composables/useOpenURL';
|
||||||
|
|
||||||
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000;
|
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000;
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -321,8 +322,7 @@ const totalPriceColor = (ticket) => {
|
||||||
if (total > 0 && total < 50) return 'warning';
|
if (total > 0 && total < 50) return 'warning';
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTab = (id) =>
|
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
|
||||||
window.open(`#/ticket/${id}/sale`, '_blank', 'noopener, noreferrer');
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -397,6 +397,7 @@ const openTab = (id) =>
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
auto-load
|
auto-load
|
||||||
:row-click="({ id }) => openTab(id)"
|
:row-click="({ id }) => openTab(id)"
|
||||||
|
:row-ctrl-click="(_, { id }) => openTab(id)"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
:user-params="{ from, to, scopeDays: 0 }"
|
:user-params="{ from, to, scopeDays: 0 }"
|
||||||
>
|
>
|
||||||
|
|
|
@ -22,7 +22,7 @@ salesTicketsTable:
|
||||||
notVisible: Not visible
|
notVisible: Not visible
|
||||||
purchaseRequest: Purchase request
|
purchaseRequest: Purchase request
|
||||||
clientFrozen: Client frozen
|
clientFrozen: Client frozen
|
||||||
risk: Risk
|
risk: Excess risk
|
||||||
componentLack: Component lack
|
componentLack: Component lack
|
||||||
tooLittle: Ticket too little
|
tooLittle: Ticket too little
|
||||||
identifier: Identifier
|
identifier: Identifier
|
||||||
|
|
|
@ -22,7 +22,7 @@ salesTicketsTable:
|
||||||
notVisible: No visible
|
notVisible: No visible
|
||||||
purchaseRequest: Petición de compra
|
purchaseRequest: Petición de compra
|
||||||
clientFrozen: Cliente congelado
|
clientFrozen: Cliente congelado
|
||||||
risk: Riesgo
|
risk: Exceso de riesgo
|
||||||
componentLack: Faltan componentes
|
componentLack: Faltan componentes
|
||||||
tooLittle: Ticket demasiado pequeño
|
tooLittle: Ticket demasiado pequeño
|
||||||
identifier: Identificador
|
identifier: Identificador
|
||||||
|
|
|
@ -10,6 +10,7 @@ import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import { onUnmounted } from 'vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -23,16 +24,40 @@ const catalogParams = {
|
||||||
const arrayData = useArrayData(dataKey, {
|
const arrayData = useArrayData(dataKey, {
|
||||||
url: 'Orders/CatalogFilter',
|
url: 'Orders/CatalogFilter',
|
||||||
userParams: catalogParams,
|
userParams: catalogParams,
|
||||||
|
exprBuilder,
|
||||||
|
searchUrl: 'table',
|
||||||
});
|
});
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const tags = ref([]);
|
const tags = ref([]);
|
||||||
const itemRefs = ref({});
|
const itemRefs = ref({});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
checkOrderConfirmation();
|
checkOrderConfirmation();
|
||||||
|
|
||||||
|
if (
|
||||||
|
arrayData.store.userParams &&
|
||||||
|
Object.keys(arrayData.store.userParams).some((key) => !key.startsWith('order'))
|
||||||
|
) {
|
||||||
|
await arrayData.fetch({});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
arrayData.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
function exprBuilder(param, value) {
|
||||||
|
switch (param) {
|
||||||
|
case 'categoryFk':
|
||||||
|
case 'typeFk':
|
||||||
|
return { [param]: value };
|
||||||
|
case 'search':
|
||||||
|
if (/^\d+$/.test(value)) return { 'i.id': value };
|
||||||
|
else return { 'i.name': { like: `%${value}%` } };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function checkOrderConfirmation() {
|
async function checkOrderConfirmation() {
|
||||||
const response = await axios.get(`Orders/${route.params.id}`);
|
const response = await axios.get(`Orders/${route.params.id}`);
|
||||||
if (response.data.isConfirmed === 1) {
|
if (response.data.isConfirmed === 1) {
|
||||||
|
@ -96,6 +121,7 @@ watch(
|
||||||
:tag-value="tagValue"
|
:tag-value="tagValue"
|
||||||
:tags="tags"
|
:tags="tags"
|
||||||
:initial-catalog-params="catalogParams"
|
:initial-catalog-params="catalogParams"
|
||||||
|
:arrayData
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
|
|
|
@ -24,6 +24,10 @@ const props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
arrayData: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -74,17 +78,6 @@ const loadTypes = async (id) => {
|
||||||
typeList.value = data;
|
typeList.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
|
||||||
switch (param) {
|
|
||||||
case 'categoryFk':
|
|
||||||
case 'typeFk':
|
|
||||||
return { [param]: value };
|
|
||||||
case 'search':
|
|
||||||
if (/^\d+$/.test(value)) return { 'i.id': value };
|
|
||||||
else return { 'i.name': { like: `%${value}%` } };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const applyTags = (tagInfo, params, search) => {
|
const applyTags = (tagInfo, params, search) => {
|
||||||
if (!tagInfo || !tagInfo.values.length) {
|
if (!tagInfo || !tagInfo.values.length) {
|
||||||
params.tagGroups = null;
|
params.tagGroups = null;
|
||||||
|
@ -152,9 +145,8 @@ function addOrder(value, field, params) {
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:hidden-tags="['filter', 'orderFk', 'orderBy']"
|
:hidden-tags="['filter', 'orderFk', 'orderBy']"
|
||||||
:unremovable-params="['orderFk', 'orderBy']"
|
:unremovable-params="['orderFk', 'orderBy']"
|
||||||
:expr-builder="exprBuilder"
|
|
||||||
:custom-tags="['tagGroups', 'categoryFk']"
|
:custom-tags="['tagGroups', 'categoryFk']"
|
||||||
:redirect="false"
|
:arrayData
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<strong v-if="tag.label === 'typeFk' && typeList">
|
<strong v-if="tag.label === 'typeFk' && typeList">
|
||||||
|
|
|
@ -155,11 +155,23 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function fetchClientAddress(id, formData = {}) {
|
async function fetchClientAddress(id, formData = {}) {
|
||||||
const { data } = await axios.get(
|
const { data } = await axios.get(`Clients/${id}/addresses`, {
|
||||||
`Clients/${id}/addresses?filter[order]=isActive DESC`
|
params: {
|
||||||
);
|
filter: JSON.stringify({
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'client',
|
||||||
|
scope: {
|
||||||
|
fields: ['defaultAddressFk'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
order: ['isActive DESC'],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
addressOptions.value = data;
|
addressOptions.value = data;
|
||||||
formData.addressId = data.defaultAddressFk;
|
formData.addressId = data[0].client.defaultAddressFk;
|
||||||
fetchAgencies(formData);
|
fetchAgencies(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +179,13 @@ async function fetchAgencies({ landed, addressId }) {
|
||||||
if (!landed || !addressId) return (agencyList.value = []);
|
if (!landed || !addressId) return (agencyList.value = []);
|
||||||
|
|
||||||
const { data } = await axios.get('Agencies/landsThatDay', {
|
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||||
params: { addressFk: addressId, landed },
|
params: {
|
||||||
|
filter: JSON.stringify({
|
||||||
|
order: ['agencyMode DESC', 'agencyModeFk ASC'],
|
||||||
|
}),
|
||||||
|
addressFk: addressId,
|
||||||
|
landed,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
agencyList.value = data;
|
agencyList.value = data;
|
||||||
}
|
}
|
||||||
|
@ -258,6 +276,7 @@ const getDateColor = (date) => {
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
:disable="!data.clientFk"
|
||||||
v-model="data.addressId"
|
v-model="data.addressId"
|
||||||
:options="addressOptions"
|
:options="addressOptions"
|
||||||
:label="t('module.address')"
|
:label="t('module.address')"
|
||||||
|
@ -284,6 +303,9 @@ const getDateColor = (date) => {
|
||||||
{{ scope.opt?.street }},
|
{{ scope.opt?.street }},
|
||||||
{{ scope.opt?.city }}
|
{{ scope.opt?.city }}
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ `#${scope.opt?.id}` }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -27,14 +27,17 @@ describe('getAgencies', () => {
|
||||||
landed: 'true',
|
landed: 'true',
|
||||||
};
|
};
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['nickname', 'street', 'city', 'id'],
|
fields: ['name', 'street', 'city', 'id'],
|
||||||
where: { isActive: true },
|
where: { isActive: true },
|
||||||
order: 'nickname ASC',
|
order: ['name ASC'],
|
||||||
};
|
};
|
||||||
|
|
||||||
await getAgencies(formData, null, filter);
|
await getAgencies(formData, null, filter);
|
||||||
|
|
||||||
expect(axios.get).toHaveBeenCalledWith('Agencies/getAgenciesWithWarehouse', generateParams(formData, filter));
|
expect(axios.get).toHaveBeenCalledWith(
|
||||||
|
'Agencies/getAgenciesWithWarehouse',
|
||||||
|
generateParams(formData, filter),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call API when formData is missing required landed field', async () => {
|
it('should not call API when formData is missing required landed field', async () => {
|
||||||
|
@ -69,14 +72,14 @@ describe('getAgencies', () => {
|
||||||
|
|
||||||
expect(options).toEqual(response.data);
|
expect(options).toEqual(response.data);
|
||||||
expect(agency).toEqual(response.data[0]);
|
expect(agency).toEqual(response.data[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return options and agency when client is not provided', async () => {
|
it('should return options and agency when client is not provided', async () => {
|
||||||
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
|
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
|
||||||
|
|
||||||
const { options, agency } = await getAgencies(formData);
|
const { options, agency } = await getAgencies(formData);
|
||||||
|
|
||||||
expect(options).toEqual(response.data);
|
expect(options).toEqual(response.data);
|
||||||
expect(agency).toBeNull();
|
expect(agency).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import agency from 'src/router/modules/agency';
|
|
||||||
|
|
||||||
export async function getAgencies(formData, client, _filter = {}) {
|
export async function getAgencies(formData, client, _filter = {}) {
|
||||||
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
..._filter
|
..._filter,
|
||||||
|
order: ['name ASC'],
|
||||||
};
|
};
|
||||||
|
|
||||||
let defaultAgency = null;
|
let agency = null;
|
||||||
let params = {
|
let params = {
|
||||||
filter: JSON.stringify(filter),
|
filter: JSON.stringify(filter),
|
||||||
warehouseFk: formData.warehouseId,
|
warehouseFk: formData.warehouseId,
|
||||||
|
@ -16,11 +16,15 @@ export async function getAgencies(formData, client, _filter = {}) {
|
||||||
landed: formData.landed,
|
landed: formData.landed,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
const { data: options } = await axios.get('Agencies/getAgenciesWithWarehouse', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
|
||||||
if(data && client) {
|
if (options && client) {
|
||||||
defaultAgency = data.find((agency) => agency.agencyModeFk === client.defaultAddress.agencyModeFk );
|
agency = options.find(
|
||||||
};
|
({ agencyModeFk }) => agencyModeFk === client.defaultAddress.agencyModeFk,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return {options: data, agency: defaultAgency}
|
return { options, agency };
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,7 @@ const exprBuilder = (param, value) => {
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
:filter="{ fields: ['id', 'name'] }"
|
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||||
sort-by="name ASC"
|
|
||||||
@on-fetch="(data) => (agencyList = data)"
|
@on-fetch="(data) => (agencyList = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -22,7 +22,12 @@ const links = {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<CardSummary data-key="Vehicle" :url="`Vehicles/${entityId}`" :filter="VehicleFilter">
|
<CardSummary
|
||||||
|
data-key="Vehicle"
|
||||||
|
:url="`Vehicles/${entityId}`"
|
||||||
|
module-name="Vehicle"
|
||||||
|
:filter="VehicleFilter"
|
||||||
|
>
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
<div>{{ entity.id }} - {{ entity.numberPlate }}</div>
|
<div>{{ entity.id }} - {{ entity.numberPlate }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,6 +11,11 @@ export default {
|
||||||
'isSerious',
|
'isSerious',
|
||||||
'isTrucker',
|
'isTrucker',
|
||||||
'account',
|
'account',
|
||||||
|
'workerFk',
|
||||||
|
'note',
|
||||||
|
'isReal',
|
||||||
|
'isPayMethodChecked',
|
||||||
|
'companySize',
|
||||||
],
|
],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,9 +93,9 @@ function ticketFilter(ticket) {
|
||||||
<VnLv :label="t('globals.warehouse')" :value="entity.warehouse?.name" />
|
<VnLv :label="t('globals.warehouse')" :value="entity.warehouse?.name" />
|
||||||
<VnLv :label="t('globals.alias')" :value="entity.nickname" />
|
<VnLv :label="t('globals.alias')" :value="entity.nickname" />
|
||||||
</template>
|
</template>
|
||||||
<template #icons>
|
<template #icons="{ entity }">
|
||||||
<QCardActions class="q-gutter-x-xs">
|
<QCardActions class="q-gutter-x-xs">
|
||||||
<TicketProblems :row="problems" />
|
<TicketProblems :row="{ ...entity?.client, ...problems }" />
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ entity }">
|
<template #actions="{ entity }">
|
||||||
|
|
|
@ -37,7 +37,6 @@ const expeditionStateTypes = ref([]);
|
||||||
|
|
||||||
const expeditionsFilter = computed(() => ({
|
const expeditionsFilter = computed(() => ({
|
||||||
where: { ticketFk: route.params.id },
|
where: { ticketFk: route.params.id },
|
||||||
order: ['created DESC'],
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ticketArrayData = useArrayData('Ticket');
|
const ticketArrayData = useArrayData('Ticket');
|
||||||
|
@ -105,6 +104,9 @@ const columns = computed(() => [
|
||||||
name: 'created',
|
name: 'created',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
columnFilter: {
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
format: (row) => toDateTimeFormat(row.created),
|
format: (row) => toDateTimeFormat(row.created),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -201,7 +203,7 @@ const getExpeditionState = async (expedition) => {
|
||||||
|
|
||||||
const openGrafana = (expeditionFk) => {
|
const openGrafana = (expeditionFk) => {
|
||||||
useOpenURL(
|
useOpenURL(
|
||||||
`https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`
|
`https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -287,7 +289,7 @@ onMounted(async () => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
'',
|
'',
|
||||||
t('expedition.removeExpeditionSubtitle'),
|
t('expedition.removeExpeditionSubtitle'),
|
||||||
deleteExpedition
|
deleteExpedition,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -302,7 +304,6 @@ onMounted(async () => {
|
||||||
url="Expeditions/filter"
|
url="Expeditions/filter"
|
||||||
search-url="expeditions"
|
search-url="expeditions"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:filter="expeditionsFilter"
|
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
:table="{
|
:table="{
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
|
@ -316,11 +317,14 @@ onMounted(async () => {
|
||||||
return { id: value };
|
return { id: value };
|
||||||
case 'packageItemName':
|
case 'packageItemName':
|
||||||
return { packagingItemFk: value };
|
return { packagingItemFk: value };
|
||||||
|
case 'created':
|
||||||
|
return { 'e.created': { gte: value } };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
|
:filter="expeditionsFilter"
|
||||||
>
|
>
|
||||||
<template #column-freightItemName="{ row }">
|
<template #column-freightItemName="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
|
|
@ -121,6 +121,50 @@ async function handleSave() {
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function validateFields(item) {
|
||||||
|
// Only validate fields that are being updated
|
||||||
|
const shouldExist = (field) => !isUpdate || field in item;
|
||||||
|
|
||||||
|
if (!shouldExist('ticketServiceTypeFk') && !item.ticketServiceTypeFk) {
|
||||||
|
notify('Description is required', 'negative');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shouldExist('quantity') && (!item.quantity || item.quantity <= 0)) {
|
||||||
|
notify('Quantity must be greater than 0', 'negative');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!shouldExist('price') && (!item.price || item.price < 0)) {
|
||||||
|
notify('Price must be valid', 'negative');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeSave(data) {
|
||||||
|
const { creates = [], updates = [] } = data;
|
||||||
|
const validData = { creates: [], updates: [] };
|
||||||
|
|
||||||
|
// Validate creates
|
||||||
|
if (creates.length) {
|
||||||
|
for (const create of creates) {
|
||||||
|
create.ticketFk = route.params.id;
|
||||||
|
if (validateFields(create)) {
|
||||||
|
validData.creates.push(create);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate updates
|
||||||
|
if (updates.length) {
|
||||||
|
for (const update of updates) {
|
||||||
|
validData.updates.push(update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return validData;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -141,6 +185,7 @@ async function handleSave() {
|
||||||
v-model:selected="selected"
|
v-model:selected="selected"
|
||||||
:order="['description ASC']"
|
:order="['description ASC']"
|
||||||
:default-remove="false"
|
:default-remove="false"
|
||||||
|
:beforeSaveFn="beforeSave"
|
||||||
>
|
>
|
||||||
<template #moreBeforeActions>
|
<template #moreBeforeActions>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -170,6 +215,7 @@ async function handleSave() {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
hide-selected
|
hide-selected
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
|
:required="true"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<TicketCreateServiceType
|
<TicketCreateServiceType
|
||||||
|
@ -185,6 +231,7 @@ async function handleSave() {
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model.number="row.quantity"
|
v-model.number="row.quantity"
|
||||||
type="number"
|
type="number"
|
||||||
|
:required="true"
|
||||||
min="0"
|
min="0"
|
||||||
:info="t('service.quantityInfo')"
|
:info="t('service.quantityInfo')"
|
||||||
/>
|
/>
|
||||||
|
@ -196,6 +243,7 @@ async function handleSave() {
|
||||||
:label="col.label"
|
:label="col.label"
|
||||||
v-model.number="row.price"
|
v-model.number="row.price"
|
||||||
type="number"
|
type="number"
|
||||||
|
:required="true"
|
||||||
min="0"
|
min="0"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -42,7 +42,7 @@ const transferRef = ref(null);
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else>
|
<div style="display: flex; flex-direction: row" v-else>
|
||||||
<TicketTransfer
|
<TicketTransfer
|
||||||
ref="transferRef"
|
ref="transferRef"
|
||||||
:ticket="$props.ticket"
|
:ticket="$props.ticket"
|
||||||
|
|
|
@ -142,7 +142,7 @@ onMounted(() => (stateStore.rightDrawer = true));
|
||||||
<template #column-concept="{ row }">
|
<template #column-concept="{ row }">
|
||||||
<span>{{ row.item.name }}</span>
|
<span>{{ row.item.name }}</span>
|
||||||
<span class="color-vn-label q-pl-md">{{ row.item.subName }}</span>
|
<span class="color-vn-label q-pl-md">{{ row.item.subName }}</span>
|
||||||
<FetchedTags :item="row.item" />
|
<FetchedTags :item="row.item" :columns="6" />
|
||||||
</template>
|
</template>
|
||||||
<template #column-volume="{ rowIndex }">
|
<template #column-volume="{ rowIndex }">
|
||||||
<span>{{ packingTypeVolume?.[rowIndex]?.volume }}</span>
|
<span>{{ packingTypeVolume?.[rowIndex]?.volume }}</span>
|
||||||
|
|
|
@ -456,6 +456,7 @@ watch(
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
:no-data-label="t('globals.noResults')"
|
:no-data-label="t('globals.noResults')"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
:order="['futureTotalWithVat ASC']"
|
||||||
auto-load
|
auto-load
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
>
|
>
|
||||||
|
|
|
@ -46,7 +46,12 @@ const getGroupedStates = (data) => {
|
||||||
"
|
"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData url="AgencyModes" @on-fetch="(data) => (agencies = data)" auto-load />
|
<FetchData
|
||||||
|
url="AgencyModes"
|
||||||
|
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||||
|
@on-fetch="(data) => (agencies = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
|
@ -74,10 +79,20 @@ const getGroupedStates = (data) => {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate v-model="params.from" :label="t('From')" is-outlined />
|
<VnInputDate
|
||||||
|
v-model="params.from"
|
||||||
|
:label="t('From')"
|
||||||
|
is-outlined
|
||||||
|
data-cy="From_date"
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate v-model="params.to" :label="t('To')" is-outlined />
|
<VnInputDate
|
||||||
|
v-model="params.to"
|
||||||
|
:label="t('To')"
|
||||||
|
is-outlined
|
||||||
|
data-cy="To_date"
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
|
@ -241,8 +256,6 @@ const getGroupedStates = (data) => {
|
||||||
v-model="params.agencyModeFk"
|
v-model="params.agencyModeFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
:options="agencies"
|
:options="agencies"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
use-input
|
use-input
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { computed, ref, onBeforeMount } from 'vue';
|
import { computed, ref, onBeforeMount, watch } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
@ -69,6 +69,8 @@ const companiesOptions = ref([]);
|
||||||
const accountingOptions = ref([]);
|
const accountingOptions = ref([]);
|
||||||
const amountToReturn = ref();
|
const amountToReturn = ref();
|
||||||
const dataKey = 'TicketList';
|
const dataKey = 'TicketList';
|
||||||
|
const filterPanelRef = ref(null);
|
||||||
|
const formInitialData = ref({});
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -119,12 +121,16 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'shipped',
|
name: 'shipped',
|
||||||
|
component: 'time',
|
||||||
|
columnFilter: false,
|
||||||
label: t('ticketList.hour'),
|
label: t('ticketList.hour'),
|
||||||
format: (row) => toTimeFormat(row.shipped),
|
format: (row) => toTimeFormat(row.shipped),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'zoneLanding',
|
name: 'zoneLanding',
|
||||||
|
component: 'time',
|
||||||
|
columnFilter: false,
|
||||||
label: t('ticketList.closure'),
|
label: t('ticketList.closure'),
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)),
|
format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)),
|
||||||
},
|
},
|
||||||
|
@ -144,9 +150,16 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'province',
|
name: 'provinceFk',
|
||||||
label: t('ticketList.province'),
|
label: t('ticketList.province'),
|
||||||
columnClass: 'expand',
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'Provinces',
|
||||||
|
},
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.province),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -180,9 +193,19 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'warehouse',
|
name: 'warehouseFk',
|
||||||
label: t('ticketList.warehouse'),
|
label: t('globals.warehouse'),
|
||||||
columnClass: 'expand',
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'warehouses',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
format: (row) => row.warehouse,
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
cardVisible: false,
|
||||||
|
create: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -422,6 +445,22 @@ function setReference(data) {
|
||||||
|
|
||||||
dialogData.value.value.description = newDescription;
|
dialogData.value.value.description = newDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.query.table,
|
||||||
|
(newValue) => {
|
||||||
|
if (newValue) {
|
||||||
|
const clientId = +JSON.parse(newValue)?.clientFk;
|
||||||
|
if (!clientId) return;
|
||||||
|
formInitialData.value = {
|
||||||
|
clientId,
|
||||||
|
};
|
||||||
|
if (tableRef.value) tableRef.value.create.formInitialData = { clientId };
|
||||||
|
onClientSelected({ clientId });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -456,7 +495,7 @@ function setReference(data) {
|
||||||
urlCreate: 'Tickets/new',
|
urlCreate: 'Tickets/new',
|
||||||
title: t('ticketList.createTicket'),
|
title: t('ticketList.createTicket'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: { clientId: null },
|
formInitialData,
|
||||||
}"
|
}"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
@ -538,11 +577,9 @@ function setReference(data) {
|
||||||
:label="t('ticketList.client')"
|
:label="t('ticketList.client')"
|
||||||
v-model="data.clientId"
|
v-model="data.clientId"
|
||||||
:options="clientsOptions"
|
:options="clientsOptions"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
required
|
required
|
||||||
@update:model-value="(client) => onClientSelected(data)"
|
@update:model-value="() => onClientSelected(data)"
|
||||||
:sort-by="'id ASC'"
|
:sort-by="'id ASC'"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
@ -564,7 +601,6 @@ function setReference(data) {
|
||||||
:label="t('basicData.address')"
|
:label="t('basicData.address')"
|
||||||
v-model="data.addressId"
|
v-model="data.addressId"
|
||||||
:options="addressesOptions"
|
:options="addressesOptions"
|
||||||
option-value="id"
|
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
hide-selected
|
hide-selected
|
||||||
map-options
|
map-options
|
||||||
|
@ -610,6 +646,9 @@ function setReference(data) {
|
||||||
{{ scope.opt?.city }}
|
{{ scope.opt?.city }}
|
||||||
</span>
|
</span>
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ `#${scope.opt?.id}` }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
@ -633,8 +672,6 @@ function setReference(data) {
|
||||||
:label="t('globals.warehouse')"
|
:label="t('globals.warehouse')"
|
||||||
v-model="data.warehouseId"
|
v-model="data.warehouseId"
|
||||||
:options="warehousesOptions"
|
:options="warehousesOptions"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
required
|
required
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
|
@ -694,7 +731,6 @@ function setReference(data) {
|
||||||
:label="t('ticketList.company')"
|
:label="t('ticketList.company')"
|
||||||
v-model="dialogData.companyFk"
|
v-model="dialogData.companyFk"
|
||||||
:options="companiesOptions"
|
:options="companiesOptions"
|
||||||
option-value="id"
|
|
||||||
option-label="code"
|
option-label="code"
|
||||||
hide-selected
|
hide-selected
|
||||||
>
|
>
|
||||||
|
@ -705,7 +741,6 @@ function setReference(data) {
|
||||||
:label="t('ticketList.bank')"
|
:label="t('ticketList.bank')"
|
||||||
v-model="dialogData.bankFk"
|
v-model="dialogData.bankFk"
|
||||||
:options="accountingOptions"
|
:options="accountingOptions"
|
||||||
option-value="id"
|
|
||||||
option-label="bank"
|
option-label="bank"
|
||||||
hide-selected
|
hide-selected
|
||||||
@update:model-value="setReference"
|
@update:model-value="setReference"
|
||||||
|
|
|
@ -73,6 +73,7 @@ warehouses();
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
|
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||||
@on-fetch="(data) => (agenciesOptions = data)"
|
@on-fetch="(data) => (agenciesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -39,6 +39,7 @@ const redirectToTravelBasicData = (_, { id }) => {
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
|
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||||
@on-fetch="(data) => (agenciesOptions = data)"
|
@on-fetch="(data) => (agenciesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -52,9 +52,8 @@ defineExpose({ states });
|
||||||
v-model="params.agencyModeFk"
|
v-model="params.agencyModeFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
url="agencyModes"
|
url="agencyModes"
|
||||||
|
sort-by="name ASC"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
option-filter="name"
|
option-filter="name"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
|
@ -79,7 +79,7 @@ const editEvent = async (event) => {
|
||||||
};
|
};
|
||||||
const { data } = await axios.patch(
|
const { data } = await axios.patch(
|
||||||
`Workers/${route.params.id}/updateAbsence`,
|
`Workers/${route.params.id}/updateAbsence`,
|
||||||
params
|
params,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (data) emit('refresh');
|
if (data) emit('refresh');
|
||||||
|
@ -108,14 +108,14 @@ const handleDateSelected = (date) => {
|
||||||
if (!event) createEvent(_date);
|
if (!event) createEvent(_date);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEventSelected = (event, { year, month, day }) => {
|
const handleEventSelected = async (event, { year, month, day }) => {
|
||||||
if (!props.absenceType) {
|
if (!props.absenceType) {
|
||||||
notify(t('Choose an absence type from the right menu'), 'warning');
|
notify(t('Choose an absence type from the right menu'), 'warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const date = new Date(year, month - 1, day);
|
const date = new Date(year, month - 1, day);
|
||||||
if (!event?.absenceId) createEvent(date);
|
if (!event?.absenceId) await createEvent(date);
|
||||||
else if (event.type == props.absenceType.code) deleteEvent(event, date);
|
else if (event.type == props.absenceType.code) deleteEvent(event, date);
|
||||||
else editEvent(event);
|
else editEvent(event);
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,9 +5,9 @@ import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const filter = {
|
const userFilter = {
|
||||||
order: 'created DESC',
|
order: 'created DESC',
|
||||||
where: { workerFk: route.params.id },
|
|
||||||
include: {
|
include: {
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
|
@ -22,11 +22,15 @@ const filter = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const body = {
|
const body = { workerFk: route.params.id };
|
||||||
workerFk: route.params.id,
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnNotes :add-note="true" url="WorkerObservations" :filter="filter" :body="body" />
|
<VnNotes
|
||||||
|
:add-note="true"
|
||||||
|
url="WorkerObservations"
|
||||||
|
:user-filter="userFilter"
|
||||||
|
:filter="{ where: { workerFk: $route.params.id } }"
|
||||||
|
:body="body"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import VnInput from 'components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import order from 'src/router/modules/order';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -24,7 +25,7 @@ const agencies = ref([]);
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
:filter="{ fields: ['id', 'name'] }"
|
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
|
||||||
@on-fetch="(data) => (agencies = data)"
|
@on-fetch="(data) => (agencies = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -199,9 +199,8 @@ function formatRow(row) {
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
|
sort-by="name ASC"
|
||||||
v-model="data.agencyModeFk"
|
v-model="data.agencyModeFk"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
:label="t('list.agency')"
|
:label="t('list.agency')"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
|
|
@ -7,7 +7,11 @@ export const useStateStore = defineStore('stateStore', () => {
|
||||||
const rightDrawer = ref(false);
|
const rightDrawer = ref(false);
|
||||||
const rightAdvancedDrawer = ref(false);
|
const rightAdvancedDrawer = ref(false);
|
||||||
const subToolbar = ref(false);
|
const subToolbar = ref(false);
|
||||||
|
const cardDescriptor = ref(null);
|
||||||
|
|
||||||
|
function cardDescriptorChangeValue(descriptor) {
|
||||||
|
cardDescriptor.value = descriptor;
|
||||||
|
}
|
||||||
function toggleLeftDrawer() {
|
function toggleLeftDrawer() {
|
||||||
leftDrawer.value = !leftDrawer.value;
|
leftDrawer.value = !leftDrawer.value;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +53,8 @@ export const useStateStore = defineStore('stateStore', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
cardDescriptor,
|
||||||
|
cardDescriptorChangeValue,
|
||||||
leftDrawer,
|
leftDrawer,
|
||||||
rightDrawer,
|
rightDrawer,
|
||||||
rightAdvancedDrawer,
|
rightAdvancedDrawer,
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('Client consignee', () => {
|
||||||
const addressName = 'test';
|
const addressName = 'test';
|
||||||
cy.dataCy('Consignee_input').type(addressName);
|
cy.dataCy('Consignee_input').type(addressName);
|
||||||
cy.dataCy('Location_select').click();
|
cy.dataCy('Location_select').click();
|
||||||
cy.get('[role="listbox"] .q-item:nth-child(1)').click();
|
cy.getOption();
|
||||||
cy.dataCy('Street address_input').type('TEST ADDRESS');
|
cy.dataCy('Street address_input').type('TEST ADDRESS');
|
||||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||||
cy.location('href').should('contain', '#/customer/1107/address');
|
cy.location('href').should('contain', '#/customer/1107/address');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe.skip('Entry', () => {
|
describe('Entry', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('buyer');
|
cy.login('buyer');
|
||||||
|
|
|
@ -16,9 +16,9 @@ describe('EntryStockBought', () => {
|
||||||
cy.get('input[aria-label="Reserve"]').type('1');
|
cy.get('input[aria-label="Reserve"]').type('1');
|
||||||
cy.get('input[aria-label="Date"]').eq(1).clear();
|
cy.get('input[aria-label="Date"]').eq(1).clear();
|
||||||
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
|
cy.get('input[aria-label="Date"]').eq(1).type('01-01');
|
||||||
cy.get('input[aria-label="Buyer"]').type('buyerBossNick');
|
cy.get('input[aria-label="Buyer"]').type('itNick');
|
||||||
cy.get('div[role="listbox"] > div > div[role="option"]')
|
cy.get('div[role="listbox"] > div > div[role="option"]')
|
||||||
.eq(0)
|
.eq(1)
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
describe('Vehicle list', () => {
|
||||||
|
const selectors = {
|
||||||
|
saveFormBtn: 'FormModelPopup_save',
|
||||||
|
summaryPopupBtn: 'tr:last-child > .q-table--col-auto-width > .q-btn',
|
||||||
|
summaryGoToSummaryBtn: '.header > .q-icon',
|
||||||
|
summaryHeader: '.summaryHeader > div',
|
||||||
|
numberPlate: 'tr:last-child > [data-col-field="numberPlate"] > .no-padding',
|
||||||
|
};
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
'Nº Plate': { val: '9465-LPA' },
|
||||||
|
'Trade Mark': { val: 'WAYNE INDUSTRIES' },
|
||||||
|
Model: { val: 'BATREMOLQUE' },
|
||||||
|
Type: { val: 'remolque', type: 'select' },
|
||||||
|
Warehouse: { val: 'Warehouse One', type: 'select' },
|
||||||
|
Country: { val: 'Portugal', type: 'select' },
|
||||||
|
Description: { val: 'Exclusive for batpod transport' },
|
||||||
|
};
|
||||||
|
|
||||||
|
const expected = data['Nº Plate'].val;
|
||||||
|
const summaryUrl = '/summary';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(`/#/route/vehicle/list`);
|
||||||
|
cy.typeSearchbar('{enter}');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should list vehicles', () => {
|
||||||
|
cy.get('.q-table')
|
||||||
|
.children()
|
||||||
|
.should('be.visible')
|
||||||
|
.should('have.length.greaterThan', 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should add new vehicle', () => {
|
||||||
|
cy.addBtnClick();
|
||||||
|
cy.fillInForm(data);
|
||||||
|
cy.dataCy(selectors.saveFormBtn).should('be.visible').click();
|
||||||
|
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
cy.get(selectors.summaryHeader).should('contain', expected);
|
||||||
|
cy.url().should('include', summaryUrl);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open summary by clicking a vehicle', () => {
|
||||||
|
cy.get(selectors.numberPlate).click();
|
||||||
|
cy.get(selectors.summaryHeader).should('contain', expected);
|
||||||
|
cy.url().should('include', summaryUrl);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to vehicle summary when click summary icon on summary pop-up', () => {
|
||||||
|
cy.get(selectors.summaryPopupBtn).click();
|
||||||
|
cy.get(selectors.summaryHeader).should('contain', expected);
|
||||||
|
cy.get(selectors.summaryGoToSummaryBtn).click();
|
||||||
|
cy.url().should('include', summaryUrl);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,15 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketFilter', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/list');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('use search button', function () {
|
||||||
|
cy.waitForElement('.q-page');
|
||||||
|
cy.get('[data-cy="Customer ID_input"]').type('1105');
|
||||||
|
cy.searchBtnFilterPanel();
|
||||||
|
cy.location('href').should('contain', '#/ticket/15/summary');
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,6 +1,6 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe.skip('TicketList', () => {
|
describe('TicketList', () => {
|
||||||
const firstRow = 'tbody > :nth-child(1)';
|
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
@ -9,15 +9,14 @@ describe.skip('TicketList', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchResults = (search) => {
|
const searchResults = (search) => {
|
||||||
cy.dataCy('vn-searchbar').find('input').focus();
|
if (search) cy.typeSearchbar().type(search);
|
||||||
if (search) cy.dataCy('vn-searchbar').find('input').type(search);
|
|
||||||
cy.dataCy('vn-searchbar').find('input').type('{enter}');
|
cy.dataCy('vn-searchbar').find('input').type('{enter}');
|
||||||
cy.dataCy('ticketListTable').should('exist');
|
// cy.dataCy('ticketListTable').should('exist');
|
||||||
cy.get(firstRow).should('exist');
|
cy.get(firstRow).should('exist');
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should search results', () => {
|
it('should search results', () => {
|
||||||
cy.dataCy('ticketListTable').should('not.exist');
|
// cy.dataCy('ticketListTable').should('not.exist');
|
||||||
cy.get('.q-field__control').should('exist');
|
cy.get('.q-field__control').should('exist');
|
||||||
searchResults();
|
searchResults();
|
||||||
});
|
});
|
||||||
|
@ -27,7 +26,7 @@ describe.skip('TicketList', () => {
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
cy.stub(win, 'open').as('windowOpen');
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
});
|
});
|
||||||
cy.get(firstRow).find('.q-btn:first').click();
|
cy.get(firstRow).should('be.visible').find('.q-btn:first').click();
|
||||||
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,6 +37,21 @@ describe.skip('TicketList', () => {
|
||||||
cy.get('.summaryBody').should('exist');
|
cy.get('.summaryBody').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('filter client and create ticket', () => {
|
||||||
|
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
|
||||||
|
searchResults();
|
||||||
|
|
||||||
|
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
|
||||||
|
cy.dataCy('Customer ID_input').clear('1');
|
||||||
|
cy.dataCy('Customer ID_input').type('1101{enter}');
|
||||||
|
|
||||||
|
cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
|
||||||
|
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
|
||||||
|
cy.dataCy('Address_select').click();
|
||||||
|
|
||||||
|
cy.getOption().click();
|
||||||
|
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
|
||||||
|
});
|
||||||
it('Client list create new client', () => {
|
it('Client list create new client', () => {
|
||||||
cy.dataCy('vnTableCreateBtn').should('exist');
|
cy.dataCy('vnTableCreateBtn').should('exist');
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
|
|
|
@ -112,7 +112,6 @@ describe('TicketSale', () => {
|
||||||
cy.dataCy('ticketSaleTransferBtn').click();
|
cy.dataCy('ticketSaleTransferBtn').click();
|
||||||
cy.dataCy('ticketTransferPopup').should('exist');
|
cy.dataCy('ticketTransferPopup').should('exist');
|
||||||
cy.dataCy('ticketTransferNewTicketBtn').click();
|
cy.dataCy('ticketTransferNewTicketBtn').click();
|
||||||
//check the new ticket has been created succesfully
|
|
||||||
cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
|
cy.get('.q-item > .q-item__label').should('not.have.text', ' #32');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ describe('TicketSale', () => {
|
||||||
it('update price', () => {
|
it('update price', () => {
|
||||||
const price = Number((Math.random() * 99 + 1).toFixed(2));
|
const price = Number((Math.random() * 99 + 1).toFixed(2));
|
||||||
cy.waitForElement(firstRow);
|
cy.waitForElement(firstRow);
|
||||||
cy.get(':nth-child(10) > .q-btn').click();
|
cy.get('[data-col-field="price"]').find('.q-btn').click();
|
||||||
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
cy.dataCy('ticketEditManaProxy').should('exist');
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
cy.waitForElement('[data-cy="Price_input"]');
|
cy.waitForElement('[data-cy="Price_input"]');
|
||||||
|
@ -147,15 +146,14 @@ describe('TicketSale', () => {
|
||||||
cy.dataCy('saveManaBtn').click();
|
cy.dataCy('saveManaBtn').click();
|
||||||
handleVnConfirm();
|
handleVnConfirm();
|
||||||
|
|
||||||
cy.get(':nth-child(10) > .q-btn > .q-btn__content').should(
|
cy.get('[data-col-field="price"]')
|
||||||
'have.text',
|
.find('.q-btn > .q-btn__content')
|
||||||
`€${price}`,
|
.should('have.text', `€${price}`);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
it('update dicount', () => {
|
it('update discount', () => {
|
||||||
const discount = Math.floor(Math.random() * 100) + 1;
|
const discount = Math.floor(Math.random() * 100) + 1;
|
||||||
selectFirstRow();
|
selectFirstRow();
|
||||||
cy.get(':nth-child(11) > .q-btn').click();
|
cy.get('[data-col-field="discount"]').find('.q-btn').click();
|
||||||
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
cy.dataCy('ticketEditManaProxy').should('exist');
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
cy.waitForElement('[data-cy="Disc_input"]');
|
cy.waitForElement('[data-cy="Disc_input"]');
|
||||||
|
@ -164,26 +162,24 @@ describe('TicketSale', () => {
|
||||||
cy.dataCy('saveManaBtn').click();
|
cy.dataCy('saveManaBtn').click();
|
||||||
handleVnConfirm();
|
handleVnConfirm();
|
||||||
|
|
||||||
cy.get(':nth-child(11) > .q-btn > .q-btn__content').should(
|
cy.get('[data-col-field="discount"]')
|
||||||
'have.text',
|
.find('.q-btn > .q-btn__content')
|
||||||
`${discount}.00%`,
|
.should('have.text', `${discount}.00%`);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('change concept', () => {
|
it('change concept', () => {
|
||||||
const quantity = Math.floor(Math.random() * 100) + 1;
|
const concept = Math.floor(Math.random() * 100) + 1;
|
||||||
cy.waitForElement(firstRow);
|
cy.waitForElement(firstRow);
|
||||||
cy.get(':nth-child(8) > .row').click();
|
cy.get('[data-col-field="item"]').click();
|
||||||
cy.get(
|
cy.get('.q-menu')
|
||||||
'.q-menu > [data-v-ca3f07a4=""] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="undefined_input"]',
|
.find('[data-cy="undefined_input"]')
|
||||||
)
|
.type(concept)
|
||||||
.type(quantity)
|
|
||||||
.type('{enter}');
|
.type('{enter}');
|
||||||
handleVnConfirm();
|
handleVnConfirm();
|
||||||
|
|
||||||
cy.get(':nth-child(8) >.row').should('contain.text', `${quantity}`);
|
cy.get('[data-col-field="item"]').should('contain.text', `${concept}`);
|
||||||
});
|
});
|
||||||
it('changequantity ', () => {
|
it('change quantity ', () => {
|
||||||
const quantity = Math.floor(Math.random() * 100) + 1;
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||||
cy.waitForElement(firstRow);
|
cy.waitForElement(firstRow);
|
||||||
cy.dataCy('ticketSaleQuantityInput').clear();
|
cy.dataCy('ticketSaleQuantityInput').clear();
|
||||||
|
@ -200,7 +196,7 @@ describe('TicketSale', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleVnConfirm() {
|
function handleVnConfirm() {
|
||||||
cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
|
cy.get('[data-cy="VnConfirm_confirm"]').click();
|
||||||
cy.waitForElement('.q-notification__message');
|
cy.waitForElement('.q-notification__message');
|
||||||
|
|
||||||
cy.get('.q-notification__message').should('be.visible');
|
cy.get('.q-notification__message').should('be.visible');
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe('UserPanel', () => {
|
||||||
cy.get(userWarehouse).should('have.value', 'VNL').click();
|
cy.get(userWarehouse).should('have.value', 'VNL').click();
|
||||||
|
|
||||||
// Actualizo la opción
|
// Actualizo la opción
|
||||||
getOption(3);
|
cy.getOption(3);
|
||||||
|
|
||||||
//Compruebo la notificación
|
//Compruebo la notificación
|
||||||
cy.get('.q-notification').should('be.visible');
|
cy.get('.q-notification').should('be.visible');
|
||||||
|
@ -26,7 +26,7 @@ describe('UserPanel', () => {
|
||||||
|
|
||||||
//Restauro el valor
|
//Restauro el valor
|
||||||
cy.get(userWarehouse).click();
|
cy.get(userWarehouse).click();
|
||||||
getOption(2);
|
cy.getOption(2);
|
||||||
});
|
});
|
||||||
it('should notify when update user company', () => {
|
it('should notify when update user company', () => {
|
||||||
const userCompany =
|
const userCompany =
|
||||||
|
@ -39,7 +39,7 @@ describe('UserPanel', () => {
|
||||||
cy.get(userCompany).should('have.value', 'Warehouse One').click();
|
cy.get(userCompany).should('have.value', 'Warehouse One').click();
|
||||||
|
|
||||||
//Actualizo la opción
|
//Actualizo la opción
|
||||||
getOption(2);
|
cy.getOption(2);
|
||||||
|
|
||||||
//Compruebo la notificación
|
//Compruebo la notificación
|
||||||
cy.get('.q-notification').should('be.visible');
|
cy.get('.q-notification').should('be.visible');
|
||||||
|
@ -47,12 +47,6 @@ describe('UserPanel', () => {
|
||||||
|
|
||||||
//Restauro el valor
|
//Restauro el valor
|
||||||
cy.get(userCompany).click();
|
cy.get(userCompany).click();
|
||||||
getOption(1);
|
cy.getOption(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function getOption(index) {
|
|
||||||
cy.waitForElement('[role="listbox"]');
|
|
||||||
const option = `[role="listbox"] .q-item:nth-child(${index})`;
|
|
||||||
cy.get(option).click();
|
|
||||||
}
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ describe('VnLocation', () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
firstOption.concat(' > .q-item__section > .q-item__label--caption'),
|
firstOption.concat(' > .q-item__section > .q-item__label--caption'),
|
||||||
).should('have.text', postCodeLabel);
|
).should('have.text', postCodeLabel);
|
||||||
cy.get(firstOption).click();
|
cy.getOption();
|
||||||
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
|
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
|
|
|
@ -399,6 +399,22 @@ Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
|
||||||
cy.wrap($btn).click();
|
cy.wrap($btn).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
|
Cypress.Commands.add('clickButtonWithText', (buttonText) => {
|
||||||
cy.get('.q-btn').contains(buttonText).click();
|
cy.get('.q-btn').contains(buttonText).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('getOption', (index = 1) => {
|
||||||
|
cy.waitForElement('[role="listbox"]');
|
||||||
|
cy.get(`[role="listbox"] .q-item:nth-child(${index})`).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('searchBtnFilterPanel', () => {
|
||||||
|
cy.get(
|
||||||
|
'.q-scrollarea__content > .q-btn--standard > .q-btn__content > .q-icon',
|
||||||
|
).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('waitRequest', (alias, cb) => {
|
||||||
|
cy.wait(alias).then(cb);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue