Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8197-remove-backwards_compatibility
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Alex Moreno 2025-03-11 10:47:55 +01:00
commit 986ed43e2a
6 changed files with 144 additions and 50 deletions

View File

@ -2,28 +2,38 @@
import { onBeforeMount, onMounted, computed, ref } from 'vue'; import { onBeforeMount, onMounted, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { useRoute } from 'vue-router';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { toDateHourMin } from 'filters/index'; import { toDateHourMin } from 'filters/index';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
import axios from 'axios';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const { getTokenMultimedia } = useSession(); const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia(); const token = getTokenMultimedia();
const state = useStateStore(); const state = useStateStore();
const warehouses = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const dataKey = 'CmrList';
const shipped = Date.vnNew();
shipped.setHours(0, 0, 0, 0);
shipped.setDate(shipped.getDate() - 1);
const userParams = {
shipped: null,
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'cmrFk', name: 'cmrFk',
label: t('route.cmr.list.cmrFk'), label: t('route.cmr.params.cmrFk'),
chip: { chip: {
condition: () => true, condition: () => true,
}, },
@ -32,62 +42,67 @@ const columns = computed(() => [
{ {
align: 'center', align: 'center',
name: 'hasCmrDms', name: 'hasCmrDms',
label: t('route.cmr.list.hasCmrDms'), label: t('route.cmr.params.hasCmrDms'),
component: 'checkbox', component: 'checkbox',
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
label: t('route.cmr.list.ticketFk'), label: t('route.cmr.params.ticketFk'),
name: 'ticketFk', name: 'ticketFk',
}, },
{ {
align: 'left', align: 'left',
label: t('route.cmr.list.routeFk'), label: t('route.cmr.params.routeFk'),
name: 'routeFk', name: 'routeFk',
}, },
{ {
align: 'left', align: 'left',
label: t('route.cmr.list.clientFk'), label: t('route.cmr.params.clientFk'),
name: 'clientFk', name: 'clientFk',
}, },
{ {
align: 'right', align: 'right',
label: t('route.cmr.list.country'), label: t('route.cmr.params.countryFk'),
name: 'countryFk', name: 'countryFk',
cardVisible: true, component: 'select',
attrs: { attrs: {
url: 'countries', url: 'countries',
fields: ['id', 'name'], fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
}, },
columnFilter: { columnFilter: {
inWhere: true, name: 'countryFk',
component: 'select', attrs: {
url: 'countries',
fields: ['id', 'name'],
},
}, },
format: ({ countryName }) => countryName, format: ({ countryName }) => countryName,
}, },
{ {
align: 'right', align: 'right',
label: t('route.cmr.list.shipped'), label: t('route.cmr.params.shipped'),
name: 'shipped', name: 'shipped',
cardVisible: true, cardVisible: true,
columnFilter: { component: 'date',
component: 'date',
inWhere: true,
},
format: ({ shipped }) => toDateHourMin(shipped), format: ({ shipped }) => toDateHourMin(shipped),
}, },
{ {
align: 'right', align: 'right',
label: t('route.cmr.params.warehouseFk'),
name: 'warehouseFk', name: 'warehouseFk',
label: t('globals.warehouse'), component: 'select',
columnFilter: {
component: 'select',
},
attrs: { attrs: {
options: warehouses.value, url: 'warehouses',
fields: ['id', 'name'],
},
columnFilter: {
inWhere: true,
name: 'warehouseFk',
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
},
}, },
format: ({ warehouseName }) => warehouseName, format: ({ warehouseName }) => warehouseName,
}, },
@ -96,7 +111,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('Ver cmr'), title: t('route.cmr.params.viewCmr'),
icon: 'visibility', icon: 'visibility',
isPrimary: true, isPrimary: true,
action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'), action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'),
@ -105,13 +120,17 @@ const columns = computed(() => [
}, },
]); ]);
onBeforeMount(async () => { onBeforeMount(() => {
const { data } = await axios.get('Warehouses'); initializeFromQuery();
warehouses.value = data;
}); });
onMounted(() => (state.rightDrawer = true)); onMounted(() => (state.rightDrawer = true));
const initializeFromQuery = () => {
const query = route.query.table ? JSON.parse(route.query.table) : {};
shipped.value = query.shipped || shipped.toISOString();
Object.assign(userParams, { shipped });
};
function getApiUrl() { function getApiUrl() {
return new URL(window.location).origin; return new URL(window.location).origin;
} }
@ -133,6 +152,11 @@ function downloadPdfs() {
} }
</script> </script>
<template> <template>
<VnSearchbar
:data-key
:label="t('route.cmr.search')"
:info="t('route.cmr.searchInfo')"
/>
<VnSubToolbar> <VnSubToolbar>
<template #st-actions> <template #st-actions>
<QBtn <QBtn
@ -142,16 +166,16 @@ function downloadPdfs() {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="downloadPdfs" @click="downloadPdfs"
> >
<QTooltip>{{ t('route.cmr.list.downloadCmrs') }}</QTooltip> <QTooltip>{{ t('route.cmr.params.downloadCmrs') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="CmrList" :data-key
url="Cmrs/filter" url="Cmrs/filter"
:columns="columns" :columns="columns"
:right-search="true" :user-params="userParams"
default-mode="table" default-mode="table"
v-model:selected="selectedRows" v-model:selected="selectedRows"
table-height="85vh" table-height="85vh"

View File

@ -3,16 +3,19 @@ route:
search: Search roadmap search: Search roadmap
searchInfo: You can search by roadmap reference searchInfo: You can search by roadmap reference
params: params:
id: Id
name: Name
etd: ETD etd: ETD
tractorPlate: Plate tractorPlate: Plate
price: Price price: Price
observations: Observations observations: Observations
id: ID
name: Name
cmrFk: CMR id cmrFk: CMR id
hasCmrDms: Attached in gestdoc hasCmrDms: Attached in gestdoc
ticketFk: Ticketd id ticketFk: Ticketd id
routeFk: Route id routeFk: Route id
clientFk: Client id
countryFk: Country
warehouseFk: Warehouse
shipped: Shipped shipped: Shipped
agencyAgreement: Agency agreement agencyAgreement: Agency agreement
agencyModeName: Agency route agencyModeName: Agency route
@ -42,7 +45,9 @@ route:
search: Search route search: Search route
searchInfo: You can search by route reference searchInfo: You can search by route reference
cmr: cmr:
list: search: Search Cmr
searchInfo: You can search Cmr by Id
params:
results: results results: results
cmrFk: CMR id cmrFk: CMR id
hasCmrDms: Attached in gestdoc hasCmrDms: Attached in gestdoc
@ -50,8 +55,10 @@ route:
'false': 'No' 'false': 'No'
ticketFk: Ticketd id ticketFk: Ticketd id
routeFk: Route id routeFk: Route id
country: Country countryFk: Country
clientFk: Client id clientFk: Client id
warehouseFk: Warehouse
shipped: Preparation date shipped: Preparation date
viewCmr: View CMR viewCmr: View CMR
downloadCmrs: Download CMRs downloadCmrs: Download CMRs
search: General search

View File

@ -3,8 +3,6 @@ route:
search: Buscar troncales search: Buscar troncales
searchInfo: Puedes buscar por referencia del troncal searchInfo: Puedes buscar por referencia del troncal
params: params:
agencyModeName: Agencia Ruta
agencyAgreement: Agencia Acuerdo
id: Id id: Id
name: Troncal name: Troncal
etd: ETD etd: ETD
@ -13,9 +11,15 @@ route:
observations: Observaciones observations: Observaciones
cmrFk: Id CMR cmrFk: Id CMR
hasCmrDms: Gestdoc hasCmrDms: Gestdoc
search: Búsqueda general
ticketFk: Id ticket ticketFk: Id ticket
routeFK: Id ruta routeFk: Id ruta
clientFk: Id cliente
countryFk: Pais
warehouseFk: Almacén
shipped: Fecha preparación shipped: Fecha preparación
agencyModeName: Agencia Ruta
agencyAgreement: Agencia Acuerdo
Worker: Trabajador Worker: Trabajador
Agency: Agencia Agency: Agencia
Vehicle: Vehículo Vehicle: Vehículo
@ -55,4 +59,4 @@ route:
clientFk: Id cliente clientFk: Id cliente
shipped: Fecha preparación shipped: Fecha preparación
viewCmr: Ver CMR viewCmr: Ver CMR
downloadCmrs: Descargar CMRs downloadCmrs: Descargar CMRs

View File

@ -1,17 +1,14 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe.skip('Client balance', () => { describe('Client balance', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1280, 720); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit('#/customer/1101/balance'); cy.visit('#/customer/1101/balance');
}); });
it('Should load layout', () => {
cy.get('.q-page').should('be.visible');
});
it('Should create a mandate', () => { it('Should create a mandate', () => {
cy.get('.q-page-sticky > div > .q-btn').click(); cy.get('.q-page-sticky > div > .q-btn').click();
cy.dataCy('paymentBank').type({ arroyDown }); cy.selectOption('[data-cy="paymentBank"]', 2);
cy.dataCy('paymentAmount').type('100'); cy.dataCy('paymentAmount_input').type('100');
cy.saveCard(); cy.saveCard();
}); });
}); });

