<template>
  <div>
    <q-toggle class="fit" v-if="!showonly" v-model="valueInner" @input="$emit('input',valueInner)" />
    <q-icon
      size="2em"
      v-if="showonly"
      :name="valueInner?'check':'clear'"
      :color="valueInner?'primary':'grey-6'"
    />
  </div>
</template>
<script>
export default {
  name: 'kyb-boolean',
  model: {
    prop: 'value',
    event: 'input'
  },
  props: {
    value: Boolean,
    showonly: Boolean
  },
  watch: {
    value(old) {
      this.valueInner = old
    }
  },
  data: function() {
    return {
      valueInner: this.value || false
    }
  }
}
</script>
