{% from "components/alert.html" import Alert %}
{% from 'components/save_button.html' import SaveButton %}
{% from "components/text_input.html" import TextInput %}

<new-environment inline-template>
  <div>
    <div v-if="open">
      <form method='POST' id="add-new-env" action='{{ url_for("applications.new_environment", application_id=application.id) }}' autocomplete="off" enctype="multipart/form-data">
        {{ new_env_form.csrf_token }}
        {{ Alert(
          title=("portfolios.applications.create_new_env" | translate),
          message=("portfolios.applications.create_new_env_info" | translate )
        ) }}
        <div class="accordion-table__item-content new-env">
          <div class="h4">{{ "portfolios.applications.enter_env_name" | translate }}</div>
            {{ TextInput(new_env_form.name, label="", validation="requiredField", optional=False) }}
          <div class="action-group">
            {{ SaveButton(text=('common.save' | translate), element="input", form="add-new-env") }}
            <a class='action-group__action icon-link icon-link--default' v-on:click="toggle">
              {{ "common.cancel" | translate }}
            </a>
          </div>
        </div>
      </form>
    </div>
    <a class="usa-button usa-button-secondary add-new-button" v-on:click="toggle">
      {{ "portfolios.applications.add_environment" | translate }}
    </a>
  </div>
</new-environment>
