Compare commits

..

3 Commits

Author SHA1 Message Date
Alex Moreno cd6b5323b6 Merge branch 'dev' into skipTests
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-04-14 05:15:46 +00:00
Jorge Penadés 9b6891ba0d test: skip EntryDescriptor tests in entryDescriptor.spec.js
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-04-11 18:26:58 +02:00
Jorge Penadés e3e16ebc3b test: skip client descriptor and ticket list tests in InvoiceOut and TicketSale specs
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-04-11 18:18:42 +02:00
19 changed files with 43 additions and 192 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "25.18.0", "version": "25.16.0",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",
@ -89,4 +89,4 @@
"vite": "^6.0.11", "vite": "^6.0.11",
"vitest": "^0.31.1" "vitest": "^0.31.1"
} }
} }

View File

@ -2,7 +2,6 @@
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { useQuasar, Dark } from 'quasar'; import { useQuasar, Dark } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnScroll from './components/common/VnScroll.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const { availableLocales, locale, fallbackLocale } = useI18n(); const { availableLocales, locale, fallbackLocale } = useI18n();
@ -39,7 +38,6 @@ quasar.iconMapFn = (iconName) => {
<template> <template>
<RouterView /> <RouterView />
<VnScroll/>
</template> </template>
<style lang="scss"> <style lang="scss">

View File

@ -406,7 +406,6 @@ defineExpose({
</QBtnDropdown> </QBtnDropdown>
<QBtn <QBtn
v-else v-else
data-cy="saveDefaultBtn"
:label="tMobile('globals.save')" :label="tMobile('globals.save')"
color="primary" color="primary"
icon="save" icon="save"

View File

@ -33,7 +33,6 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
import VnTableFilter from './VnTableFilter.vue'; import VnTableFilter from './VnTableFilter.vue';
import { getColAlign } from 'src/composables/getColAlign'; import { getColAlign } from 'src/composables/getColAlign';
import RightMenu from '../common/RightMenu.vue'; import RightMenu from '../common/RightMenu.vue';
import VnScroll from '../common/VnScroll.vue'
const arrayData = useArrayData(useAttrs()['data-key']); const arrayData = useArrayData(useAttrs()['data-key']);
const $props = defineProps({ const $props = defineProps({
@ -169,7 +168,6 @@ const params = ref(useFilterParams($attrs['data-key']).params);
const orders = ref(useFilterParams($attrs['data-key']).orders); const orders = ref(useFilterParams($attrs['data-key']).orders);
const app = inject('app'); const app = inject('app');
const tableHeight = useTableHeight(); const tableHeight = useTableHeight();
const vnScrollRef = ref(null);
const editingRow = ref(null); const editingRow = ref(null);
const editingField = ref(null); const editingField = ref(null);
@ -191,17 +189,6 @@ const tableModes = [
}, },
]; ];
const onVirtualScroll = ({ to }) => {
handleScroll();
const virtualScrollContainer = tableRef.value?.$el?.querySelector('.q-table__middle');
if (virtualScrollContainer) {
virtualScrollContainer.dispatchEvent(new CustomEvent('scroll'));
if (vnScrollRef.value) {
vnScrollRef.value.updateScrollContainer(virtualScrollContainer);
}
}
};
onBeforeMount(() => { onBeforeMount(() => {
const urlParams = route.query[$props.searchUrl]; const urlParams = route.query[$props.searchUrl];
hasParams.value = urlParams && Object.keys(urlParams).length !== 0; hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
@ -340,13 +327,16 @@ function handleOnDataSaved(_) {
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value }); if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
else $props.create.onDataSaved(_); else $props.create.onDataSaved(_);
} }
function handleScroll() { function handleScroll() {
if ($props.crudModel.disableInfiniteScroll) return; if ($props.crudModel.disableInfiniteScroll) return;
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
const { scrollHeight, scrollTop, clientHeight } = tMiddle; const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40; const { scrollHeight, scrollTop, clientHeight } = tMiddle;
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate(); const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
} }
function handleSelection({ evt, added, rows: selectedRows }, rows) { function handleSelection({ evt, added, rows: selectedRows }, rows) {
if (evt?.shiftKey && added) { if (evt?.shiftKey && added) {
const rowIndex = selectedRows[0].$index; const rowIndex = selectedRows[0].$index;
@ -679,9 +669,9 @@ const rowCtrlClickFunction = computed(() => {
ref="tableRef" ref="tableRef"
v-bind="table" v-bind="table"
:class="[ :class="[
'vnTable', 'vnTable',
table ? 'selection-cell' : '', table ? 'selection-cell' : '',
$props.footer ? 'last-row-sticky' : '', $props.footer ? 'last-row-sticky' : '',
]" ]"
wrap-cells wrap-cells
:columns="splittedColumns.columns" :columns="splittedColumns.columns"
@ -693,7 +683,7 @@ const rowCtrlClickFunction = computed(() => {
flat flat
:style="isTableMode && `max-height: ${$props.tableHeight || tableHeight}`" :style="isTableMode && `max-height: ${$props.tableHeight || tableHeight}`"
:virtual-scroll="isTableMode" :virtual-scroll="isTableMode"
@virtual-scroll="onVirtualScroll" @virtual-scroll="handleScroll"
@row-click="(event, row) => handleRowClick(event, row)" @row-click="(event, row) => handleRowClick(event, row)"
@update:selected="emit('update:selected', $event)" @update:selected="emit('update:selected', $event)"
@selection="(details) => handleSelection(details, rows)" @selection="(details) => handleSelection(details, rows)"
@ -1097,11 +1087,6 @@ const rowCtrlClickFunction = computed(() => {
</template> </template>
</FormModelPopup> </FormModelPopup>
</QDialog> </QDialog>
<VnScroll
ref="vnScrollRef"
v-if="isTableMode"
:scroll-target="tableRef?.$el?.querySelector('.q-table__middle')"
/>
</template> </template>
<i18n> <i18n>
en: en:

View File

@ -1,100 +0,0 @@
<script setup>
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue';
const props = defineProps({
scrollTarget: { type: [String, Object], default: 'window' }
});
const scrollPosition = ref(0);
const showButton = ref(false);
let scrollContainer = null;
const onScroll = () => {
if (!scrollContainer) return;
scrollPosition.value =
typeof props.scrollTarget === 'object'
? scrollContainer.scrollTop
: window.scrollY;
};
watch(scrollPosition, (newValue) => {
showButton.value = newValue > 0;
});
const scrollToTop = () => {
if (scrollContainer) {
scrollContainer.scrollTo({ top: 0, behavior: 'smooth' });
}
};
const updateScrollContainer = (container) => {
if (container) {
if (scrollContainer) {
scrollContainer.removeEventListener('scroll', onScroll);
}
scrollContainer = container;
scrollContainer.addEventListener('scroll', onScroll);
onScroll();
}
};
defineExpose({
updateScrollContainer
});
const initScrollContainer = async () => {
await nextTick();
if (typeof props.scrollTarget === 'object') {
scrollContainer = props.scrollTarget;
} else {
scrollContainer = window;
}
if (!scrollContainer) return
scrollContainer.addEventListener('scroll', onScroll);
};
onMounted(() => {
initScrollContainer();
});
onUnmounted(() => {
if (scrollContainer) {
scrollContainer.removeEventListener('scroll', onScroll);
scrollContainer = null;
}
});
</script>
<template>
<QIcon
v-if="showButton"
color="primary"
name="keyboard_arrow_up"
class="scroll-to-top"
@click="scrollToTop"
>
<QTooltip>{{ $t('globals.scrollToTop') }}</QTooltip>
</QIcon>
</template>
<style scoped>
.scroll-to-top {
position: fixed;
top: 70px;
font-size: 65px;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
transition: transform 0.2s ease-in-out;
}
.scroll-to-top:hover {
transform: translateX(-50%) scale(1.2);
cursor: pointer;
filter: brightness(0.8);
}
</style>

View File

@ -232,7 +232,7 @@ fr:
pt: Portugais pt: Portugais
pt: pt:
Send SMS: Enviar SMS Send SMS: Enviar SMS
CustomerDefaultLanguage: Este cliente utiliza o {locale} como seu idioma padrão CustomerDefaultLanguage: Este cliente utiliza o <strong>{locale}</strong> como seu idioma padrão
Language: Linguagem Language: Linguagem
Phone: Móvel Phone: Móvel
Subject: Assunto Subject: Assunto

View File

@ -6,7 +6,6 @@ globals:
quantity: Quantity quantity: Quantity
entity: Entity entity: Entity
preview: Preview preview: Preview
scrollToTop: Go up
user: User user: User
details: Details details: Details
collapseMenu: Collapse lateral menu collapseMenu: Collapse lateral menu

View File

@ -6,7 +6,6 @@ globals:
quantity: Cantidad quantity: Cantidad
entity: Entidad entity: Entidad
preview: Vista previa preview: Vista previa
scrollToTop: Ir arriba
user: Usuario user: Usuario
details: Detalles details: Detalles
collapseMenu: Contraer menú lateral collapseMenu: Contraer menú lateral

View File

@ -18,7 +18,7 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
const arrayData = useArrayData('Customer'); const arrayData = useArrayData('Client');
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const campaignList = ref(); const campaignList = ref();
@ -260,7 +260,7 @@ const updateDateParams = (value, params) => {
:label="t('globals.campaign')" :label="t('globals.campaign')"
:filled="true" :filled="true"
class="q-px-sm q-pt-none fit" class="q-px-sm q-pt-none fit"
:option-label="(opt) => t(opt.code ?? '')" :option-label="(opt) => t(opt.code)"
:fields="['id', 'code', 'dated', 'scopeDays']" :fields="['id', 'code', 'dated', 'scopeDays']"
@update:model-value="(data) => updateDateParams(data, params)" @update:model-value="(data) => updateDateParams(data, params)"
dense dense

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { QBtn, useQuasar } from 'quasar'; import { QBtn, useQuasar } from 'quasar';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { toDateTimeFormat } from 'src/filters/date'; import { toDateTimeFormat } from 'src/filters/date';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
@ -33,7 +34,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
format: (row) => row?.type?.description, format: (row) => row.type.description,
label: t('Description'), label: t('Description'),
name: 'description', name: 'description',
}, },
@ -73,11 +74,12 @@ const tableRef = ref();
<template> <template>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="CustomerSamples" data-key="ClientSamples"
auto-load auto-load
:user-filter="filter" :filter="filter"
url="ClientSamples" url="ClientSamples"
:columns="columns" :columns="columns"
:pagination="{ rowsPerPage: 12 }"
:disable-option="{ card: true }" :disable-option="{ card: true }"
:right-search="false" :right-search="false"
:rows="rows" :rows="rows"

View File

@ -42,11 +42,7 @@ const groupedStates = ref([]);
auto-load auto-load
/> />
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load /> <FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
<VnFilterPanel <VnFilterPanel :data-key="props.dataKey" :search-button="true">
:data-key="props.dataKey"
:search-button="true"
:unremovableParams="['from', 'to']"
>
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>

View File

@ -68,7 +68,7 @@ const arrayData = useArrayData('ZoneEvents');
const exclusionGeoCreate = async () => { const exclusionGeoCreate = async () => {
const params = { const params = {
zoneFk: parseInt(route.params.id), zoneFk: parseInt(route.params.id),
date: dated.value, date: dated,
geoIds: tickedNodes.value, geoIds: tickedNodes.value,
}; };
await axios.post('Zones/exclusionGeo', params); await axios.post('Zones/exclusionGeo', params);
@ -101,17 +101,9 @@ const exclusionCreate = async () => {
const existsEvent = data.events.find( const existsEvent = data.events.find(
(event) => toDateFormat(event.dated) === toDateFormat(dated.value), (event) => toDateFormat(event.dated) === toDateFormat(dated.value),
); );
const existsGeoEvent = data.geoExclusions.find(
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
);
if (existsEvent) { if (existsEvent) {
await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`); await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`);
} }
if (existsGeoEvent) {
await axios.delete(
`Zones/${existsGeoEvent?.zoneFk}/exclusions/${existsGeoEvent?.zoneExclusionFk}`,
);
}
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]); if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
else await axios.put(`${url}/${props.event?.id}`, body); else await axios.put(`${url}/${props.event?.id}`, body);
@ -130,21 +122,8 @@ const onSubmit = async () => {
const deleteEvent = async () => { const deleteEvent = async () => {
if (!props.event) return; if (!props.event) return;
if (!props.event.created) { const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
const filter = { await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
where: {
dated: dated.value,
},
};
const params = { filter: JSON.stringify(filter) };
const { data: res } = await axios.get(`Zones/${route.params.id}/exclusions`, {
params,
});
if (res) await axios.delete(`Zones/${route.params.id}/exclusions/${res[0].id}`);
} else {
const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
}
await refetchEvents(); await refetchEvents();
}; };
@ -156,7 +135,7 @@ const refetchEvents = async () => {
}; };
onMounted(() => { onMounted(() => {
if (props.event && props.event.dated) { if (props.event) {
dated.value = props.event?.dated; dated.value = props.event?.dated;
excludeType.value = excludeType.value =
props.eventType === 'geoExclusion' ? 'specificLocations' : 'all'; props.eventType === 'geoExclusion' ? 'specificLocations' : 'all';

View File

@ -56,7 +56,6 @@ const isNew = computed(() => props.isNewMode);
const eventInclusionFormData = ref({ wdays: [] }); const eventInclusionFormData = ref({ wdays: [] });
const dated = ref(props.date || Date.vnNew()); const dated = ref(props.date || Date.vnNew());
const _inclusionType = ref('indefinitely'); const _inclusionType = ref('indefinitely');
const hasDeletedEvent = ref(false);
const inclusionType = computed({ const inclusionType = computed({
get: () => _inclusionType.value, get: () => _inclusionType.value,
set: (val) => { set: (val) => {
@ -85,7 +84,7 @@ const createEvent = async () => {
} }
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id]; const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
for (const zoneId of zoneIds) { for (const id of zoneIds) {
let today = eventInclusionFormData.value.dated let today = eventInclusionFormData.value.dated
? moment(eventInclusionFormData.value.dated) ? moment(eventInclusionFormData.value.dated)
: moment(dated.value); : moment(dated.value);
@ -93,7 +92,7 @@ const createEvent = async () => {
const { data } = await axios.get(`Zones/getEventsFiltered`, { const { data } = await axios.get(`Zones/getEventsFiltered`, {
params: { params: {
zoneFk: zoneId, zoneFk: id,
started: today, started: today,
ended: lastDay, ended: lastDay,
}, },
@ -107,19 +106,15 @@ const createEvent = async () => {
await axios.delete( await axios.delete(
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`, `Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
); );
await refetchEvents();
hasDeletedEvent.value = true;
} }
delete eventInclusionFormData.value.id; if (isNew.value)
if (isNew.value || hasDeletedEvent.value) await axios.post(`Zones/${id}/events`, eventInclusionFormData.value);
await axios.post(`Zones/${zoneId}/events`, eventInclusionFormData.value);
else else
await axios.put( await axios.put(
`Zones/${zoneId}/events/${props.event?.id}`, `Zones/${id}/events/${props.event?.id}`,
eventInclusionFormData.value, eventInclusionFormData.value,
); );
hasDeletedEvent.value = false;
} }
quasar.notify({ quasar.notify({
message: t('globals.dataSaved'), message: t('globals.dataSaved'),

View File

@ -1,5 +1,5 @@
import '../commands.js'; import '../commands.js';
describe('EntryDescriptor', () => { describe.skip('EntryDescriptor', () => {
beforeEach(() => { beforeEach(() => {
cy.login('buyer'); cy.login('buyer');
cy.visit(`/#/entry/list`); cy.visit(`/#/entry/list`);

View File

@ -28,13 +28,13 @@ describe('InvoiceOut list', () => {
cy.dataCy('InvoiceOutDownloadPdfBtn').click(); cy.dataCy('InvoiceOutDownloadPdfBtn').click();
}); });
it.skip('should open the invoice descriptor from table icon', () => { it('should open the invoice descriptor from table icon', () => {
cy.get(firstSummaryIcon).click(); cy.get(firstSummaryIcon).click();
cy.get('.cardSummary').should('be.visible'); cy.get('.cardSummary').should('be.visible');
cy.get('.summaryHeader > div').should('include.text', 'A1111111'); cy.get('.summaryHeader > div').should('include.text', 'A1111111');
}); });
it('should open the client descriptor', () => { it.skip('should open the client descriptor', () => {
cy.get(firstRowDescriptor).click(); cy.get(firstRowDescriptor).click();
cy.get(summaryPopupIcon).click(); cy.get(summaryPopupIcon).click();
}); });

View File

@ -15,7 +15,7 @@ describe('InvoiceOut summary', () => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/invoice-out/1/summary`); cy.visit(`/#/invoice-out/1/summary`);
}); });
it.skip('open the descriptors', () => { it('open the descriptors', () => {
cy.get(firstRowDescriptors(1)).click(); cy.get(firstRowDescriptors(1)).click();
cy.get('.descriptor').should('be.visible'); cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1'); cy.get('.q-item > .q-item__label').should('include.text', '1');

View File

@ -11,15 +11,14 @@ describe('OrderList', () => {
it('create order', () => { it('create order', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click(); cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.selectOption('[data-cy="Client_select"]', 1101); cy.selectOption(clientCreateSelect, 1101);
cy.dataCy('landedDate').find('input').type('06/01/2001'); cy.get(addressCreateSelect).click();
cy.get('[data-cy="Address_select"]').click();
cy.get( cy.get(
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i', '.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
).should('have.text', 'star'); ).should('have.text', 'star');
cy.get('.q-menu > div> .q-item:nth-child(1)').click(); cy.dataCy('landedDate').find('input').type('06/01/2001');
cy.get('.q-card [data-cy="Agency_select"]').click(); cy.selectOption(agencyCreateSelect, 1);
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale'); cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click(); cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
cy.wait('@orderSale'); cy.wait('@orderSale');

View File

@ -2,7 +2,7 @@
const firstRow = 'tbody > :nth-child(1)'; const firstRow = 'tbody > :nth-child(1)';
describe('TicketSale', () => { describe('TicketSale', () => {
describe.skip('Ticket #23', () => { describe.skip('#23', () => {
beforeEach(() => { beforeEach(() => {
cy.login('claimManager'); cy.login('claimManager');
cy.viewport(1920, 1080); cy.viewport(1920, 1080);

View File

@ -10,7 +10,7 @@ describe('WagonTypeEdit', () => {
cy.get('.q-card'); cy.get('.q-card');
cy.get('input').first().type(' changed'); cy.get('input').first().type(' changed');
cy.get('div.q-checkbox__bg').first().click(); cy.get('div.q-checkbox__bg').first().click();
cy.dataCy('saveDefaultBtn').click(); cy.get('.q-btn--standard').click();
}); });
it('should delete a tray', () => { it('should delete a tray', () => {