<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): echo $viewDatas['service']->getHelper()->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">
      <tr>
        <th>기본 서버정보</th>
        <th>기본 추가정보(서버 비용에 포함)</th>
      </tr>
      <tr>
        <td>
          <table class="table table-bordered">
            <tr>
              <?php foreach (["code", "type", "title", "price", "manufactur_at", "format_at", "status",] as $field): ?>
                <th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
                <td nowrap class="text-start">
                  <?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field, $viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
                  <span><?= validation_show_error($field); ?></span>
                </td>
            </tr>
          <?php endforeach ?>
          </table>
        </td>
        <td>
          <table class="table table-bordered">
            <?php foreach (SERVERPART['SERVER_PARTTYPES'] as $field): ?>
              <tr>
                <th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
                <td nowrap class="text-start">
                  <?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field, $viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
                  <?= $viewDatas['service']->getHelper()->getFieldForm("{$field}_cnt", old("{$field}_cnt", $viewDatas['control']['form_datas']["{$field}_cnt"] ?? 1), $viewDatas) ?>
                  <?php if ($field === 'DISK'): ?>
                    <?= $viewDatas['service']->getHelper()->getFieldForm("{$field}_extra", old("{$field}_extra", $viewDatas['control']['form_datas']["{$field}_extra"] ?? null), $viewDatas) ?>
                  <?php endif ?>
                  <span><?= validation_show_error($field); ?></span>
                </td>
              </tr>
            <?php endforeach; ?>
          </table>
        </td>
      </tr>
    </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() ?>