<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
  <div class="top">
    <?= form_open(current_url(), array("method" => "get")) ?>
    <ul class="nav">
      조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_BoardConfigHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
    <?= $this->include('templates/admin/index_head'); ?>
    </ul>
    <?= form_close(); ?>
  </div>
  <?= form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
  <table class="table table-bordered table-hover table-striped">
    <tr>
      <th>번호</th>
      <?php foreach ($fields as $field) : ?><th><?= getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_value) ?></th><?php endforeach; ?>
      <th>작업</th>
    </tr>
    <?php $i = 0; ?>
    <?php foreach ($entitys as $entity) : ?>
      <tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
        <td>
          <?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
          <?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
        </td>
        <?php foreach ($fields as $field) : ?>
          <td nowrap><?= getFieldIndex_Row_BoardConfigHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
        <?php endforeach; ?>
        <td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
      </tr>
      <?php $i++; ?>
    <?php endforeach; ?>
  </table>
  <div class="bottom">
    <ul class="nav justify-content-center">
      <li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
      <?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_BoardConfigHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
      <li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></li>
      <li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
    </ul>
    <?= $pagination ?>
  </div>
  <?= form_close(); ?>
</div>
<?= $this->endSection() ?>