<template>
    <div class="row parentContainer padding-40 bg-white b-rad-lg" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
        <div class="col">
            <div class="row m-b-10">
                <div class="col">
                    <h2 class="text-center">Edit Base Price</h2>
                    <p class="text-center">{{ parameters.dateFrom }}</p>
                </div>
            </div>
            <validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate">
                <label class="text-primary">Base Price (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 class="row m-t-15">
                <div class="col-auto p-r-5">
                    <div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
                </div>
                <div class="col p-l-5">
                    <div class="btn btn-primary w-100 btn-lg" @click="submit(route('api.segment.constant.basePrice.create', 1), 'post', section, true, true)">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: this.data.date, 
                    dateTo: this.data.date, 
                    rate: this.data.rate
                },
            };
        },
        validations: {
            parameters: {
                dateFrom: { required },
                dateTo: { required },
                rate: { required },
            }
        },
        mixins: [modalFormHandler]
    }

</script>