<div class="container-fluid">
    <div class="block-header">
        <h2>Tools > Fake User Generator</h2>
    </div>
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="header">
                    <h2>Fake User Generator</h2> 
                    <br>
                    <small>Generate unlimited fake users.</small>
                </div>
                <form action="" method="POST" class="generate-form">
                	<div class="body">
                	 <div class="form-group form-float">
                            <div class="form-line">
                                <input type="number" id="count_users" name="count_users" class="form-control" value="10">
                                <label class="form-label">How many users you want to generate?</label>
                            </div>
                        </div>
                         <div class="form-group form-float">
                            <div class="form-line">
                                <input type="text" id="password" name="password" class="form-control">
                                <label class="form-label">Password (Choose the password that will be used for all users, default: 123456789)</label>
                            </div>
                        </div>
                        <label for="avatar">Create Random Avatar?</label>
                        <div class="form-group">
                            <input type="radio" name="avatar" id="avatar-enabled" value="1">
                            <label for="avatar-enabled">Yes</label>
                            <input type="radio" name="avatar" id="avatar-disabled" value="0" checked>
                            <label for="avatar-disabled" class="m-l-20">No</label>
                        </div>
                        <div class="clearfix"></div>
                        <small>If avatar is enabled, you might see dublicated avatars, avatars are generated randomly.</small><br>
                        <small>This process might take some time, you can check for your site changes after few minutes.</small><br>
                        <button type="submit" class="btn btn-danger waves-effect waves-light m-t-20" id="delete-btn">Generate Fake Data</button>
                        <button type="button" class="btn btn-main waves-effect waves-light m-t-20" onclick="DeleteAllFake()" id="delete_all_btn">Delete All Fake Users</button>
                </div>
                </form>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    </div>
<script>
function DeleteAllFake() {
    if (!confirm('Are you sure you want to delete All Fake Users?')) {
        return false;
    }
    $('#delete_all_btn').text('Please wait..');
    $.post(Wo_Ajax_Requests_File() + '?f=admin_setting&s=delete_fake_users', function(data, textStatus, xhr) {
        $('#delete_all_btn').text('User are being deleted, check your site after few mins.');
        setTimeout(function () {
            $('#delete_all_btn').text('Delete All Fake Users');
        }, 4000);
    });
}
$(function() {
    var generate_form = $('form.generate-form');
    generate_form.ajaxForm({
        url: Wo_Ajax_Requests_File() + '?f=admin_setting&s=generate_fake_users',
        beforeSend: function() {
            $('#delete-btn').text('Please wait..');
        },
        success: function(data) {
            if (data.status == 200) {
            	$('#delete-btn').text('User are being generated, check your site after few mins.');
            	setTimeout(function () {
					$('#delete-btn').text('Generate Fake Data');
				}, 4000);
            }
        }
    });

});
</script>