#6683 - createPropertiesSection #1665

Open
jtubau wants to merge 32 commits from 6683-createPropertiesSection into dev
29 changed files with 1975 additions and 20 deletions

View File

@ -13,6 +13,7 @@ import VnDms from 'src/components/common/VnDms.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import { useSession } from 'src/composables/useSession';
import { toDate } from 'src/filters/index';
const route = useRoute();
const quasar = useQuasar();
@ -118,7 +119,7 @@ const columns = computed(() => [
},
{
align: 'left',
field: 'type',
field: 'dmsType',
label: t('globals.type'),
name: 'type',
component: QInput,
@ -127,6 +128,7 @@ const columns = computed(() => [
borderless: true,
'model-value': prop.row.dmsType?.name,
}),
format: (row) => row.name,
},
{
align: 'left',
@ -172,6 +174,7 @@ const columns = computed(() => [
name: prop.row.worker?.user?.name.toLowerCase(),
workerId: prop.row.worker?.id,
}),
format: (row) => row?.user?.name,
},
{
align: 'left',
@ -183,6 +186,7 @@ const columns = computed(() => [
disable: true,
'model-value': prop.row.created,
}),
format: (row) => toDate(row),
},
{
field: 'options',
@ -298,6 +302,7 @@ defineExpose({
:data-key="$props.model"
:url="$props.model"
:user-filter="dmsFilter"
search-url="dmsFilter"
:order="['dmsFk DESC']"
auto-load
@on-fetch="setData"

View File

@ -160,6 +160,9 @@ globals:
department: Department
noData: No data available
vehicle: Vehicle
selectDocumentId: Select document id
import: Import from existing
document: Document
pageTitles:
logIn: Login
addressEdit: Update address
@ -341,6 +344,7 @@ globals:
parking: Parking
vehicleList: Vehicles
vehicle: Vehicle
properties: Properties
unsavedPopup:
title: Unsaved changes will be lost
subtitle: Are you sure exit without saving?
@ -389,6 +393,7 @@ errors:
updateUserConfig: Error updating user config
tokenConfig: Error fetching token config
writeRequest: The requested operation could not be completed
documentIdEmpty: The document identifier can't be empty
login:
title: Login
username: Username

View File

@ -164,6 +164,9 @@ globals:
noData: Datos no disponibles
department: Departamento
vehicle: Vehículo
selectDocumentId: Introduzca id de gestión documental
import: Importar desde existente
document: Documento
pageTitles:
logIn: Inicio de sesión
addressEdit: Modificar consignatario
@ -344,6 +347,7 @@ globals:
parking: Parking
vehicleList: Vehículos
vehicle: Vehículo
properties: Propiedades
unsavedPopup:
title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar?
@ -385,6 +389,7 @@ errors:
updateUserConfig: Error al actualizar la configuración de usuario
tokenConfig: Error al obtener configuración de token
writeRequest: No se pudo completar la operación solicitada
documentIdEmpty: El número de documento no puede estar vacío
login:
title: Inicio de sesión
username: Nombre de usuario

View File

@ -0,0 +1,191 @@
<script setup>
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInput from 'components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n();
const route = useRoute();
const isNew = Boolean(!route.params.id);
</script>
<template>
<VnSubToolbar v-if="isNew" />
<div class="q-pa-md">
<FormModel
:url-update="`Properties/${route.params.id}`"
model="Property"
auto-load
>
<template #form="{ data }">
<VnRow>
<VnInput
:label="t('property.name')"
v-model="data.name"
fill-input
/>
<VnInput
:label="t('property.cadaster')"
v-model="data.cadaster"
fill-input
/>
</VnRow>
<VnRow>
<VnSelect
url="propertyGroups"
:label="t('property.group')"
v-model="data.propertyGroupFk"
option-value="id"
option-label="description"
hide-selected
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ `${scope.opt.id}: ${scope.opt.description}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect
url="Companies"
:label="t('property.owner')"
v-model="data.companyFk"
option-value="id"
option-label="code"
hide-selected
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ `${scope.opt.id}: ${scope.opt.code}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow>
<VnRow>
<VnInput
:label="t('property.map')"
v-model="data.url"
fill-input
/>
</VnRow>
<VnRow>
<VnInputDate
placeholder="dd-mm-aaa"
:label="t('property.purchased')"
v-model="data.purchased"
fill-input
/>
<VnInput
:label="t('property.value')"
v-model="data.value"
fill-input
/>
<VnInput
:label="t('property.protocol')"
v-model="data.protocol"
fill-input
/>
</VnRow>
<VnRow>
<VnInput
:label="t('property.smallHolding')"
v-model="data.smallHolding"
fill-input
/>
<VnInput
:label="t('property.area')"
v-model="data.area"
fill-input
/>
<VnInput
:label="t('property.allocation')"
v-model="data.allocation"
fill-input
/>
</VnRow>
<VnRow>
<VnSelect
url="Towns"
:label="t('property.town')"
v-model="data.townFk"
option-value="id"
option-label="name"
hide-selected
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ `${scope.opt.id}: ${scope.opt.name}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnInput
:label="t('property.m2')"
v-model="data.m2"
fill-input
/>
<VnInput
:label="t('property.registry')"
v-model="data.registry"
fill-input
/>
</VnRow>
<VnRow>
<VnInput
:label="t('property.tome')"
v-model="data.tome"
fill-input
/>
<VnInput
:label="t('property.book')"
v-model="data.book"
fill-input
/>
<VnInput
:label="t('property.page')"
v-model="data.page"
fill-input
/>
<VnInput
:label="t('property.farm')"
v-model="data.farm"
fill-input
/>
</VnRow>
<VnRow>
<VnInput
:label="t('property.registration')"
v-model="data.registration"
fill-input
/>
<VnInputDate
placeholder="dd-mm-aaa"
:label="t('property.booked')"
v-model="data.booked"
fill-input
/>
<VnInput
:label="t('property.volume')"
v-model="data.volume"
fill-input
/>
</VnRow>
</template>
</FormModel>
</div>
</template>

View File

@ -0,0 +1,12 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import PropertyDescriptor from 'pages/Property/Card/PropertyDescriptor.vue';
</script>
<template>
<VnCard
data-key="Property"
url="Properties"
:descriptor="PropertyDescriptor"
:filter="{ where: { id: $route.params.id } }"
/>
</template>

View File

@ -0,0 +1,60 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
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();
const route = useRoute();
const entityId = computed(() => {
return Number(props.id || route.params.id);
});
const props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
summary: {
type: Object,
default: null,
},
});
</script>
<template>
<CardDescriptor
v-bind="$attrs"
:id="entityId"
:card="PropertyCard"
title="name"
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.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" />
</template>
</CardDescriptor>
</template>

View File

@ -0,0 +1,42 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnDmsList from 'src/components/common/VnDmsList.vue';
import PropertyDmsImportForm from 'src/pages/Property/Card/PropertyDmsImportForm.vue';
const { t } = useI18n();
const dmsListRef = ref(null);
const showImportDialog = ref(false);
const onDataSaved = () => dmsListRef.value.dmsRef.fetch();
</script>
<template>
<VnDmsList
ref="dmsListRef"
model="PropertyDms"
update-model="PropertyDms"
delete-model="PropertyDms"
download-model="dms"
default-dms-code="property"
filter="propertyFk"
/>
<QDialog v-model="showImportDialog">
<PropertyDmsImportForm @on-data-saved="onDataSaved()" />
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 90]">
<QBtn
fab
color="primary"
icon="file_copy"
@click="showImportDialog = true"
class="fill-icon"
data-cy="importBtn"
>
<QTooltip>
{{ t('globals.import') }}
</QTooltip>
</QBtn>
</QPageSticky>
</template>

View File

@ -0,0 +1,65 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnSelect from 'src/components/common/VnSelect.vue';
import FormModelPopup from 'components/FormModelPopup.vue';
import FetchData from 'components/FetchData.vue';
import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
const { notify } = useNotify();
const route = useRoute();
const dmsOptions = ref([]);
const dmsId = ref(null);
const importDms = async () => {
try {
if (!dmsId.value) throw new Error(t(`globals.errors.documentIdEmpty`));
const data = {
propertyFk: route.params.id,
dmsFk: dmsId.value,
};
await axios.post('propertyDms', data);
notify(t('globals.dataSaved'), 'positive');
dmsId.value = null;
emit('onDataSaved');
} catch (e) {
throw e;
}
};
</script>
<template>
<FetchData
url="Dms"
:filter="{ fields: ['id'], order: 'id ASC' }"
auto-load
@on-fetch="(data) => (dmsOptions = data)"
/>
<FormModelPopup
model="DmsImport"
:title="t('globals.selectDocumentId')"
:form-initial-data="{}"
:save-fn="importDms"
>
<template #form-inputs>
<VnSelect
:label="t('globals.document')"
:options="dmsOptions"
hide-selected
option-label="id"
option-value="id"
v-model="dmsId"
/>
</template>
</FormModelPopup>
</template>

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Property" url="/PropertyLogs" />
</template>

View File

@ -0,0 +1,33 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const state = useState();
const user = state.getUser();
const propertyId = computed(() => route.params.id);
const noteFilter = computed(() => {
return {
order: 'created DESC',
where: { propertyFk: propertyId.value },
};
});
const body = {
propertyFk: propertyId.value,
workerFk: user.value.id,
};
</script>
<template>
<VnNotes
url="propertyObservations"
:add-note="true"
:filter="noteFilter"
:body="body"
required
/>
</template>

View File

@ -0,0 +1,349 @@
<script setup>
import { onMounted, ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { dashIfEmpty, toDate, toCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { getUrl } from 'src/composables/getUrl';
import useNotify from 'src/composables/useNotify.js';
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 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();
const { t } = useI18n();
const $props = defineProps({
id: {
type: Number,
default: null,
},
});
const dmsColumns = ref([
{
align: 'left',
label: t('globals.id'),
name: 'id',
field: ({ id }) => id,
},
{
align: 'left',
label: t('globals.type'),
name: 'type',
field: ({ type }) => type?.name,
},
{
align: 'left',
label: t('globals.order'),
name: 'order',
field: ({ hardCopyNumber }) => dashIfEmpty(hardCopyNumber),
},
{
align: 'left',
label: t('globals.reference'),
name: 'reference',
field: ({ reference }) => dashIfEmpty(reference),
},
{
align: 'left',
label: t('globals.description'),
name: 'description',
field: ({ description }) => dashIfEmpty(description),
},
{
align: 'left',
label: t('globals.original'),
name: 'hasFile',
toolTip: t('The documentation is available in paper form'),
component: 'checkbox',
field: ({ hasFile }) => hasFile,
},
{
align: 'left',
label: t('globals.worker'),
name: 'worker',
field: ({ worker }) => worker?.name,
},
{
align: 'left',
label: t('globals.created'),
name: 'created',
field: ({ created }) => toDate(created),
},
]);
const entityId = computed(() => $props.id || route.params.id);
const summary = ref();
const property = computed(() => summary.value?.entity);
const propertyUrl = ref();
const propertyDms = ref(null);
const descriptorData = useArrayData('Property');
onMounted(async () => {
propertyUrl.value = (await getUrl('property/')) + entityId.value + '/';
});
function toPropertyUrl(section) {
return '#/property/' + entityId.value + '/' + section;
}
</script>
<template>
<FetchData
ref="propertyDms"
:url="`Properties/${entityId}/dms`"
@on-fetch="
(data) => {
propertyDms.value = data;
}
"
/>
<CardSummary
ref="summary"
:url="`Properties/${entityId}/summary`"
data-key="PropertySummary"
v-bind="$attrs.width"
>
<template #header-left>
<VnToSummary
v-if="route?.name !== 'PropertySummary'"
:route-name="'PropertySummary'"
:entity-id="entityId"
:url="PropertyUrl"
/>
</template>
<template #header="{ entity }">
<div>Property #{{ entity.id }} - {{ entity.name }}</div>
</template>
<template #menu="{ entity }">
<!-- <PropertyDescriptorMenu :ticket="entity" /> -->
</template>
<template #body="{ entity }">
<QCard class="vn-one">
<VnTitle
:url="toPropertyUrl('basic-data')"
:text="t('globals.summary.basicData')"
data-cy="titleBasicDataBlock1"
/>
<div class="vn-card-group">
<div class="vn-card-content">
<VnLv
:label="t('property.owner')"
:value="dashIfEmpty(entity.company.code)"
/>
<VnLv
:label="t('property.map')"
:value="dashIfEmpty(entity.url)"
copy
>
<template #value>
<a
v-if="entity?.url"
:href="`${entity?.url}`"
target="_blank"
class="grafana"
data-cy="propertyMapLink"
>
{{ t('property.goToMap') }}
</a>
</template>
</VnLv>
<VnLv
: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)"
copy
/>
<VnLv
:label="t('property.purchased')"
:value="toDate(entity.purchased)"
/>
<VnLv
:label="t('property.booked')"
:value="toDate(entity.booked)"
/>
</div>
</div>
</QCard>
<QCard class="vn-one">
<VnTitle
:url="toPropertyUrl('basic-data')"
:text="t('globals.summary.basicData')"
data-cy="titleBasicDataBlock2"
/>
<div class="vn-card-content">
<VnLv
:label="t('property.cadaster')"
:value="dashIfEmpty(entity.cadaster)"
copy
/>
<VnLv
:label="t('property.smallHolding')"
:value="dashIfEmpty(entity.smallHolding)"
/>
<VnLv :label="t('property.area')" :value="dashIfEmpty(entity.area)" />
<VnLv
:label="t('property.allocation')"
:value="dashIfEmpty(entity.allocation)"
/>
<VnLv
:label="t('property.town')"
:value="dashIfEmpty(entity.town.name)"
/>
<VnLv :label="t('property.m2')" :value="dashIfEmpty(entity.m2)" />
</div>
</QCard>
<QCard class="vn-one">
<VnTitle
:url="toPropertyUrl('basic-data')"
:text="t('globals.summary.basicData')"
data-cy="titleBasicDataBlock3"
/>
<div class="vn-card-content">
<VnLv
:label="t('property.registry')"
:value="dashIfEmpty(entity.registry)"
/>
<VnLv :label="t('property.tome')" :value="dashIfEmpty(entity.tome)" />
<VnLv :label="t('property.book')" :value="dashIfEmpty(entity.book)" />
<VnLv :label="t('property.page')" :value="dashIfEmpty(entity.page)" />
<VnLv :label="t('property.farm')" :value="dashIfEmpty(entity.farm)" />
<VnLv
:label="t('property.registration')"
:value="dashIfEmpty(entity.registration)"
/>
</div>
</QCard>
<QCard v-if="entity?.propertyDms.length > 0" class="vn-max">
<VnTitle
:url="toPropertyUrl('dms')"
:text="t('globals.pageTitles.dms')"
data-cy="titleDmsBlock"
/>
<QTable :columns="dmsColumns" :rows="entity?.propertyDms" flat>
<template #header="props">
<QTr :props="props">
<QTh auto-width class="text-left">{{ t('globals.id') }}</QTh>
<QTh auto-width class="text-left">{{
t('globals.type')
}}</QTh>
<QTh auto-width class="text-left">{{
t('globals.order')
}}</QTh>
<QTh auto-width class="text-left">{{
t('globals.reference')
}}</QTh>
<QTh auto-width class="text-left">{{
t('globals.description')
}}</QTh>
<QTh auto-width class="text-center">{{
t('globals.original')
}}</QTh>
<QTh auto-width class="text-left">{{
t('globals.worker')
}}</QTh>
<QTh auto-width class="text-center">{{
t('globals.created')
}}</QTh>
</QTr>
</template>
<template #body="props">
<QTr :props="props">
<QTd class="text-left">{{ props.row.dms.id }}</QTd>
<QTd class="text-left">{{ props.row.dms.dmsType.name }}</QTd>
<QTd class="text-left">{{
props.row.dms.hardCopyNumber
}}</QTd>
<QTd class="text-left">{{ props.row.dms.reference }}</QTd>
<QTd class="text-left">{{ props.row.dms.description }}</QTd>
<QTd class="text-center"
><VnCheckbox
:disable="true"
v-model="props.row.dms.hasFile"
/></QTd>
<QTd class="text-left"
><span class="link" @click.stop
>{{ props.row.dms.worker.firstName
}}<WorkerDescriptorProxy
:id="props.row.dms.worker.id" /></span
></QTd>
<QTd class="text-center">{{
toDate(props.row.dms.created)
}}</QTd>
</QTr>
</template>
</QTable>
</QCard>
<QCard v-if="entity?.notes.length > 0" class="vn-max">
<VnTitle
:url="toPropertyUrl('notes')"
:text="t('globals.notes')"
data-cy="titleNotesBlock"
/>
<QCardSection
v-if="entity?.notes"
v-for="note in entity?.notes"
horizontal
class="q-pb-sm"
>
<VnAvatar
:descriptor="false"
:worker-id="note.workerFk"
size="md"
:title="note.worker?.user.nickname"
class="q-pr-xs"
/>
<VnUserLink
:name="`${note.worker.user.name}`"
:worker-id="note.worker.id"
/>
<span class="q-pr-xs">{{ ':' }}</span>
<span class="no-margin">
{{ note.text }}
</span>
</QCardSection>
</QCard>
</template>
</CardSummary>
</template>
<style lang="scss" scoped>
.q-card.q-card--dark.q-dark.vn-one {
& > .bodyCard {
padding: 1%;
}
}
.q-table {
tr,
th,
.q-td {
border-bottom: 1px solid black;
}
}
.grafana {
color: $primary-light;
}
</style>

View File

@ -0,0 +1,182 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
</script>
<template>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`property.params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
v-model="params.id"
:label="t('property.id')"
dense
filled
data-cy="idInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
v-model="params.name"
:label="t('property.name')"
dense
filled
data-cy="nameInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
url="PropertyGroups"
:label="t('property.group')"
v-model="params.propertyGroupFk"
option-value="id"
option-label="description"
dense
filled
data-cy="propertyGroupSelect"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
url="Suppliers"
:label="t('property.notary')"
v-model="params.supplierFk"
option-value="id"
option-label="name"
dense
filled
data-cy="notarySelect"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
v-model="params.protocol"
:label="t('property.protocol')"
dense
filled
data-cy="protocolInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
v-model="params.cadaster"
:label="t('property.cadaster')"
filled
dense
data-cy="cadasterInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
url="Companies"
:label="t('property.owner')"
v-model="params.companyFk"
option-value="id"
option-label="code"
dense
filled
data-cy="ownerSelect"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
v-model="params.purchased"
:label="t('property.purchased')"
dense
filled
data-cy="purchasedDateInput"
/>
</QItemSection>
<QItemSection>
<VnInputDate
v-model="params.booked"
:label="t('property.booked')"
dense
filled
data-cy="bookedDateInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnCheckbox
v-model="params.hasFormalization"
:label="t('property.hasFormalization')"
dense
filled
data-cy="hasFormalizationCheckbox"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnCheckbox
v-model="params.hasSimpleCopy"
:label="t('property.hasSimpleCopy')"
dense
filled
data-cy="hasSimpleCopyCheckbox"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnCheckbox
v-model="params.hasOriginalPropertyDeed"
:label="t('property.hasOriginalPropertyDeed')"
dense
filled
data-cy="hasOriginalPropertyDeedCheckbox"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnCheckbox
v-model="params.hasFundProvision"
:label="t('property.hasFundProvision')"
dense
filled
data-cy="hasFundProvisionCheckbox"
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>

View File

@ -0,0 +1,307 @@
<script setup>
import { computed, ref } from 'vue';
import { toDate } from 'src/filters/index';
import { useI18n } from 'vue-i18n';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnSection from 'src/components/common/VnSection.vue';
import PropertyFilter from './PropertyFilter.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'src/components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnRow from 'src/components/ui/VnRow.vue';
import SupplierDescriptorProxy from '../Supplier/Card/SupplierDescriptorProxy.vue';
const { t } = useI18n();
const tableRef = ref();
const dataKey = 'PropertyList';
const columns = computed(() => [
{
align: 'right',
name: 'id',
label: t('property.id'),
width: '35px',
chip: {
condition: () => true,
},
isId: true,
},
{
align: 'left',
name: 'name',
label: t('property.name'),
isTitle: true,
},
{
align: 'left',
name: 'propertyGroupFk',
label: t('property.group'),
component: 'select',
attrs: {
url: 'propertyGroups',
fields: ['id', 'description'],
optionValue: 'id',
optionLabel: 'description',
hideSelected: true,
},
format: ({ propertyGroup }) => propertyGroup,
},
{
label: t('property.group'),
name: 'propertyGroup',
cardVisible: true,
visible: false,
},
{
align: 'left',
name: 'notary',
label: t('property.notary'),
cardVisible: true,
},
{
align: 'left',
name: 'protocol',
label: t('property.protocol'),
cardVisible: true,
},
{
align: 'left',
name: 'cadaster',
label: t('property.cadaster'),
cardVisible: true,
},
{
align: 'left',
name: 'companyFk',
label: t('property.owner'),
component: 'select',
attrs: {
url: 'Companies',
fields: ['id', 'code'],
optionValue: 'id',
optionLabel: 'code',
hideSelected: true,
},
format: ({ companyCode }) => companyCode,
},
{
label: t('property.owner'),
name: 'companyCode',
cardVisible: true,
visible: false,
},
{
align: 'left',
name: 'purchased',
label: t('property.purchased'),
component: 'date',
format: ({ purchased }) => toDate(purchased),
},
{
label: t('property.purchased'),
name: 'purchased',
format: ({ purchased }) => toDate(purchased),
cardVisible: true,
visible: false,
},
{
align: 'left',
name: 'booked',
label: t('property.booked'),
component: 'date',
format: ({ booked }) => toDate(booked),
},
{
label: t('property.booked'),
name: 'booked',
format: ({ booked }) => toDate(booked),
cardVisible: true,
visible: false,
},
{
labelAbbreviation: 'Fo',
label: t('property.hasFormalization'),
toolTip: t('property.hasFormalization'),
name: 'hasFormalization',
component: 'checkbox',
width: '35px',
cardVisible: true,
},
{
labelAbbreviation: 'SC',
label: t('property.hasSimpleCopy'),
toolTip: t('property.hasSimpleCopy'),
name: 'hasSimpleCopy',
component: 'checkbox',
width: '35px',
cardVisible: true,
},
{
labelAbbreviation: 'OP',
label: t('property.hasOriginalPropertyDeed'),
toolTip: t('property.hasOriginalPropertyDeed'),
name: 'hasOriginalPropertyDeed',
component: 'checkbox',
width: '35px',
cardVisible: true,
},
{
labelAbbreviation: 'FP',
label: t('property.hasFundProvision'),
toolTip: t('property.hasFundProvision'),
name: 'hasFundProvision',
component: 'checkbox',
width: '35px',
cardVisible: true,
},
]);
</script>
<template>
<VnSection
:data-key="dataKey"
:columns="columns"
prefix="property"
:array-data-props="{
url: 'Properties/filter',
}"
>
<template #advanced-menu>
<PropertyFilter :data-key="dataKey" />
</template>
<template #body>
<VnTable
ref="tableRef"
:data-key="dataKey"
:columns="columns"
redirect="property"
search-url="PropertyList"
:create="{
urlCreate: 'Properties',
title: t('property.createProperty'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {},
}"
:with-filters="false"
:right-search="false"
>
<template #column-name="{ row }">
<span>
{{ row.name }}
<QTooltip>
{{ row.name }}
</QTooltip>
</span>
</template>
<template #column-notary="{ row }">
<span class="link" @click.stop>
{{ row.notary }}
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template>
<template #more-create-dialog="{ data }">
<div class="col-span-2">
<VnRow>
<VnInput v-model="data.name" :label="$t('property.name')" />
</VnRow>
<VnRow>
<VnSelect
url="Suppliers"
v-model="data.supplierFk"
:label="$t('property.notary')"
:fields="['id', 'name']"
hide-selected
/>
<VnInput
v-model="data.protocol"
:label="$t('property.protocol')"
/>
</VnRow>
<VnRow>
<VnSelect
url="Companies"
:fields="['id', 'code']"
v-model="data.companyFk"
:label="$t('property.owner')"
option-value="id"
option-label="code"
hide-selected
/>
<VnSelect
url="PropertyGroups"
:fields="['id', 'description']"
v-model="data.propertyGroupFk"
:label="$t('property.group')"
option-value="id"
option-label="description"
hide-selected
/>
</VnRow>
<VnRow>
<VnInput v-model="data.url" :label="$t('property.map')" />
</VnRow>
<VnRow>
<VnInput v-model="data.value" :label="$t('property.value')" />
<VnInputDate
placeholder="dd-mm-aaa"
:label="$t('property.purchased')"
v-model="data.purchased"
/>
<VnInputDate
placeholder="dd-mm-aaa"
:label="$t('property.booked')"
v-model="data.booked"
/>
</VnRow>
<VnRow>
<VnInput
v-model="data.cadaster"
:label="$t('property.cadaster')"
/>
</VnRow>
<VnRow>
<VnInput
v-model="data.smallHolding"
:label="$t('property.smallHolding')"
/>
<VnInput v-model="data.area" :label="$t('property.area')" />
<VnInput
v-model="data.allocation"
:label="$t('property.allocation')"
/>
</VnRow>
<VnRow>
<VnSelect
url="Towns"
v-model="data.townFk"
:label="$t('property.town')"
:fields="['id', 'name']"
:options="towns"
option-value="id"
option-label="name"
hide-selected
/>
<VnInput v-model="data.m2" :label="$t('property.m2')" />
<VnInput
v-model="data.registry"
:label="$t('property.registry')"
/>
</VnRow>
<VnRow>
<VnInput v-model="data.tome" :label="$t('property.tome')" />
<VnInput v-model="data.book" :label="$t('property.book')" />
<VnInput v-model="data.page" :label="$t('property.page')" />
<VnInput v-model="data.farm" :label="$t('property.farm')" />
</VnRow>
<VnInput
v-model="data.registration"
:label="$t('property.registration')"
/>
</div>
</template>
</VnTable>
</template>
</VnSection>
</template>

View File

@ -0,0 +1,47 @@
property:
search: Search property
searchInfo: Search property by id or name
id: Id
name: Name
cadaster: Cadaster
smallHolding: Small holding
area: Area
town: Town
registry: Registry
volume: Volume
book: Book
page: Page
farm: Farm
registration: Registration
value: Value
group: Group
m2: m2
owner: Owner
allocation: Allocation
tome: Tome
map: Map
notary: Notary
protocol: Notarial protocol
purchased: Purchased date
booked: Booked date
createProperty: Create property
goToMap: Link to map
hasFormalization: Formalization
hasSimpleCopy: Simple copy
hasOriginalPropertyDeed: Original property deed
hasFundProvision: Fund provision
params:
search: General search
id: Id
name: Name
supplierFk: Notary
propertyGroupFk: Group
protocol: Notarial protocol
companyFk: Owner
purchased: Purchased date
booked: Booked date
cadaster: Cadaster
hasFormalization: Formalization
hasSimpleCopy: Simple copy
hasOriginalPropertyDeed: Original property deed
hasFundProvision: Fund provision

View File

@ -0,0 +1,47 @@
property:
search: Buscar propiedad
searchInfo: Buscar propiedad por id o nombre
id: Id
name: Nombre
cadaster: Ref. catastral
smallHolding: Parcela
area: Polígono
town: Municipio
registry: Registro urbanístico
volume: Volumen
book: Libro
page: Folio
farm: Finca
registration: Inscripción
value: Valor
group: Grupo
m2: m2
owner: Propietario
allocation: Partida
tome: Volumen
map: Mapa
notary: Notario
protocol: Prot. notarial
purchased: F. compra
booked: F. finalización
createProperty: Nueva propiedad
goToMap: Ir al mapa
hasFormalization: Formalización
hasSimpleCopy: Copia simple
hasOriginalPropertyDeed: Escritura original
hasFundProvision: Provisión de fondos
params:
search: Búsqueda general
id: Id
name: Nombre
supplierFk: Notario
propertyGroupFk: Grupo
protocol: Prot. notarial
companyFk: Propietario
purchased: F. compra
booked: F. finalización
cadaster: Ref. catastral
hasFormalization: Formalización
hasSimpleCopy: Copia simple
hasOriginalPropertyDeed: Escritura original
hasFundProvision: Provisión de fondos

View File

@ -28,7 +28,6 @@ const body = {
:add-note="true"
:filter="noteFilter"
:body="body"
style="overflow-y: auto"
required
deletable
/>

View File

@ -35,13 +35,8 @@ const onDataSaved = () => dmsListRef.value.dmsRef.fetch();
class="fill-icon"
>
<QTooltip>
{{ t('Import from existing') }}
{{ t('globals.import') }}
</QTooltip>
</QBtn>
</QPageSticky>
</template>
<i18n>
es:
Import from existing: Importar desde existente
</i18n>

View File

@ -22,7 +22,7 @@ const dmsId = ref(null);
const importDms = async () => {
try {
if (!dmsId.value) throw new Error(t(`The document identifier can't be empty`));
if (!dmsId.value) throw new Error(t(`globals.errors.documentIdEmpty`));
const data = {
ticketFk: route.params.id,
@ -34,7 +34,7 @@ const importDms = async () => {
dmsId.value = null;
emit('onDataSaved');
} catch (e) {
throw new Error(e.message);
throw e;
}
};
</script>
@ -49,14 +49,14 @@ const importDms = async () => {
<FormModelPopup
url-create="genera"
model="DmsImport"
:title="t('Select document id')"
:title="t('globals.selectDocumentId')"
:form-initial-data="{}"
:save-fn="importDms"
>
<template #form-inputs>
<VnRow>
<VnSelect
:label="t('Document')"
:label="t('globals.document')"
:options="dmsOptions"
hide-selected
option-label="id"
@ -67,10 +67,3 @@ const importDms = async () => {
</template>
</FormModelPopup>
</template>
<i18n>
es:
Select document id: Introduzca id de gestion documental
Document: Documento
The document indentifier can't be empty: El número de documento no puede estar vacío
</i18n>

View File

@ -15,6 +15,7 @@ import Entry from './entry';
import Zone from './zone';
import Account from './account';
import Monitor from './monitor';
import Property from './property';
export default [
Item,
@ -34,4 +35,5 @@ export default [
Zone,
Account,
Monitor,
Property,
];

View File

@ -0,0 +1,100 @@
import { RouterView } from 'vue-router';
const propertyCard = {
name: 'PropertyCard',
path: ':id',
component: () => import('src/pages/Property/Card/PropertyCard.vue'),
redirect: { name: 'PropertySummary' },
meta: {
menu: ['PropertyBasicData', 'PropertyDms', 'PropertyNotes', 'PropertyLog'],
},
children: [
{
name: 'PropertySummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'view_list',
},
component: () => import('pages/Property/Card/PropertySummary.vue'),
},
{
name: 'PropertyBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Property/Card/PropertyBasicData.vue'),
},
{
name: 'PropertyDms',
path: 'dms',
meta: {
title: 'dms',
icon: 'cloud_upload',
},
component: () => import('pages/Property/Card/PropertyDms.vue'),
},
{
name: 'PropertyNotes',
path: 'notes',
meta: {
title: 'notes',
icon: 'note',
},
component: () => import('pages/Property/Card/PropertyNotes.vue'),
},
{
name: 'PropertyLog',
path: 'history',
meta: {
title: 'history',
icon: 'history',
},
component: () => import('pages/Property/Card/PropertyLog.vue'),
},
],
};
export default {
name: 'Property',
path: '/property',
meta: {
title: 'properties',
icon: 'apartment',
moduleName: 'Property',
menu: ['PropertyList'],
},
component: RouterView,
redirect: { name: 'PropertyMain' },
children: [
{
name: 'PropertyMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'PropertyIndexMain' },
children: [
{
path: '',
name: 'PropertyIndexMain',
component: () => import('src/pages/Property/PropertyList.vue'),
redirect: { name: 'PropertyList' },
children: [
{
name: 'PropertyList',
path: 'list',
meta: {
title: 'list',
icon: 'view_list',
},
component: () =>
import('src/pages/Property/PropertyList.vue'),
},
propertyCard,
],
},
],
},
],
};

View File

@ -15,6 +15,7 @@ import entry from 'src/router/modules/entry';
import zone from 'src/router/modules/zone';
import account from './modules/account';
import monitor from 'src/router/modules/monitor';
import property from 'src/router/modules/property';
const routes = [
{
@ -83,6 +84,7 @@ const routes = [
entry,
zone,
account,
property,
{
path: '/:catchAll(.*)*',
name: 'NotFound',

View File

@ -18,6 +18,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
'monitor',
'supplier',
'claim',
'property',
'route',
'ticket',
'worker',

View File

@ -0,0 +1,53 @@
describe('Property basic data', () => {
const selectors = {
resetBtn: '#st-actions > .q-btn-group > .q-btn[title="Reset"]',
saveBtn: '#st-actions > .q-btn-group > .q-btn[title="Save"]',
labelName: '[data-cy="Name_input"]',
};
const updateData = {
Name: { val: 'Palacio de Asgard' },
Cadaster: { val: 'REF-123-456' },
Owner: { val: 'VNL', type: 'select' },
Map: { val: 'http://www.google.com' },
'Purchase date': { val: '01-01-2001', type: 'date' },
Value: { val: 500000 },
'Notarial protocol': { val: '1291/2025' },
'Small holding': { val: 195 },
Area: { val: 5 },
Allocation: { val: 'COTES' },
Town: { val: 'Alzira', type: 'select' },
m2: { val: 5000 },
Registry: { val: 'Asgard' },
Tome: { val: 1 },
Book: { val: 1 },
Page: { val: 1 },
Farm: { val: 1 },
Registration: { val: 5 },
'Booked date': { val: '02-02-2002', type: 'date' },
Volume: { val: 1 },
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/property/2/basic-data');
});
it('Should reset property basic data', () => {
cy.get(selectors.labelName)
.should('be.visible')
.click().invoke('text').then((name) => {
name= name.trim();
cy.get(selectors.labelName).click().type(`{selectall}{backspace}Tony Stark`);
cy.get(selectors.resetBtn).click();
cy.containContent(selectors.labelName, name);
});
});
it('Should edit property basic data', () => {
cy.fillInForm(updateData);
cy.get(selectors.saveBtn).click();
cy.checkNotification('Data saved');
});
});

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

@ -0,0 +1,135 @@
describe('Property DMS', () => {
const getBtnSelector = (trPosition, btnPosition) =>
`tr:${trPosition}-child > .text-right > .no-wrap > :nth-child(${btnPosition}) > .q-btn > .q-btn__content > .q-icon`;
const selectors = {
lastRowDownloadBtn: getBtnSelector('last', 1),
firstRowEditBtn: getBtnSelector('first', 2),
lastRowDeleteBtn: getBtnSelector('last', 3),
firstRowDeleteBtn: getBtnSelector('first', 3),
lastRowReference: 'tr:last-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
firstRowReference:
'tr:first-child > :nth-child(5) > .q-tr > :nth-child(1) > span',
firstRowId: 'tr:first-child > :nth-child(2) > .q-tr > :nth-child(1) > span',
lastRowWorkerLink: 'tr:last-child > :nth-child(8) > .q-tr > .link',
descriptorTitle: '.descriptor .title',
summaryGoToSummaryBtn: '.summaryHeader [data-cy="goToSummaryBtn"]',
descriptorOpenSummaryBtn: '.q-menu > .descriptor [data-cy="openSummaryBtn"]',
descriptorGoToSummaryBtn: '.q-menu .descriptor [data-cy="goToSummaryBtn"]',
summaryTitle: '.summaryHeader',
referenceInput: 'Reference_input',
companySelect: 'Company_select',
warehouseSelect: 'Warehouse_select',
typeSelect: 'Type_select',
fileInput: 'VnDms_inputFile',
importBtn: 'importBtn',
addBtn: 'addButton',
saveFormBtn: 'FormModelPopup_save',
};
const data = {
Reference: { val: 'Property:Peter Parker' },
Company: { val: 'VNL', type: 'select' },
Warehouse: { val: 'Warehouse One', type: 'select' },
Type: { val: 'Copia simple', type: 'select' },
};
const updateData = {
Reference: { val: 'Property:Peter Parker House' },
Company: { val: 'CCs', type: 'select' },
Warehouse: { val: 'Warehouse Two', type: 'select' },
Type: { val: 'Escritura original', type: 'select' },
};
const workerSummaryUrlRegex = /worker\/\d+\/summary/;
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/property/1/dms`);
});
it('should display vehicle DMS', () => {
cy.get('.q-table')
.children()
.should('be.visible')
.should('have.length.greaterThan', 0);
});
it('Should create new DMS', () => {
cy.dataCy(selectors.addBtn).click();
cy.fillInForm(data);
cy.dataCy(selectors.fileInput).selectFile('test/cypress/fixtures/image.jpg', {
force: true,
});
cy.dataCy(selectors.saveFormBtn).click();
cy.checkNotification('Data saved');
});
it('Should edit DMS', () => {
cy.get(selectors.firstRowEditBtn).click();
cy.fillInForm(updateData);
cy.dataCy(selectors.saveFormBtn).click();
cy.checkNotification('Data saved');
cy.validateContent(selectors.firstRowReference, updateData.Reference.val);
});
it('Should delete DMS', () => {
cy.get(selectors.firstRowDeleteBtn).click();
cy.clickConfirm();
cy.checkNotification('Data deleted');
cy.validateContent(selectors.firstRowReference, '1');
});
it('Should import DMS', () => {
const data = {
Document: { val: '10', type: 'select' },
};
cy.dataCy(selectors.importBtn).click();
cy.fillInForm(data);
cy.dataCy(selectors.saveFormBtn).click();
cy.checkNotification('Data saved');
cy.validateContent(selectors.lastRowReference, '1');
cy.get(selectors.lastRowDeleteBtn).click();
cy.clickConfirm();
});
it('Should download DMS', () => {
const downloadsFolder = Cypress.config('downloadsFolder');
cy.get(selectors.lastRowDownloadBtn).click();
cy.wait(3000);
const fileName = '1.txt';
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
});
describe('Worker pop-ups', () => {
it('Should redirect to the worker summary from worker descriptor pop-up', () => {
cy.get(selectors.lastRowWorkerLink)
.should('be.visible')
.click()
.invoke('text')
.then((workerName) => {
workerName = workerName.trim();
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.location().should('match', workerSummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, workerName);
});
});
it('Should redirect to the worker summary from summary pop-up from the worker descriptor pop-up', () => {
cy.get(selectors.lastRowWorkerLink)
.should('be.visible')
.click()
.invoke('text')
.then((workerName) => {
workerName = workerName.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.location().should('match', workerSummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, workerName);
});
});
});
});

View File

@ -0,0 +1,102 @@
describe('Property list', () => {
const selectors = {
firstRow: 'tr:first-child > [data-col-field="name"]',
firstRowNotaryLink: 'tr:first-child > [data-col-field="notary"] > .no-padding > .link',
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"]',
};
const summaryUrlRegex = /property\/\d+\/summary/;
const notarySummaryUrlRegex = /supplier\/\d+\/summary/;
const data = {
Name: { val: 'Palacio de Asgard' },
Notary: { val: 'VNL', type: 'select' },
'Notarial protocol': { val: '1291/2025' },
Owner: { val: 'VNL', type: 'select' },
Group: { val: 'Cotes', type: 'select' },
Map: { val: 'http://www.google.com' },
Value: { val: 150000 },
'Purchase date': { val: '01-01-2001', type: 'date' },
'Booked date': { val: '01-01-2002', type: 'date' },
Cadaster: { val: 'REF-123-456' },
'Small holding': { val: 195 },
Area: { val: 3 },
Allocation: { val: 'COTES' },
Town: { val: 'Alzira', type: 'select' },
m2: { val: 120000 },
Registry: { val: 'Asgard' },
Tome: { val: 1 },
Book: { val: 1 },
Page: { val: 1 },
Farm: { val: 1 },
Registration: { val: 2 },
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit('/#/property/list');
cy.typeSearchbar('{enter}');
});
it('Should list properties', () => {
cy.get('.q-table')
.children()
.should('be.visible')
.should('have.length.greaterThan', 0);
});
it('Should redirect to the property summary when clicking the row', () => {
cy.get(selectors.firstRow)
.should('be.visible')
.click()
.invoke('text')
.then((name) => {
name = name.trim();
cy.location().should('match', summaryUrlRegex);
cy.containContent(selectors.descriptorTitle, name);
});
});
it('Should create new property', () => {
cy.addBtnClick();
cy.fillInForm(data);
cy.dataCy('FormModelPopup_save').should('be.visible').click();
cy.checkNotification('Data created');
cy.location().should('match', summaryUrlRegex);
cy.containContent(selectors.descriptorTitle, data.Name.val);
});
describe('Notary pop-ups', () => {
it('Should redirect to the notary summary from notary descriptor pop-up', () => {
cy.get(selectors.firstRowNotaryLink)
.should('be.visible')
.click()
.invoke('text')
.then((notaryName) => {
notaryName = notaryName.trim();
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.firstRowNotaryLink)
.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);
});
});
});
});

View File

@ -0,0 +1,26 @@
describe('Property notes', () => {
const selectors = {
addNoteInput: 'Add note here..._input',
saveNoteBtn: 'saveNote',
noteCard: '.column.full-width > :nth-child(1) > .q-card__section--vert',
};
const newNoteText = 'Cristal ventana salon roto';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('#/property/1/notes');
});
it('Should show the property notes', () => {
cy.get(selectors.noteCard)
.first()
.should('contain', 'Golpe en la puerta de entrada');
});
it('Should add a new note', () => {
cy.dataCy(selectors.addNoteInput).should('be.visible').type(newNoteText);
cy.dataCy(selectors.saveNoteBtn).click();
cy.get(selectors.noteCard).last().should('contain', newNoteText);
});
});

View File

@ -0,0 +1,146 @@
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';
const basicDataUrlRegex = /property\/1\/basic-data/;
const dmsUrlRegex = /property\/1\/dms/;
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(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(url);
});
it('Should load summary', () => {
cy.containContent(selectors.summaryTitle, propertyName);
cy.containContent(selectors.descriptorTitle, propertyName);
});
it('Should redirect to the corresponding section when clicking on the icons in the left menu', () => {
cy.dataCy(selectors.basicDataIcon).click();
cy.location().should('match', basicDataUrlRegex);
cy.visit(url);
cy.dataCy(selectors.dmsIcon).click();
cy.location().should('match', dmsUrlRegex);
cy.visit(url);
cy.dataCy(selectors.notesIcon).click();
cy.location().should('match', notesUrlRegex);
cy.visit(url);
cy.dataCy(selectors.logIcon).click();
cy.location().should('match', logUrlRegex);
});
it('Should redirect to property basic-data when clicking on basic-data title links', () => {
cy.get(selectors.summaryBasicDataBlock1Link).click();
cy.location().should('match', basicDataUrlRegex);
cy.visit(url);
cy.get(selectors.summaryBasicDataBlock2Link).click();
cy.location().should('match', basicDataUrlRegex);
cy.visit(url);
cy.get(selectors.summaryBasicDataBlock3Link).click();
cy.location().should('match', basicDataUrlRegex);
});
it('Should redirect to property DMS when clicking on DMS title', () => {
cy.get(selectors.summaryDmsBlockLink).click();
cy.location().should('match', dmsUrlRegex);
});
it('Should redirect to property notes when clicking on notes title', () => {
cy.get(selectors.summaryNotesBlockLink).click();
cy.location().should('match', notesUrlRegex);
});
it('Should redirect to property map', () => {
cy.get(selectors.summaryPropertyMapLink).invoke('removeAttr', 'target').click();
cy.origin('https://www1.sedecatastro.gob.es', () => {
cy.location().should('match', /sedecatastro.gob.es/);
});
});
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.dmsFirstRowWorkerLink)
.should('be.visible')
.click()
.invoke('text')
.then((workerName) => {
workerName = workerName.trim();
cy.get(selectors.descriptorGoToSummaryBtn).click();
cy.location().should('match', workerSummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, workerName);
});
});
it('Should redirect to the worker summary from summary pop-up from the worker descriptor pop-up', () => {
cy.get(selectors.dmsFirstRowWorkerLink)
.should('be.visible')
.click()
.invoke('text')
.then((workerName) => {
workerName = workerName.trim();
cy.get(selectors.descriptorOpenSummaryBtn).click();
cy.get(selectors.summaryGoToSummaryBtn).click();
cy.location().should('match', workerSummaryUrlRegex);
cy.containContent(selectors.descriptorTitle, workerName);
});
});
});
});

View File

@ -114,7 +114,7 @@ describe.skip('Route extended list', () => {
fillField(selector, type, value);
});
cy.get('[title="Reset"]').click();
cy.get(selectors.resetBtn).click();
originalFields.forEach(({ selector, value }) => {
cy.validateContent(selector, value);