<template>
    <div class="row" style="width: 450px; margin: auto;">
        <div class="col bg-white padding-40 b-rad-lg">
            <div class="row m-b-10">
                <div class="col">
                    <h2 class="text-center text-complete bold">{{data.postcode}}</h2>
                    <p class="text-center" v-show="parameters.reference=== ''">This postcode is yet to be declare. Plase choose the area.</p>
                </div>
            </div>
            <div class="row text-center justify-content-center">
                <div class="col p-r-5">
                    <div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.reference === 'CENTER_POSTCODE', 'b-grey': parameters.reference !== 'CENTER_POSTCODE' }"  @click="parameters.reference = 'CENTER_POSTCODE'">
                        <div class="row">
                            <div class="col">
                                <h5 class="no-margin" :class="{ 'text-primary': parameters.reference === 'CENTER_POSTCODE', 'semi-bold': parameters.reference === 'CENTER_POSTCODE' }">City Center</h5>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col p-l-5">
                    <div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.reference === 'OUTSTATION_POSTCODE', 'b-grey': parameters.reference !== 'OUTSTATION_POSTCODE' }"  @click="parameters.reference = 'OUTSTATION_POSTCODE'">
                        <div class="row">
                            <div class="col">
                                <h5 class="no-margin" :class="{ 'text-primary': parameters.reference === 'OUTSTATION_POSTCODE', 'semi-bold': parameters.reference === 'OUTSTATION_POSTCODE'}">Outskirt</h5>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <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.update.postcode', 1), 'put', 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 {
        props: {
            data: {
                type: Object,
                required: false
            },
            section: {
                default: ''
            },
        },
        data() {
            return {
                parameters: {
                    reference: this.data.postcodeArea,
                    postcode: this.data.postcode
                } 
            };
        },
        mixins: [modalFormHandler]
    }

</script>