forked from verdnatura/salix-front
refactors
This commit is contained in:
parent
5ec40ac6cf
commit
5be762d781
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -36,7 +36,7 @@ const states = ref([]);
|
|||
lazy-rules
|
||||
is-outlined
|
||||
>
|
||||
<template #prepend> <QIcon name="badge" size="xs"></QIcon></template>
|
||||
<template #prepend> <QIcon name="badge" size="xs" /></template>
|
||||
</VnInput>
|
||||
<VnInput
|
||||
:label="t('Client Name')"
|
||||
|
|
Loading…
Reference in New Issue