<?php $this->load->view('element/head');?>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Register Index
        <small>List Register</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Register Index</a></li>
        <li class="active">Here</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
            <ul class="nav nav-tabs">
                <li role="presentation"><a href="<?php echo site_url('register/create');?>">Input Register</a></li>
                <li role="presentation" class="active"><a href="<?php echo site_url('register');?>">List Register</a></li>
            </ul>
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Data Table Register</h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
            <form action="<?php echo site_url('register?search=true');?>" method="GET">
                <input type="hidden" class="form-control" name="search" value="true"/>
                <div class="box-body pad">
                  <div class="col-md-3">
                    <div class="form-group">
                      <label for="id">Voucher Registered</label>
                      <input type="text" class="form-control" name="voucher" value="<?php echo !empty($_GET['voucher']) ? $_GET['voucher'] : '';?>"/>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label for="submit">&nbsp</label>
                      <input type="submit" value="Cari" class="form-control btn btn-primary">
                    </div>
                  </div>
                </div>
              </form>
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th style="display: none;">USERNAME</th>
                  <th>VOUCHER</th>
                  <th>ITEM NAME</th>
                  <th>ITEM VALUE</th>
                  <th>USED</th>
                  <th>CREATED</th>
                  <th style="display: none;">DATE EXPIRED</th>
                  <th>ACTION</th>
                </tr>
                </thead>
                <tbody>
				<?php if(isset($registers) && is_array($registers)){ ?>
				  <?php foreach($registers as $register){?>
                <tr>
                <td style="display: none;"><?php echo $register->username;?></td>
				<td><?php echo $register->voucher;?></td>
				<td><?php echo $register->item_name;?></td>
				<td><?php echo $register->item_value;?></td>
				<td><?php echo $register->used;?></td>
				<td><?php echo $register->created_by;?></td>
				<td style="display: none;"><?php echo $register->date_first." - ".$register->date_last;?></td>
				<td>
				    <a href="<?php echo site_url('register/edit').'/'.$register->id;?>" class="btn btn-xs btn-primary">Edit</a>
					<a onclick="return confirm('Are you sure you want to delete this register?');" href="<?php echo site_url('register/delete').'/'.$register->id;?>" class="btn btn-xs btn-danger">Delete</a>
				</td>
				</tr>
				  <?php } ?>
				<?php } ?>
                </tbody>
                <tfoot>
                </tfoot>
              </table>
            </div>
            <!-- /.box-body -->
            <div class="text-center">
              <?php echo $paggination;?>
            </div>
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
	  <!-- row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
<?php $this->load->view('element/footer');?>