<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
  <div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
  <table class="table" style="margin:0px; padding:0px;">
    <tr>
      <td width="10%">
        <?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey() . 'order_field=price,order_value=ASC', '판매가순', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?>
        <?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey() . 'order_field=view_cnt,order_value=DESC', '인기순', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
      </td>
      <td>
        <?= form_open(current_url(), array("method" => "get")) ?>
        <?= $this->include('templates/front/index_head') ?>
        <?= form_close() ?>
      </td>
      <td width="10%" style="text-align:right; padding-right:10px;">
        <?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey(), 'Block', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
      </td>
    </tr>
  </table>
  <?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
  <table class="table table-bordered table-hover table-striped">
    <tr>
      <th>번호</th>
      <?php foreach ($viewDatas['fields'] as $field) : ?><th><?= getFieldIndex_Column_ProductHelper($field, $viewDatas) ?></th><?php endforeach ?>
    </tr>
    <?php $cnt = 0 ?>
    <?php foreach ($viewDatas['entitys'] as $entity) : ?>
      <tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
        <td>
          <?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
        </td>
        <?php foreach ($viewDatas['fields'] as $field) : ?>
          <td nowrap><?= getFieldIndex_Row_ProductHelper($field, $entity, $viewDatas) ?></td>
        <?php endforeach ?>
      </tr>
      <?php $cnt++ ?>
    <?php endforeach ?>
  </table>
  <div class="bottom">
    <?= $viewDatas['pagination'] ?>
  </div>
  <?= form_close() ?>
  <div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
</div>
<?= $this->endSection() ?>