<!-- PAGE WITH SIDEBAR -->
<?php  
    if($part == 'ad'){
?><script src="https://checkout.stripe.com/checkout.js"></script>

<?php
    }
?>
<section class="page-section with-sidebar pad-t-15">
    <div class="container">
        <div class="row">
            <!-- SIDEBAR -->
            <aside class="col-md-3 sidebar" id="sidebar">
                <?php
                    include 'navigation.php';
                ?>
            </aside>
            <!-- /SIDEBAR -->
            
            <!-- CONTENT -->
            
            <div class="col-md-9 content" id="content">
                <div id="profile-content" class="box_shadow">
                </div>
            </div>
            <!-- /CONTENT -->

        </div>
    </div>
</section>
<!-- /PAGE WITH SIDEBAR -->

<!-- for switchery -->
<link href="<?php echo base_url(); ?>template/back/plugins/switchery/switchery.min.css" rel="stylesheet">
<script src="<?php echo base_url(); ?>template/back/plugins/switchery/switchery.js"></script>

<script>
    var top = Number(500);
    var loading_set = '<div style="text-align:center;width:100%;height:' + (top * 2) + 'px; position:relative;top:' + top + 'px;"><i class="fa fa-refresh fa-spin fa-3x fa-fw"></i></div>';
    function get_profile() {
        $("#profile-content").html(loading_set);
        $('.widget-content li').removeClass('active');
        $('#gp').addClass('active');
        $("#profile-content").load("<?php echo base_url() ?>index.php/home/profile/profile");
    }
    function get_read_later() {
        $("#profile-content").html(loading_set);
        $('.widget-content li').removeClass('active');
        $('#rl').addClass('active');
        $("#profile-content").load("<?php echo base_url() ?>index.php/home/profile/read_later");
    }
    function get_support() {
        $("#profile-content").html(loading_set);
        $('.widget-content li').removeClass('active');
        $('#st').addClass('active');
        $("#profile-content").load("<?php echo base_url() ?>index.php/home/profile/support_ticket");
    }
    function update_profile() {
        $("#profile-content").html(loading_set);
        $('.widget-content li').removeClass('active');
        $('#up').addClass('active');
        $("#profile-content").load("<?php echo base_url() ?>index.php/home/profile/update_info/");
    }
    function apply(){
        window.location.replace("<?php echo base_url();?>index.php/home/marketing/");
    }
    function get_adList(){
        $("#profile-content").html(loading_set);
        $('.widget-content li').removeClass('active');
        $('#ad_list').addClass('active');
        $("#profile-content").load("<?php echo base_url() ?>index.php/home/profile/ad_list");
    }
    function set_switchery() {
        $(".aiz_switchery").each(function () {
            new Switchery($(this).get(0), {color: 'rgb(100, 189, 99)', secondaryColor: '#cc2424', jackSecondaryColor: '#c8ff77'});
            var changeCheckbox = document.querySelector('#status_' + $(this).data('id'));
            changeCheckbox.onchange = function () {
                $.ajax({
                    url: '<?php echo base_url(); ?>index.php/home/profile/ad_list/status/'+$(this).data('id')+'/' + changeCheckbox.checked
                });
                if(changeCheckbox.checked == true){
                    notify($(this).data('tm'),'success','bottom','right');
                }else{
                    notify($(this).data('fm'),'danger','bottom','right');
                }
            };
        });
    }
    function edit_ad(id){
        $("#profile-content").html(loading_set);
        $('.widget-content li').removeClass('active');
        $('#ad_list').addClass('active');
        $("#profile-content").load("<?php echo base_url() ?>index.php/home/profile/ad_list/edit/"+id); 
    }
    $(document).ready(function () {
        $("#<?php echo $part; ?>").click();
    });
    
</script>
