
<script type="text/javascript">

    $(document).on("click", '.delete_job_btn', function (e) {
        e.preventDefault();

        var id = $(this).data('job_id');

        Swal.fire({
            title: "Delete Job?",
            text: "Job will be deleted from the system!",
            icon: "warning",
            showCancelButton: true,
            confirmButtonColor: "#3085d6",
            cancelButtonColor: "#d33",
            confirmButtonText: "Confirm"
        }).then((result) => {
            if (result.isConfirmed) {

                $.ajax({
                    type: 'post',
                    url: '{{ path('api_job_delete') }}',
                    datatype: 'json',
                    data: {
                        id: id
                    }
                })
                    .done(function (data) {
                        Swal.fire(
                            'Success!',
                            'Quotation Created Successfully!',
                            'success'
                        );

                        setTimeout(function(){
                            window.location.replace("{{ path('admin_job_index') }}");
                        }, 1500);
                    })
                    .fail(function (jqXHR, textStatus, errorThrown) {
                        toastr.options.progressBar = true;
                        toastr.error('Failed to Delete Job!', 'Error!');
                    });

            }
        });
    });


</script>
