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 setData = (entity) =>
(data.value = useCardDescription(entity.client.name, entity.id));
@ -93,9 +88,15 @@ const setData = (entity) =>
<template #body="{ entity }">
<VnLv v-if="entity.ticketState" :label="t('ticket.card.state')">
<template #value>
<span :class="stateColor(entity.ticketState.state)">
<QBadge
:color="
entity.ticketState.state.classColor
? entity.ticketState.state.classColor
: 'dark'
"
>
{{ entity.ticketState.state.name }}
</span>
</QBadge>
</template>
</VnLv>
<VnLv :label="t('ticket.card.shipped')" :value="toDate(entity.shipped)" />

View File

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