<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): echo $viewDatas['service']->getHelper()->alert($error) ?><?php endif ?>
<style>
  /* 드롭다운 패널 */
  .ac-panel {
    --row-h: 34px;
    /* 한 줄 높이 */
    position: absolute;
    z-index: 1100;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
    max-height: calc(var(--row-h) * 10);
    /* ← 10줄 제한 */
    overflow-y: auto;
    /* 스크롤 생성 */
  }

  .ac-item {
    min-height: var(--row-h);
    line-height: var(--row-h);
    padding: 0 12px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ac-item:hover,
  .ac-item.active {
    background: #f1f5f9;
  }
</style>
<script id="ipData" type="application/json">
  <?= json_encode($viewDatas['ips'] ?? [], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>
</script>
<script id="switchData" type="application/json">
  <?= json_encode($viewDatas['switchs'] ?? [], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>
</script>
<script src="/js/admin/server/ipAutoComplete.js"></script>
<script src="/js/admin/server/switchAutoComplete.js"></script>
<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 ($viewDatas['control']['actionFields'] 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) ?>
            <span><?= validation_show_error($field); ?></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() ?>