<?php
$this->load->view("top_application");
//trace($res);
?>
<script src="<?php echo site_url(); ?>assets/sitepanel/js/common.js"></script>
<section>
  <div class="tz">
    <!--LEFT SECTION-->
    <div class="tz-l">      
      <?php $this->load->view("members/left"); ?>
    </div>
    <!--CENTER SECTION-->
    <div class="tz-4">
      <div class="tz-2-com tz-2-main">
        <h4>Manage Banners <span class="pull-right"><a class="add_website_cat" href="<?php echo site_url(); ?>members/add_banner" style="color: #FFF;">Add Banner</a></span></h4>

        <div class="db-list-com tz-db-table">
          <div class="ds-boar-title">
            <h2>Banners</h2>
          </div>
          <?php
          error_message();
          if (is_array($res) && !empty($res)) {
            echo form_open("", 'id="data_form"');
            ?>
             <div class="table-responsive">
            <table>
              <thead>
                <tr>
                  <th>
                    <label style="left:0px!important;" class="containerdash"><input type="checkbox" class="dashcheckbox" onclick="$('input:checkbox').not(this).prop('checked', this.checked);" /></label>
                  </th>
                  <th><strong>Banner</strong></th>
                  <th><strong>Date</strong></th>
                  <th><strong>Status</strong></th>
                  <th><strong>Edit</strong></th>
                </tr>
              </thead>
              <tbody>
                <?php
                $slno = 1;
                foreach ($res as $rkey => $rval) {
                  ?>
                  <tr>
                    <td>
                      <label style="left:0px!important;" class="containerdash"><input type="checkbox" class="dashcheckbox" name="arr_ids[]" value="<?php echo $rval['banner_id']; ?>" /></label>
                    </td>
                    <td><img src="<?php echo get_image('clients/banners', $rval['banner_image'],'200','150','R'); ?>"</td>
                    <td><?php echo getDateFormat($rval['banner_added_date'], 3); ?></td>
                    <td>
                      <span class="db-list-ststus">
                        <?php echo ($rval['status'] == '1') ? 'Active' : 'Deactivated'; ?>
                      </span>
                    </td>
                    <td><a href="<?php echo site_url(); ?>members/edit_banner/<?php echo $rval['banner_id']; ?>" class="db-list-edit">Edit</a></td>
                  </tr>
                  <?php
                  $slno++;
                }
                ?>
              </tbody>
            </table>
            </div>
            <table class="list" width="100%"> 
              <tr>
                <td class="table_50" align="left">
                  <input name="status_action" type="submit"  value="Activate" class="btn btn-success btn-xs" id="Activate" onClick="return validcheckstatus('arr_ids[]', 'Activate', 'Record', 'u_status_arr[]');"/>

                  <input name="status_action" type="submit" class="btn btn-warning btn-xs" value="Deactivate" id="Deactivate"  onClick="return validcheckstatus('arr_ids[]', 'Deactivate', 'Record', 'u_status_arr[]');"/>
                  <input name="status_action" type="submit" class="btn btn-danger btn-xs" id="Delete" value="Delete"  onClick="return validcheckstatus('arr_ids[]', 'delete', 'Record');"/>
                </td>
                <td class="table_50 text-right">
                  <p class="paging"><?php echo $page_links; ?></p>
                </td>
              </tr>
            </table>
            <?php
            echo form_close();
          } else {
            ?>
            <div class="alert alert-danger" role="alert">
              <strong>Oh snap!</strong> No Client(s) Found.
            </div>
            <div class="row">
              <div class="input-field s12 text-center">
                <div class="row">
                  <div class="input-field s4 "><a href="<?php echo site_url(); ?>members/add_banner" class="waves-effect waves-light btn-large" >Add a Banner Now!</a></div>
                </div>
              </div>
            </div>
            <?php
          }
          ?>
        </div>
      </div>
    </div>
    <!--RIGHT SECTION-->
  </div>
</section>
<?php $this->load->view("bottom_application"); ?>
<script type="text/javascript">
  function onclickgroup() {
    if (validcheckstatus('arr_ids[]', 'set', 'record', 'u_status_arr[]')) {
      $('#data_form').submit();
    }
  }
</script>