<template>
    <div class="row">
        <div class="col p-r-0">
            <validation-wrapper-component :validator="$v.parameters.identification_number">
                <input type="text" class="form-control fs-12" placeholder="Edit identification number" v-model.trim="parameters.identification_number">
            </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 {
        props: {
            id: {
                type: Number,
                required: true
            }
        },
        data() {
            return {
                parameters: {
                    identification_number: this.identification_number,
                },
            };
        },
        validations: {
            parameters: {
                identification_number: { required },
            }
        },
        created() {
            if (this.data) {
                this.parameters.identification_number = this.data.identification_number
            }
        },
        methods: {
            submitForm() {
                this.submit(this.route('api.document.reference.update', this.id), 'put', '', false, false);
                this.$emit('submit')    
            }
        },
        mixins: [modalFormHandler]
    }
</script>
