<?= $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">
  <div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
  <?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
  <div class="action_form">
    <table class="table table-bordered">
      <?php foreach (["code", "type", "title", "price", "amount", "manufactur_at", "format_at", "status",] as $field): ?>
        <tr>
          <th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
          <td nowrap class="text-start">
            <?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['field_default_values'][$field] ?? null), $viewDatas) ?>
            <span><?= validation_show_error($field); ?></span>
          </td>
        </tr>
      <?php endforeach; ?>
      <?php foreach (SERVER['PARTTYPES'] as $type): ?>
        <tr>
          <th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel("partinfo_uid_{$type}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$type}"), $viewDatas) ?></th>
          <td nowrap class="text-start">
            <?= $viewDatas['helper']->getFieldForm("partinfo_uid_{$type}", old("partinfo_uid_{$type}") ?? ($viewDatas['control']['field_default_values']["partinfo_uid_{$type}"] ?? null), $viewDatas) ?>
            <?= form_dropdown("partinfo_uid_{$type}_cnt", $viewDatas['serverinfopartinfo_cnt_range'], old("partinfo_uid_{$type}_cnt") ?? 1) . "개" ?>
            <?php if ($type === "DISK"): ?>
              <?= form_dropdown("partinfo_uid_{$type}_extra", $viewDatas['serverinfopartinfo_extra_options'], old("partinfo_uid_{$type}_extra") ?? null) ?>
            <?php endif ?>
            <span><?= validation_show_error("partinfo_uid_{$type}"); ?></span>
          </td>
        </tr>
      <?php endforeach; ?>
    </table>
    <div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
    <?= form_close(); ?>
  </div>
  <div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
</div>
<?= $this->endSection() ?>