Merge pull request '#7648 - HOTFIX: myEntries filters' (!566) from hotfix_myEntries into master
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #566 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
1923e83210
|
@ -1,28 +1,11 @@
|
||||||
import { getCurrentInstance } from 'vue';
|
import { getCurrentInstance } from 'vue';
|
||||||
|
|
||||||
const filterAvailableInput = (element) => {
|
|
||||||
return element.classList.contains('q-field__native') && !element.disabled;
|
|
||||||
};
|
|
||||||
const filterAvailableText = (element) => {
|
|
||||||
return (
|
|
||||||
element.__vueParentComponent.type.name === 'QInput' &&
|
|
||||||
element.__vueParentComponent?.attrs?.class !== 'vn-input-date'
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
const vm = getCurrentInstance();
|
const vm = getCurrentInstance();
|
||||||
if (vm.type.name === 'QForm') {
|
if (vm.type.name === 'QForm') {
|
||||||
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
||||||
// AUTOFOCUS
|
// TODO: AUTOFOCUS IS NOT FOCUSING
|
||||||
const elementsArray = Array.from(this.$el.elements);
|
|
||||||
const availableInputs = elementsArray.filter(filterAvailableInput);
|
|
||||||
const firstInputElement = availableInputs.find(filterAvailableText);
|
|
||||||
|
|
||||||
if (firstInputElement) {
|
|
||||||
firstInputElement.focus();
|
|
||||||
}
|
|
||||||
const that = this;
|
const that = this;
|
||||||
this.$el.addEventListener('keyup', function (evt) {
|
this.$el.addEventListener('keyup', function (evt) {
|
||||||
if (evt.key === 'Enter') {
|
if (evt.key === 'Enter') {
|
||||||
|
|
|
@ -45,7 +45,7 @@ const defaultAttrs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const forceAttrs = {
|
const forceAttrs = {
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
label: $props.showTitle ? '' : columnFilter.value?.label ?? $props.column.label,
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectComponent = {
|
const selectComponent = {
|
||||||
|
|
|
@ -81,7 +81,7 @@ async function fetchViewConfigData() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.err('Error fetching config view data', err);
|
console.error('Error fetching config view data', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ const fetchViewConfigData = async () => {
|
||||||
setUserConfigViewData(defaultColumns);
|
setUserConfigViewData(defaultColumns);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.err('Error fetching config view data', err);
|
console.error('Error fetching config view data', err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,32 +15,65 @@ const columns = computed(() => [
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: t('customer.extendedList.tableVisibleColumns.id'),
|
label: t('customer.extendedList.tableVisibleColumns.id'),
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
|
isTitle: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
visible: false,
|
||||||
|
align: 'right',
|
||||||
|
label: t('shipped'),
|
||||||
|
name: 'shipped',
|
||||||
|
columnFilter: {
|
||||||
|
name: 'fromShipped',
|
||||||
|
label: t('fromShipped'),
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
|
format: ({ shipped }) => toDate(shipped),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
visible: false,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('shipped'),
|
label: t('shipped'),
|
||||||
name: 'shipped',
|
name: 'shipped',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
|
name: 'toShipped',
|
||||||
|
label: t('toShipped'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
},
|
},
|
||||||
format: ({ shipped }) => toDate(shipped),
|
format: ({ shipped }) => toDate(shipped),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
label: t('landed'),
|
label: t('shipped'),
|
||||||
name: 'from',
|
name: 'shipped',
|
||||||
cardVisible: false,
|
columnFilter: false,
|
||||||
columnFilter: {
|
format: ({ shipped }) => toDate(shipped),
|
||||||
component: 'date',
|
|
||||||
},
|
|
||||||
format: ({ landed }) => toDate(landed),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
|
label: t('landed'),
|
||||||
|
name: 'landed',
|
||||||
|
columnFilter: false,
|
||||||
|
format: ({ landed }) => toDate(landed),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
label: t('globals.wareHouseIn'),
|
label: t('globals.wareHouseIn'),
|
||||||
name: 'warehouseInName',
|
name: 'warehouseInFk',
|
||||||
|
format: (row) => row.warehouseInName,
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
columnFilter: {
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'warehouses',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
optionLabel: 'name',
|
||||||
|
optionValue: 'id',
|
||||||
|
},
|
||||||
|
alias: 't',
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -77,7 +110,14 @@ const printBuys = (rowId) => {
|
||||||
:label="t('Search entries')"
|
:label="t('Search entries')"
|
||||||
:info="t('You can search by entry reference')"
|
:info="t('You can search by entry reference')"
|
||||||
/>
|
/>
|
||||||
<VnTable data-key="myEntriesList" url="Entries/filter" :columns="columns" auto-load />
|
<VnTable
|
||||||
|
data-key="myEntriesList"
|
||||||
|
url="Entries/filter"
|
||||||
|
:columns="columns"
|
||||||
|
default-mode="card"
|
||||||
|
order="shipped DESC"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -8,4 +8,6 @@ entryFilter:
|
||||||
reference: Reference
|
reference: Reference
|
||||||
landed: Landed
|
landed: Landed
|
||||||
shipped: Shipped
|
shipped: Shipped
|
||||||
|
fromShipped: Shipped(from)
|
||||||
|
toShipped: Shipped(to)
|
||||||
printBuys: Print buys
|
printBuys: Print buys
|
||||||
|
|
|
@ -12,4 +12,6 @@ entryFilter:
|
||||||
|
|
||||||
landed: F. llegada
|
landed: F. llegada
|
||||||
shipped: F. salida
|
shipped: F. salida
|
||||||
|
fromShipped: F. salida(desde)
|
||||||
|
toShipped: F. salida(hasta)
|
||||||
Print buys: Imprimir etiquetas
|
Print buys: Imprimir etiquetas
|
||||||
|
|
|
@ -207,8 +207,14 @@ async function cloneInvoice() {
|
||||||
|
|
||||||
const isAdministrative = () => hasAny(['administrative']);
|
const isAdministrative = () => hasAny(['administrative']);
|
||||||
|
|
||||||
const isAgricultural = () =>
|
const isAgricultural = () => {
|
||||||
invoiceIn.value?.supplier?.sageWithholdingFk === config.value[0]?.sageWithholdingFk;
|
console.error(config);
|
||||||
|
if (!config.value) return false;
|
||||||
|
return (
|
||||||
|
invoiceIn.value?.supplier?.sageFarmerWithholdingFk ===
|
||||||
|
config?.value[0]?.sageWithholdingFk
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
function showPdfInvoice() {
|
function showPdfInvoice() {
|
||||||
if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`);
|
if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`);
|
||||||
|
|
|
@ -38,7 +38,7 @@ const cloneTravelWithEntries = async () => {
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
router.push({ name: 'TravelBasicData', params: { id: data.id } });
|
router.push({ name: 'TravelBasicData', params: { id: data.id } });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.err('Error cloning travel with entries');
|
console.error('Error cloning travel with entries');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ describe('EntryMy when is supplier', () => {
|
||||||
cy.stub(win, 'open');
|
cy.stub(win, 'open');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
cy.waitForElement('.q-page', 6000);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open buyLabel when is supplier', () => {
|
it('should open buyLabel when is supplier', () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
describe('InvoiceInCorrective', () => {
|
describe('InvoiceInCorrective', () => {
|
||||||
const createRectificative = '.q-menu > .q-list > :nth-child(4) > .q-item__section';
|
const createRectificative = '.q-menu > .q-list > :nth-child(6) > .q-item__section';
|
||||||
const rectificativeSection = '.q-drawer-container .q-list > a:nth-child(6)';
|
const rectificativeSection = '.q-drawer-container .q-list > a:nth-child(6)';
|
||||||
const saveDialog = '.q-card > .q-card__actions > .q-btn--standard ';
|
const saveDialog = '.q-card > .q-card__actions > .q-btn--standard ';
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,6 @@ describe('Route', () => {
|
||||||
cy.get(getRowColumn(1, 4) + getVnSelect).type('{downArrow}{enter}');
|
cy.get(getRowColumn(1, 4) + getVnSelect).type('{downArrow}{enter}');
|
||||||
cy.get(getRowColumn(1, 5) + getVnSelect).type('{downArrow}{enter}');
|
cy.get(getRowColumn(1, 5) + getVnSelect).type('{downArrow}{enter}');
|
||||||
cy.get('button[title="Save"]').click();
|
cy.get('button[title="Save"]').click();
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue