<div class="modal fade" id="del-SAPForm<?= htmlentities($user_session); ?>" tabindex="-1" role="dialog" aria-labelledby="smallmodalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="smallmodalLabel">Delete SAP Form
                </h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form method="POST">
                <div class="modal-body">
                    <div class="" id="msgs_2"></div>
                    <div class="form-group">
                        <label for="exampleInputEmail1">Beneficieries Name</label>
                        <input type="text" class="form-control" id="delete_fullname" placeholder="Enter Category Name.." autocomplete="off" disabled="">
                    </div>
                </div>
                <div class="modal-footer">
                    <input type="hidden" id="delete_sapformid" name="">
                    <input type="hidden" alt="user_edits" id="user_edits" value="<?= htmlentities($user_session); ?>">
                    <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> No</button>
                    <button type="button" class="btn btn-primary" id="del-SAP"><i class="fa fa-check"></i> Yes</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    document.addEventListener('DOMContentLoaded', () => {
        let btn = document.querySelector('#del-SAP');
        btn.addEventListener('click', (e) => {
            e.preventDefault();

             const sapform_id = document.querySelector('input[id=delete_sapformid]').value;
             const user = document.querySelector('input[alt=user_edits]').value;
  

            var data = new FormData(this.form);

          data.append('sapform_id', sapform_id);
          data.append('user', user);

          // if (category_name == '') {

          //   } else {
                $.ajax({
                    url: '../../controllers/delete_sapform.php',
                    type: "POST",
                    data: data,
                    processData: false,
                    contentType: false,

                    async: false,
                    cache: false,

                    success: function(data) {
                        $('#msgs_2').html(data);

                    },
                    error: function(data) {
                        console.log("Failed");
                    }
                });
         //   }     

        });
    });
</script>

