<?= $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() . '&v=_list', 'List', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
      </td>
    </tr>
  </table>
  <?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
  <div>
    <?php $cnt = 0 ?>
    <?php foreach ($viewDatas['entitys'] as $entity) : ?>
      <table class="table table-bordered">
        <tr>
          <td width="10%"><?= getFieldIndex_Row_ProductHelper('photo', $entity, $viewDatas) ?></td>
          <td width="*">
            <div style="text-align:left;"><?= getFieldIndex_Row_ProductHelper('name', $entity, $viewDatas) ?></div>
            <div style="text-align:left;">
              <b style="font-size:18px;">판매가:<?= getFieldIndex_Row_ProductHelper('price', $entity, $viewDatas) ?>원</b>
              <span style="font-size:12px;">
                원가:<?= getFieldIndex_Row_ProductHelper('cost', $entity, $viewDatas) ?>원
                -
                할인가:<?= getFieldIndex_Row_ProductHelper('sale', $entity, $viewDatas) ?>원
              </span>
            </div>
            <div style="text-align:left;">
              조회수:<?= getFieldIndex_Row_ProductHelper('view_cnt', $entity, $viewDatas) ?>
            </div>
          </td>
          <td width="10%"><?= getFieldIndex_Row_ProductHelper('user_uid', $entity, $viewDatas) ?></td>
        </tr>
      </table>
      <?php $cnt++ ?>
    <?php endforeach ?>
  </div>
  <div class="bottom">
    <?= $viewDatas['pagination'] ?>
  </div>
  <?= form_close() ?>
  <div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
</div>
<?= $this->endSection() ?>