Skip to content
Snippets Groups Projects
Commit 5c373791 authored by Julian's avatar Julian
Browse files

Create ExtraMarkButtons component

parent 115520ce
No related branches found
No related tags found
1 merge request!400Resolve "Extra marks also in person multiple select in lesson dialog"
<script>
import { extraMarks } from "./extra_marks.graphql";
export default {
name: "ExtraMarkButtons",
data() {
return {
extraMarks: [],
};
},
apollo: {
extraMarks: {
query: extraMarks,
update: (data) => data.items,
skip() {
return this.customExtraMarks > 0;
},
},
},
props: {
customExtraMarks: {
type: Array,
required: false,
default: () => [],
},
},
computed: {
innerExtraMarks() {
if (this.customExtraMarks.length > 0) {
return this.customExtraMarks;
} else {
return this.extraMarks;
}
},
},
methods: {
emit(value) {
this.$emit("input", value);
this.$emit("click", value);
},
},
};
</script>
<template>
<div class="d-flex flex-wrap" style="gap: 0.5em">
<v-skeleton-loader
class="full-width d-flex flex-wrap child-flex-grow-1"
style="gap: 0.5em"
v-if="$apollo.queries.extraMarks.loading"
type="button@4"
/>
<template v-else>
<v-btn
v-for="extraMark in innerExtraMarks"
:key="'extra-mark-' + extraMark.id"
:color="extraMark.colourBg"
:style="{ color: extraMark.colourFg }"
class="flex-grow-1"
@click="emit(extraMark.id)"
>
{{ extraMark.name }}
</v-btn>
</template>
</div>
</template>
<style>
.child-flex-grow-1 > * {
flex-grow: 1;
}
</style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment