<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
    document.getElementById("user_environment_back_button").addEventListener('click', function(){
      location.href = '<%= user_environment_index_path %>';
    });
    document.getElementById("user_environment_submit_button").addEventListener('click', function(){
      document.querySelector("form").submit();
    });
})

localDomains = "<%= @local_domains %>";
$(document).ready(function() {
  $.validationEngineLanguage.newLang(localDomains);
  $("form").validationEngine({promptPosition: "centerRight"})
});
</script>

<h1><%= t('views.user_menu.user_environment') %></h1>

<div class="comment">
<%= form_with(url: {action: :create}) do %>
  <div class="table-address-a">
    <div class="item-topx2">
      <%= t('.from_organization_add') %>
    </div>
    <div class="input-topx2">
      <div class="inner-box">
      <% if current_user.present? %>
        <%= text_field_tag 'conditions[from_organization_add]', current_user.from_organization_add, style: 'width:330px;', class: 'validate[maxSize[20]]' %>
      <% end %>
      </div>
    </div>
    <div class="item-botx2">
      <%= t('.to_organization_add') %>
    </div>
    <div class="input-botx2">
      <div class="inner-box">
      <% if current_user.present? %>
        <%= t('views.enable') %>：<%= radio_button_tag 'conditions[to_organization_add]', 'true', (current_user.to_organization_add), class: 'validate[required]' %>
        <%= t('views.disable') %>：<%= radio_button_tag 'conditions[to_organization_add]', 'false', (!current_user.to_organization_add), class: 'validate[required]' %>
      <% else %>
        &nbsp;
      <% end %>
      </div>
    </div>
  </div>
<% end %>

&nbsp;</br>

<div id="address_submit"><input type="button" value="<%= t('views.page_transration_button.back') %>" id="user_environment_back_button" style="margin-left:0px;"/>&nbsp;&nbsp;<input type="button" value="<%= t('views.page_transration_button.create') %>" id="user_environment_submit_button" style="margin-left:0px;"/></div>
</div>
