refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
91
resources/js/components/partials/form/Toggle.vue
Normal file
91
resources/js/components/partials/form/Toggle.vue
Normal file
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<div>
|
||||
<label
|
||||
v-if="title"
|
||||
:for="realId"
|
||||
class="mb2"
|
||||
:class="{ b: required }"
|
||||
>
|
||||
{{ title }}
|
||||
</label>
|
||||
<toggle-button
|
||||
:id="realId"
|
||||
:name="id"
|
||||
:class="inputClass"
|
||||
:sync="true"
|
||||
:labels="labels"
|
||||
:disabled="disabled"
|
||||
:value="selectedOption"
|
||||
@input="$emit('input', $event)"
|
||||
@change="$emit('change', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ToggleButton } from 'vue-js-toggle-button';
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
ToggleButton
|
||||
},
|
||||
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
labels: {
|
||||
type: [Boolean, Object],
|
||||
default: false,
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
required: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
iclass: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
selectedOption: null,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
realId() {
|
||||
return this.id + this._uid;
|
||||
},
|
||||
inputClass() {
|
||||
return this.iclass !== '' ? this.iclass : '';
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
value: function (newValue) {
|
||||
this.selectedOption = newValue;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.selectedOption = this.value;
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user