<?php
include("lib/config.php");

$userID = isset($_GET["uid"])?$_GET["uid"]:'';
?>

<div class="box-content">
  <form method="post" name="frmUsers" id="frmUsers">
    <input type="hidden" name="action" value="delete">
    <input type="hidden" name="user_id" value="<?php echo(isset($userID))?$userID:'';?>"> 
    <div class="alert alert-danger" role="alert">
  		Are you sure want to delete this User permanently?
	</div>
    <div style="text-align:right;">
      <button data-loading-text="Saving..." type="submit" class="btn btn-danger"> <i class="fa fa-floppy-o"></i> Delete</button>
      <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
    </div>
  </form>
</div>
<script>
$(document).ready(function(e){
    
	$("#frmUsers").on('submit', function(e){
	  
        e.preventDefault();
		
        $.ajax({
            type: 'POST',
            url: 'users-config.php',
            data: new FormData(this),
            //data: userData,
            contentType: false,
            cache: false,
            processData:false,
			dataType: 'JSON',
            beforeSend: function(){
                //$('.submitBtn').attr("disabled","disabled");
                //$('#fupForm').css("opacity",".5");
            },
            success: function(msg){
			   				
                //$('.statusMsg').html('');
				
                if(msg[0].message == 'ok'){
				
                    $('#frmUsers')[0].reset();
					
					//$('.statusMMsg').html('<span style="font-size:18px;color:#34A853">Product(s) added successfully.</span>');
					$('#myModal').modal('hide');
					
					getUsers(); 
					
					Lobibox.notify('success', {
						title: 'Success',
						msg: 'Record deleted successfully.'
					});
					
                }
				else
				{   
					//$('.statusMMsg').html('<span style="font-size:18px;color:#EA4335">Some problem occurred, please try again.</span>');
					$('#myModal').modal('hide');
					
					Lobibox.notify('error', {
						title: 'Error',
						msg: 'Some problem occurred, please try again.'
					});
                }
            }
        });
    });
	
});
</script>