<script type="text/javascript">

localDomains = ""

$(document).ready(function() {
  $.validationEngineLanguage.newLang(localDomains);
  $("#app_env1").validationEngine({
    success : function() { document.app_env1.submit(); },
    failure : function() {}
  })
});
</script>

<fieldset>
  <h2>システム管理画面アクセスＩＰアドレスの設定</h2>
  <div class="table-sys-a1">
    <div class="item-body">
      <div class="item-tr">
        <div class="table-sys-a2">
          <div class="item-body">
          <%- @system_ip_count = 0 -%>
          <%- @app_envs.each do | app_env | -%>
            <%- if app_env.key == 'PERMIT_OPERATION_IPS' -%>
              <%- @system_ip_count += 1 -%>
            <div class="item-tr">
              <div class="input-mid-2-l"><%= app_env.value %></div>
              <div class="input-mid-2-r">
              <span>
                <%= link_to '[編集]', {action: :param_edit1, id: app_env.id } -%>
              </span>
              <span data-turbo="true">
                <%= link_to '[削除]', {action: 'param_destroy', id: app_env.id},
                                       class: 'delete',
                                       data: { turbo_method: "delete", turbo_confirm: "削除します。よろしいですか?" } -%>
              </span>
              </div>
            </div>
            <%- end -%>
          <%- end -%>
          <%- if @system_ip_count == 0 -%>
            <div class="item-tr">
              <div class="input-mid-2-l">(<%= $param_label['PERMIT_OPERATION_IPS'] %>が登録されていません)</div>
              <div class="input-mid-2-r">&nbsp;</div>
            </div>
          <%- end -%>
          </div>
        </div>
        <div class="table-sys-a2">
          <div class="item-body">
            <%= form_with(model: @app_env, url: {action: :param_create}, 
                          id: 'app_env1', html: {name: "app_env1" }) do |f| -%>
              <div class="item-tr">
                <div class="item-mid">ＩＰアドレスの登録</div>
                <div class="input-mid">
                  <%= f.hidden_field :key, {value: "PERMIT_OPERATION_IPS"} -%>
                  <%= f.hidden_field :category, {value: 0} -%>
                  <%= f.text_field :value, class: 'validate[required, custom[IPAddress]]' -%>
                  <%= f.submit "登　録" -%>
                </div>
              </div>
            <%- end -%>
          </div>
        </div>
      </div>
    </div>
  </div>
</fieldset>

<br>

<br><br>

