<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Admin &gt; Phone Validator</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>Phone Validator</span></li>
      </ul>
      <?php echo form_open();?>
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3><i class="fa fa-mobile"></i> Phone Validator</h3>
        </div>
        <div class="table-responsive">
          <table class="table table-bordered" style="margin-bottom: 0;">
            <thead>
              <tr>
                <th style="width: 180px;">Nama</th>
                <th>Regex Validasi</th>
                <th class="text-center" style="width: 100px;">Tindakan</th>
              </tr>
            </thead>
            <tbody>
              <?php for ($i = 0; $i < count($validator); $i++):?>
              <tr id="validator-<?php echo $i;?>">
                <td style="vertical-align: middle;width:180px"><?php echo html_escape($validator[$i]['nama']);?></td>
                <td style="vertical-align: middle;"><?php echo html_escape(strlen($validator[$i]['regex']) > 80 ? substr($validator[$i]['regex'],0,80) . '...' : $validator[$i]['regex']);?></td>
                <td class="text-center" style="vertical-align: middle;width:100px;">
                  <a class="btn btn-default btn-xs" href="<?php echo site_url('admin/modules/phone-validator/edit/'.$i);?>" data-toggle="modal" data-target="#myModal" style="margin-right: 5px;"><i class="fa fa-edit"></i></a>
                  <a class="btn btn-danger btn-xs" href="<?php echo site_url('admin/modules/phone-validator/delete/'.$i);?>" data-toggle="modal" data-target="#myModal"><i class="fa fa-remove"></i></a>
                </td>
              </tr>
              <?php endfor;?>
              <tr id="add-validator">
                <td style="vertical-align: middle;width:180px;"><input class="form-control input-sm" name="nama" value="" maxlength="32"/></td>
                <td style="vertical-align: middle;"><input class="form-control input-sm" name="regex" value="" maxlength="1024"/></td>
                <td class="text-center"  style="vertical-align: middle;width:100px;"><button class="btn btn-primary btn-sm" type="submit" name="submit" value="submit" title="Tambah"><i class="fa fa-plus"></i> Tambah</button></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <?php echo form_close();?>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>
</html>