<div class="container-fluid">
    <div class="block-header">
        <h2>Advertisements > Manage Website Ads</h2>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-12 col-md-12">
            <div class="card">
                <div class="header">
                    <h2>Manage Website Ads</h2>
                </div>
                <div class="body">
                    <div class="alert alert-success ads-settings-alert"></div>
                    <form class="ads-settings" method="POST">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <textarea name="header" id="header" class="form-control" cols="30" rows="5"><?php echo PT_GetAd('header', true);?></textarea>
                                <label class="form-label">Header <small>(Appears on all pages right under the nav bar)</small></label>
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <textarea name="footer" id="footer" class="form-control" cols="30" rows="5"><?php echo PT_GetAd('footer', true);?></textarea>
                                <label class="form-label">Footer <small>(Appears on all pages right before the footer)</small></label>
                            </div>
                        </div>
                        <!--  <div class="form-group form-float">
                            <div class="form-line">
                                <textarea name="right_side" id="right_side" class="form-control" cols="30" rows="5"><?php echo PT_GetAd('right_side', true);?></textarea>
                                <label class="form-label">Right Sidebar <small>(Appears on the right sidebar in all pages)</small></label>
                            </div>
                        </div>
                         <div class="form-group form-float">
                            <div class="form-line">
                                <textarea name="left_side" id="left_side" class="form-control" cols="30" rows="5"><?php echo PT_GetAd('left_side', true);?></textarea>
                                <label class="form-label">Left Sidebar <small>(Appears on the left sidebar in all pages)</small></label>
                            </div>
                        </div>-->
                        <div class="form-group form-float">
                            <div class="form-line">
                                <textarea name="watch_side_bar" id="watch_side_bar" class="form-control" cols="30" rows="5"><?php echo PT_GetAd('watch_side_bar', true);?></textarea>
                                <label class="form-label">Watch Page Sidebar <small>(Appears on watching page above the related videos section)</small></label>
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <textarea name="watch_comments" id="watch_comments" class="form-control" cols="30" rows="5"><?php echo PT_GetAd('watch_comments', true);?></textarea>
                                <label class="form-label">Watch Comments <small>(Appears on watching page above the comments section)</small></label>
                            </div>
                        </div>
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">Save</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<script>
$(function() {
    var form_ads_settings = $('form.ads-settings');
    form_ads_settings.ajaxForm({
        url: '{{LINK aj/ap/update-ads}}',
        beforeSend: function() {
            form_ads_settings.find('.waves-effect').text('Please wait..');
        },
        beforeSubmit : function(arr, $form, options){
          delete arr[0];
          delete arr[1];
          delete arr[2];
          delete arr[3];
          delete arr[4];
          delete arr[5];
          arr.push({name:'header', value:btoa($('#header').val())});
          arr.push({name:'footer', value:btoa($('#footer').val())});
          arr.push({name:'right_side', value:btoa($('#right_side').val())});
          arr.push({name:'left_side', value:btoa($('#left_side').val())});
          arr.push({name:'watch_side_bar', value:btoa($('#watch_side_bar').val())});
          arr.push({name:'watch_comments', value:btoa($('#watch_comments').val())});
        },
        success: function(data) {
            if (data.status == 200) {
                form_ads_settings.find('.waves-effect').text('Save');
                $("html, body").animate({ scrollTop: 0 }, "slow");
                $('.ads-settings-alert').html('<i class="fa fa-check"></i> Ads updated successfully');
                setTimeout(function () {
                    $('.ads-settings-alert').empty();
                }, 2000);
            }
        }
    });
});
</script>