<template>
    <div class="row bg-white padding-40 b-rad-lg" @keyup.enter="submitForm">
        <div class="col">
            <div class="row m-b-20">
                <div class="col">
                    <h4>Create Warehouse Transport</h4>
                </div>
            </div>

            <div class="row">
                <div class="col">
                    <validation-wrapper-component class="m-b-10" :validator="$v.parameters.receive_date">
                        <label class="text-primary text-left">Receive Date</label>
                        <date-picker-component :parameters="parameters" v-model.lazy="parameters.receive_date"></date-picker-component>
                    </validation-wrapper-component>
                </div>
            </div>
            <div class="row">
                <div class="col">
                    <validation-wrapper-component class="m-b-10" :validator="$v.parameters.tracking">
                        <label class="text-primary text-left">Tracking Number</label>
                        <input type="text" class="form-control" v-model="parameters.tracking">
                    </validation-wrapper-component>
                </div>
            </div>
            
            <div class="row">
                <div class="col p-r-5">
                    <div class="btn btn-sm btn-default btn-block bg-master-lighter" data-dismiss="modal">Cancel</div>
                </div>
                <div class="col p-l-5">
                    <div class="btn btn-sm btn-block b-rad-none btn-success" @click="submitForm">Confrim</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
import { required } from "vuelidate/lib/validators";
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
export default {
    props: {
        packinglistId: {
            type: Number,
            required: true
        },
        section: {
            type: String,
            required: true
        },
    },
    data() {
        return {
            error: '',
            parameters: {
                receive_date: this.receive_date,
                tracking: this.tracking,
            }
        };
    },
    validations: {
        parameters: {
            receive_date: {
                required
            },
            tracking: {
            },
        }
    },
    methods: {
        submitForm() {
            this.submit(this.route('api.packing_list.warehouse_transport.create', this.packinglistId), 'post', this.section, true, true);
        }
    },
    mixins: [componentHandler, ModalFormHandler]
}
</script>