<style>
/* ############################################### */
/* ####### The Switch - the box around the slider ####### */
/* ############################################### */

.switch {
  position: relative;
  display: inline-block;
  width: 60px !important;
  height: 32px;
}

/* Hide default HTML checkbox */
.switch input {display:none;}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 28px;
  width: 28px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #98cb54;
}

input:focus + .slider {
  box-shadow: 0 0 1px #98cb54;
}

input:checked + .slider:before {
  -webkit-transform: translateX(28px);
  -ms-transform: translateX(28px);
  transform: translateX(28px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 32px; -moz-border-radius: 32px; -webkit-border-radius: 32px;
}

.slider.round:before {
  border-radius: 50%;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  
}
/* ############################################### */
/* ##############     The Switch ENDS     ############## */
/* ############################################### */
</style>
<!--
<?php $enable_square_loyalty = !empty($soptions['use_square_loyalty']) ? " checked='checked'" : ""; ?>
 <label class='switch'>
   <input class='' id='' data-toggle='toggle' type='checkbox' name="settings[use_square_loyalty]"<?= $enable_square_loyalty ?> /><span class='slider round'></span>
 </label>  
  -->                       
<div class="tab-pane accordion-content<?= $active_ssettings ?>">
<div class="form form-profile aif" style='width:auto'>
    <h2 style="margin-top:0px;">
        Locations Manager
    </h2>
    Locations from your Square Account
    
    <table class="admintable" style="margin:10px; width:98%">
        <tr><th width="300">Image</th><th width="150">Name</th><th width="100">Hide</th></tr>
        <?php
        foreach ($square_locations as $loc) {
            if($loc['image'] !=''){
                    $imgfix = "onerror=\"this.src='/static/images/placeholder_sqcat.jpg'\"";
            } else {
                     $imgfix = "onerror=\"this.src='/static/images/placeholder_sqcat.jpg'\"";
            }          
            if($loc['is_active'] == 1){
                $hidden = " checked='checked'";
            } else {
                $hidden = "";
            }     
            //$hidden = " checked='checked'";          
            echo "<tr data-id='{$loc['id']}' data-checked='{$loc['is_active']}'>
            <td style='padding:10px;'><img src='{$loc['image']}' alt='{$loc['name']}' style='width:100%; height:auto;' {$imgfix} /></td>
            <td style='padding:10px; font-weight:300;'>{$loc['name']}</td>
            <td style='padding:10px; text-align:center;'>              
                <label class='switch is_excludeddiv'>
                    <input name='switch' data-id='{$loc['id']}' class='hiddenval' data-toggle='toggle' type='checkbox' {$hidden} value='{$loc['is_active']}' />
                    <span class='slider round sliderloc' value='{$loc['is_active']}'></span>
                </label>
             </td>
            </tr>
            <tr>
            <td colspan='2' style='color:#ccc;'>SQID: {$loc['id']}</td>
            <td style='text-align:center;'> <i class='fa fa-angle-up'></i> <a href='?square_loc&edit={$loc['id']}'>edit</a> | <a href='?square_loc&delete={$loc['id']}' class='confirm'>delete</a></td>
            </tr>";
        }
        ?>
    </table>
    
    <div style="margin:10px; display:nonex;">
        <a href='?square_loc&add' class='btn btn-blue'>Add New</a>
    </div>
                            
</div><!-- FORM AIF ENDS -->
</div><!-- TAB ENDS -->