<div class="container-fluid">
    <div>
        <h3>Create New Forum</h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Home</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Manage Features</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Forums</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Create New Forum</li>
            </ol>
        </nav>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Create New Forum</h6>
                    <div class="alert alert-info">You can create a forum, a forum is created inside sections.</div>
                    <div class="newforum-alert"></div>
                    <div class="newforum-error-alert"></div>
                    <form class="newforum" method="POST">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Name</label>
                                <input type="text" id="name" name="name" class="form-control">
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Description</label>
                                <textarea name="description" id="description" class="form-control" cols="30" rows="3"></textarea>
                            </div>
                        </div>
                        <label for="section">Section</label>
                        <select class="form-control show-tick" id="section" name="section">
                          <?php foreach (Wo_GetForumSec(array('forums'=>false,'limit'=>500)) as $section): ?>
							<option value="<?php echo $section['id']; ?>">
								<?php echo $section['section_name']; ?>
							</option>
						<?php endforeach ?>
                        </select>
                        <div class="clearfix"></div>
                        <br><br>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">Create Forum</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<script>

$(function() {
    var form_new_forum = $('form.newforum');
    form_new_forum.ajaxForm({
        url: Wo_Ajax_Requests_File()  +  '?f=add-new-forum&hash=' + $('.main_session').val(),
        beforeSend: function() {
            form_new_forum.find('.waves-effect').text('Please wait..');
        },
        success: function(data) {
            if (data.status == 200) {
                $("html, body").animate({ scrollTop: 0 }, "slow");
                $('.newforum-alert').html('<div class="alert alert-success"><i class="fa fa-check"></i> New forum created successfully.</div>');
                setTimeout(function () {
                    $('.newforum-alert').empty();
                }, 2000);
            } else {
                $('.newforum-alert').html('<div class="alert alert-danger">'+data['message']+'</div>');
                setTimeout(function () {
                    $('.newforum-alert').empty();
                }, 2000);
            } 
            form_new_forum.find('.waves-effect').text('Create Forum');
        }
    });
});
</script>