<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Admin &gt; Blog &gt; Kategori</title>
    <?php include_once(VIEWPATH. 'includes/head.php'); ?>
  </head>
  <body>
    <?php include_once(VIEWPATH. 'admin/_navbar.php'); ?>
    <div class="container">
      <ul class="breadcrumb">
        <li><a href="<?php echo site_url();?>"><i class="fa fa-home"></i></a></li>
        <li><a href="<?php echo site_url('admin');?>">Admin Panel</a></li>
        <li><a href="<?php echo site_url('admin/modules/blog');?>">Blog</a></li>
        <li class="active"><span>Kategori</span></li>
      </ul>
      <div class="row">
        <div class="col-sm-4 col-md-3">
          <?php include(dirname(__FILE__).'/_sidebar.php');?>
        </div>
        <div class="col-sm-8 col-md-9">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3><i class="fa fa-tags"></i> Kategori</h3>
            </div>
            <div class="panel-body">
              <div style="margin-bottom: 15px;">
                <a class="btn btn-default" data-toggle="modal" data-target="#myModal" href="<?php echo site_url('admin/modules/blog/membuat-kategori');?>"><i class="fa fa-plus"></i> Membuat</a>
              </div>
              <?php if (!$categories):?>
              <div class="alert alert-warning">Belum ada kategori.</div>
              <?php else:?>
              <div class="table-responsive">
                <table class="table table-bordered" style="margin-bottom: 0;">
                  <thead>
                    <tr>
                      <th>Nama</th>
                      <th>Slug</th>
                      <th>Total Posting</th>
                      <th class="text-center" style="width: 100px;">Tindakan</th>
                    </tr>
                  </thead>
                  <tbody>
                    <?php foreach ($categories as $kategori):?>
                    <tr>
                      <td><a href="<?php echo site_url('blog/kategori/'.$kategori->bk_slug);?>"><?php echo html_escape($kategori->bk_nama);?></a></td>
                      <td><?php echo $kategori->bk_slug;?></td>
                      <td><a href="<?php echo site_url('admin/modules/blog/index/'.$kategori->bk_id);?>"><?php echo $kategori->bk_posting;?></a></td>
                      <td class="text-center" style="width: 100px;">
                        <a class="btn btn-default btn-xs" href="<?php echo site_url('admin/modules/blog/edit-kategori/'.$kategori->bk_id);?>" data-toggle="modal" data-target="#myModal"><i class="fa fa-edit"></i></a>
                        <a class="btn btn-danger btn-xs" href="<?php echo site_url('admin/modules/blog/hapus-kategori/'.$kategori->bk_id);?>" data-toggle="modal" data-target="#myModal"><i class="fa fa-times"></i></a>
                      </td>
                    </tr>
                    <?php endforeach;?>
                  </tbody>
                </table>
              </div>
              <?php endif;?>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>
</html>