<template>
    <div class="row">
        <div class="col">
            <loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
            <div class="row justify-content-center" v-show="!isLoading">
                <div class="col">
                    <div class="row m-b-20">
                        <div class="col">
                            <h3 class="all-caps text-center">Export Customer Summary</h3>
                            <div class="fs-11 text-center">Please key in the Container Number spereated by a comma.</div>
                        </div>
                    </div>
                    <div class="row m-b-15">
                        <div class="col">
                            <validation-wrapper-component :validator="$v.containerIds">
                                <label>Container Number</label>
                                <input class="form-control" v-model="containerIds">
                            </validation-wrapper-component>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col p-r-5">
                            <div class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none" data-dismiss="modal">Cancel</div>
                        </div>
                        <div class="col p-l-5">
                            <div class="btn btn-sm btn-primary btn-block b-rad-none" @click="submitForm()">Confirm</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import componentHandler from '../../../general/mixins/componentHandler';
    import ModalFormHandler from '../../../general/mixins/modalFormHandler';
    import { required } from "vuelidate/lib/validators";

    export default {
        data() {
            return {
                containerIds: '',
            }
        },
        validations: {
            containerIds: {
                required
            },
        },
        methods: {
            submitForm() {
                this.validate();
                if(this.validate()){
                    this.$v.$reset();
                    this.closeModal();
                    window.open(this.route('customer.summary.export', this.item.id)+'?containerNumber='+this.containerIds, '_blank');
                }
                return;
            }
        },
        mixins: [componentHandler, ModalFormHandler]
    }
</script>