<template>
    <div class="row">
        <div class="col">
            <div class="row m-b-20">
                <div class="col">
                    <h6 class="all-caps m-b-5 bold no-margin">Delete Affiliate Code</h6>
                </div>
            </div>
            <div class="row m-b-20">
                <div class="col">
                    <p>Are you sure you want to delete the affiliate code <strong>{{ data.campaign_name }}</strong> ({{ data.code }})?</p>
                </div>
            </div>
            <div class="row">
                <div class="col p-r-5">
                    <div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Cancel</div>
                </div>
                <div class="col p-l-5">
                    <div class="btn btn-sm btn-danger btn-block b-rad-none" @click="submitForm">Delete</div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup lang="ts">
import { useFormHandler } from '@/composables/useFormHandler';
import route from '@/general/functions/router';

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

const props = defineProps<Props>();
const { submit } = useFormHandler(props);

const submitForm = () => {
    submit(route('api.affiliate.delete', props.data.id), 'delete', props.section, true, false);
};
</script>
