<div class="container-fluid">
    <div>
        <h3>Website Information</h3>
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="#">Admin Panel</a>
                </li>
                <li class="breadcrumb-item">
                    <a href="#">Settings</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Website Information</li>
            </ol>
        </nav>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-6 col-md-6 pull-left">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Website Information</h6>
                    <div class="site-settings-alert"></div>
                    <form class="site-settings" method="POST">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Site Title</label>
                                <input type="text" name="title" class="form-control" value="<?php echo ($pt->config->title);?>">
                                <small class="admin-info">Your website general title, it will appear on Google and on your browser tab.</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Site Name</label>
                                <input type="text" name="name" class="form-control" value="<?php echo ($pt->config->name);?>">
                                <small class="admin-info">Your website name, it will appear on website's footer and E-mails.</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Site E-mail</label>
                                <input type="text" name="email" class="form-control" value="<?php echo ($pt->config->email);?>">
                                <small class="admin-info">Your website E-mail, it will appear on website's footer and E-mails.</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Site Keywords</label>
                                <input type="text" name="keyword" class="form-control" value="<?php echo ($pt->config->keyword);?>">
                                <small class="admin-info">Your website's keyword, used mostly for SEO and search engines.</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Site Description</label>
                                <textarea name="description" id="description" class="form-control" cols="30" rows="5"><?php echo ($pt->config->description);?></textarea>
                                <small class="admin-info">Your website's description, used mostly for SEO and search engines, Max of 100 characters is recommended</small>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
        <div class="col-lg-6 col-md-6 pull-right">
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Features API Keys & Information</h6>
                    <div class="other-settings-alert"></div>
                    <form class="other-settings" method="POST">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Google Analytics ID</label>
                                <input type="text" name="google" class="form-control" value="<?php echo ($pt->config->google);?>">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="card">
                <div class="card-body">
                    <h6 class="card-title">Point System Settings</h6>
                    <div class="point-settings-alert"></div>
                    <form class="point-settings" method="POST">
                        <div class="float-left">
                            <label for="point_level_system" class="main-label">Point System</label>
                            <br><small class="admin-info">Gives the ability for users to earn points from liking, sharing, commenting and posting.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="point_level_system" value="0" />
                            <input type="checkbox" name="point_level_system" id="chck-point_level_system" value="1" <?php echo ($pt->config->point_level_system == '1') ? 'checked': '';?>>
                            <label for="chck-point_level_system" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="float-left">
                            <label for="point_allow_withdrawal" class="main-label">Allow user to withdrawal earned points as currency?</label>
                            <br><small class="admin-info">Allow users to transfer earned points into money and withdrawal.</small>
                        </div>
                        <div class="form-group float-right switcher">
                            <input type="hidden" name="point_allow_withdrawal" value="0" />
                            <input type="checkbox" name="point_allow_withdrawal" id="chck-point_allow_withdrawal" value="1" <?php echo ($pt->config->point_allow_withdrawal == '1') ? 'checked': '';?>>
                            <label for="chck-point_allow_withdrawal" class="check-trail"><span class="check-handler"></span></label>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">$1.00 = ? Point</label>
                                <input type="text" name="dollar_to_point_cost" class="form-control" value="<?php echo ($pt->config->dollar_to_point_cost);?>">
                                <small class="admin-info">How much does 1 dollar equal in points?</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Commenting on Videos</label>
                                <input type="text" name="comments_point" class="form-control" value="<?php echo ($pt->config->comments_point);?>">
                                <small class="admin-info">How many points does a user earn by creating comments?</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Liking Videos</label>
                                <input type="text" name="likes_point" class="form-control" value="<?php echo ($pt->config->likes_point);?>">
                                <small class="admin-info">How many points does a user earn by liking videos?</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Disliking Videos</label>
                                <input type="text" name="dislikes_point" class="form-control" value="<?php echo ($pt->config->dislikes_point);?>">
                                <small class="admin-info">How many points does a user earn by disliking videos?</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Watching Videos</label>
                                <input type="text" name="watching_point" class="form-control" value="<?php echo ($pt->config->watching_point);?>">
                                <small class="admin-info">How many points does a user earn by wondering videos?</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Uploading Videos</label>
                                <input type="text" name="upload_point" class="form-control" value="<?php echo ($pt->config->upload_point);?>">
                                <small class="admin-info">How many points does a user earn by uploading videos?</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Free Users Daily Limit</label>
                                <input type="text" name="free_day_limit" class="form-control" value="<?php echo ($pt->config->free_day_limit);?>">
                                <small class="admin-info">How many points can a free user earn in a day?</small>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <hr>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <label class="form-label">Pro Members Daily Limit</label>
                                <input type="text" name="pro_day_limit" class="form-control" value="<?php echo ($pt->config->pro_day_limit);?>">
                                <small class="admin-info">How many points can a pro user earn in a day?</small>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<script>
$(function() {
    $('.switcher input[type=checkbox]').click(function () {
        var configName = $(this).attr('name');
        var hash_id = $('input[name=hash_id]').val();
        var objData = {};
        if ($(this).is(":checked") === true) {
            objData[configName] = $(this).val();
        }
        else{
            if ($('input[name='+configName+']')[0]) {
                objData[configName] = $($('input[name='+configName+']')[0]).val();
            }
        }
        objData['hash_id'] = hash_id;
        $.post('{{LINK aj/ap/save-settings}}', objData);
    });

    var setTimeOutColor = setTimeout(function (){});
    $('select').on('change', function() {
         clearTimeout(setTimeOutColor);
        var thisElement = $(this);
        var configName = thisElement.attr('name');
        var hash_id = $('input[name=hash_id]').val();
        var objData = {};
        objData[configName] = this.value;
        objData['hash_id'] = hash_id;
        thisElement.addClass('warning');
        $.post("{{LINK aj/ap/save-settings}}", objData, function (data) {
            if (data.status == 200) {
                thisElement.removeClass('warning');
                thisElement.addClass('success');
            } else {
                thisElement.addClass('error');
            }
            var setTimeOutColor = setTimeout(function () {
                thisElement.removeClass('success');
                thisElement.removeClass('warning');
                thisElement.removeClass('error');
            }, 2000);
        });
    });
    $('input[type=text], input[type=number] , textarea').on('keyup', delay(function() {
            clearTimeout(setTimeOutColor);
            var thisElement = $(this);
            var configName = thisElement.attr('name');
            var hash_id = $('input[name=hash_id]').val();
            var objData = {};
            objData[configName] = this.value;
            objData['hash_id'] = hash_id;
            thisElement.addClass('warning');
            $.post("{{LINK aj/ap/save-settings}}", objData, function (data) {
                if (data.status == 200) {
                    thisElement.removeClass('warning');
                    thisElement.addClass('success');
                } else {
                    thisElement.addClass('error');
                }
                var setTimeOutColor = setTimeout(function () {
                    thisElement.removeClass('success');
                    thisElement.removeClass('warning');
                    thisElement.removeClass('error');
                }, 2000);
                //thisElement.focus();
            });
    }, 500));
});
</script>
