<template>
    <div class="row m-t-5">
        <div class="col">
            <validation-wrapper-component :validator="$v.parameters.content">
                <input type="text" class="form-control fs-12" placeholder="Write your comments..." v-model.trim="parameters.content">
            </validation-wrapper-component>
        </div>
        <div class="col-auto b-a b-grey d-flex justify-content-center align-items-center rounded pointer">
            <i class="fa fa-paper-plane" @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: {
                    content: this.content,
                },
            };
        },
        validations: {
            parameters: {
                content: { required },
            }
        },
        created() {
            if (this.data) {
                this.parameters.content = this.data.content
            }
        },
        methods: {
            submitForm() {
                this.submit(this.data ? this.route('api.remark.update', this.data.id) : this.route('api.packing_list.container.remark.create', this.id), this.data ? 'put' : 'post', this.section, true, true);
                this.$emit('submit')
            }
        },
        mixins: [modalFormHandler]
    }
</script>
