<?php
include('views/_header_shop.tpl.php');

if (isset($_GET['app'])) {
    require('views/admin/app-tab.tpl.php');
    exit;
}

?>

<!--<script>
var $= jQuery.noConflict();
</script>
-->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">

<style type="text/css">
#mmen { display:none; }
div.spacer { padding-top: 65px; }

.ajax-content {
    border: 1px solid #d4d4d4;
    background: #FFF;
    border-radius: 0 4px 4px;
    -moz-border-radius: 0 4px 4px;
    -webkit-border-radius: 0 4px 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ajax-content .loading {
    padding: 20px;
}
    
#fb-editor p {
    margin-right: 5px;
    display: inline-block;
}

#customAjaxLoader td, #customAjaxLoader th {
    padding: 4px;
}
.admintable td, .admintable th {
    padding: 3px;
    border: solid #eee 1px;
}
.regl a, .regl a:active, .regl. a:visited, .regl:link { color:#0077cc !important; }
.regl a:hover { color:#0000ff; }
/*.btn { background:#325fac; }*/
a.lgbtn, a.lgbtn:active, a.lgbtn:visited {
    padding:3px; width:50px;    display:inline-block; background:#ddd; text-shadow:0px 1px 0px #fff;
    border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;
}
a.lgbtn.confirm { color:#ff0000; }

a.lgbtn:hover {
    background:#0077cc; color:#fff; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;
    text-shadow:0px -1px 0px rgba(0,0,0,.5);
}
a:focus {
    outline: none;
    text-decoration:none !important;
    border:0;
    color: none !important;
}
.btn-green { font-weight:normal; padding:5px 16px; }

.btn-blue { margin:5px 5px 5px 5px;  min-width:150px; font-size:17px; font-weight:300; }
.btn-red { font-size:17px; }
input[type="button"] { }
input[type="submit"] { margin:5px 5px 5px 5px; line-height:25px !important; padding-bottom:5px; width:150px; font-size:17px; }

/* ############################## */
/* #########   NAV TABS   ####### */
/* ############################## */

.nav-tabs > li.active > a {
    /*color: #377ae8;*/
    color:#ff0000;
    font-weight:bold;
    /*border: 0px solid #d4d4d4;
    border-bottom-color: #fff;*/
}

.nav-tabs > li > a {
    color: #5c666b;
    font-family: 'Open Sans', sans-serif;
    font-weight: 300;
    padding: 9px 18px;
    border-radius: 4px 4px 0 0;
    -webkit-border-radius: 4px 4px 0 0;
    -moz-border-radius: 4px 4px 0 0;
    background-color: none; 
    background:none;
}

/* ############################## */
/* #########   SUB TABS   ####### */
/* ############################## */

ul.subtabs-list {
    margin: 0;
    padding: 0;
    list-style: none;
    margin-right:10px;
    width:98%;
    background:#444;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;
    overflow:hidden;
}
ul.subtabs-list li {
    float: left;
    width:14.5%;
    padding-left:1%;
    padding-right:1%;
    margin-left: 0px;
    border-right: 1px solid #777;
    padding-top: 5px;
    padding-bottom:7px;
    font-family: 'Open Sans',sans-serif;
    font-weight:300;
    font-size: 15px;
    background: #444;
    text-shadow:0px -1px 0px rgba(0,0,0,.4);
    text-align:center;
}
ul.subtabs-list li a {
    color: #ccc;
    font-family: 'Open Sans',sans-serif;
    font-weight:300;
    display:block;
}
ul.subtabs-list li.active {
    background: #00C617;
    color:#fff;
    text-shadow:0px -1px 0px rgba(0,0,0,.4);
}
ul.subtabs-list li.active a {
    color: #fff;
    font-family: 'Open Sans',sans-serif;
    font-weight:300;
    text-shadow:0px -1px 0px rgba(0,0,0,.4);
}
div.subtab {
    display: none;
}
div.subtab.active {
    display: block;
}

div.form.form-profile { padding-top:20px; }
td img { width:100px; }

.dashtotals {
    float:right; text-align:right; font-family:'Open Sans';
}

#footer { padding-top:0px; }
.main-footer { display:none; }

/* APP INTRO PADDING TOP */
.aif { padding-top:20px; }

/* ######################### */
/*       1024px Screens      */
/* ######################### */
@media (max-width: 1024px) {
    div.form.form-profile { }
    ul.subtabs-list {
        width:95%;
    }
}

/* ######################### */
/* Layout 2-cols */
/* ######################### */

@media (max-width: 1160px) {
    .layout-2cols { width:100%; }
}   

/* ######################### */
/* Landscape phones and down */
/* ######################### */

@media screen and (max-device-width:  600px), screen and (max-width: 600px) {
    #wrapper { overflow:hidden; }
    .nav-tabs > li {    
        width: 100% !important;
        display:block;
    }   
    .nav-tabs > li.active > a {
        color:#ff0000;
        background-color: #ccc;
        background: #ccc;
    }
    .nav-tabs > li > a {    
        width: 100% !important;
        display:block;
        color: #5c666b;
        font-family: 'Open Sans', sans-serif;
        font-weight: 300;
        padding: 9px 18px;
        /*border-bottom: 3px solid #fff;
        margin-bottom: 3px;*/
        border-radius: 0 0 0 0;
        -webkit-border-radius: 0 0 0 0;
        -moz-border-radius: 0 0 0 0;
        background-color: #eee;  
        background: #eee;
    }   
}

/* ######################### */
/* Landscape phones and down */
/* ######################### */

/* @media (max-width: 480px) { */
@media screen and (max-device-width:  480px), screen and (max-width:  480px) {
    div.spacer { padding-top: 70px; }
    .layout-2cols { padding-top:3px; }
    .header-content .header-right {
        border-bottom: 0px solid #d4d4d4;
        padding-bottom: 0px;
    }
/* ############################## */
/* #########   NAV TABS   ####### */
/* ############################## */
    ul.nav.admin-tabs.nav-tabs.clearfix { display:block; background:none; }
    .nav-tabs > li {    
        height:40px;
        width: 50% !important;
        float:left;
        display: inline-block;
        overflow:hidden;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }   
    .nav-tabs > li:nth-child(odd) {
        /* margin-right:2%; */
    }
    .nav-tabs > li.active {
        background:none;
        width: 50% !important;
        float:left;
        display: inline-block;      
        overflow:hidden;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;      
        border-bottom:0px solid #fff !important;
     }
    .nav-tabs > li.active > a {
        color:#ff0000;
        background-color: #ccc;
        background: #ccc;
        overflow:hidden;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;     
        border-bottom:0px solid #fff !important;   
    }
    .nav-tabs > li > a {    
        /*width: 100% !important;*/
        /*display:block;*/
        color: #5c666b;
        font-family: 'Open Sans', sans-serif;
        font-weight: 300;
        /*padding: 9px 18px;*/
       /* border-bottom: 3px solid #fff;
        margin-bottom: 3px;*/
        border-radius: 0 0 0 0;
        -webkit-border-radius: 0 0 0 0;
        -moz-border-radius: 0 0 0 0;
        background-color: #eee;  
        background: #eee;
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;       
    }   

/* ############################## */
/* #########     SUB TABS     ####### */
/* ############################## */

    ul.subtabs-list {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        width:99%;
    }
    ul.subtabs-list li {
        float: left;
        width:17.7%;
        padding-left:1%;
        padding-right:1%;
        margin-left: 0px;
        border-right: 1px solid #ccc;
        font-size: 14px;
    }


    ul.nav.admin-tabs.nav-tabs {
    }
    /*
    .nav-tabs > li {
        display: inline-block;
        float:left;
        width: 32%;  
        margin-right:1%;    
        margin-bottom:4px;
      }  
      */
      /*
     .nav-tabs > li:nth-child(odd) {
        background: purple;
        width:32%;
        margin-right:1%;
    }
    */
   /*
    .nav-tabs > li:nth-child(3n) {
        width:33%;
        margin-right:0%;
    }    
    
    .nav-tabs > li.active > a {
        color:#fff;
        text-shadow:0px -1px 1px rgba(0,0,0,.5);
        font-weight:bold;
        background-color: none !important;
        background: #cd1000 !important;
        border: 0px solid #d4d4d4;
        border-bottom-color: #ff0000;
    }
    
    .nav-tabs > li > a {    
        color: #5c666b;
        font-family: 'Open Sans', sans-serif;
        font-weight: 300;
        padding: 9px 18px;
        border-radius: 4px 4px 0 0;
        -webkit-border-radius: 4px 4px 0 0;
        -moz-border-radius: 4px 4px 0 0;
        background-color: none !important;  
        background: #eee !important;
    }
    */
    /* SUBTABS WAS HERE */
   
    .dashtotals {
        font-size:11px; padding-right:3px;
        text-shadow:0px 1px 0px rgba(255,255,255,.5); font-family:'Open Sans';
    }
    .tophdrw{ display:none; }
    div.form.form-profile { padding:5px; }
    /* APP INTRO PADDING TOP */
    .aif { padding-top:5px; }
}

</style>

<script type="text/javascript">
$('body').on('click', ".subtabs-list li a", function(e) {
        e.preventDefault();
        group_id = $(this).attr("href");
        li_elm   = $(this).parent();

        $(".subtab.active").fadeOut("fast");
        $(".subtab.active").removeClass("active");
        $(".subtabs-list li.active").removeClass("active");

        $(group_id).fadeIn("slow");
        $(group_id).addClass("active");

        li_elm.addClass("active");

        return false;
});
</script>

    <div class="layout-2cols">
        <div class="content grid_12" style="overflow:hidden;">
            <div class="project-detail" style="width:auto; overflow:hidden;">
                <div class="project-tab-detail tabbable accordion" style="width:auto; overflow:hidden;">

                    <?php
                    $invalid_tab = !in_array($_GET['tab'], ['welcome','settings','ssettings', 'csettings', 'orders', 'testimonials', 'logos', 'projects', 
                                                            'storecat', 'projectcat', 'content',  'app', 'jets', 'manageusers',
                                                            'appintro', 'portfolio', 'forms','reminders','deals','rewards','squarecats',
                                                            'squarelocs','squarexproducts','managelocations','ordrs','squsers','squarevariations']);
                    $_GET['tab']       = $invalid_tab ? "welcome" : $_GET['tab'];
                    $active_welcome    = $_GET['tab'] && $_GET['tab'] == 'welcome' ? " active" : "";
                    $active_settings   = $_GET['tab'] && $_GET['tab'] == 'settings' ? " active" : "";
                    $active_ssettings   = $_GET['tab'] && $_GET['tab'] == 'ssettings' ? " active" : "";
                    $active_csettings   = $_GET['tab'] && $_GET['tab'] == 'csettings' ? " active" : "";
                    $active_orders     = $_GET['tab'] && $_GET['tab'] == 'orders' ? " active" : "";
                    $active_testimonials   = $_GET['tab'] && $_GET['tab'] == 'testimonials' ? " active" : "";
                    $active_logos      = $_GET['tab'] && $_GET['tab'] == 'logos' ? " active" : "";
                    $active_pcodes      = $_GET['tab'] && $_GET['tab'] == 'promocodes' ? " active" : "";                    
                    $active_projects   = $_GET['tab'] && $_GET['tab'] == 'projects' ? " active" : "";
                    $active_storecat   = $_GET['tab'] && $_GET['tab'] == 'storecat' ? " active" : "";
                    $active_projectcat = $_GET['tab'] && $_GET['tab'] == 'projectcat' ? " active" : "";
                    $active_content    = $_GET['tab'] && $_GET['tab'] == 'content' ? " active" : "";
                    $active_app        = $_GET['tab'] && $_GET['tab'] == 'app' ? " active" : "";
                    $active_jets       = $_GET['tab'] && $_GET['tab'] == 'jets' ? " active" : "";
                    $active_manageusers   = $_GET['tab'] && $_GET['tab'] == 'manageusers' ? " active" : "";
                    $active_appintro   = !$_GET['tab'] || $_GET['tab'] == 'appintro' ? " active" : "";
                    $active_portfolio  = $_GET['tab'] && $_GET['tab'] == 'portfolio' ? " active" : "";
                    $active_forms  = $_GET['tab'] && $_GET['tab'] == 'forms' ? " active" : "";
                    $active_reminders  = $_GET['tab'] && $_GET['tab'] == 'reminders' ? " active" : "";
                    $active_deals  = $_GET['tab'] && $_GET['tab'] == 'deals' ? " active" : "";
                    $active_rewards  = $_GET['tab'] && $_GET['tab'] == 'rewards' ? " active" : "";
                    $active_squarecats  = $_GET['tab'] && $_GET['tab'] == 'squarecats' ? " active" : "";
                    $active_squarelocs  = $_GET['tab'] && $_GET['tab'] == 'squarelocs' ? " active" : "";
                    $active_squarexproducts  = $_GET['tab'] && $_GET['tab'] == 'squarexproducts' ? " active" : "";
                    $active_locations      = $_GET['tab'] && $_GET['tab'] == 'managelocations' ? " active" : "";
                    $active_ordrs     = $_GET['tab'] && $_GET['tab'] == 'ordrs' ? " active" : "";
                    $active_squsers     = $_GET['tab'] && $_GET['tab'] == 'squsers' ? " active" : "";
                    $active_variations     = $_GET['tab'] && $_GET['tab'] == 'squarevariations' ? " active" : "";
                    ?>

                    <ul class="nav admin-tabs nav-tabs clearfix">
                      <li tab="welcome" class="<?= $active_welcome ?>"><a href="#">Home</a></li>
                      <?php if ($_SESSION['loggedin'] && $_SESSION['user']['is_admin'] < 3) : ?>
                          <li tab="ssettings" class="<?= $active_ssettings ?>"><a href="#">Loyalty</a></li>
                          <li tab="rewards" class="<?= $active_rewards ?>"><a href="#">Rewards</a></li>
                          <li tab="squarecats" class="<?= $active_squarecats ?>"><a href="#">SQCats</a></li>
                          <li tab="squarelocs" class="<?= $active_squarelocs ?>"><a href="#">SQLocs</a></li>
                          <li tab="managelocations" class="<?= $active_locations ?>"><a href="#">Locs</a></li>
                          <li tab="squarexproducts" class="<?= $active_squarexproducts ?>"><a href="#">SQItems</a></li>   
                          <li tab="squarevariations" class="<?= $active_variations ?>"><a href="#">SQVar</a></li>                               
                          <!--<li tab="squarexproducts" class="<?= $active_squarexproducts ?>"><a href="#">SQProducts</a></li> Previous Exclude Tab -->                        
                          <li tab="deals" class="<?= $active_deals ?>"><a href="#">Deals</a></li>   
                          <!--<li tab="app-tab" class="<?= $active_app ?>"><a href="#">App</a></li>  -->                          
                            
                          <li tab="csettings" class="<?= $active_csettings ?>"><a href="#">App</a></li>
                          <li tab="settings" class="<?= $active_settings ?>"><a href="#">Config</a></li>     
                          <li tab="ordrs" class="<?= $active_ordrs ?>"><a href="#">Orders</a></li>                        
                          <!--
                          <li tab="orders" class="<?= $active_orders ?>"><a href="#">Ordrs</a></li>
                          <li tab="testimonials" class="<?= $active_testimonials ?>"><a href="#">TMoni</a></li>
                          <li tab="managelogos" class="<?= $active_logos ?>"><a href="#">Logos</a></li>
                          <li tab="managepromocodes" class="<?= $active_pcodes ?>"><a href="#">PCodz</a></li>                          
                          <li tab="featuredcontent" class="<?= $active_projects ?>"><a href="#">Feat</a></li>
                          <li tab="manageshops" class="<?= $active_storecat ?>"><a href="#">Shop</a></li>
                          -->
                      <?php endif; ?>
                      
                      <!--<li tab="blogcategories" class="<?= $active_projectcat ?>"><a href="#">Categories</a></li>-->
                      <li tab="managepages" class="<?= $active_content ?>"><a href="#">CMS</a></li>

                      <?php if ($_SESSION['loggedin'] && $_SESSION['user']['is_admin'] < 3) : ?>
                          <!--<li tab="app-tab" class="<?= $active_app ?>"><a href="#">App</a></li>-->     
                          <!--<li tab="jets" class="<?= $active_jets ?>"><a href="#">J</a></li>-->
                          <li tab="manageusers" class="<?= $active_manageusers ?>"><a href="#">Admins</a></li>   
                          <li tab="squsers" class="<?= $active_squsers ?>"><a href="#">Cust</a></li>                  
                          <!--
                          <li tab="welcomeslides" class="<?= $active_appintro ?>"><a href="#">Intro</a></li>
                          <li tab="portfolio" class="<?= $active_portfolio ?>"><a href="#">Folio</a></li>
                          <li tab="forms" class="<?= $active_forms ?>"><a href="#">Frms</a></li>
                          <li tab="reminders" class="<?= $active_reminders ?>"><a href="#">Remnd</a></li>
                          -->
                      <?php endif; ?>
                    </ul>
                    
                    <script>
                    $('.admin-tabs li').click(function () {
                        var tab = $(this).attr('tab');
                        $('.ajax-content').fadeTo( 'fast', 0.8 );
                        if (tab) {           
                            $.ajax({
                                data: {
                                    tab: tab
                                },
                                success: function (d) {
                                    $('.ajax-content').fadeTo( 1, 1 );
                                    $('.ajax-content').html(d);
                                }
                            });
                        }
                    });
                    </script>
                    
                    <div class="ajax-content">
                        <?php
                        // load initial tab directly
                        require('views/admin/tabs/welcome.tpl.php');
                        ?>                          
                    </div>

                    <!-- 
                    
                    3/11/2018 THE INDIVIDUAL TABS WERE HERE, BUT I REMOVED THEM BECAUSE I DON'T THINK THEY WERE
                    NEEDED AND I WAS TRYING TO FIGURE OUT HOW TO GET CKEDITOR BACK WORKING AGAIN AND SUSPECTED THEY MAY
                    BE CAUSING SCRIPTS TO DOUBLE LOAD. THE BACKUP FILE JUST BEFORE I REMOVED THEM IS index_withextratabs.tpl.php 
                    
                    -->

                </div><!--end: .project-tab-detail -->
            </div>
        </div><!--end: .content grid_12 -->
        <div class="clear"></div>
    </div><!-- END OF 2 COLS LAYOUT -->

<script src="/3rdparty/ckeditoradv/ckeditor.js"></script>
<script>
// $('.featured').change(function () {
$('body').on( 'click', '.featured', function (e) {
    $.ajax({
        async: true,
        url: '?setFeatured',
        type: 'post',
        data: {
            id: $(this).attr('id'),
            flag: ($(this).attr('flag')),
            featured: ($(this).attr('checked') == 'checked')
        },
        success: function (d) {
            if (d != 'ok') {
                alert("Unable to update featured status");
            }
        }
    })
});

// FULFILLED AJAX WAS HERE
$('body').on( 'click', '.todayPay', function (e) {
    $.ajax({
        async: true,
        url: '?todayPay',
        type: 'post',
        data: {
            id: $(this).attr('id'),
            value: ($(this).attr('value')),
        },
        success: function (d) {
            if (d != 'ok') {
                alert("Unable to update amount_paid ");
            }
        }
    })
});

$('body').on( 'click', '.activate-user', function (e) {
    e.preventDefault();

    var button = $(this);
    var row    = $(this).parents("tr").first();
    var uid    = row.attr("data-uid");
    var url    = $(this).attr("href");
    $.ajax({
        async: true,
        url: url,
        type: "post",
        data: {uid: uid},
        success:function(d) {
            var d = eval(d);

            if (d)
                // activate done.
                row.fadeOut();
                //alert('This User Account has been activated.');
                $('[tab=manageusers]').click(); // reload tab
        }
    });
    return false;
});

$('body').on( 'click', '.delete-user', function (e) {
    e.preventDefault();

    var button = $(this);
    var row    = $(this).parents("tr").first();
    var uid    = row.attr("data-uid");
    var url    = $(this).attr("href");
    $.ajax({
        async: true,
        url: url,
        type: "post",
        data: {uid: uid},
        success:function(d) {
            var d = eval(d);

            if (d)
                // activate done.
                row.fadeOut();
                alert('This User Account has been deleted.');
                $('[tab=manageusers]').click(); // reload tab
        }
    });
    return false;
});

$('body').on( 'click', '.make-admin', function (e) {
    e.preventDefault();

    var button = $(this);
    var row    = $(this).parents("tr").first();
    var uid    = row.attr("data-uid");
    var url    = $(this).attr("href");
    $.ajax({
        async: true,
        url: url,
        type: "post",
        data: {uid: uid},
        success:function(d) {
            var d = eval(d);

            if (d)
                // activate done.
                //row.fadeOut();
                alert('This User has been updated to an Admin.');
                $('[tab=manageusers]').click(); // reload tab
        }
    });
    return false;
});

$('body').on( 'click', '.remove-admin', function (e) {
    e.preventDefault();

    var button = $(this);
    var row    = $(this).parents("tr").first();
    var uid    = row.attr("data-uid");
    var url    = $(this).attr("href");
    $.ajax({
        async: true,
        url: url,
        type: "post",
        data: {uid: uid},
        success:function(d) {
            var d = eval(d);

            if (d)
                // activate done.
                //row.fadeOut();
                alert('Admin priveleges have been removed.');
                $('[tab=manageusers]').click(); // reload tab
                //location.window.href = "/admin/?tab=usersact";
        }
    });
    return false;
});

// TOGGLE SQUARE CATEGORIES HIDDEN FIELD ON/OFF
$('body').on( 'click', '.slider', function (e) {
    e.preventDefault();
    //$("input:checkbox").on("change", function () {
    //var val = $(this).val();
   // var apply = $(this).is(':checked') ? 1 : 0;
    //var button = $(this);
     //var checked = $(this).is(':checked') ? 1 : 0;
    var row    = $(this).parents("tr").first();
    var id    = row.attr("data-id");     
    var checked =  row.attr("data-checked"); 
    var checkStatus = $(this).checked ? 'ON' : 'OFF';
    //var checked = $('.hiddenval').val();
    //var id    = $(this).attr("data-id");
   // var id    = switch.attr("data-id");
    $.ajax({
        async: true,
        url: '/admin/makeHidden',
        type: "post",
        data: {id: id, checked:checked},
        success:function(d) {
            var d = eval(d);

            if (d){
                alert('This item has been updated! Saving...');
               // $('#resultQuickVar1').html(data);
                //alert('This item has been updated! id is: ' + id + ' and checkedval is: ' + checked + ' and d is: ' + d);
                //$(".is_excludeddiv").load(" .is_excludeddiv");
                //$('.is_excludeddiv').html(d);
                $('[tab=squarecats]').click(); // reload tab                
            } else {
                alert('This item has been updated! Saving...');
                //alert('Hidden! id is: ' + id + ' and checkedval is: ' + checked + ' and d is: ' + d);
                //$(".is_excludeddiv").load(" .is_excludeddiv");
                //$('.is_excludeddiv').html(d);
                $('[tab=squarecats]').click(); // reload tab    
            }
        }
    });
    return false;
});

// TOGGLE SQUARE LOCATIONS HIDDEN FIELD ON/OFF
$('body').on( 'click', '.sliderloc', function (e) {
    e.preventDefault();
    //$("input:checkbox").on("change", function () {
    //var val = $(this).val();
   // var apply = $(this).is(':checked') ? 1 : 0;
    //var button = $(this);
     //var checked = $(this).is(':checked') ? 1 : 0;
    var row    = $(this).parents("tr").first();
    var id    = row.attr("data-id");     
    var checked =  row.attr("data-checked"); 
    var checkStatus = $(this).checked ? 'ON' : 'OFF';
    //var checked = $('.hiddenval').val();
    //var id    = $(this).attr("data-id");
   // var id    = switch.attr("data-id");
    $.ajax({
        async: true,
        url: '/admin/makeHiddenLocation',
        type: "post",
        data: {id: id, checked:checked},
        success:function(d) {
            var d = eval(d);

            if (d){
                alert('This item has been updated! Saving...');
               // $('#resultQuickVar1').html(data);
                //alert('This item has been updated! id is: ' + id + ' and checkedval is: ' + checked + ' and d is: ' + d);
                //$(".is_excludeddiv").load(" .is_excludeddiv");
                //$('.is_excludeddiv').html(d);
                $('[tab=squarelocs]').click(); // reload tab                
            } else {
                alert('This item has been updated! Saving...');
                //alert('Hidden! id is: ' + id + ' and checkedval is: ' + checked + ' and d is: ' + d);
                //$(".is_excludeddiv").load(" .is_excludeddiv");
                //$('.is_excludeddiv').html(d);
                $('[tab=squarelocs]').click(); // reload tab    
            }
        }
    });
    return false;
});


$(function() {  
    CKEDITOR.config.extraPlugins = 'justify';   
    CKEDITOR.add
    CKEDITOR.config.contentsCss = '/static/css/my_styles.css';  
    CKEDITOR.config.extraPlugins = 'ckeditor-gwf-plugin';
    CKEDITOR.config.font_names = 'GoogleWebFonts';  
});
</script>

<style>
.admintable td, .admintable th {
    padding: 3px;
    border:solid #eee 1px;
}
</style>

<?php
include 'views/_footer.tpl.php';
?>