fix: refs #8349 fixed ItemFixedPrice crashing and it's e2e test not working
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
764bd3915e
commit
e862110aca
|
@ -35,7 +35,6 @@ const editTableCellDialogRef = ref(null);
|
|||
const user = state.getUser();
|
||||
const fixedPrices = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const hasSelectedRows = computed(() => rowsSelected.value.length > 0);
|
||||
const rowsSelected = ref([]);
|
||||
const itemFixedPriceFilterRef = ref();
|
||||
|
||||
|
@ -54,6 +53,7 @@ const columns = computed(() => [
|
|||
name: 'itemFk',
|
||||
...defaultColumnAttrs,
|
||||
isId: true,
|
||||
cardVisible: true,
|
||||
columnField: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
|
@ -65,12 +65,14 @@ const columns = computed(() => [
|
|||
name: 'name',
|
||||
...defaultColumnAttrs,
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.groupingPrice'),
|
||||
field: 'rate2',
|
||||
name: 'rate2',
|
||||
...defaultColumnAttrs,
|
||||
cardVisible: true,
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
|
@ -79,6 +81,7 @@ const columns = computed(() => [
|
|||
field: 'rate3',
|
||||
name: 'rate3',
|
||||
...defaultColumnAttrs,
|
||||
cardVisible: true,
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
|
@ -88,6 +91,7 @@ const columns = computed(() => [
|
|||
field: 'minPrice',
|
||||
name: 'minPrice',
|
||||
...defaultColumnAttrs,
|
||||
cardVisible: true,
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
|
@ -96,6 +100,7 @@ const columns = computed(() => [
|
|||
field: 'started',
|
||||
name: 'started',
|
||||
format: ({ started }) => toDate(started),
|
||||
cardVisible: true,
|
||||
...defaultColumnAttrs,
|
||||
columnField: {
|
||||
component: 'date',
|
||||
|
@ -111,6 +116,7 @@ const columns = computed(() => [
|
|||
field: 'ended',
|
||||
name: 'ended',
|
||||
...defaultColumnAttrs,
|
||||
cardVisible: true,
|
||||
columnField: {
|
||||
component: 'date',
|
||||
class: 'shrink',
|
||||
|
@ -245,14 +251,11 @@ const upsertPrice = async (props, resetMinPrice = false) => {
|
|||
}
|
||||
if (!changes.updates && !changes.creates) return;
|
||||
const data = await upsertFixedPrice(row);
|
||||
Object.assign(tableRef.value.CrudModelRef.formData[props.rowIndex], data);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
tableRef.value.reload();
|
||||
tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
|
||||
};
|
||||
|
||||
async function upsertFixedPrice(row) {
|
||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||
data.hasMinPrice = data.hasMinPrice ? 1 : 0;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -369,9 +372,9 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</template>
|
||||
</RightMenu>
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<template #st-data>
|
||||
<QBtn
|
||||
:disable="!hasSelectedRows"
|
||||
v-if="rowsSelected.length"
|
||||
@click="openEditTableCellDialog()"
|
||||
color="primary"
|
||||
icon="edit"
|
||||
|
@ -381,17 +384,23 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:disable="!hasSelectedRows"
|
||||
:label="tMobile('globals.remove')"
|
||||
color="primary"
|
||||
icon="delete"
|
||||
flat
|
||||
@click="(row) => confirmRemove(row, true)"
|
||||
:title="t('globals.remove')"
|
||||
v-if="rowsSelected.length"
|
||||
/>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<VnTable
|
||||
@on-fetch="
|
||||
(data) =>
|
||||
data.forEach((item) => {
|
||||
item.hasMinPrice = `${item.hasMinPrice !== 0}`;
|
||||
})
|
||||
"
|
||||
:default-remove="false"
|
||||
:default-reset="false"
|
||||
:default-save="false"
|
||||
|
@ -422,6 +431,11 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
onDataSaved: handleOnDataSave,
|
||||
}"
|
||||
:disable-option="{ card: true }"
|
||||
:bottom="true"
|
||||
:crud-model="{
|
||||
disableInfiniteScroll: true,
|
||||
}"
|
||||
:disabled-attr="true"
|
||||
>
|
||||
<template #header-selection="scope">
|
||||
<QCheckbox v-model="scope.selected" />
|
||||
|
@ -457,7 +471,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</span>
|
||||
<span class="subName">{{ row.subName }}</span>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
<FetchedTags :item="row" :columns="3" />
|
||||
<FetchedTags :item="row" />
|
||||
</template>
|
||||
<template #column-rate2="props">
|
||||
<QTd class="col">
|
||||
|
@ -489,15 +503,14 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
<QCheckbox
|
||||
:model-value="props.row.hasMinPrice"
|
||||
@update:model-value="updateMinPrice($event, props)"
|
||||
:false-value="0"
|
||||
:true-value="1"
|
||||
:toggle-indeterminate="false"
|
||||
:false-value="'false'"
|
||||
:true-value="'true'"
|
||||
/>
|
||||
<VnInput
|
||||
class="col"
|
||||
type="currency"
|
||||
mask="###.##"
|
||||
:disable="props.row.hasMinPrice === 0"
|
||||
:disable="props.row.hasMinPrice === 1"
|
||||
v-model.number="props.row.minPrice"
|
||||
v-on="getRowUpdateInputEvents(props)"
|
||||
>
|
||||
|
|
|
@ -3,7 +3,9 @@ function goTo(n = 1) {
|
|||
return `.q-virtual-scroll__content > :nth-child(${n})`;
|
||||
}
|
||||
const firstRow = goTo();
|
||||
`.q-virtual-scroll__content > :nth-child(2)`;
|
||||
const secondRow = goTo(2);
|
||||
`.q-virtual-scroll__content > :nth-child(1)`;
|
||||
|
||||
describe('Handle Items FixedPrice', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
|
@ -14,33 +16,25 @@ describe('Handle Items FixedPrice', () => {
|
|||
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon'
|
||||
).click();
|
||||
});
|
||||
it.skip('filter', function () {
|
||||
cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click();
|
||||
cy.selectOption('.list > :nth-child(2)', 'Alstroemeria');
|
||||
it('filter', function () {
|
||||
cy.get('.category-filter > :nth-child(2) > .q-btn__content > .q-icon').click();
|
||||
cy.selectOption('.list > :nth-child(2)', 'Crisantemo');
|
||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
||||
|
||||
cy.addBtnClick();
|
||||
cy.selectOption(`${firstRow} > :nth-child(2)`, '#13');
|
||||
cy.get(`${firstRow} > :nth-child(4)`).find('input').type(1);
|
||||
cy.get(`${firstRow} > :nth-child(5)`).find('input').type('2');
|
||||
cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
/* ==== End Cypress Studio ==== */
|
||||
});
|
||||
it.skip('Create and delete ', function () {
|
||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.addBtnClick();
|
||||
cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
|
||||
cy.get(`${firstRow} > :nth-child(4)`).type('1');
|
||||
cy.get(`${firstRow} > :nth-child(5)`).type('2');
|
||||
cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click();
|
||||
cy.get(
|
||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
||||
).click();
|
||||
|
||||
it('Create and delete ', function () {
|
||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content').click();
|
||||
cy.get('.bottomButton > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.get(`${secondRow} > :nth-child(2)`).type('11');
|
||||
cy.get('.q-menu .q-item').contains('#11').click();
|
||||
cy.get(`${secondRow} > :nth-child(4)`).find('input').type(1);
|
||||
cy.get(`${secondRow} > :nth-child(5)`).find('input').type(2);
|
||||
cy.get(`${secondRow} > :nth-child(9)`).type('Warehouse One');
|
||||
cy.get('.q-menu .q-item').contains('Warehouse One').click();
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
cy.get(':nth-child(3) > .text-right > .q-btn').click();
|
||||
cy.dataCy('VnConfirm_confirm').click();
|
||||
});
|
||||
|
||||
it.skip('Massive edit', function () {
|
||||
|
@ -48,11 +42,12 @@ describe('Handle Items FixedPrice', () => {
|
|||
cy.get('#subToolbar > .q-btn--standard').click();
|
||||
cy.selectOption("[data-cy='field-to-edit']", 'Min price');
|
||||
cy.dataCy('value-to-edit').find('input').type('1');
|
||||
cy.get('.countLines').should('have.text', ' 1 ');
|
||||
cy.get('.countLines').invoke('text').then(parseFloat).should('be.gte', 1);
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
//Falla debido a que hay una petición doble
|
||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||
});
|
||||
it.skip('Massive remove', function () {
|
||||
it('Massive remove', function () {
|
||||
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
|
||||
cy.get('#subToolbar > .q-btn--flat').click();
|
||||
cy.get(
|
||||
|
|
Loading…
Reference in New Issue