View File

@ -1,12 +1,74 @@
describe('RoadMap', () => { describe('RoadMap', () => {
const getSelector = (colField) =>
`tr:last-child > [data-col-field="${colField}"] > .no-padding`;
const selectors = {
roadmap: getSelector('name'),
id: getSelector('id'),
etd: getSelector('etd'),
summaryHeader: '.summaryHeader > :nth-child(2)',
summaryGoToSummaryBtn: '.summaryHeader > a > .q-icon',
summaryBtn: 'tableAction-0',
inputRoadmap: 'Roadmap_input',
checkbox: '.q-virtual-scroll__content tr:last-child .q-checkbox',
cloneFormBtn: '.q-card__actions > .q-btn--standard',
cloneBtn: '#subToolbar > :nth-child(3)',
deleteBtn: ':nth-child(4) > .q-btn__content',
confirmBtn: 'VnConfirm_confirm',
inputEtd: 'ETD_inputDate',
};
const data = {
roadmap: 'TEST-ROADMAP',
etd: '01/01/2025',
};
const dataCreated = 'Data created';
const summaryUrl = '/summary';
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/route/roadmap`); cy.visit(`/#/route/roadmap`);
cy.typeSearchbar('{enter}');
}); });
it('Should list roadmaps', () => {
cy.get('.q-table')
.children()
.should('be.visible')
.should('have.length.greaterThan', 0);
});
it('Route list create roadmap and redirect', () => { it('Route list create roadmap and redirect', () => {
cy.addBtnClick(); cy.addBtnClick();
cy.get('input[name="name"]').type('roadMapTestOne{enter}'); cy.dataCy(selectors.inputRoadmap).type(`${data.roadmap}{enter}`);
cy.get('.q-notification__message').should('have.text', 'Data created'); cy.checkNotification(dataCreated);
cy.url().should('include', '/summary'); cy.url().should('include', summaryUrl);
});
it('open summary', () => {
cy.dataCy(selectors.summaryBtn).last().click();
cy.get(selectors.summaryHeader).should('contain', data.roadmap);
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.get(selectors.summaryHeader).should('contain', data.roadmap);
});
it('Should clone selected roadmap with new ETD', () => {
cy.get(selectors.checkbox).click();
cy.get(selectors.cloneBtn).click();
cy.dataCy(selectors.inputEtd).click().type(`${data.etd}{enter}`);
cy.get(selectors.cloneFormBtn).click();
cy.get(selectors.etd).should('contain', data.etd);
});
it('Should delete selected roadmap', () => {
cy.get(selectors.id).then(($el) => {
cy.get(selectors.checkbox).click();
cy.get(selectors.deleteBtn).click();
cy.dataCy(selectors.confirmBtn).click();
cy.typeSearchbar('{enter}');
cy.get(selectors.id).should('not.have.text', $el.text);
});
}); });
}); });

View File

@ -138,8 +138,8 @@ describe.skip('Ticket Lack detail', () => {
cy.get('[data-cy="itemProposal"]').click(); cy.get('[data-cy="itemProposal"]').click();
cy.wait('@getItemGetSimilar'); cy.wait('@getItemGetSimilar');
}); });
describe('Replace item if', () => { describe.skip('Replace item if', () => {
it.skip('Quantity is less than available', () => { it('Quantity is less than available', () => {
cy.get(':nth-child(1) > .text-right > .q-btn').click(); cy.get(':nth-child(1) > .text-right > .q-btn').click();
}); });
}); });