Upgrade ui-bool

This commit is contained in:
philipp lang 2023-09-06 23:40:14 +02:00
parent 71da52791d
commit 560881725d
2 changed files with 11 additions and 8 deletions
resources/js
components/ui
views/member

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="bool" v-tooltip="comment" :class="modelValue ? 'enabled' : 'disabled'"> <div v-tooltip="comment" class="bool" :class="value ? 'enabled' : 'disabled'">
<ui-sprite v-if="!$slots.default" :src="modelValue ? 'check' : 'close'"></ui-sprite> <ui-sprite v-if="!$slots.default" :src="value ? 'check' : 'close'"></ui-sprite>
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
@ -8,20 +8,23 @@
<script> <script>
export default { export default {
props: { props: {
modelValue: {}, value: {
type: Boolean,
default: () => false,
},
trueComment: {}, trueComment: {},
falseComment: {}, falseComment: {},
}, },
computed: { computed: {
t() { t() {
return this.modelValue ? 'Ja' : 'Nein'; return this.value ? 'Ja' : 'Nein';
}, },
comment() { comment() {
if (this.modelValue && this.trueComment) { if (this.value && this.trueComment) {
return this.trueComment; return this.trueComment;
} }
if (!this.modelValue && this.falseComment) { if (!this.value && this.falseComment) {
return this.falseComment; return this.falseComment;
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="bool-row"> <div class="bool-row">
<ui-bool true-comment="In NaMi eingetragen" false-comment="Nicht in NaMi eingetragen" v-model="member.has_nami">N</ui-bool> <ui-bool true-comment="In NaMi eingetragen" false-comment="Nicht in NaMi eingetragen" :value="member.has_nami">N</ui-bool>
<ui-bool true-comment="Mittendrin abonniert" false-comment="Mittendrin nicht abonníert" v-model="member.send_newspaper">M</ui-bool> <ui-bool true-comment="Mittendrin abonniert" false-comment="Mittendrin nicht abonníert" :value="member.send_newspaper">M</ui-bool>
</div> </div>
</template> </template>