<template>
    <div class="row">
        <div class="col">
            <loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" />
            <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">Are you Sure?</h3>
                            <div class="fs-11">Are you sure you want to set this bank account as the default?</div>
                        </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-success btn-block b-rad-none" @click="handleSetDefault">Set Default</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { useComponentHandler } from '@/composables/useComponentHandler';
import { useFormHandler } from '@/composables/useFormHandler';
import route from '@/general/functions/router';

interface Props {
    data?: any;
    section: string;
}

const props = defineProps<Props>();

const { item } = useComponentHandler(props);

const { submit, isLoading, closeModal } = useFormHandler({
    section: props.section
});

const handleSetDefault = () => {
    submit(route('api.bank.default', item.value.id), 'put', props.section, true, true, null);
};
</script>
