Merge branch 'fix_frenchMothersDay_i18n' of https://gitea.verdnatura.es/verdnatura/salix-front into fix_frenchMothersDay_i18n
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2025-02-17 13:32:31 +01:00
commit 7265ac6fc0
7 changed files with 99 additions and 59 deletions

View File

@ -353,14 +353,14 @@ const clickHandler = async (event) => {
const column = $props.columns.find((col) => col.name === colField); const column = $props.columns.find((col) => col.name === colField);
if (editingRow.value !== null && editingField.value !== null) { if (editingRow.value !== null && editingField.value !== null) {
if (editingRow.value === rowIndex && editingField.value === colField) { if (editingRow.value == rowIndex && editingField.value == colField) return;
return;
}
destroyInput(editingRow.value, editingField.value); destroyInput(editingRow.value, editingField.value);
} }
if (isEditableColumn(column))
if (isEditableColumn(column)) {
await renderInput(Number(rowIndex), colField, clickedElement); await renderInput(Number(rowIndex), colField, clickedElement);
}
}; };
async function handleTabKey(event, rowIndex, colField) { async function handleTabKey(event, rowIndex, colField) {
@ -492,9 +492,7 @@ async function handleTabNavigation(rowIndex, colName, direction) {
if (isEditableColumn(columns[newColumnIndex])) break; if (isEditableColumn(columns[newColumnIndex])) break;
} while (iterations < totalColumns); } while (iterations < totalColumns);
if (iterations >= totalColumns) { if (iterations >= totalColumns + 1) return;
return;
}
if (direction === 1 && newColumnIndex <= currentColumnIndex) { if (direction === 1 && newColumnIndex <= currentColumnIndex) {
rowIndex++; rowIndex++;
@ -767,6 +765,7 @@ function cardClick(_, row) {
: 'hidden' : 'hidden'
}`" }`"
@click="btn.action(row)" @click="btn.action(row)"
:data-cy="btn?.name ?? `tableAction-${index}`"
/> />
</QTd> </QTd>
</template> </template>

View File

@ -209,13 +209,14 @@ const columns = [
row['amount'] = row['quantity'] * row['buyingValue']; row['amount'] = row['quantity'] * row['buyingValue'];
}, },
}, },
width: '20px', width: '30px',
style: (row) => { style: (row) => {
if (row.groupingMode === 'grouping') if (row.groupingMode === 'grouping')
return { color: 'var(--vn-label-color)' }; return { color: 'var(--vn-label-color)' };
}, },
}, },
{ {
align: 'center',
labelAbbreviation: 'GM', labelAbbreviation: 'GM',
label: t('Grouping selector'), label: t('Grouping selector'),
toolTip: t('Grouping selector'), toolTip: t('Grouping selector'),
@ -249,7 +250,7 @@ const columns = [
toolTip: 'Grouping', toolTip: 'Grouping',
name: 'grouping', name: 'grouping',
component: 'number', component: 'number',
width: '20px', width: '30px',
create: true, create: true,
style: (row) => { style: (row) => {
if (row.groupingMode === 'packing') return { color: 'var(--vn-label-color)' }; if (row.groupingMode === 'packing') return { color: 'var(--vn-label-color)' };
@ -508,7 +509,7 @@ async function setBuyUltimate(itemFk, data) {
allowedKeys.forEach((key) => { allowedKeys.forEach((key) => {
if (buyUltimateData.hasOwnProperty(key) && key !== 'entryFk') { if (buyUltimateData.hasOwnProperty(key) && key !== 'entryFk') {
data[key] = buyUltimateData[key]; if (!['stickers', 'quantity'].includes(key)) data[key] = buyUltimateData[key];
} }
}); });
} }
@ -600,7 +601,6 @@ onMounted(() => {
ref="entryBuysRef" ref="entryBuysRef"
data-key="EntryBuys" data-key="EntryBuys"
:url="`Entries/${entityId}/getBuyList`" :url="`Entries/${entityId}/getBuyList`"
order="name DESC"
save-url="Buys/crud" save-url="Buys/crud"
:disable-option="{ card: true }" :disable-option="{ card: true }"
v-model:selected="selectedRows" v-model:selected="selectedRows"
@ -644,7 +644,8 @@ onMounted(() => {
:is-editable="editableMode" :is-editable="editableMode"
:without-header="!editableMode" :without-header="!editableMode"
:with-filters="editableMode" :with-filters="editableMode"
:right-search="editableMode" :right-search="false"
:right-search-icon="false"
:row-click="false" :row-click="false"
:columns="columns" :columns="columns"
:beforeSaveFn="beforeSave" :beforeSaveFn="beforeSave"

View File

@ -44,28 +44,32 @@ const entryQueryFilter = {
const columns = computed(() => [ const columns = computed(() => [
{ {
label: 'Ex', labelAbbreviation: 'Ex',
label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),
toolTip: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'), toolTip: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),
name: 'isExcludedFromAvailable', name: 'isExcludedFromAvailable',
component: 'checkbox', component: 'checkbox',
width: '35px', width: '35px',
}, },
{ {
label: 'Pe', labelAbbreviation: 'Pe',
label: t('entry.list.tableVisibleColumns.isOrdered'),
toolTip: t('entry.list.tableVisibleColumns.isOrdered'), toolTip: t('entry.list.tableVisibleColumns.isOrdered'),
name: 'isOrdered', name: 'isOrdered',
component: 'checkbox', component: 'checkbox',
width: '35px', width: '35px',
}, },
{ {
label: 'Le', labelAbbreviation: 'LE',
label: t('entry.list.tableVisibleColumns.isConfirmed'),
toolTip: t('entry.list.tableVisibleColumns.isConfirmed'), toolTip: t('entry.list.tableVisibleColumns.isConfirmed'),
name: 'isConfirmed', name: 'isConfirmed',
component: 'checkbox', component: 'checkbox',
width: '35px', width: '35px',
}, },
{ {
label: 'Re', labelAbbreviation: 'Re',
label: t('entry.list.tableVisibleColumns.isReceived'),
toolTip: t('entry.list.tableVisibleColumns.isReceived'), toolTip: t('entry.list.tableVisibleColumns.isReceived'),
name: 'isReceived', name: 'isReceived',
component: 'checkbox', component: 'checkbox',
@ -89,6 +93,7 @@ const columns = computed(() => [
chip: { chip: {
condition: () => true, condition: () => true,
}, },
width: '50px',
}, },
{ {
label: t('entry.list.tableVisibleColumns.supplierFk'), label: t('entry.list.tableVisibleColumns.supplierFk'),
@ -99,8 +104,10 @@ const columns = computed(() => [
attrs: { attrs: {
url: 'suppliers', url: 'suppliers',
fields: ['id', 'name'], fields: ['id', 'name'],
where: { order: 'name DESC' },
}, },
format: (row, dashIfEmpty) => dashIfEmpty(row.supplierName), format: (row, dashIfEmpty) => dashIfEmpty(row.supplierName),
width: '110px',
}, },
{ {
align: 'left', align: 'left',
@ -124,6 +131,7 @@ const columns = computed(() => [
label: 'AWB', label: 'AWB',
name: 'awbCode', name: 'awbCode',
component: 'input', component: 'input',
width: '100px',
}, },
{ {
align: 'left', align: 'left',
@ -160,6 +168,7 @@ const columns = computed(() => [
component: null, component: null,
}, },
format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseOutName), format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseOutName),
width: '65px',
}, },
{ {
align: 'left', align: 'left',
@ -175,12 +184,24 @@ const columns = computed(() => [
component: null, component: null,
}, },
format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseInName), format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseInName),
width: '65px',
}, },
{ {
align: 'left', align: 'left',
labelAbbreviation: t('Type'),
label: t('entry.list.tableVisibleColumns.entryTypeDescription'), label: t('entry.list.tableVisibleColumns.entryTypeDescription'),
toolTip: t('entry.list.tableVisibleColumns.entryTypeDescription'),
name: 'entryTypeCode', name: 'entryTypeCode',
component: 'select',
attrs: {
url: 'entryTypes',
fields: ['code', 'description'],
optionValue: 'code',
optionLabel: 'description',
},
cardVisible: true, cardVisible: true,
width: '65px',
format: (row, dashIfEmpty) => dashIfEmpty(row.entryTypeDescription),
}, },
{ {
name: 'companyFk', name: 'companyFk',
@ -320,4 +341,5 @@ es:
Search entries: Buscar entradas Search entries: Buscar entradas
You can search by entry reference: Puedes buscar por referencia de la entrada You can search by entry reference: Puedes buscar por referencia de la entrada
Create entry: Crear entrada Create entry: Crear entrada
Type: Tipo
</i18n> </i18n>

View File

@ -34,18 +34,20 @@ const columns = computed(() => [
label: t('entryStockBought.buyer'), label: t('entryStockBought.buyer'),
isTitle: true, isTitle: true,
component: 'select', component: 'select',
isEditable: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
attrs: { attrs: {
url: 'Workers/activeWithInheritedRole', url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'], fields: ['id', 'name', 'nickname'],
where: { role: 'buyer' }, where: { role: 'buyer' },
optionFilter: 'firstName', optionFilter: 'firstName',
optionLabel: 'name', optionLabel: 'nickname',
optionValue: 'id', optionValue: 'id',
useLike: false, useLike: false,
}, },
columnFilter: false, columnFilter: false,
width: '70px',
}, },
{ {
align: 'center', align: 'center',
@ -55,6 +57,7 @@ const columns = computed(() => [
create: true, create: true,
component: 'number', component: 'number',
summation: true, summation: true,
width: '60px',
}, },
{ {
align: 'center', align: 'center',
@ -78,6 +81,7 @@ const columns = computed(() => [
actions: [ actions: [
{ {
title: t('entryStockBought.viewMoreDetails'), title: t('entryStockBought.viewMoreDetails'),
name: 'searchBtn',
icon: 'search', icon: 'search',
isPrimary: true, isPrimary: true,
action: (row) => { action: (row) => {
@ -91,6 +95,7 @@ const columns = computed(() => [
}, },
}, },
], ],
'data-cy': 'table-actions',
}, },
]); ]);
@ -158,7 +163,7 @@ function round(value) {
@on-fetch=" @on-fetch="
(data) => { (data) => {
travel = data.find( travel = data.find(
(data) => data.warehouseIn?.code.toLowerCase() === 'vnh' (data) => data.warehouseIn?.code.toLowerCase() === 'vnh',
); );
} }
" "
@ -179,6 +184,7 @@ function round(value) {
@click="openDialog()" @click="openDialog()"
:title="t('entryStockBought.editTravel')" :title="t('entryStockBought.editTravel')"
color="primary" color="primary"
data-cy="edit-travel"
/> />
</div> </div>
</VnRow> </VnRow>
@ -239,10 +245,11 @@ function round(value) {
table-height="80vh" table-height="80vh"
auto-load auto-load
:column-search="false" :column-search="false"
:without-header="true"
> >
<template #column-workerFk="{ row }"> <template #column-workerFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row?.worker?.user?.name }} {{ row?.worker?.user?.nickname }}
<WorkerDescriptorProxy :id="row?.workerFk" /> <WorkerDescriptorProxy :id="row?.workerFk" />
</span> </span>
</template> </template>
@ -279,10 +286,11 @@ function round(value) {
justify-content: center; justify-content: center;
} }
.column { .column {
min-width: 30%;
margin-top: 5%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
min-width: 35%;
} }
.text-negative { .text-negative {
color: $negative !important; color: $negative !important;

View File

@ -21,7 +21,7 @@ const $props = defineProps({
const customUrl = `StockBoughts/getStockBoughtDetail?workerFk=${$props.workerFk}&dated=${$props.dated}`; const customUrl = `StockBoughts/getStockBoughtDetail?workerFk=${$props.workerFk}&dated=${$props.dated}`;
const columns = [ const columns = [
{ {
align: 'left', align: 'right',
label: t('Entry'), label: t('Entry'),
name: 'entryFk', name: 'entryFk',
isTitle: true, isTitle: true,
@ -29,7 +29,7 @@ const columns = [
columnFilter: false, columnFilter: false,
}, },
{ {
align: 'left', align: 'right',
name: 'itemFk', name: 'itemFk',
label: t('Item'), label: t('Item'),
columnFilter: false, columnFilter: false,
@ -44,21 +44,21 @@ const columns = [
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'right',
name: 'volume', name: 'volume',
label: t('Volume'), label: t('Volume'),
columnFilter: false, columnFilter: false,
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'right',
label: t('Packaging'), label: t('Packaging'),
name: 'packagingFk', name: 'packagingFk',
columnFilter: false, columnFilter: false,
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'right',
label: 'Packing', label: 'Packing',
name: 'packing', name: 'packing',
columnFilter: false, columnFilter: false,
@ -73,12 +73,14 @@ const columns = [
ref="tableRef" ref="tableRef"
data-key="StockBoughtsDetail" data-key="StockBoughtsDetail"
:url="customUrl" :url="customUrl"
order="itemName DESC" order="volume DESC"
:columns="columns" :columns="columns"
:right-search="false" :right-search="false"
:disable-infinite-scroll="true" :disable-infinite-scroll="true"
:disable-option="{ card: true }" :disable-option="{ card: true }"
:limit="0" :limit="0"
:without-header="true"
:with-filters="false"
auto-load auto-load
> >
<template #column-entryFk="{ row }"> <template #column-entryFk="{ row }">
@ -105,7 +107,7 @@ const columns = [
align-items: center; align-items: center;
margin: auto; margin: auto;
background-color: var(--vn-section-color); background-color: var(--vn-section-color);
padding: 4px; padding: 2%;
} }
.container > div > div > .q-table__top.relative-position.row.items-center { .container > div > div > .q-table__top.relative-position.row.items-center {
background-color: red !important; background-color: red !important;

View File

@ -106,8 +106,9 @@ describe('Entry', () => {
cy.get(`td[data-col-field="${field}"][data-row-index="${row}"]`); cy.get(`td[data-col-field="${field}"][data-row-index="${row}"]`);
const selectSpan = (field, row = 0) => selectCell(field, row).find('div > span'); const selectSpan = (field, row = 0) => selectCell(field, row).find('div > span');
const selectButton = (cySelector) => cy.get(`button[data-cy="${cySelector}"]`); const selectButton = (cySelector) => cy.get(`button[data-cy="${cySelector}"]`);
const clickAndType = (field, value, row = 0) => const clickAndType = (field, value, row = 0) => {
selectCell(field, row).click().type(value); selectCell(field, row).click().type(`${value}{esc}`);
};
const checkText = (field, expectedText, row = 0) => const checkText = (field, expectedText, row = 0) =>
selectCell(field, row).should('have.text', expectedText); selectCell(field, row).should('have.text', expectedText);
const checkColor = (field, expectedColor, row = 0) => const checkColor = (field, expectedColor, row = 0) =>
@ -115,21 +116,18 @@ describe('Entry', () => {
createEntryAndBuy(); createEntryAndBuy();
selectCell('isIgnored') selectCell('isIgnored').click().click().type('{esc}');
.click() checkText('isIgnored', 'close');
.click()
.trigger('keydown', { key: 'Tab', keyCode: 9, which: 9 });
checkText('isIgnored', 'check');
checkColor('quantity', COLORS.negative);
clickAndType('stickers', '1'); clickAndType('stickers', '1');
checkText('quantity', '11'); checkText('stickers', '0/01');
checkText('amount', '550.00'); checkText('quantity', '1');
checkText('amount', '50.00');
clickAndType('packing', '2'); clickAndType('packing', '2');
checkText('packing', '12close'); checkText('packing', '12');
checkText('weight', '12.0'); checkText('weight', '12.0');
checkText('quantity', '132'); checkText('quantity', '12');
checkText('amount', '6600.00'); checkText('amount', '600.00');
checkColor('packing', COLORS.enabled); checkColor('packing', COLORS.enabled);
selectCell('groupingMode').click().click().click(); selectCell('groupingMode').click().click().click();
@ -137,7 +135,7 @@ describe('Entry', () => {
checkColor('grouping', COLORS.enabled); checkColor('grouping', COLORS.enabled);
selectCell('buyingValue').click().clear().type('{backspace}{backspace}1'); selectCell('buyingValue').click().clear().type('{backspace}{backspace}1');
checkText('amount', '132.00'); checkText('amount', '12.00');
checkColor('minPrice', COLORS.disable); checkColor('minPrice', COLORS.disable);
selectCell('hasMinPrice').click().click(); selectCell('hasMinPrice').click().click();
@ -145,7 +143,7 @@ describe('Entry', () => {
selectCell('hasMinPrice').click(); selectCell('hasMinPrice').click();
cy.saveCard(); cy.saveCard();
cy.get('span[data-cy="footer-stickers"]').should('have.text', '11'); cy.get('span[data-cy="footer-stickers"]').should('have.text', '1');
cy.get('.q-notification__message').contains('Data saved'); cy.get('.q-notification__message').contains('Data saved');
selectButton('change-quantity-sign').should('be.disabled'); selectButton('change-quantity-sign').should('be.disabled');
@ -156,9 +154,9 @@ describe('Entry', () => {
selectButton('change-quantity-sign').click(); selectButton('change-quantity-sign').click();
selectButton('set-negative-quantity').click(); selectButton('set-negative-quantity').click();
checkText('quantity', '-132'); checkText('quantity', '-12');
selectButton('set-positive-quantity').click(); selectButton('set-positive-quantity').click();
checkText('quantity', '132'); checkText('quantity', '12');
checkColor('amount', COLORS.disable); checkColor('amount', COLORS.disable);
selectButton('check-buy-amount').click(); selectButton('check-buy-amount').click();

View File

@ -6,7 +6,7 @@ describe('EntryStockBought', () => {
}); });
it('Should edit the reserved space', () => { it('Should edit the reserved space', () => {
cy.get('.q-field__native.q-placeholder').should('have.value', '01/01/2001'); cy.get('.q-field__native.q-placeholder').should('have.value', '01/01/2001');
cy.get('td[data-col-field="reserve"]').click(); cy.get('[data-col-field="reserve"][data-row-index="0"]').click();
cy.get('input[name="reserve"]').type('10{enter}'); cy.get('input[name="reserve"]').type('10{enter}');
cy.get('button[title="Save"]').click(); cy.get('button[title="Save"]').click();
cy.get('.q-notification__message').should('have.text', 'Data saved'); cy.get('.q-notification__message').should('have.text', 'Data saved');
@ -16,25 +16,35 @@ 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('buyerboss{downarrow}{enter}'); cy.get('input[aria-label="Buyer"]').type('buyerBossNick');
cy.get('div[role="listbox"] > div > div[role="option"]')
.eq(0)
.should('be.visible')
.click();
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get('.q-notification__message').should('have.text', 'Data created'); cy.get('.q-notification__message').should('have.text', 'Data created');
cy.get('[data-col-field="reserve"][data-row-index="1"]').click().clear();
cy.get('[data-cy="searchBtn"]').eq(1).click();
cy.get('.q-table__bottom.row.items-center.q-table__bottom--nodata')
.should('have.text', 'warningNo data available')
.type('{esc}');
cy.get('[data-col-field="reserve"][data-row-index="1"]')
.click()
.type('{backspace}{enter}');
cy.get('[data-cy="crudModelDefaultSaveBtn"]').should('be.enabled').click();
cy.get('.q-notification__message').eq(1).should('have.text', 'Data saved');
}); });
it('Should check detail for the buyer', () => { it('Should check detail for the buyer', () => {
cy.get(':nth-child(1) > .sticky > .q-btn > .q-btn__content > .q-icon').click(); cy.get('[data-cy="searchBtn"]').eq(0).click();
cy.get('tBody > tr').eq(1).its('length').should('eq', 1); cy.get('tBody > tr').eq(1).its('length').should('eq', 1);
}); });
it('Should check detail for the buyerBoss and had no content', () => {
cy.get(':nth-child(2) > .sticky > .q-btn > .q-btn__content > .q-icon').click();
cy.get('.q-table__bottom.row.items-center.q-table__bottom--nodata').should(
'have.text',
'warningNo data available',
);
});
it('Should edit travel m3 and refresh', () => { it('Should edit travel m3 and refresh', () => {
cy.get('.vn-row > div > .q-btn > .q-btn__content > .q-icon').click(); cy.get('[data-cy="edit-travel"]').should('be.visible').click();
cy.get('input[aria-label="m3"]').clear(); cy.get('input[aria-label="m3"]').clear().type('60');
cy.get('input[aria-label="m3"]').type('60'); cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get('.q-mt-lg > .q-btn--standard > .q-btn__content > .block').click();
cy.get('.vn-row > div > :nth-child(2)').should('have.text', '60'); cy.get('.vn-row > div > :nth-child(2)').should('have.text', '60');
}); });
}); });