refactor: refs #6683 add notary information to property descriptor and summary; update translations and tests
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jose Antonio Tubau 2025-04-07 14:59:03 +02:00
parent bcf5750619
commit 561b607163
6 changed files with 107 additions and 11 deletions

View File

@ -7,6 +7,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import PropertyCard from './PropertyCard.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
const { notify } = useNotify();
const { t } = useI18n();
@ -37,11 +38,20 @@ const props = defineProps({
module="Property"
>
<template #body="{ entity }">
<VnLv :label="$t('property.owner')" :value="entity.company.code" />
<VnLv
:label="$t('property.group')"
:value="entity.propertyGroup.description"
/>
<VnLv :label="$t('property.protocol')" :value="entity.protocol" copy/>
<VnLv :label="$t('property.notary')">
<template #value>
<span class="link">
{{ entity?.supplier?.name || '-' }}
<SupplierDescriptorProxy :id="entity?.supplierFk" />
</span>
</template>
</VnLv>
<VnLv :label="$t('property.protocol')" :value="entity.protocol" copy />
<VnLv :label="$t('property.cadaster')" :value="entity.cadaster" copy />
<VnLv :label="$t('property.farm')" :value="entity.farm" />
<VnLv :label="$t('property.area')" :value="entity.area" />

View File

@ -2,7 +2,6 @@
import { onMounted, ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { dashIfEmpty, toDate, toCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
@ -12,11 +11,11 @@ import { useArrayData } from 'composables/useArrayData';
import VnTitle from 'src/components/common/VnTitle.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
import FetchData from 'src/components/FetchData.vue';
import PropertyNotes from './PropertyNotes.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
const route = useRoute();
const { notify } = useNotify();
@ -98,11 +97,6 @@ onMounted(async () => {
function toPropertyUrl(section) {
return '#/property/' + entityId.value + '/' + section;
}
onMounted(async () => {
const filter = { fields: ['code', 'name', 'id', 'alertLevel'] };
const params = { filter: JSON.stringify(filter) };
});
</script>
<template>
@ -169,6 +163,14 @@ onMounted(async () => {
:label="t('property.value')"
:value="toCurrency(entity.value)"
/>
<VnLv :label="$t('property.notary')">
<template #value>
<span class="link">
{{ entity?.supplier?.name || '-' }}
<SupplierDescriptorProxy :id="entity?.supplierFk" />
</span>
</template>
</VnLv>
<VnLv
:label="t('property.protocol')"
:value="dashIfEmpty(entity.protocol)"

View File

@ -20,6 +20,7 @@ property:
allocation: Allocation
tome: Tome
map: Map
notary: Notary
protocol: Notarial protocol
purchased: Purchased date
booked: Booked date

View File

@ -20,6 +20,7 @@ property:
allocation: Partida
tome: Volumen
map: Mapa
notary: Notario
protocol: Prot. notarial
purchased: F. compra
booked: F. finalización

View File

@ -0,0 +1,45 @@
describe('Property descriptor', () => {
const selectors = {
notaryLink: '.descriptor [data-cy="vnLvNotario"] .link',
descriptorOpenSummaryBtn: '.q-menu > .descriptor [data-cy="openSummaryBtn"]',
descriptorGoToSummaryBtn: '.q-menu > .descriptor [data-cy="goToSummaryBtn"]',
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
descriptorTitle: '[data-cy="vnDescriptor_description"]',
};
const notarySummaryUrlRegex = /supplier\/\d+\/summary/;
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/property/1/summary');
});
it('Should redirect to the notary summary from notary descriptor pop-up', () => {
cy.get(selectors.notaryLink)
.should('be.visible')
.click()
.invoke('text')
.then((notaryName) => {
notaryName = notaryName.trim();
cy.log('Notary name: ', notaryName);
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.location().should('match', notarySummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, notaryName);
});
});
it('Should redirect to the notary summary from summary pop-up from the notary descriptor pop-up', () => {
cy.get(selectors.notaryLink)
.should('be.visible')
.click()
.invoke('text')
.then((notaryName) => {
notaryName = notaryName.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.location().should('match', notarySummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, notaryName);
});
});
});

View File

@ -2,16 +2,22 @@ describe('Property summary', () => {
const selectors = {
summaryTitle: '.summaryHeader',
descriptorTitle: '[data-cy="vnDescriptor_title"]',
notaryDescriptorTitle: '[data-cy="vnDescriptor_description"]',
descriptorOpenSummaryBtn: '.q-menu > .descriptor [data-cy="openSummaryBtn"]',
descriptorGoToSummaryBtn: '.q-menu > .descriptor [data-cy="goToSummaryBtn"]',
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
summaryBasicDataBlock1Link: 'a.link[data-cy="titleBasicDataBlock1"]',
summaryBasicDataBlock2Link: 'a.link[data-cy="titleBasicDataBlock2"]',
summaryBasicDataBlock3Link: 'a.link[data-cy="titleBasicDataBlock3"]',
summaryDmsBlockLink: 'a.link[data-cy="titleDmsBlock"]',
summaryNotesBlockLink: 'a.link[data-cy="titleNotesBlock"]',
summaryPropertyMapLink: 'a.grafana[data-cy="propertyMapLink"]',
dmsFirstRowWorkerLink: '.summaryBody :nth-child(1) > :nth-child(7) .link',
basicDataIcon: 'PropertyBasicData-menu-item',
dmsIcon: 'PropertyDms-menu-item',
notesIcon: 'PropertyNotes-menu-item',
logIcon: 'PropertyLog-menu-item',
notaryLink: '.summaryBody [data-cy="vnLvNotario"] .link',
};
const url = '/#/property/1/summary';
@ -20,6 +26,7 @@ describe('Property summary', () => {
const notesUrlRegex = /property\/1\/notes/;
const logUrlRegex = /property\/1\/history/;
const workerSummaryUrlRegex = /worker\/\d+\/summary/;
const notarySummaryUrlRegex = /supplier\/\d+\/summary/;
const propertyName = 'Stark Tower';
beforeEach(() => {
@ -78,9 +85,39 @@ describe('Property summary', () => {
});
});
describe.skip('Worker pop-ups', () => {
describe('Notary pop-ups', () => {
it('Should redirect to the notary summary from notary descriptor pop-up', () => {
cy.get(selectors.notaryLink)
.should('be.visible')
.click()
.invoke('text')
.then((notaryName) => {
notaryName = notaryName.trim();
cy.log('Notary name: ', notaryName);
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.location().should('match', notarySummaryUrlRegex);
cy.containContent(selectors.notaryDescriptorTitle, notaryName);
});
});
it('Should redirect to the notary summary from summary pop-up from the notary descriptor pop-up', () => {
cy.get(selectors.notaryLink)
.should('be.visible')
.click()
.invoke('text')
.then((notaryName) => {
notaryName = notaryName.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.location().should('match', notarySummaryUrlRegex);
cy.containContent(selectors.notaryDescriptorTitle, notaryName);
});
});
});
describe('Worker pop-ups', () => {
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
cy.get(selectors.lastRowWorkerLink)
cy.get(selectors.dmsFirstRowWorkerLink)
.should('be.visible')
.click()
.invoke('text')
@ -93,7 +130,7 @@ describe('Property summary', () => {
});
it('Should redirect to the worker summary from summary pop-up from the worker descriptor pop-up', () => {
cy.get(selectors.lastRowWorkerLink)
cy.get(selectors.dmsFirstRowWorkerLink)
.should('be.visible')
.click()
.invoke('text')