<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
  <div><?= html_entity_decode($viewDatas['currentCategory']->head) ?></div>
  <div class="top">
    <?= $this->include('templates/front/index_head') ?>
    <nav class="nav"></nav>
    <nav class="nav justify-content-center"></nav>
    <nav class="nav justify-content-end">
      <?= anchor(current_url() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey() . '&order_field=price&order_value=ASC', '판매가순', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?>
      <?= anchor(current_url() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey() . '&order_field=view_cnt&order_value=DESC', '인기순', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
    </nav>
  </div>
  <?php $cnt = 0 ?>
  <?php foreach ($viewDatas['entitys'] as $entity) : ?>
    <table class="product table table-bordered">
      <tbody>
        <tr>
          <td width="14%" rowspan="3" class="align-middle"><?= $entity->getFileImage('middle') ?></td>
          <td class="text-start"><?= getFieldIndex_Row_ProductHelper('name', $entity, $viewDatas) ?></td>
        </tr>
        <tr>
          <td class="text-start">
            <span class="fs-4 fw-bold">구매비용 : <?= getFieldIndex_Row_ProductHelper('price', $entity, $viewDatas) ?></span>
            =
            <span class="text-decoration-line-through">
              상품원가 : <?= getFieldIndex_Row_ProductHelper('cost', $entity, $viewDatas) ?>
              -
              할인가 : <?= getFieldIndex_Row_ProductHelper('sale', $entity, $viewDatas) ?>
            </span>
          </td>
        </tr>
        <tr>
          <td class="text-start">조회수 : <?= getFieldIndex_Row_ProductHelper('view_cnt', $entity, $viewDatas) ?></td>
        </tr>
      </tbody>
    </table>
    <?php $cnt++ ?>
  <?php endforeach ?>
  <div class=" bottom"><?= $viewDatas['pagination'] ?>
  </div>
  <div><?= html_entity_decode($viewDatas['currentCategory']->tail) ?></div>
</div>
<?= $this->endSection() ?>