<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
<div id="container" class="content">
  <link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
  <script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
  <script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
  <?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
    <link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
  <?php endforeach ?>
  <?php foreach ($viewDatas['individualScripts'] as $js): ?>
    <script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
  <?php endforeach ?>
  <?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
  <div class="action_form">
    <table class="table table-bordered">
      <?php foreach ($viewDatas['form_fields'] as $field): ?>
        <tr>
          <th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
          <td nowrap class="text-start">
            <?= $viewDatas['helper']->getFieldForm($field,  old($field) ?? $viewDatas['entity']->$field, $viewDatas) ?>
            <div><?= validation_show_error($field); ?></div>
          </td>
        </tr>
      <?php endforeach; ?>
    </table>
    <div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
    <?= form_close(); ?>
  </div>
</div>
<?= $this->endSection() ?>