<%= form_with model: @prompt do |f| %>

  <% if @prompt.errors.any? %>
    <div style="color: red" class="mb-3">
      <h2><%= pluralize(@prompt.errors.count, "error") %> prohibited this prompt from being saved:</h2>

      <ul>
        <% @prompt.errors.each do |error| %>
          <li><%= error.full_message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <div class="mb-3">
    <%= f.label :title, 'Title', class: 'form-label' %>
    <%= f.text_field :title, value: @prompt.title, class: 'form-control', required: true %>
  </div>

  <div class="mb-3">
    <%= f.label :icon, 'Icon', class: 'form-label' %>
    <%=
      f.select :icon,
        options_for_select(prompt_icons_collection, @prompt.icon),
        {},
        class: 'form-select'
    %>
  </div>

  <div class="mb-3">
    <%= f.label :scope, 'Prompt Scope', class: 'form-label' %>
    <%=
      f.select :scope,
        options_for_select(Dradis::Plugins::Echo::Prompt::SCOPES.map { |scope| [scope.to_s.humanize, scope] }, @prompt.scope),
        {},
        class: 'form-select'
    %>
  </div>

  <div class="mb-3">
    <%= f.label :prompt, 'Prompt', class: 'form-label' %>
    <%= f.text_area :prompt, value: @prompt.prompt, class: 'form-control', rows: 10, required: true %>
  </div>

  <div>
    <%= f.submit class: 'btn btn-primary' %> or <%= link_to 'Cancel', prompts_path %>
  </div>
<% end %>
