0
0
Fork 0

refs #5986 refactored ticket stateColor

This commit is contained in:
Jorge Penadés 2023-08-08 13:48:36 +02:00
parent 8ba7615aee
commit eb95ff18ec
2 changed files with 19 additions and 12 deletions

View File

@ -67,12 +67,7 @@ const filter = {
}, },
], ],
}; };
function stateColor(state) {
if (state.code === 'OK') return 'text-green';
if (state.code === 'FREE') return 'text-blue-3';
if (state.alertLevel === 1) return 'text-primary';
if (state.alertLevel === 0) return 'text-red';
}
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => const setData = (entity) =>
(data.value = useCardDescription(entity.client.name, entity.id)); (data.value = useCardDescription(entity.client.name, entity.id));
@ -93,9 +88,15 @@ const setData = (entity) =>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv v-if="entity.ticketState" :label="t('ticket.card.state')"> <VnLv v-if="entity.ticketState" :label="t('ticket.card.state')">
<template #value> <template #value>
<span :class="stateColor(entity.ticketState.state)"> <QBadge
:color="
entity.ticketState.state.classColor
? entity.ticketState.state.classColor
: 'dark'
"
>
{{ entity.ticketState.state.name }} {{ entity.ticketState.state.name }}
</span> </QBadge>
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('ticket.card.shipped')" :value="toDate(entity.shipped)" /> <VnLv :label="t('ticket.card.shipped')" :value="toDate(entity.shipped)" />

View File

@ -135,10 +135,16 @@ async function changeState(value) {
<QItemLabel caption> <QItemLabel caption>
{{ t('ticket.summary.state') }} {{ t('ticket.summary.state') }}
</QItemLabel> </QItemLabel>
<QItemLabel <QItemLabel>
:class="stateColor(ticket.ticketState.state)" <QBadge
> :color="
{{ ticket.ticketState.state.name }} ticket.ticketState.state.classColor
? ticket.ticketState.state.classColor
: 'dark'
"
>
{{ ticket.ticketState.state.name }}
</QBadge>
</QItemLabel> </QItemLabel>
</QItemSection> </QItemSection>
</QItem> </QItem>