diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index 380806540..fe76fceb6 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -57,9 +57,9 @@ onBeforeMount(async () => { }); store = arrayData.store; entity = computed(() => { - const data = Array.isArray(store.data) ? store.data[0] : store.data; - if (data) emit('onFetch', data ?? {}); - return data ?? {}; + const data = (Array.isArray(store.data) ? store.data[0] : store.data) ?? {}; + if (data) emit('onFetch', data); + return data; }); // 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('.'); let current = entity.value; - for (let i = 0; i < keys.length; i++) { - if (current[keys[i]] === undefined) return undefined; - else current = current[keys[i]]; + for (const key of keys) { + if (current[key] === undefined) return undefined; + else current = current[key]; } return current; } diff --git a/src/pages/Claim/Card/ClaimDescriptor.vue b/src/pages/Claim/Card/ClaimDescriptor.vue index 85bc88258..02b63dd8e 100644 --- a/src/pages/Claim/Card/ClaimDescriptor.vue +++ b/src/pages/Claim/Card/ClaimDescriptor.vue @@ -42,7 +42,7 @@ function stateColor(code) { const data = ref(useCardDescription()); const setData = (entity) => { if (!entity) return; - data.value = useCardDescription(entity.client.name, entity.id); + data.value = useCardDescription(entity?.client?.name, entity.id); state.set('ClaimDescriptor', entity); }; onMounted(async () => { diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index 2a679b73d..bf645e1ea 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -35,6 +35,9 @@ const ClaimStates = ref([]); const claimUrl = ref(); const salixUrl = ref(); const claimDmsRef = ref(); +const claimDms = ref([]); +const multimediaDialog = ref(); +const multimediaSlide = ref(); const claimDmsFilter = ref({ include: [ { @@ -43,11 +46,6 @@ const claimDmsFilter = ref({ ], }); -onMounted(async () => { - salixUrl.value = await getUrl(''); - claimUrl.value = salixUrl.value + `claim/${entityId.value}/`; -}); - const detailsColumns = ref([ { 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 = { pending: 'warning', incomplete: 'info', resolved: 'positive', canceled: 'negative', }; + function stateColor(code) { return STATE_COLOR[code]; } @@ -143,9 +147,11 @@ const developmentColumns = ref([ sortable: true, }, ]); -const claimDms = ref([]); -const multimediaDialog = ref(); -const multimediaSlide = ref(); + +onMounted(async () => { + salixUrl.value = await getUrl(''); + claimUrl.value = salixUrl.value + `claim/${entityId.value}/`; +}); async function getClaimDms() { claimDmsFilter.value.where = { claimFk: entityId.value }; @@ -380,10 +386,7 @@ async function changeState(value) { label-always color="var()" markers - :marker-labels="[ - { value: 1, label: t('claim.company') }, - { value: 5, label: t('claim.person') }, - ]" + :marker-labels="markerLabels" :min="1" :max="5" readonly diff --git a/src/pages/Claim/ClaimFilter.vue b/src/pages/Claim/ClaimFilter.vue index eaeaaabbb..b77ac05cf 100644 --- a/src/pages/Claim/ClaimFilter.vue +++ b/src/pages/Claim/ClaimFilter.vue @@ -36,7 +36,7 @@ const states = ref([]); lazy-rules is-outlined > - +