<template>
    <div class="row">
        <div class="col p-r-0">
            <validation-wrapper-component :validator="$v.parameters.name">
                <input type="text" class="form-control fs-12" placeholder="Edit company name" v-model.trim="parameters.name">
            </validation-wrapper-component>
        </div>
        <div class="col-auto bg-success d-flex justify-content-center align-items-center pointer text-white">
            <i class="fa fa-check" @click="submitForm"></i>
        </div>
    </div>
</template>
<script>
    import modalFormHandler from '../../../general/mixins/modalFormHandler';
    import { required } from "vuelidate/lib/validators";

    export default {
        data() {
            return {
                parameters: {
                    name: this.data.name,
                    reference: this.data.reference,
                    type: this.data.type,
                },
            };
        },
        validations: {
            parameters: {
                name: { required },
            }
        },
        methods: {
            submitForm() {
                this.submit(this.route('api.company.update', this.data.id), 'put', '', false, false);
                this.$emit('submit');
            }
        },
        mixins: [modalFormHandler]
    }
</script>
