0
0
Fork 0

refactors

This commit is contained in:
Alex Moreno 2024-07-08 09:00:01 +02:00
parent 5ec40ac6cf
commit 5be762d781
4 changed files with 23 additions and 20 deletions

View File

@ -57,9 +57,9 @@ onBeforeMount(async () => {
}); });
store = arrayData.store; store = arrayData.store;
entity = computed(() => { entity = computed(() => {
const data = Array.isArray(store.data) ? store.data[0] : store.data; const data = (Array.isArray(store.data) ? store.data[0] : store.data) ?? {};
if (data) emit('onFetch', data ?? {}); if (data) emit('onFetch', data);
return data ?? {}; return data;
}); });
// It enables to load data only once if the module is the same as the dataKey // It enables to load data only once if the module is the same as the dataKey
@ -90,9 +90,9 @@ function getValueFromPath(path) {
const keys = path.toString().split('.'); const keys = path.toString().split('.');
let current = entity.value; let current = entity.value;
for (let i = 0; i < keys.length; i++) { for (const key of keys) {
if (current[keys[i]] === undefined) return undefined; if (current[key] === undefined) return undefined;
else current = current[keys[i]]; else current = current[key];
} }
return current; return current;
} }

View File

@ -42,7 +42,7 @@ function stateColor(code) {
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {
if (!entity) return; if (!entity) return;
data.value = useCardDescription(entity.client.name, entity.id); data.value = useCardDescription(entity?.client?.name, entity.id);
state.set('ClaimDescriptor', entity); state.set('ClaimDescriptor', entity);
}; };
onMounted(async () => { onMounted(async () => {

View File

@ -35,6 +35,9 @@ const ClaimStates = ref([]);
const claimUrl = ref(); const claimUrl = ref();
const salixUrl = ref(); const salixUrl = ref();
const claimDmsRef = ref(); const claimDmsRef = ref();
const claimDms = ref([]);
const multimediaDialog = ref();
const multimediaSlide = ref();
const claimDmsFilter = ref({ const claimDmsFilter = ref({
include: [ include: [
{ {
@ -43,11 +46,6 @@ const claimDmsFilter = ref({
], ],
}); });
onMounted(async () => {
salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
});
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
@ -101,12 +99,18 @@ const detailsColumns = ref([
}, },
]); ]);
const markerLabels = [
{ value: 1, label: t('claim.company') },
{ value: 5, label: t('claim.person') },
];
const STATE_COLOR = { const STATE_COLOR = {
pending: 'warning', pending: 'warning',
incomplete: 'info', incomplete: 'info',
resolved: 'positive', resolved: 'positive',
canceled: 'negative', canceled: 'negative',
}; };
function stateColor(code) { function stateColor(code) {
return STATE_COLOR[code]; return STATE_COLOR[code];
} }
@ -143,9 +147,11 @@ const developmentColumns = ref([
sortable: true, sortable: true,
}, },
]); ]);
const claimDms = ref([]);
const multimediaDialog = ref(); onMounted(async () => {
const multimediaSlide = ref(); salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
});
async function getClaimDms() { async function getClaimDms() {
claimDmsFilter.value.where = { claimFk: entityId.value }; claimDmsFilter.value.where = { claimFk: entityId.value };
@ -380,10 +386,7 @@ async function changeState(value) {
label-always label-always
color="var()" color="var()"
markers markers
:marker-labels="[ :marker-labels="markerLabels"
{ value: 1, label: t('claim.company') },
{ value: 5, label: t('claim.person') },
]"
:min="1" :min="1"
:max="5" :max="5"
readonly readonly

View File

@ -36,7 +36,7 @@ const states = ref([]);
lazy-rules lazy-rules
is-outlined is-outlined
> >
<template #prepend> <QIcon name="badge" size="xs"></QIcon></template> <template #prepend> <QIcon name="badge" size="xs" /></template>
</VnInput> </VnInput>
<VnInput <VnInput
:label="t('Client Name')" :label="t('Client Name')"