<%= bootstrap_form_with model: [project, contract_template], local: true do |form| %>
  <%= field_set_tag content_tag(:span, t(".release_info.heading"), class: "h6 text-muted text-uppercase") do %>
    <div class="form-row">
      <%= form.text_field :name, wrapper_class: "col-sm-6" %>
      <%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target_show_values_mapping: { "#guardian_clause": %w(appearance talent), "#fee_field": %w(appearance talent location material acquired_media), "#exploitable_rights_fields": %w(appearance talent location material acquired_media), "#custom_fields": %w(medical) } }, class: "form-control custom-select" %>
    </div>
    <div class="form-row" id="fee_field">
      <%= form.number_field :fee, min:"0", max:"99999999",  step: "0.01", prepend: "$", help: "Leave at $0.00 for no-fee", wrapper_class: "col-sm-6" %>
    </div>
  <% end %>

  <hr>

  <%= field_set_tag content_tag(:span, t(".exploitable_rights.heading"), class: "h6 text-muted text-uppercase"), id: "exploitable_rights_fields" do %>
    <%= render "shared/exploitable_rights_fields", form: form %>
    <hr>
  <% end %>

  <%= field_set_tag content_tag(:span, t(".legal.heading"), class: "h6 text-muted text-uppercase") do %>
    <%= form.form_group do %>
      <%= form.rich_text_area :body %>
    <% end %>
    <div id="guardian_clause">
      <%= form.form_group do %>
        <%= form.rich_text_area :guardian_clause %>
      <% end %>
    </div>
  <% end %>

  <%= field_set_tag content_tag(:span, t(".custom_fields.heading"), class: "h6 text-muted text-uppercase"), id: "custom_fields", style: "display: none;" do %>
    <p class="alert alert-info"><%= fa_icon("info-circle", text: t(".custom_fields.instructions")) %></p>
    <%= render "shared/custom_fields", form: form %>
    <hr>
  <% end %>

  <div class="row align-items-center text-center mt-4">
    <%= link_to t("shared.cancel"), [project, :contract_templates], class: "col-3 text-reset" %>
    <div class="col-3">
      <%= form.button "Preview", name: "commit", value: "preview", class: 'btn btn-info btn-block', formtarget: "_blank" %>
    </div>
    <div class="col-6">
      <%= form.submit class: "btn btn-success btn-block", data: { disable_with: false } %>
    </div>
  </div>
<% end %>
