<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  
  <head>
    <title>
      Admin &gt; FAQ | <?php echo html_escape($this->system->set[ 'site_name']) . PHP_EOL; ?>
    </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 class="active"><span>FAQ</span></li>
      </ul>
      <div class="row">
        <div class="col-sm-8">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3>
                <i class="fa fa-thumb-tack"></i> FAQ
              </h3>
            </div>
            <div class="panel-body visible-xs"><a class="btn btn-default" href="#add-faq"><i class="fa fa-plus"></i> Tambah</a></div>
            <?php if (!$results):?>
            <div class="panel-body">
              <div class="alert alert-warning">Tidak ada FAQ.</div>
            </div>
            <?php else:?>
            <div class="list-group">
              <?php $i = 1; foreach ($results as $faq):?>
              <div class="list-group-item" id="faq-<?php echo $faq->id;?>">
                <h4 class="list-group-item-heading"><span class="badge"><?php echo $i;?></span> <?php echo html_escape($faq->judul);?></h4>
                <div class="list-group-item-text">
                  <?php echo $faq->teks;?>
                  <p style="margin-top: 5px;margin-bottom: 0;">
                    <a href="<?php echo site_url('admin/faq/edit/'.$faq->id);?>" title="Edit"><i class="fa fa-edit"></i><span>Edit</span></a>
                    &nbsp;<a href="<?php echo site_url('admin/faq/delete/'.$faq->id);?>" class="text-danger" data-toggle="modal" data-target="#myModal" title="Hapus"><i class="fa fa-remove"></i><span>Hapus</span></a>
                  </p>
                </div>
              </div>
              <?php $i++; endforeach;?>
            </div>
            <?php endif;?>
          </div>
        </div>
        <div class="col-sm-4">
          <div class="panel panel-default" id="add-faq">
            <div class="panel-heading">
              <h3>
                <a href="<?php echo site_url('admin/faq/add');?>" class="pull-right"><i class="fa fa-external-link"></i></a>
                <i class="fa fa-pencil"></i> Menambahkan
              </h3>
            </div>
            <div class="panel-body">
              <?php echo form_open(site_url('admin/faq/add'));?>
                <div class="form-group">
                  <label for="judul">Judul</label>
                  <input class="form-control" type="text" name="judul" id="judul" maxlength="255" />
                </div>
                <div class="form-group">
                  <label for="teks">Teks <span class="text-muted"><small>(HTML mode)</small></span></label>
                  <textarea class="form-control" name="teks" id="teks" rows="8"></textarea>
                </div>
                <div>
                  <button class="btn btn-primary" type="submit" name="submit" value="save">Simpan</button>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>

</html>