<!-- Delete Vendor Modal -->
<div class="modal fade" id="deleteVendorModal" tabindex="-1" aria-labelledby="deleteVendorLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm modal-dialog-centered">
    <div class="modal-content">
      <div class="modal-header bg-danger text-white">
        <h5 class="modal-title"><i class="fas fa-trash mr-2"></i>Delete Vendor</h5>
        <button type="button" class="close text-white" data-dismiss="modal">&times;</button>
      </div>
      <form id="deleteVendorForm">
        <input type="hidden" name="id" id="deleteVendorId">
        <div class="modal-body text-center">
          <p>Are you sure you want to delete this vendor?</p>
        </div>
        <div class="modal-footer justify-content-center bg-light">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
          <button type="submit" class="btn btn-danger"><i class="fas fa-trash mr-1"></i>Delete</button>
        </div>
      </form>
    </div>
  </div>
</div>

<script>
$('#deleteVendorForm').on('submit', function(e){
  e.preventDefault();
  $.post('public/ajax/vendor/delete.php', $(this).serialize(), function(r){
    alert(r.message);
    if(r.status==='success') location.reload();
  }, 'json');
});
</script>
