[events] Show if event needs service (spinner)

This commit is contained in:
Ferdinand Thiessen 2021-04-04 21:36:18 +02:00
parent 5780c73608
commit 494a555985
1 changed files with 24 additions and 11 deletions

View File

@ -1,16 +1,20 @@
<template> <template>
<q-card <q-card class="q-mx-xs q-mt-sm rounded-borders shadow-5" bordered>
class="q-mx-xs q-mt-sm justify-start content-center items-center rounded-borders shadow-5" <q-spinner-rings
bordered v-if="serviceNeeded"
> size="100%"
<q-card-section class="text-primary q-pa-xs"> style="max-height: min(3vw, 3em); max-width: min(3vw, 3em); position: absolute"
<div class="text-weight-bolder text-center" style="font-size: 1.5vw"> color="warning"
{{ event.type.name />
}}<template v-if="event.name" <q-card-section class="text-primary q-pa-xs" style="font-size: clamp(1em, 1.5vw, 1.6em)">
>: <span style="font-size: 1.2vw">{{ event.name }}</span> <div class="text-weight-bolder text-center">
</template> {{ event.type.name }}<template v-if="event.name">: </template
><span style="font-size: 0.9em">
{{ event.name }}
</span>
</div> </div>
<div v-if="event.description" class="text-weight-medium" style="font-size: 1vw">
<div v-if="event.description" class="text-weight-medium" style="font-size: 0.75em">
{{ event.description }} {{ event.description }}
</div> </div>
</q-card-section> </q-card-section>
@ -78,6 +82,14 @@ export default defineComponent({
set: (v) => emit('update:modelValue', v), set: (v) => emit('update:modelValue', v),
}); });
const serviceNeeded = computed(() =>
props.modelValue.jobs.some(
(job) =>
job.required_services >
job.services.reduce((p, c) => ((c.value += p.value) && c) || c, { value: 0 }).value
)
);
function remove() { function remove() {
emit('removeEvent', props.modelValue.id); emit('removeEvent', props.modelValue.id);
} }
@ -91,6 +103,7 @@ export default defineComponent({
edit, edit,
event, event,
remove, remove,
serviceNeeded,
}; };
}, },
}); });