<template>
    <v-card
        tile
        flat
        width="520"
    >
        <v-card-text class="pa-1">

            <v-row dense>
                <v-col cols="12">
                    <cs-text-box 
                        ref="Nume"
                        :control="controls.name"
                        :errors="errorsManager.ByField('name')"
                        v-model="activeRecord.name"
                        @focus="errorsManager.ResetField('name')"
                        @blur="errorsManager.Validate('name')"
                    />
                </v-col>

                <v-col cols="8">
                    <cs-text-box 
                        :control="controls.email"
                        :errors="errorsManager.ByField('email')"
                        v-model="activeRecord.email"
                        @focus="errorsManager.ResetField('email')"
                        @blur="errorsManager.Validate('email')"
                    />
                </v-col>

                <v-col cols="4">
                    <cs-text-box 
                        :control="controls.phone"
                        :errors="errorsManager.ByField('phone')"
                        v-model="activeRecord.phone"
                        @focus="errorsManager.ResetField('phone')"
                        @blur="errorsManager.Validate('phone')"
                    />
                </v-col>

                <v-col cols="8">
                    <v-sheet class="mx-2">
                        <account-newsletter-control 
                            v-model="activeRecord"
                        />
                    </v-sheet>
                </v-col>

                <v-col cols="4">
                    <cs-text-box 
                        :control="controls.vat"
                        :errors="errorsManager.ByField('vat')"
                        v-model="activeRecord.vat"
                        @focus="errorsManager.ResetField('vat')"
                        @blur="errorsManager.Validate('vat')"
                    />
                </v-col>

                <v-col cols="12">
                    <cs-edit-box 
                        :control="controls.details"
                        :errors="errorsManager.ByField('details')"
                        v-model="activeRecord.details"
                        @focus="errorsManager.ResetField('details')"
                        @blur="errorsManager.Validate('details')"
                    />
                </v-col>

            </v-row>
        </v-card-text>

        <v-card-actions class="pa-1 px-0">
            <cs-btn 
                outlined
                position="bottom"
                icon="mdi-chevron-right"
                color="primary"
                caption="Adresa"
                tooltip="Informații despre localizarea clientului"
    
                :disabled="false"

                :click="OnClickNext"
            />
        </v-card-actions>
    </v-card>
</template>

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

        computed: {
            form() {
                return this.app.forms.Customers;
            },

            stepper() {
                return this.app.menus.Insertcustomerstepper;
            },
        },

        methods: {
            OnClickNext() {
                this.stepper.activeStep = 2;
            }
        },

        created() {
        },

        components: {
            CsTextBox: require('@CsVueComp/controls/texts/CsTextBox').default,
            CsEditBox: require('@CsVueComp/controls/texts/CsEditBox').default,
            CsBtn: require('@CsVueComp/buttons/CsBtn').default,
        },

        mixins: [
            require('@CsVueMix/Forminput/Forminput')
        ],

        name: 'CustomerForm',
    }
</script>