<template>
    <v-select
        dense
        hide-details
        outlined
        :items="app.dataSession.Departamente.selectorItems"
        v-model="myvalue"
    >
    </v-select>
</template>

<script>
    export default {
        props: {
            app: {required: true},
            column: {required: true},
            rowvalues: {required: true},
        },

        data: () => ({
            myvalue: null,
        }),

        watch: {
            rowvalues: {
                deep: true,
                handler: function() {
                    this.myvalue = this.rowvalues['col-' + this.column.id];
                },
            },
            
            myvalue: function(value) {
                let r = {...this.rowvalues};
                r['col-' + this.column.id]  = value;
                this.$emit('update-values', r);
            },
        },

        created() {
            this.myvalue = 1 * this.rowvalues['col-' + this.column.id];

            if(! this.myvalue)
            {
                let i = setInterval( () => {
                    if(! this.app.dataSession.Departamente.processing)
                    {
                        clearInterval(i);
                        if(this.app.dataSession.Departamente.selectorItems.length > 0)
                        {
                            this.myvalue = this.app.dataSession.Departamente.selectorItems[0].value;
                        }
                    }
                }, 350);
            }
            else
            {
            }

            
        },

        components: {
            CsTextBox: require('@CsVueComp/controls/texts/CsTextBox').default,
        },
        
        name: 'RegistruRowInputDepartament',
    }
</script>