fix: bugs
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2025-02-16 03:02:34 +01:00
parent 4af8361f90
commit 6877a629c7
12 changed files with 165 additions and 157 deletions

View File

@ -10,6 +10,10 @@ import { useClipboard } from 'src/composables/useClipboard';
import VnMoreOptions from './VnMoreOptions.vue'; import VnMoreOptions from './VnMoreOptions.vue';
const $props = defineProps({ const $props = defineProps({
id: {
type: Number,
default: null,
},
url: { url: {
type: String, type: String,
default: '', default: '',
@ -67,7 +71,8 @@ onBeforeMount(async () => {
}); });
// It enables to load data only once if the module is the same as the dataKey // It enables to load data only once if the module is the same as the dataKey
if (!isSameDataKey.value || !route.params.id) await getData(); if (!isSameDataKey.value || !route.params.id || $props.id !== route.params.id)
await getData();
watch( watch(
() => [$props.url, $props.filter], () => [$props.url, $props.filter],
async () => { async () => {

View File

@ -11,7 +11,7 @@ const $props = defineProps({
</script> </script>
<template> <template>
<QPopupProxy> <QPopupProxy data-cy="customerDescriptorProxy">
<CustomerDescriptor v-if="$props.id" :id="$props.id" :summary="CustomerSummary" /> <CustomerDescriptor v-if="$props.id" :id="$props.id" :summary="CustomerSummary" />
</QPopupProxy> </QPopupProxy>
</template> </template>

View File

@ -22,7 +22,7 @@ const $props = defineProps({
}); });
</script> </script>
<template> <template>
<QPopupProxy style="max-width: 10px"> <QPopupProxy style="max-width: 10px" data-cy="itemDescriptorProxy">
<ItemDescriptor <ItemDescriptor
v-if="$props.id" v-if="$props.id"
:id="$props.id" :id="$props.id"

View File

@ -213,7 +213,6 @@ async function change({ itemFk: substitutionFk }) {
notifyResults(results, 'saleFk'); notifyResults(results, 'saleFk');
emit('itemReplaced', { emit('itemReplaced', {
type: 'refresh', type: 'refresh',
quantity: quantity.value,
itemProposal: proposalSelected.value[0], itemProposal: proposalSelected.value[0],
}); });
proposalSelected.value = []; proposalSelected.value = [];

View File

@ -20,11 +20,7 @@ const $props = defineProps({
}, },
}); });
const { dialogRef } = useDialogPluginComponent(); const { dialogRef } = useDialogPluginComponent();
const emit = defineEmits([ const emit = defineEmits(['onDialogClosed', ...useDialogPluginComponent.emits]);
'onDialogClosed',
'itemReplaced',
...useDialogPluginComponent.emits,
]);
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() }); defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
</script> </script>
<template> <template>
@ -39,8 +35,7 @@ defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.h
<ItemProposal <ItemProposal
v-bind="$props" v-bind="$props"
@item-replaced=" @item-replaced="
(data) => { () => {
emit('itemReplaced', data);
dialogRef.hide(); dialogRef.hide();
} }
" "

View File

@ -44,6 +44,7 @@ function ticketFilter(ticket) {
@on-fetch="(data) => ([problems] = data)" @on-fetch="(data) => ([problems] = data)"
/> />
<CardDescriptor <CardDescriptor
:id="entityId"
:url="`Tickets/${entityId}`" :url="`Tickets/${entityId}`"
:filter="filter" :filter="filter"
data-key="Ticket" data-key="Ticket"

View File

@ -10,7 +10,7 @@ const $props = defineProps({
}); });
</script> </script>
<template> <template>
<QPopupProxy> <QPopupProxy data-cy="ticketDescriptorProxy">
<TicketDescriptor v-if="$props.id" :id="$props.id" :summary="TicketSummary" /> <TicketDescriptor v-if="$props.id" :id="$props.id" :summary="TicketSummary" />
</QPopupProxy> </QPopupProxy>
</template> </template>

View File

@ -155,7 +155,6 @@ const setUserParams = (params) => {
<TicketLackFilter data-key="NegativeList" @set-user-params="setUserParams" /> <TicketLackFilter data-key="NegativeList" @set-user-params="setUserParams" />
</template> </template>
</RightMenu> </RightMenu>
{{ filterRef }}
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="NegativeList" data-key="NegativeList"

View File

@ -82,6 +82,7 @@ const columns = computed(() => [
}, },
{ {
name: 'alertLevelCode', name: 'alertLevelCode',
field: 'alertLevelCode',
label: t('negative.detail.state'), label: t('negative.detail.state'),
columnFilter: { columnFilter: {
name: 'alertLevelCode', name: 'alertLevelCode',
@ -291,9 +292,9 @@ function onBuysFetched(data) {
</span> </span>
</template> </template>
<template #column-ticketFk="{ row }"> <template #column-ticketFk="{ row }">
<span class="q-pa-sm link"> <span class="link" @click.stop>
{{ row.id }} {{ row.ticketFk }}
<TicketDescriptorProxy :id="row.id" /> <TicketDescriptorProxy :id="row.ticketFk" />
</span> </span>
</template> </template>
<template #column-alertLevelCode="props"> <template #column-alertLevelCode="props">

View File

@ -11,7 +11,12 @@ const $props = defineProps({
</script> </script>
<template> <template>
<QPopupProxy> <QPopupProxy data-cy="zoneDescriptorProxy">
<ZoneDescriptor v-if="$props.id" :id="$props.id" :summary="ZoneSummary" /> <ZoneDescriptor
v-if="$props.id"
:id="$props.id"
:summary="ZoneSummary"
data-cy="zoneDescriptorProxy"
/>
</QPopupProxy> </QPopupProxy>
</template> </template>

View File

@ -1,49 +1,38 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Ticket Lack detail', () => { describe('Ticket Lack detail', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.intercept('GET', /\/api\/Tickets\/itemLack\/5.*$/, { cy.intercept('GET', /\/api\/Tickets\/itemLack\/88.*$/).as('getItemLack');
statusCode: 200, cy.visit('/#/ticket/negative/88');
body: [
{
saleFk: 33,
code: 'OK',
ticketFk: 142,
nickname: 'Malibu Point',
shipped: '2000-12-31T23:00:00.000Z',
hour: 0,
quantity: 50,
agName: 'Super-Man delivery',
alertLevel: 0,
stateName: 'OK',
stateId: 3,
itemFk: 5,
price: 1.79,
alertLevelCode: 'FREE',
zoneFk: 9,
zoneName: 'Zone superMan',
theoreticalhour: '2011-11-01T22:59:00.000Z',
isRookie: 1,
turno: 1,
peticionCompra: 1,
hasObservation: 1,
hasToIgnore: 1,
isBasket: 1,
minTimed: 0,
customerId: 1104,
customerName: 'Tony Stark',
observationTypeCode: 'administrative',
},
],
}).as('getItemLack');
cy.visit('/#/ticket/negative/5'); cy.wait('@getItemLack').then((interception) => {
cy.wait('@getItemLack'); const { query } = interception.request;
const filter = JSON.parse(query.filter);
expect(filter).to.have.property('where');
expect(filter.where).to.have.property('alertLevelCode', 'FREE');
});
cy.domContentLoad();
cy.waitForElement('.q-table');
}); });
describe('Table actions', () => { describe.skip('Table detail', () => {
it.skip('should display only one row in the lack list', () => { it('should open descriptors', () => {
cy.location('href').should('contain', '#/ticket/negative/5'); cy.get('.q-table').should('be.visible');
cy.get('[data-col-field="nickname"]').click();
cy.dataCy('customerDescriptorProxy').should('be.visible');
cy.get('.q-item > .q-item__label').should('have.text', ' #1 content_copy');
cy.get('[data-col-field="zoneName"]').click();
cy.dataCy('zoneDescriptorProxy').should('be.visible');
cy.get('.q-item > .q-item__label').should('have.text', ' #1 content_copy');
cy.get('[data-col-field="ticketFk"]').click();
cy.dataCy('ticketDescriptorProxy').should('be.visible');
cy.get('.q-item > .q-item__label').should(
'have.text',
' #1000000 content_copy',
);
});
it.only('should display only one row in the lack list', () => {
cy.get('[data-cy="changeItem"]').should('be.disabled'); cy.get('[data-cy="changeItem"]').should('be.disabled');
cy.get('[data-cy="changeState"]').should('be.disabled'); cy.get('[data-cy="changeState"]').should('be.disabled');
cy.get('[data-cy="changeQuantity"]').should('be.disabled'); cy.get('[data-cy="changeQuantity"]').should('be.disabled');
@ -57,91 +46,123 @@ describe('Ticket Lack detail', () => {
cy.get('[data-cy="transferLines"]').should('be.enabled'); cy.get('[data-cy="transferLines"]').should('be.enabled');
}); });
}); });
describe('Item proposal', () => {
describe.only('Item proposal', () => {
beforeEach(() => { beforeEach(() => {
cy.get('tr.cursor-pointer > :nth-child(1)').click(); cy.get('tr.cursor-pointer > :nth-child(1)').click();
cy.intercept('GET', /\/api\/Items\/getSimilar\?.*$/, { // cy.intercept('GET', /\/api\/Items\/getSimilar\?.*$/, {
statusCode: 200, // statusCode: 200,
body: [ // body: [
{ // {
id: 1, // id: 1,
longName: 'Ranged weapon longbow 50cm', // longName: 'Ranged weapon longbow 50cm',
subName: 'Stark Industries', // subName: 'Stark Industries',
tag5: 'Color', // tag5: 'Color',
value5: 'Brown', // value5: 'Brown',
match5: 0, // match5: 0,
match6: 0, // match6: 0,
match7: 0, // match7: 0,
match8: 1, // match8: 1,
tag6: 'Categoria', // tag6: 'Categoria',
value6: '+1 precission', // value6: '+1 precission',
tag7: 'Tallos', // tag7: 'Tallos',
value7: '1', // value7: '1',
tag8: null, // tag8: null,
value8: null, // value8: null,
available: 20, // available: 20,
calc_id: 6, // calc_id: 6,
counter: 0, // counter: 0,
minQuantity: 1, // minQuantity: 1,
visible: null, // visible: null,
price2: 1, // price2: 1,
}, // },
{ // {
id: 2, // id: 2,
longName: 'Ranged weapon longbow 100cm', // longName: 'Ranged weapon longbow 100cm',
subName: 'Stark Industries', // subName: 'Stark Industries',
tag5: 'Color', // tag5: 'Color',
value5: 'Brown', // value5: 'Brown',
match5: 0, // match5: 0,
match6: 1, // match6: 1,
match7: 0, // match7: 0,
match8: 1, // match8: 1,
tag6: 'Categoria', // tag6: 'Categoria',
value6: '+1 precission', // value6: '+1 precission',
tag7: 'Tallos', // tag7: 'Tallos',
value7: '1', // value7: '1',
tag8: null, // tag8: null,
value8: null, // value8: null,
available: 50, // available: 50,
calc_id: 6, // calc_id: 6,
counter: 1, // counter: 1,
minQuantity: 5, // minQuantity: 5,
visible: null, // visible: null,
price2: 10, // price2: 10,
}, // },
{ // {
id: 3, // id: 3,
longName: 'Ranged weapon longbow 200cm', // longName: 'Ranged weapon longbow 200cm',
subName: 'Stark Industries', // subName: 'Stark Industries',
tag5: 'Color', // tag5: 'Color',
value5: 'Brown', // value5: 'Brown',
match5: 1, // match5: 1,
match6: 1, // match6: 1,
match7: 1, // match7: 1,
match8: 1, // match8: 1,
tag6: 'Categoria', // tag6: 'Categoria',
value6: '+1 precission', // value6: '+1 precission',
tag7: 'Tallos', // tag7: 'Tallos',
value7: '1', // value7: '1',
tag8: null, // tag8: null,
value8: null, // value8: null,
available: 185, // available: 185,
calc_id: 6, // calc_id: 6,
counter: 10, // counter: 10,
minQuantity: 10, // minQuantity: 10,
visible: null, // visible: null,
price2: 100, // price2: 100,
}, // },
], // ],
}).as('getItemGetSimilar'); // }).as('getItemGetSimilar');
cy.get('[data-cy="itemProposal"]').click(); cy.get('[data-cy="itemProposal"]').click();
cy.wait('@getItemGetSimilar'); // cy.wait('@getItemGetSimilar');
}); });
describe('Replace item if', () => { describe('Replace item if', () => {
it.only('Quantity is less than available', () => { it('Quantity is less than available', () => {
cy.get(':nth-child(1) > .text-right > .q-btn').click(); cy.get(':nth-child(1) > .text-right > .q-btn').click();
}); });
/* ==== Test Created with Cypress Studio ==== */
it.only('item proposal cells', function () {
cy.get(
':nth-child(1) > .q-table--col-auto-width > .q-btn > .q-btn__content > .q-icon',
).should('not.be.visible');
cy.get('[data-col-field="longName"] .link').first().click();
cy.dataCy('itemDescriptorProxy').should('be.visible');
cy.get(
':nth-child(2) > [data-col-field="longName"] > .no-padding > .q-td > .middle',
).should('have.class', 'proposal-primary');
cy.get(
':nth-child(2) > [data-col-field="tag5"] > .no-padding > .match',
).should('have.class', 'match');
cy.get(
':nth-child(2) > [data-col-field="tag6"] > .no-padding > .match',
).should('have.class', 'match');
cy.get(':nth-child(2) > [data-col-field="tag7"]').click();
cy.get(
':nth-child(2) > .q-table--col-auto-width > .q-btn > .q-btn__content > .q-icon',
).should('be.visible');
cy.get(':nth-child(2) > .q-table--col-auto-width > .q-btn')
.should('be.enabled')
.click();
// cy.get('.q-notification__message').should(
// 'have.text',
// 'Operación (1) 43 completada con éxito.',
// );
});
}); });
}); });
}); });

View File

@ -1,34 +1,16 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('Ticket Lack list', () => { describe('Ticket Lack list', () => {
beforeEach(() => { beforeEach(() => {
cy.login('developer'); cy.viewport(1280, 720);
cy.intercept('GET', /Tickets\/itemLack\?.*$/, {
statusCode: 200,
body: [
{
itemFk: 5,
longName: 'Ranged weapon pistol 9mm',
warehouseFk: 1,
producer: null,
size: 15,
category: null,
warehouse: 'Warehouse One',
lack: -50,
inkFk: 'SLV',
timed: '2025-01-25T22:59:00.000Z',
minTimed: '23:59',
originFk: 'Holand',
},
],
}).as('getLack');
cy.login('developer');
cy.visit('/#/ticket/negative'); cy.visit('/#/ticket/negative');
}); });
describe('Table actions', () => { describe('Table actions', () => {
it('should display only one row in the lack list', () => { it('should display only one row in the lack list', () => {
cy.wait('@getLack', { timeout: 10000 }); cy.get('[data-col-field="longName"]').first().click();
cy.dataCy('itemDescriptorProxy').should('be.visible');
cy.get('.q-virtual-scroll__content > :nth-child(1) > .sticky').click(); cy.get('.q-virtual-scroll__content > :nth-child(1) > .sticky').click();
cy.location('href').should('contain', '#/ticket/negative/5'); cy.location('href').should('contain', '#/ticket/negative/5');
}); });