<div class="container-fluid">
    <div>
        <h3>Auto Delete Website Data</h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Home</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Tools</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Auto Delete Website Data</li>
            </ol>
        </nav>
    </div>
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="card-body">
                  <h6 class="card-title">Auto Delete Website Data</h6>
                    <div class="alert alert-info">It's recommended to create a backup before applying any actions.</div>
                   <label for="delete">Select what you would like to delete</label>
                        <select class="form-control show-tick" id="delete" name="delete">
                           <option value="1">Delete all inactive users</option>
                           <option value="2">Delete users that are not logged in more than 1 week</option>
                           <option value="3">Delete users that are not logged in more than 1 month</option>
                           <option value="4">Delete users that are not logged in more than 1 year</option>
                           <option value="5">Delete posts that are longer than 1 week</option>
                           <option value="6">Delete posts that are longer than 1 month</option>
                           <option value="7">Delete posts that are longer than 1 year</option>
                        </select>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="alert alert-warning">This process might take some time, you can check for your site changes after few minutes.</div>
                        <div class="clearfix"></div>
                  <button type="submit" class="btn btn-danger waves-effect waves-light m-t-20" id="delete-btn" onclick="Wo_DeleteAuto('hide');">Delete Data</button>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    </div>
<div class="modal fade" id="DeleteModal" tabindex="-1" role="dialog" aria-labelledby="exampleModal1Label" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModal1Label">Auto Delete?</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                Are you sure you want to delete? this action can't be undo.
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal">Delete</button>
            </div>
        </div>
    </div>
</div>
<script>
  function Wo_DeleteAuto(type = 'show') {
  if (type == 'hide') {
      $('#DeleteModal').find('.btn-primary').attr('onclick', "Wo_DeleteAuto()");
      $('#DeleteModal').modal('show');
      return false;
    }
    $('#delete-btn').text('Please wait..');
  $.get(Wo_Ajax_Requests_File(), {f:'admin_setting', s: 'auto_delete', delete: $('#delete').val()}, function(data, textStatus, xhr) {
    $('#delete-btn').text('Data is being deleted, check your site after few mins.');
    setTimeout(function () {
      $('#delete-btn').text('Delete Data');
    }, 4000);
  });
}
</script>