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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,49 +1,38 @@
/// <reference types="cypress" />
describe('Ticket Lack detail', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.intercept('GET', /\/api\/Tickets\/itemLack\/5.*$/, {
statusCode: 200,
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.intercept('GET', /\/api\/Tickets\/itemLack\/88.*$/).as('getItemLack');
cy.visit('/#/ticket/negative/88');
cy.visit('/#/ticket/negative/5');
cy.wait('@getItemLack');
cy.wait('@getItemLack').then((interception) => {
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', () => {
it.skip('should display only one row in the lack list', () => {
cy.location('href').should('contain', '#/ticket/negative/5');
describe.skip('Table detail', () => {
it('should open descriptors', () => {
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="changeState"]').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');
});
});
describe('Item proposal', () => {
describe.only('Item proposal', () => {
beforeEach(() => {
cy.get('tr.cursor-pointer > :nth-child(1)').click();
cy.intercept('GET', /\/api\/Items\/getSimilar\?.*$/, {
statusCode: 200,
body: [
{
id: 1,
longName: 'Ranged weapon longbow 50cm',
subName: 'Stark Industries',
tag5: 'Color',
value5: 'Brown',
match5: 0,
match6: 0,
match7: 0,
match8: 1,
tag6: 'Categoria',
value6: '+1 precission',
tag7: 'Tallos',
value7: '1',
tag8: null,
value8: null,
available: 20,
calc_id: 6,
counter: 0,
minQuantity: 1,
visible: null,
price2: 1,
},
{
id: 2,
longName: 'Ranged weapon longbow 100cm',
subName: 'Stark Industries',
tag5: 'Color',
value5: 'Brown',
match5: 0,
match6: 1,
match7: 0,
match8: 1,
tag6: 'Categoria',
value6: '+1 precission',
tag7: 'Tallos',
value7: '1',
tag8: null,
value8: null,
available: 50,
calc_id: 6,
counter: 1,
minQuantity: 5,
visible: null,
price2: 10,
},
{
id: 3,
longName: 'Ranged weapon longbow 200cm',
subName: 'Stark Industries',
tag5: 'Color',
value5: 'Brown',
match5: 1,
match6: 1,
match7: 1,
match8: 1,
tag6: 'Categoria',
value6: '+1 precission',
tag7: 'Tallos',
value7: '1',
tag8: null,
value8: null,
available: 185,
calc_id: 6,
counter: 10,
minQuantity: 10,
visible: null,
price2: 100,
},
],
}).as('getItemGetSimilar');
// cy.intercept('GET', /\/api\/Items\/getSimilar\?.*$/, {
// statusCode: 200,
// body: [
// {
// id: 1,
// longName: 'Ranged weapon longbow 50cm',
// subName: 'Stark Industries',
// tag5: 'Color',
// value5: 'Brown',
// match5: 0,
// match6: 0,
// match7: 0,
// match8: 1,
// tag6: 'Categoria',
// value6: '+1 precission',
// tag7: 'Tallos',
// value7: '1',
// tag8: null,
// value8: null,
// available: 20,
// calc_id: 6,
// counter: 0,
// minQuantity: 1,
// visible: null,
// price2: 1,
// },
// {
// id: 2,
// longName: 'Ranged weapon longbow 100cm',
// subName: 'Stark Industries',
// tag5: 'Color',
// value5: 'Brown',
// match5: 0,
// match6: 1,
// match7: 0,
// match8: 1,
// tag6: 'Categoria',
// value6: '+1 precission',
// tag7: 'Tallos',
// value7: '1',
// tag8: null,
// value8: null,
// available: 50,
// calc_id: 6,
// counter: 1,
// minQuantity: 5,
// visible: null,
// price2: 10,
// },
// {
// id: 3,
// longName: 'Ranged weapon longbow 200cm',
// subName: 'Stark Industries',
// tag5: 'Color',
// value5: 'Brown',
// match5: 1,
// match6: 1,
// match7: 1,
// match8: 1,
// tag6: 'Categoria',
// value6: '+1 precission',
// tag7: 'Tallos',
// value7: '1',
// tag8: null,
// value8: null,
// available: 185,
// calc_id: 6,
// counter: 10,
// minQuantity: 10,
// visible: null,
// price2: 100,
// },
// ],
// }).as('getItemGetSimilar');
cy.get('[data-cy="itemProposal"]').click();
cy.wait('@getItemGetSimilar');
// cy.wait('@getItemGetSimilar');
});
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();
});
/* ==== 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" />
describe('Ticket Lack list', () => {
beforeEach(() => {
cy.login('developer');
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.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/ticket/negative');
});
describe('Table actions', () => {
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.location('href').should('contain', '#/ticket/negative/5');
});