forked from verdnatura/salix-front
Merge branch 'dev' into 6321_negative_tickets
This commit is contained in:
commit
967fb4592b
|
@ -5,16 +5,23 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [2416.01] - 2024-04-18
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
## [2414.01] - 2024-04-04
|
## [2414.01] - 2024-04-04
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- (Tickets) => Se añade la opción de clonar ticket. #6951
|
- (Tickets) => Se añade la opción de clonar ticket. #6951
|
||||||
|
- (Parking) => Se añade la sección Parking. #5186
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- (General) => Se corrige la redirección cuando hay 1 solo registro y cuando se aplica un filtro diferente al id al hacer una búsqueda general. #6893
|
||||||
|
|
||||||
## [2400.01] - 2024-01-04
|
## [2400.01] - 2024-01-04
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.14.0",
|
"version": "24.16.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
|
|
@ -198,9 +198,11 @@ function addDefaultData(data) {
|
||||||
en:
|
en:
|
||||||
contentTypesInfo: Allowed file types {allowedContentTypes}
|
contentTypesInfo: Allowed file types {allowedContentTypes}
|
||||||
EntryDmsDescription: Reference {reference}
|
EntryDmsDescription: Reference {reference}
|
||||||
|
SupplierDmsDescription: Reference {reference}
|
||||||
es:
|
es:
|
||||||
Generate identifier for original file: Generar identificador para archivo original
|
Generate identifier for original file: Generar identificador para archivo original
|
||||||
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
|
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
|
||||||
EntryDmsDescription: Referencia {reference}
|
EntryDmsDescription: Referencia {reference}
|
||||||
|
SupplierDmsDescription: Referencia {reference}
|
||||||
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
|
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
||||||
|
@ -68,9 +66,8 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
|
||||||
const arrayData = useArrayData(props.dataKey, { ...props });
|
const arrayData = useArrayData(props.dataKey, { ...props });
|
||||||
const store = arrayData.store;
|
const { store } = arrayData;
|
||||||
const searchText = ref('');
|
const searchText = ref('');
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -92,18 +89,26 @@ async function search() {
|
||||||
});
|
});
|
||||||
if (!props.redirect) return;
|
if (!props.redirect) return;
|
||||||
|
|
||||||
if (props.customRouteRedirectName) {
|
if (props.customRouteRedirectName)
|
||||||
router.push({
|
return router.push({
|
||||||
name: props.customRouteRedirectName,
|
name: props.customRouteRedirectName,
|
||||||
params: { id: searchText.value },
|
params: { id: searchText.value },
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { matched: matches } = route;
|
const { matched: matches } = router.currentRoute.value;
|
||||||
const { path } = matches[matches.length - 1];
|
const { path } = matches.at(-1);
|
||||||
const newRoute = path.replace(':id', searchText.value);
|
const [, moduleName] = path.split('/');
|
||||||
await router.push(newRoute);
|
|
||||||
|
if (!store.data.length || store.data.length > 1)
|
||||||
|
return router.push({ path: `/${moduleName}/list` });
|
||||||
|
|
||||||
|
const targetId = store.data[0].id;
|
||||||
|
let targetUrl;
|
||||||
|
|
||||||
|
if (path.endsWith('/list')) targetUrl = path.replace('/list', `/${targetId}/summary`);
|
||||||
|
else if (path.includes(':id')) targetUrl = path.replace(':id', targetId);
|
||||||
|
|
||||||
|
await router.push({ path: targetUrl });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
export function usePrintService() {
|
export function usePrintService() {
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const { getToken } = useSession();
|
const { getTokenMultimedia } = useSession();
|
||||||
|
|
||||||
function sendEmail(path, params) {
|
function sendEmail(path, params) {
|
||||||
return axios.post(path, params).then(() =>
|
return axios.post(path, params).then(() =>
|
||||||
|
@ -19,7 +19,7 @@ export function usePrintService() {
|
||||||
function openReport(path, params) {
|
function openReport(path, params) {
|
||||||
params = Object.assign(
|
params = Object.assign(
|
||||||
{
|
{
|
||||||
access_token: getToken(),
|
access_token: getTokenMultimedia(),
|
||||||
},
|
},
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
|
|
|
@ -130,4 +130,4 @@ input::-webkit-inner-spin-button {
|
||||||
appearance: none;
|
appearance: none;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
}
|
}
|
|
@ -503,6 +503,7 @@ export default {
|
||||||
request: 'Request',
|
request: 'Request',
|
||||||
weight: 'Weight',
|
weight: 'Weight',
|
||||||
goTo: 'Go to',
|
goTo: 'Go to',
|
||||||
|
summaryAmount: 'Summary',
|
||||||
},
|
},
|
||||||
negative: {
|
negative: {
|
||||||
hour: 'Hour',
|
hour: 'Hour',
|
||||||
|
@ -1082,6 +1083,7 @@ export default {
|
||||||
addresses: 'Addresses',
|
addresses: 'Addresses',
|
||||||
consumption: 'Consumption',
|
consumption: 'Consumption',
|
||||||
agencyTerm: 'Agency agreement',
|
agencyTerm: 'Agency agreement',
|
||||||
|
dms: 'File management',
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
payMethod: 'Pay method',
|
payMethod: 'Pay method',
|
||||||
|
|
|
@ -546,6 +546,7 @@ export default {
|
||||||
request: 'Petición de compra',
|
request: 'Petición de compra',
|
||||||
weight: 'Peso',
|
weight: 'Peso',
|
||||||
goTo: 'Ir a',
|
goTo: 'Ir a',
|
||||||
|
summaryAmount: 'Resumen',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
claim: {
|
claim: {
|
||||||
|
@ -1081,6 +1082,7 @@ export default {
|
||||||
addresses: 'Direcciones',
|
addresses: 'Direcciones',
|
||||||
consumption: 'Consumo',
|
consumption: 'Consumo',
|
||||||
agencyTerm: 'Acuerdo agencia',
|
agencyTerm: 'Acuerdo agencia',
|
||||||
|
dms: 'Gestión documental',
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
payMethod: 'Método de pago',
|
payMethod: 'Método de pago',
|
||||||
|
|
|
@ -22,7 +22,7 @@ const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const token = session.getToken();
|
const tokenMultimedia = session.getTokenMultimedia();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
|
||||||
const manualInvoiceDialogRef = ref(null);
|
const manualInvoiceDialogRef = ref(null);
|
||||||
|
@ -66,7 +66,7 @@ const openPdf = () => {
|
||||||
|
|
||||||
if (selectedCards.value.size === 1) {
|
if (selectedCards.value.size === 1) {
|
||||||
const [invoiceOut] = selectedCardsArray;
|
const [invoiceOut] = selectedCardsArray;
|
||||||
const url = `api/InvoiceOuts/${invoiceOut.id}/download?access_token=${token}`;
|
const url = `api/InvoiceOuts/${invoiceOut.id}/download?access_token=${tokenMultimedia}`;
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
} else {
|
} else {
|
||||||
const invoiceOutIdsArray = selectedCardsArray.map(
|
const invoiceOutIdsArray = selectedCardsArray.map(
|
||||||
|
@ -75,7 +75,7 @@ const openPdf = () => {
|
||||||
const invoiceOutIds = invoiceOutIdsArray.join(',');
|
const invoiceOutIds = invoiceOutIdsArray.join(',');
|
||||||
|
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
access_token: token,
|
access_token: tokenMultimedia,
|
||||||
ids: invoiceOutIds,
|
ids: invoiceOutIds,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<script setup>
|
||||||
|
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnDmsList
|
||||||
|
model="SupplierDms"
|
||||||
|
update-model="SupplierDms"
|
||||||
|
default-dms-code="supplier"
|
||||||
|
filter="supplierFk"
|
||||||
|
/>
|
||||||
|
</template>
|
|
@ -131,22 +131,6 @@ async function changeState(value) {
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<QCard class="vn-max">
|
|
||||||
<div class="taxes">
|
|
||||||
<VnLv
|
|
||||||
:label="t('ticket.summary.subtotal')"
|
|
||||||
:value="toCurrency(ticket.totalWithoutVat)"
|
|
||||||
/>
|
|
||||||
<VnLv
|
|
||||||
:label="t('ticket.summary.vat')"
|
|
||||||
:value="toCurrency(ticket.totalWithVat - ticket.totalWithoutVat)"
|
|
||||||
/>
|
|
||||||
<VnLv
|
|
||||||
:label="t('ticket.summary.total')"
|
|
||||||
:value="toCurrency(ticket.totalWithVat)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</QCard>
|
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="ticketUrl + 'basic-data/step-one'"
|
:url="ticketUrl + 'basic-data/step-one'"
|
||||||
|
@ -236,7 +220,7 @@ async function changeState(value) {
|
||||||
:value="formattedAddress()"
|
:value="formattedAddress()"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one" v-if="ticket.notes.length">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="ticketUrl + 'observation'"
|
:url="ticketUrl + 'observation'"
|
||||||
:text="t('ticket.pageTitles.notes')"
|
:text="t('ticket.pageTitles.notes')"
|
||||||
|
@ -258,6 +242,23 @@ async function changeState(value) {
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
<QCard class="vn-one">
|
||||||
|
<VnTitle :text="t('ticket.summary.summaryAmount')" />
|
||||||
|
<div class="bodyCard">
|
||||||
|
<VnLv
|
||||||
|
:label="t('ticket.summary.subtotal')"
|
||||||
|
:value="toCurrency(ticket.totalWithoutVat)"
|
||||||
|
/>
|
||||||
|
<VnLv
|
||||||
|
:label="t('ticket.summary.vat')"
|
||||||
|
:value="toCurrency(ticket.totalWithVat - ticket.totalWithoutVat)"
|
||||||
|
/>
|
||||||
|
<VnLv
|
||||||
|
:label="t('ticket.summary.total')"
|
||||||
|
:value="toCurrency(ticket.totalWithVat)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</QCard>
|
||||||
<QCard class="vn-max">
|
<QCard class="vn-max">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="ticketUrl + 'sale'"
|
:url="ticketUrl + 'sale'"
|
||||||
|
@ -448,21 +449,10 @@ async function changeState(value) {
|
||||||
.notes {
|
.notes {
|
||||||
width: max-content;
|
width: max-content;
|
||||||
}
|
}
|
||||||
.cardSummary .summaryBody > .q-card > .taxes {
|
|
||||||
border: 2px solid gray;
|
.q-card.q-card--dark.q-dark.vn-one {
|
||||||
padding: 0;
|
& > .bodyCard {
|
||||||
> .vn-label-value {
|
padding: 1%;
|
||||||
text-align: right;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
margin-top: 5px;
|
|
||||||
justify-content: flex-end;
|
|
||||||
padding-right: 20px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cardSummary .summaryBody > .q-card:has(.taxes) {
|
|
||||||
margin-top: 2px;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -22,6 +22,7 @@ export default {
|
||||||
'SupplierAddresses',
|
'SupplierAddresses',
|
||||||
'SupplierConsumption',
|
'SupplierConsumption',
|
||||||
'SupplierAgencyTerm',
|
'SupplierAgencyTerm',
|
||||||
|
'SupplierDms',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
@ -161,6 +162,15 @@ export default {
|
||||||
component: () =>
|
component: () =>
|
||||||
import('src/pages/Supplier/Card/SupplierAgencyTerm.vue'),
|
import('src/pages/Supplier/Card/SupplierAgencyTerm.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'dms',
|
||||||
|
name: 'SupplierDms',
|
||||||
|
meta: {
|
||||||
|
title: 'dms',
|
||||||
|
icon: 'smb_share',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Supplier/Card/SupplierDms.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'agency-term/create',
|
path: 'agency-term/create',
|
||||||
name: 'SupplierAgencyTermCreate',
|
name: 'SupplierAgencyTermCreate',
|
||||||
|
|
|
@ -1,19 +1,42 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('VnSearchBar', () => {
|
describe('VnSearchBar', () => {
|
||||||
|
const employeeId = ' #1';
|
||||||
|
const salesPersonId = ' #18';
|
||||||
|
const idGap = '.q-item > .q-item__label';
|
||||||
|
const cardList = '.vn-card-list';
|
||||||
|
|
||||||
|
let url;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit('/');
|
cy.visit('#/customer/list');
|
||||||
|
cy.url().then((currentUrl) => (url = currentUrl));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect to new customer', () => {
|
it('should redirect to customer summary page', () => {
|
||||||
cy.visit('#/customer/1112/basic-data');
|
searchAndCheck('1', employeeId);
|
||||||
cy.openLeftMenu();
|
searchAndCheck('salesPerson', salesPersonId);
|
||||||
cy.get('.q-item > .q-item__label').should('have.text', ' #1112');
|
|
||||||
cy.closeSideMenu();
|
|
||||||
cy.clearSearchbar();
|
|
||||||
cy.writeSearchbar('1{enter}');
|
|
||||||
cy.openLeftMenu();
|
|
||||||
cy.get('.q-item > .q-item__label').should('have.text', ' #1');
|
|
||||||
cy.closeSideMenu();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should stay on the list page if there are several results or none', () => {
|
||||||
|
cy.writeSearchbar('salesA{enter}');
|
||||||
|
checkCardListAndUrl(2);
|
||||||
|
|
||||||
|
cy.clearSearchbar();
|
||||||
|
|
||||||
|
cy.writeSearchbar('0{enter}');
|
||||||
|
checkCardListAndUrl(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
const searchAndCheck = (searchTerm, expectedText) => {
|
||||||
|
cy.clearSearchbar();
|
||||||
|
cy.writeSearchbar(`${searchTerm}{enter}`);
|
||||||
|
cy.get(idGap).should('have.text', expectedText);
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkCardListAndUrl = (expectedLength) => {
|
||||||
|
cy.get(cardList).then(($cardList) => {
|
||||||
|
expect($cardList.find('.q-card').length).to.equal(expectedLength);
|
||||||
|
cy.url().then((currentUrl) => expect(currentUrl).to.equal(url));
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
|
// Probar a importar como plugin vue-router en archivo helper
|
||||||
|
|
||||||
describe('VnSearchBar', () => {
|
describe('VnSearchBar', () => {
|
||||||
let vm;
|
let vm;
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
let pushSpy;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
wrapper = createWrapper(VnSearchbar, {
|
wrapper = createWrapper(VnSearchbar, {
|
||||||
|
@ -16,7 +16,7 @@ describe('VnSearchBar', () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
vm = wrapper.vm;
|
vm = wrapper.vm;
|
||||||
vm.route.matched = [
|
vm.router.currentRoute.value.matched = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
},
|
},
|
||||||
|
@ -30,24 +30,33 @@ describe('VnSearchBar', () => {
|
||||||
path: '/customer/:id/basic-data',
|
path: '/customer/:id/basic-data',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
pushSpy = vi.spyOn(vm.router, 'push');
|
||||||
|
vi.spyOn(vm.arrayData, 'applyFilter');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
beforeEach(() => (vm.store.data = [{ id: 1112, name: 'Trash' }]));
|
||||||
vi.clearAllMocks();
|
afterEach(() => vi.clearAllMocks());
|
||||||
});
|
|
||||||
it('should be defined', async () => {
|
it('should be defined', async () => {
|
||||||
expect(vm.searchText).toBeDefined();
|
expect(vm.searchText).toBeDefined();
|
||||||
expect(vm.searchText).toEqual('');
|
expect(vm.searchText).toEqual('');
|
||||||
});
|
});
|
||||||
it('should redirect', async () => {
|
|
||||||
vi.spyOn(vm.router,'push');
|
it('should redirect to list page if there are several results', async () => {
|
||||||
vm.searchText = '1';
|
vm.store.data.push({ id: 1, name: 'employee' });
|
||||||
await vm.search();
|
await vm.search();
|
||||||
expect(vm.router.push).toHaveBeenCalledWith('/customer/1/basic-data');
|
expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/list' });
|
||||||
vm.searchText = '1112';
|
});
|
||||||
expect(vm.searchText).toEqual('1112');
|
|
||||||
vi.spyOn(vm.router,'push');
|
it('should redirect to list page if there is no results', async () => {
|
||||||
|
vm.store.data.pop();
|
||||||
await vm.search();
|
await vm.search();
|
||||||
expect(vm.router.push).toHaveBeenCalledWith('/customer/1112/basic-data');
|
expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/list' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should redirect to basic-data page if there is only one result', async () => {
|
||||||
|
await vm.search();
|
||||||
|
expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/1112/basic-data' });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue