<template>
    <div class="row" @keyup.enter="submitForm">
        <div class="col">
            <loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
            <div class="row" v-show="!$store.getters.isLoading(section)">
                <div class="col">
                    <div class="row">
                        <div class="col">
                            <div class="font-heading fs-16 all-caps bold m-b-15">Identification Verification</div>
                        </div>
                    </div>
                    <error-message-component class="m-b-20" :error="error"></error-message-component>
                    <div class="row m-b-15">
                        <div class="col">
                            <validation-wrapper-component :validator="$v.parameters.identification_no">
                                <label class="text-primary">{{ data.type === 0 ? 'IC/Passport' : 'SSM Registration' }} Number</label>
                                <div class="controls">
                                    <input type="text" class="form-control fs-12" v-model="parameters.identification_no">
                                </div>
                            </validation-wrapper-component>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col">
                            <file-input-component :validator="$v.parameters.files" v-model="parameters.files">
                                <template slot="label">
                                    <div class="font-heading fs-11 text-primary all-caps">{{ data.type === 0 ? 'IC Photo' : 'SSM Registration Photo' }}</div>
                                </template>
                                <template slot="tips">
                                    <div class="row">
                                        <div class="col">
                                            <div class="row m-b-20">
                                                <div class="col">
                                                    <div class="font-heading fs-11 text-warning m-b-10">{{ data.type === 0 ? 'IC': 'SSM registration'}} number shown in the photo should tally with {{ data.type === 0 ? 'IC': 'SSM registration'}} number provided above.</div>
                                                    <div class="font-heading fs-11 muted">Tips on how your photo should look</div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col">
                                                    <div class="row m-b-15">
                                                        <div class="col">
                                                            <div class="row m-b-5">
                                                                <div class="col">
                                                                    <div class="b-a b-danger b-thick">
                                                                        <div class="absolute" style="right: -10px; top: -10px;">
                                                                            <div class="icon-thumbnail btn-rounded icon-25 bg-danger fs-12"><i class="fa fa-times text-white fs-12"></i></div>
                                                                        </div>
                                                                        <img v-if="data.type === 0" src="https://i.pinimg.com/originals/c2/18/96/c218966593d1baacae525934835d847d.jpg" class="w-100">
                                                                        <img v-if="data.type === 1" src="https://2.bp.blogspot.com/-uElNIO5qSEI/VE4I_f2Ai-I/AAAAAAAAJdA/zJbbBr7NRzI/s1600/ssm-notice-facebook-page.png" class="w-100">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row text-center">
                                                                <div class="col">
                                                                    <div class="font-heading fs-11">Covered</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col">
                                                            <div class="row m-b-5">
                                                                <div class="col">
                                                                    <div class="b-a b-danger b-thick">
                                                                        <div class="absolute" style="right: -10px; top: -10px;">
                                                                            <div class="icon-thumbnail btn-rounded icon-25 bg-danger fs-12"><i class="fa fa-times text-white fs-12"></i></div>
                                                                        </div>
                                                                        <img v-if="data.type === 0" src="https://i.pinimg.com/originals/c2/18/96/c218966593d1baacae525934835d847d.jpg" class="w-100">
                                                                        <img v-if="data.type === 1" src="https://2.bp.blogspot.com/-uElNIO5qSEI/VE4I_f2Ai-I/AAAAAAAAJdA/zJbbBr7NRzI/s1600/ssm-notice-facebook-page.png" class="w-100">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row text-center">
                                                                <div class="col">
                                                                    <div class="font-heading fs-11">Blurry</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col">
                                                            <div class="row m-b-5">
                                                                <div class="col">
                                                                    <div class="b-a b-success b-thick">
                                                                        <div class="absolute" style="right: -10px; top: -10px;">
                                                                            <div class="icon-thumbnail btn-rounded icon-25 bg-success fs-12"><i class="fa fa-check text-white fs-12"></i></div>
                                                                        </div>
                                                                        <img v-if="data.type === 0" src="https://i.pinimg.com/originals/c2/18/96/c218966593d1baacae525934835d847d.jpg" class="w-100">
                                                                        <img v-if="data.type === 1" src="https://2.bp.blogspot.com/-uElNIO5qSEI/VE4I_f2Ai-I/AAAAAAAAJdA/zJbbBr7NRzI/s1600/ssm-notice-facebook-page.png" class="w-100">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row text-center">
                                                                <div class="col">
                                                                    <div class="font-heading fs-11">This is right!</div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">

                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </template>
                            </file-input-component>
                        </div>
                    </div>
                    <div class="row m-t-20">
                        <div class="col">
                            <div class="row">
                                <div class="col-auto">
                                    <button type="button" class="btn btn-sm bg-master-lighter p-t-10 p-b-10 p-r-35 p-l-35 btn-default b-rad-none" data-dismiss="modal">Cancel</button>
                                </div>
                                <div class="col text-right">
                                    <button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none" @click="submitForm">Save and continue</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import identificationVerificationFormValidation from '../../../general/mixins/companies/validation/identificationVerificationFormValidation'
    export default {
        data(){
            return {
                parameters: {
                    identification_no: '',
                    files: []
                }
            }
        },
        methods: {
            submitForm(){
                this.submit(this.route('api.company.identification.create', this.data.id), 'post', this.section, true, false)
            }
        },
        mixins: [identificationVerificationFormValidation]

    }
</script>