<template>
    <div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
        <div class="col bg-white b-rad-lg">
             <div class="row m-b-10">
                <div class="col text-center">
                    <p>Plese set the approximate of base price and dates of below.</p>
                </div>
            </div>
            <div class="row">
                <div class="col">
                    <div class="row m-auto mt-10 mb-10">
                        <div class="col p-l-0 p-r-10">
                            <validation-wrapper-component class="m-b-15" :validator="$v.parameters.dateFrom">
                                <label class="text-primary">Date From</label>
                                <date-picker-component v-model="parameters.dateFrom"></date-picker-component>
                            </validation-wrapper-component>
                        </div>
                    </div>
                    <div class="row m-auto mt-10 mb-10">
                        <div class="col p-l-0 p-r-10">
                            <validation-wrapper-component class="m-b-15" :validator="$v.parameters.dateTo">
                                <label class="text-primary">Date To</label>
                                <date-picker-component v-model="parameters.dateTo"></date-picker-component>
                            </validation-wrapper-component>
                        </div>
                    </div>
                    <validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate">
                        <label class="text-primary">Extra Charges (MYR)</label>
                        <div class="controls">
                            <input type="text" class="form-control fs-12" v-model.trim="parameters.rate" v-money="money">
                        </div>
                    </validation-wrapper-component>
                </div>
            </div>
            <div class="row m-t-15">
                <div class="col p-r-5">
                    <div class="btn btn-sm btn-default b-rad-none w-100" data-dismiss="modal">Cancel</div>
                </div>
                <div class="col p-l-5">
                    <div class="btn btn-sm btn-primary w-100" @click="submitForm()">Confirm</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import modalFormHandler from '../../../general/mixins/modalFormHandler';
    import { required } from "vuelidate/lib/validators";

    export default {
        data() {
            return {
                parameters: {
                    dateFrom: '', 
                    dateTo: '', 
                    rate: ''
                },
            };
        },
        validations: {
            parameters: {
                dateFrom: { required },
                dateTo: { required },
                rate: { required },
            }
        },
        methods: {
            submitForm(){
                this.submit(this.route('api.segment.constant.basePrice.create', 1), 'post', this.section, true, true)
            },
        },
        mixins: [modalFormHandler]
    }

</script>