<h1><%= t("scaffold.pagetitle_new", model: SuccessCriterion.model_name.human) %></h1>

<%= turbo_frame_tag dom_id(@success_criterion.element, "new_success_criterion_frame") do %>
  <div id="<%= dom_id @success_criterion %>" class="card mt-3">
    <%== render partial: "success_criteria/header", locals: { success_criterion: @success_criterion.tap { _1.title = "Neu" } } %>
    
    <div class="collapse show" id="collapseSuccessCriterion_<%= @success_criterion.id %>">
      <div class="card-body">
        <%= bootstrap_form_with(model: @success_criterion.persisted? ? @success_criterion : [:element, @success_criterion]) do |form| %>
          <%= form.collection_select :check_id, Check.all.order(:external_number), :id, :display_label %>
          <%= form.submit class: "btn btn-warning" %>
          <%= link_to "Abbrechen", @success_criterion.persisted? ? @success_criterion : @success_criterion.element, class: "btn btn-outline-secondary" %>
        <% end %>
      </div>
    </div>
    <%# <%= link_to "edit", url_for([:edit, success_criterion]) %>
  </div>
<% end %>
<div class="action-row">
  <%= link_to t("scaffold.link_index", model: SuccessCriterion.model_name.human(count: 2)), element_success_criteria_path(@element) %>
</div>
