<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
  <div class="top container-fluid">
    <?= form_open(current_url(), array("method" => "get")) ?>
    <nav class="nav">
      조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_OrderHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
    </nav>
    <?= $this->include('templates/admin/index_head') ?>
    <?= form_close() ?>
  </div>
  <?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
  <table class="table table-hover">
    <thead>
      <tr>
        <th>#</th>
        <?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_OrderHelper($field, $viewDatas) ?><?php endforeach ?>
        <th>@</th>
      </tr>
    </thead>
    <tbody>
      <?php $cnt = 0 ?>
      <?php foreach ($viewDatas['entitys'] as $entity) : ?>
        <tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
          <td nowarp>
            <?php if ($entity->status == DEFAULTS['STATUS']) : ?>
              <?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
            <?php endif ?>
          </td>
          <?php foreach ($viewDatas['fields'] as $field) : ?>
            <td><?= getFieldIndex_Row_OrderHelper_Admin($field, $entity, $viewDatas) ?></td>
          <?php endforeach ?>
          <td>
            <?php if ($entity->status == DEFAULTS['STATUS']) : ?>
              <?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
            <?php endif ?>
          </td>
        </tr>
        <?php $cnt++ ?>
      <?php endforeach ?>
    </tbody>
  </table>
  <div class="bottom">
    <?= $viewDatas['pagination'] ?>
  </div>
  <?= form_close() ?>
</div>
<?= $this->endSection() ?>