<template>
    <div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
        <div class="col bg-white padding-40 b-rad-lg">
            <div class="row m-b-10">
                <div class="col text-center">
                    <h3>Edit Role Type</h3>
                </div>
            </div>
            <div class="row">
                <div class="col">
                    <div class="row m-t-15 m-b-15">
                <div class="col p-r-5">
                    <div class="b-grey b-a w-100 text-center p-l-15 p-r-15 p-t-10 p-b-10 pointer fs-15" :class="[{'b-primary': parameters.type === 2}]" @click="updateRoleType(2)">Admin</div>
                </div> 
                <div class="col p-l-5"> 
                    <div class="b-grey b-a w-100 text-center p-l-15 p-r-15 p-t-10 p-b-10 pointer fs-15" :class="[{'b-primary': parameters.type === 1}]" @click="updateRoleType(1)">Super Admin</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="submitForm">Confirm</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import modalFormHandler from '../../../general/mixins/modalFormHandler';
    import { required, minLength } from "vuelidate/lib/validators";

    export default {
        props: {
            data:{
                type: Object,
                required: true,
            }
        },
        data() {
            return {
                parameters: {
                    type: this.data.type, 
                }
            };
        },
        
        methods: {
            submitForm() {
                this.submit(this.route('api.account.user.update.role', this.data.id), 'put', this.section, true, true)
            },
            updateRoleType(type){
                this.parameters.type=type;
            }
        },
        mixins: [modalFormHandler]
    }

</script>