<template>
    <v-sheet
        :outlined="outlined"
        class="rounded-lg"
    >
        <div style="width:100%" class="px-2">
            <v-radio-group
                dense
                hide-details
                outlined
                class="mt-0"
                v-model="control.value"
            >
                <template v-slot:label>
                    <div
                        class="text-body-2 font-weight-bold mb-1"
                        v-html="__('Selectați')"
                    >
                    </div>
                </template>

                <v-radio
                    v-for="(option, index) in control.options()"
                    :key="'option-' + index"
                    :value="option.value"
                    :label="option.text"
                >
                </v-radio>
                
            </v-radio-group>
        </div>

    </v-sheet>
</template>

<script>
    export default {
        props: {
            control: {required: true},
            outlined: {default: true},
        },

        watch: {
            'control.value': function(newValue, oldValue) {
                if(newValue == '0')
                {
                    this.control.operator = 'all';
                }
                else
                {
                    this.control.operator = 'equal';
                }
            }
        },

        name: 'CsRadioFilterControl',        
    }
</script>