feat: refs #8602 refactor EntryBuys component and enhance observation tests
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2025-03-10 12:55:02 +01:00
parent 2b2f4bb8ab
commit 913049ac3d
3 changed files with 50 additions and 49 deletions

View File

@ -59,31 +59,6 @@ const columns = [
createOrder: 12,
width: '25px',
},
{
label: t('Buyer'),
name: 'workerFk',
component: 'select',
attrs: {
url: 'TicketRequests/getItemTypeWorker',
fields: ['id', 'nickname'],
optionLabel: 'nickname',
sortBy: 'nickname ASC',
optionValue: 'id',
},
visible: false,
},
{
label: t('Family'),
name: 'itemTypeFk',
component: 'select',
attrs: {
url: 'itemTypes',
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
},
visible: false,
},
{
name: 'id',
isId: true,
@ -115,15 +90,8 @@ const columns = [
{
align: 'center',
label: t('Article'),
component: 'input',
name: 'name',
component: 'select',
attrs: {
url: 'Items',
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
sortBy: 'name ASC',
},
width: '85px',
isEditable: false,
},
@ -423,6 +391,8 @@ const itemTypeFk = ref(null);
const inkFk = ref(null);
const tag1 = ref(null);
const tag2 = ref(null);
const tag1Filter = ref(null);
const tag2Filter = ref(null);
const filter = computed(() => {
const where = {};
if (buyerFk.value) {
@ -434,6 +404,7 @@ const filter = computed(() => {
if (inkFk.value) {
where.inkFk = inkFk.value;
}
if (tag1.value) {
where.tag1 = tag1.value;
}
@ -710,8 +681,16 @@ onMounted(() => {
option-label="name"
sort-by="name ASC"
/>
<VnInput v-model="tag1" :label="t('Tag')" :placeholder="t('Tag')" />
<VnInput v-model="tag2" :label="t('Tag')" :placeholder="t('Tag')" />
<VnInput
v-model="tag1Filter"
:label="t('Tag')"
@keyup.enter="tag1 = tag1Filter"
/>
<VnInput
v-model="tag2Filter"
:label="t('Tag')"
@keyup.enter="tag2 = tag2Filter"
/>
</VnRow>
</template>
<template #column-hex="{ row }">

View File

@ -7,14 +7,44 @@ describe('EntryNotes', () => {
cy.visit(`/#/entry/list`);
});
it('Create delete and edit', () => {
const createObservation = (type, description) => {
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('Observation type_select').eq(1).should('be.visible').type(type);
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
cy.dataCy('Description_input').should('be.visible').type(description);
cy.dataCy('FormModelPopup_save').should('be.enabled').click();
};
const editObservation = (rowIndex, type, description) => {
cy.get(`td[data-col-field="description"][data-row-index="${rowIndex}"]`)
.click()
.clear()
.type(description);
cy.get(`td[data-col-field="observationTypeFk"][data-row-index="${rowIndex}"]`)
.click()
.clear()
.type(type);
cy.get('div[role="listbox"] > div > div[role="option"]').eq(0).click();
cy.saveCard();
};
it('Create, delete, and edit observations', () => {
cy.createEntry();
cy.waitForElement('[data-cy="entry-buys"]');
cy.dataCy('EntryNotes-menu-item').click();
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('Observation type_select').eq(1).should('be.visible').type('Packager');
cy.dataCy('Description_input').should('be.visible').type('test');
cy.dataCy('FormModelPopup_save').should('be.enabled').click();
createObservation('Packager', 'test');
cy.get('.q-notification__message').eq(0).should('have.text', 'Data created');
editObservation(0, 'Administrative', 'test2');
createObservation('Administrative', 'test');
cy.get('.q-notification__message')
.eq(2)
.should('have.text', "The observation type can't be repeated");
cy.dataCy('FormModelPopup_cancel').click();
cy.deleteEntry();
});
});

View File

@ -7,20 +7,12 @@ describe('Entry', () => {
cy.visit(`/#/entry/list`);
});
it('Filter deleted entries and view popup summary', () => {
it('View popup summary', () => {
cy.createEntry();
cy.get('.q-notification__message').eq(0).should('have.text', 'Data created');
cy.waitForElement('[data-cy="entry-buys"]');
cy.deleteEntry();
cy.typeSearchbar('{enter}');
cy.get('span[title="Date"]').click().click();
cy.typeSearchbar('{enter}');
cy.url().should('include', 'order');
cy.get('td[data-row-index="0"][data-col-field="landed"]').should(
'have.text',
'-',
);
cy.get('button[title="Summary"]').eq(1).should('be.visible').click();
cy.dataCy('entry-summary').should('be.visible');
});