Merge branch 'dev' into 7949-TicketModifications
gitea/salix-front/pipeline/pr-dev Something is wrong with the build of this commit Details

This commit is contained in:
Jon Elias 2025-03-04 12:53:33 +00:00
commit 45d54e737b
27 changed files with 152 additions and 156 deletions

View File

@ -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 🆕

View File

@ -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

View File

@ -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">

View File

@ -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,

View File

@ -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) {

View File

@ -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
@ -126,8 +127,8 @@ function fetchData([ data ]) {
@on-fetch="fetchData" @on-fetch="fetchData"
auto-load auto-load
/> />
<QCard <QCard
class="q-pa-xs q-mb-lg full-width" class="q-pa-xs q-mb-lg full-width"
:class="{ 'just-input': $props.justInput }" :class="{ 'just-input': $props.justInput }"
v-if="$props.addNote || $props.justInput" v-if="$props.addNote || $props.justInput"
> >
@ -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>

View File

@ -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"

View File

@ -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>

View File

@ -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

View File

@ -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 }"
> >

View File

@ -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

View File

@ -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

View File

@ -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
/> />

View File

@ -11,6 +11,11 @@ export default {
'isSerious', 'isSerious',
'isTrucker', 'isTrucker',
'account', 'account',
'workerFk',
'note',
'isReal',
'isPayMethodChecked',
'companySize',
], ],
include: [ include: [
{ {

View File

@ -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 }">

View File

@ -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');
@ -325,6 +324,7 @@ onMounted(async () => {
" "
: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>

View File

@ -48,7 +48,7 @@ const getGroupedStates = (data) => {
/> />
<FetchData <FetchData
url="AgencyModes" url="AgencyModes"
:sort-by="['name ASC']" :filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (agencies = data)" @on-fetch="(data) => (agencies = data)"
auto-load auto-load
/> />
@ -256,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

View File

@ -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
/> />

View File

@ -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
/> />

View File

@ -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

View File

@ -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>

View File

@ -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
/> />

View File

@ -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

View File

@ -33,7 +33,7 @@ describe('InvoiceOut summary', () => {
cy.get('.q-item > .q-item__label').should('include.text', '1101'); cy.get('.q-item > .q-item__label').should('include.text', '1101');
}); });
it('should open the ticket list', () => { it.skip('should open the ticket list', () => {
cy.get(toTicketList).click(); cy.get(toTicketList).click();
cy.get('.descriptor').should('be.visible'); cy.get('.descriptor').should('be.visible');
cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111'); cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');

View File

@ -8,43 +8,8 @@ describe('TicketFilter', () => {
it('use search button', function () { it('use search button', function () {
cy.waitForElement('.q-page'); cy.waitForElement('.q-page');
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter'); cy.get('[data-cy="Customer ID_input"]').type('1105');
cy.searchBtnFilterPanel(); cy.searchBtnFilterPanel();
cy.waitRequest('@ticketFilter', ({ request }) => { cy.location('href').should('contain', '#/ticket/15/summary');
const { query } = request;
expect(query).to.have.property('from');
expect(query).to.have.property('to');
});
cy.on('uncaught:exception', () => {
return false;
});
cy.get('.q-field__control-container > [data-cy="From_date"]')
.type(`${today()} `)
.type('{enter}');
cy.get('.q-notification').should(
'contain',
`The date range must have both 'from' and 'to'`,
);
cy.get('.q-field__control-container > [data-cy="To_date"]').type(
`${today()}{enter}`,
);
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.searchBtnFilterPanel();
cy.wait('@ticketFilter').then(({ request }) => {
const { query } = request;
expect(query).to.have.property('from');
expect(query).to.have.property('to');
});
cy.location('href').should('contain', '#/ticket/999999');
}); });
}); });
function today(date) {
// return new Date().toISOString().split('T')[0];
return new Intl.DateTimeFormat('es-ES', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}).format(date ?? new Date());
}

View File

@ -11,12 +11,12 @@ describe('TicketList', () => {
const searchResults = (search) => { const searchResults = (search) => {
if (search) cy.typeSearchbar().type(search); if (search) cy.typeSearchbar().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();
}); });
@ -40,21 +40,11 @@ describe('TicketList', () => {
it('filter client and create ticket', () => { it('filter client and create ticket', () => {
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar'); cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketSearchbar');
searchResults(); searchResults();
cy.wait('@ticketSearchbar').then(({ request }) => {
const { query } = request;
expect(query).to.have.property('from');
expect(query).to.have.property('to');
expect(query).to.not.have.property('clientFk');
});
cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter'); cy.intercept('GET', /\/api\/Tickets\/filter/).as('ticketFilter');
cy.dataCy('Customer ID_input').clear('1'); cy.dataCy('Customer ID_input').clear('1');
cy.dataCy('Customer ID_input').type('1101{enter}'); cy.dataCy('Customer ID_input').type('1101{enter}');
cy.wait('@ticketFilter').then(({ request }) => {
const { query } = request;
expect(query).to.not.have.property('from');
expect(query).to.not.have.property('to');
expect(query).to.have.property('clientFk');
});
cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click(); cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne'); cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
cy.dataCy('Address_select').click(); cy.dataCy('Address_select').click();

View File

@ -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');