<template>
    <v-chip
        :color="!!customer.mystatus ? customer.mystatus.props.color : null"
        small
        outlined
        @contextmenu="ShowStatusForm"
    >
        <v-icon small>
            mdi-{{!!customer.mystatus && customer.mystatus.initial == 'A' ? 'check' : 'lock' }}
        </v-icon>
    </v-chip>
</template>

<script>
    export default {
        props: {
            customer: {required: true},
            app: {required: true},
            form: {required: true},
        },

        methods: {
            ShowStatusForm(e) {
                if(this.form)
                {
                    e.preventDefault();

                    this.form.formprovider
                        .Reset()
                        .SetAction('update')
                        .SetActiveRecord({...this.customer});
                    
                    this.form.visible = false;
                    this.form.left = e.clientX;
                    this.form.top = e.clientY;
                    
                    this.$nextTick(() => {
                        this.form.visible = true
                    })
                }
            }
        },
        
        name: 'CustomerStatus',
    }
</script>