Merge branch 'dev' into Fix-TicketServicesSortByName
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2025-01-20 13:45:43 +00:00
commit 84dd46b22c
14 changed files with 101 additions and 102 deletions

View File

@ -106,7 +106,7 @@ const { openConfirmationModal } = useVnConfirm();
:to="{ :to="{
name: 'WorkerList', name: 'WorkerList',
query: { query: {
params: JSON.stringify({ departmentFk: entityId }), table: JSON.stringify({ departmentFk: entityId }),
}, },
}" }"
> >

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { onMounted, computed, reactive, ref, nextTick, watch } from 'vue'; import { onMounted, computed, ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue'; import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
@ -22,19 +22,16 @@ import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const state = useState(); const state = useState();
const user = state.getUser(); const user = state.getUser();
const today = ref(Date.vnNew()); const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const itemBalancesRef = ref(null); const itemBalances = computed(() => arrayDataItemBalances.store.data);
const itemsBalanceFilter = reactive({ const where = computed(() => arrayDataItemBalances.store.filter.where || {});
where: { itemFk: route.params.id, warehouseFk: null, date: null }, const showWhatsBeforeInventory = ref(false);
});
const itemBalances = ref([]);
const warehouseFk = ref(null);
const _showWhatsBeforeInventory = ref(false);
const inventoriedDate = ref(null); const inventoriedDate = ref(null);
let arrayDataItemBalances = useArrayData('ItemBalances');
const originTypeMap = { const originTypeMap = {
entry: { entry: {
@ -122,36 +119,28 @@ const columns = computed(() => [
}, },
]); ]);
const showWhatsBeforeInventory = computed({
get: () => _showWhatsBeforeInventory.value,
set: (val) => {
_showWhatsBeforeInventory.value = val;
if (!val) itemsBalanceFilter.where.date = null;
else itemsBalanceFilter.where.date = inventoriedDate.value ?? new Date();
},
});
onMounted(async () => { onMounted(async () => {
today.value.setHours(0, 0, 0, 0); const ref = where.value;
if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk; const query = route.query;
else if (user.value) warehouseFk.value = user.value.warehouseFk; inventoriedDate.value =
itemsBalanceFilter.where.warehouseFk = warehouseFk.value; (await axios.get('Configs/findOne')).data?.inventoried || today;
const { data } = await axios.get('Configs/findOne');
inventoriedDate.value = data.inventoried; if (query.warehouseFk) ref.warehouseFk = query.warehouseFk;
else if (!ref.warehouseFk && user.value) ref.warehouseFk = user.value.warehouseFk;
if (ref.date) showWhatsBeforeInventory.value = true;
ref.itemFk = route.params.id;
arrayDataItemBalances = useArrayData('ItemBalances', {
url: 'Items/getBalance',
filter: { where: ref },
});
await fetchItemBalances(); await fetchItemBalances();
await scrollToToday(); await scrollToToday();
await updateWarehouse(warehouseFk.value); await updateWarehouse(ref.warehouseFk);
}); });
watch( const fetchItemBalances = async () => await arrayDataItemBalances.fetch({});
() => router.currentRoute.value.params.id,
(newId) => {
itemsBalanceFilter.where.itemFk = newId;
itemBalancesRef.value.fetch();
}
);
const fetchItemBalances = async () => await itemBalancesRef.value.fetch();
const getBadgeAttrs = (_date) => { const getBadgeAttrs = (_date) => {
const isSameDate = date.isSameDate(today.value, _date); const isSameDate = date.isSameDate(today.value, _date);
@ -178,23 +167,13 @@ const formatDateForAttribute = (dateValue) => {
}; };
async function updateWarehouse(warehouseFk) { async function updateWarehouse(warehouseFk) {
const stock = useArrayData('descriptorStock', { const stock = useArrayData('descriptorStock', { userParams: { warehouseFk } });
userParams: {
warehouseFk,
},
});
await stock.fetch({}); await stock.fetch({});
stock.store.data.itemFk = route.params.id; stock.store.data.itemFk = route.params.id;
} }
</script> </script>
<template> <template>
<FetchData
ref="itemBalancesRef"
url="Items/getBalance"
:filter="itemsBalanceFilter"
@on-fetch="(data) => (itemBalances = data)"
/>
<FetchData <FetchData
url="Warehouses" url="Warehouses"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }" :filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@ -207,27 +186,30 @@ async function updateWarehouse(warehouseFk) {
<VnSelect <VnSelect
:label="t('itemDiary.warehouse')" :label="t('itemDiary.warehouse')"
:options="warehousesOptions" :options="warehousesOptions"
hide-selected v-model="where.warehouseFk"
option-label="name"
option-value="id"
dense
v-model="itemsBalanceFilter.where.warehouseFk"
@update:model-value=" @update:model-value="
(value) => fetchItemBalances() && updateWarehouse(value) (val) => fetchItemBalances() && updateWarehouse(val)
" "
class="q-mr-lg" class="q-mr-lg"
:is-clearable="false"
/> />
<QCheckbox <QCheckbox
:label="t('itemDiary.showBefore')" :label="t('itemDiary.showBefore')"
v-model="showWhatsBeforeInventory" v-model="showWhatsBeforeInventory"
@update:model-value="fetchItemBalances" @update:model-value="
async (val) => {
if (!val) where.date = null;
else where.date = inventoriedDate;
await fetchItemBalances();
}
"
class="q-mr-lg" class="q-mr-lg"
/> />
<VnInputDate <VnInputDate
v-if="showWhatsBeforeInventory" v-if="showWhatsBeforeInventory"
:label="t('itemDiary.since')" :label="t('itemDiary.since')"
dense dense
v-model="itemsBalanceFilter.where.date" v-model="where.date"
@update:model-value="fetchItemBalances" @update:model-value="fetchItemBalances"
/> />
</div> </div>

View File

@ -36,18 +36,7 @@ const exprBuilder = (param, value) => {
} }
}; };
const where = { let arrayData = useArrayData('ItemLastEntries');
itemFk: route.params.id,
};
const arrayData = useArrayData('ItemLastEntries', {
url: 'Items/lastEntriesFilter',
order: ['landed DESC', 'buyFk DESC'],
exprBuilder: exprBuilder,
userFilter: {
where: where,
},
});
const itemLastEntries = ref([]); const itemLastEntries = ref([]);
const columns = computed(() => [ const columns = computed(() => [
@ -161,25 +150,51 @@ const getDate = (date, type) => {
}; };
const updateFilter = async () => { const updateFilter = async () => {
let filter; let landed;
if (!from.value && to.value) filter = { lte: to.value }; if (!from.value && to.value) landed = { lte: to.value };
else if (from.value && !to.value) filter = { gte: from.value }; else if (from.value && !to.value) landed = { gte: from.value };
else if (from.value && to.value) filter = { between: [from.value, to.value] }; else if (from.value && to.value) landed = { between: [from.value, to.value] };
const userFilter = arrayData.store.userFilter.where;
userFilter.landed = filter;
arrayData.store.filter.where.landed = landed;
await fetchItemLastEntries(); await fetchItemLastEntries();
}; };
onMounted(async () => { onMounted(async () => {
const _from = Date.vnNew(); const landed = arrayData.store.filter.where?.landed;
_from.setDate(_from.getDate() - 75); arrayData = useArrayData('ItemLastEntries', {
from.value = getDate(_from, 'from'); url: 'Items/lastEntriesFilter',
const _to = Date.vnNew(); order: ['landed DESC', 'buyFk DESC'],
_to.setDate(_to.getDate() + 10); exprBuilder: exprBuilder,
to.value = getDate(_to, 'to'); filter: {
where: {
itemFk: route.params.id,
landed,
},
},
});
if (landed) {
const key = Object.keys(landed)[0];
switch (key) {
case 'gte':
from.value = landed.gte;
break;
case 'lte':
to.value = landed.lte;
break;
case 'between':
from.value = landed.between[0];
to.value = landed.between[1];
break;
}
} else {
const _from = Date.vnNew();
_from.setDate(_from.getDate() - 75);
from.value = getDate(_from, 'from');
const _to = Date.vnNew();
_to.setDate(_to.getDate() + 10);
to.value = getDate(_to, 'to');
}
updateFilter(); updateFilter();

View File

@ -1,5 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('ClaimPhoto', () => { // redmine.verdnatura.es/issues/8417
describe.skip('ClaimPhoto', () => {
beforeEach(() => { beforeEach(() => {
const claimId = 1; const claimId = 1;
cy.login('developer'); cy.login('developer');

View File

@ -8,8 +8,8 @@ describe('EntryMy when is supplier', () => {
}, },
}); });
}); });
// https://redmine.verdnatura.es/issues/8418
it('should open buyLabel when is supplier', () => { it.skip('should open buyLabel when is supplier', () => {
cy.get( cy.get(
'[to="/null/3"] > .q-card > .column > .q-btn > .q-btn__content > .q-icon' '[to="/null/3"] > .q-card > .column > .q-btn > .q-btn__content > .q-icon'
).click(); ).click();

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
// https://redmine.verdnatura.es/issues/8419
describe('InvoiceInCorrective', () => { describe.skip('InvoiceInCorrective', () => {
const createCorrective = '.q-menu > .q-list > :nth-child(6) > .q-item__section'; const createCorrective = '.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 ';

View File

@ -21,8 +21,8 @@ describe('InvoiceInList', () => {
cy.url().should('include', `/invoice-in/${id}/summary`); cy.url().should('include', `/invoice-in/${id}/summary`);
}); });
}); });
// https://redmine.verdnatura.es/issues/8420
it('should open the details', () => { it.skip('should open the details', () => {
cy.get(firstDetailBtn).click(); cy.get(firstDetailBtn).click();
cy.get(summaryHeaders).eq(1).contains('Basic data'); cy.get(summaryHeaders).eq(1).contains('Basic data');
cy.get(summaryHeaders).eq(4).contains('Vat'); cy.get(summaryHeaders).eq(4).contains('Vat');

View File

@ -35,8 +35,8 @@ describe('InvoiceOut summary', () => {
cy.dataCy('VnConfirm_confirm').click(); cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted'); cy.checkNotification('InvoiceOut deleted');
}); });
// https://redmine.verdnatura.es/issues/8415
it('should transfer the invoice ', () => { it.skip('should transfer the invoice ', () => {
cy.typeSearchbar('T1111111{enter}'); cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click(); cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(1)').click(); cy.get('.q-menu > .q-list > :nth-child(1)').click();

View File

@ -15,8 +15,8 @@ describe('Item list', () => {
cy.get('.q-menu .q-item').contains('Anthurium').click(); cy.get('.q-menu .q-item').contains('Anthurium').click();
cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click(); cy.get('.q-virtual-scroll__content > :nth-child(4) > :nth-child(4)').click();
}); });
// https://redmine.verdnatura.es/issues/8421
it('should create an item', () => { it.skip('should create an item', () => {
const data = { const data = {
Description: { val: `Test item` }, Description: { val: `Test item` },
Type: { val: `Crisantemo`, type: 'select' }, Type: { val: `Crisantemo`, type: 'select' },

View File

@ -18,8 +18,8 @@ describe('Item tag', () => {
+cy.dataCy('crudModelDefaultSaveBtn').click(); +cy.dataCy('crudModelDefaultSaveBtn').click();
cy.checkNotification("The tag or priority can't be repeated for an item"); cy.checkNotification("The tag or priority can't be repeated for an item");
}); });
// https://redmine.verdnatura.es/issues/8422
it('should add a new tag', () => { it.skip('should add a new tag', () => {
cy.get('.q-page').should('be.visible'); cy.get('.q-page').should('be.visible');
cy.get('.q-page-sticky > div').click(); cy.get('.q-page-sticky > div').click();
cy.get('.q-page-sticky > div').click(); cy.get('.q-page-sticky > div').click();

View File

@ -1,6 +1,6 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
// https://redmine.verdnatura.es/issues/8423
describe('Ticket expedtion', () => { describe.skip('Ticket expedtion', () => {
const tableContent = '.q-table .q-virtual-scroll__content'; const tableContent = '.q-table .q-virtual-scroll__content';
const stateTd = 'td:nth-child(9)'; const stateTd = 'td:nth-child(9)';

View File

@ -30,8 +30,8 @@ describe('TicketList', () => {
cy.get(firstRow).find('.q-btn:first').click(); cy.get(firstRow).find('.q-btn:first').click();
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/); cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
}); });
// https://redmine.verdnatura.es/issues/8424
it('should open ticket summary', () => { it.skip('should open ticket summary', () => {
searchResults(); searchResults();
cy.get(firstRow).find('.q-btn:last').click(); cy.get(firstRow).find('.q-btn:last').click();
cy.dataCy('ticketSummary').should('exist'); cy.dataCy('ticketSummary').should('exist');

View File

@ -53,7 +53,8 @@ describe('VnLocation', () => {
cy.waitForElement('.q-card'); cy.waitForElement('.q-card');
cy.get(inputLocation).click(); cy.get(inputLocation).click();
}); });
it('Show all options', function () { // https://redmine.verdnatura.es/issues/8436
it.skip('Show all options', function () {
cy.get(locationOptions).should('have.length.at.least', 5); cy.get(locationOptions).should('have.length.at.least', 5);
}); });
it('input filter location as "al"', function () { it('input filter location as "al"', function () {

View File

@ -18,8 +18,8 @@ describe('ZoneWarehouse', () => {
cy.get(saveBtn).click(); cy.get(saveBtn).click();
cy.checkNotification(dataError); cy.checkNotification(dataError);
}); });
// https://redmine.verdnatura.es/issues/8425
it('should create & remove a warehouse', () => { it.skip('should create & remove a warehouse', () => {
cy.addBtnClick(); cy.addBtnClick();
cy.fillInForm(data); cy.fillInForm(data);
cy.get(saveBtn).click(); cy.get(saveBtn).click();