<%= form_with model: import, class: "contents" do |form| %>
  <% if import.errors.any? %>
    <div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
      <h2><%= pluralize(import.errors.count, "error") %> prohibited this import from being saved:</h2>

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

  <div class="form-control w-full max-w-xs">
    <label class="label">
      <span class="label-text">Select source</span>
    </label>
    <div class="space-y-2">
      <%= form.collection_radio_buttons :source, Import.sources.except('google_records'), :first, :first do |b| %>
        <div class="form-control">
          <label class="label cursor-pointer space-x-3">
            <%= b.radio_button(class: "radio radio-primary") %>
            <span class="label-text"><%= b.text.humanize %></span>
          </label>
        </div>
      <% end %>
    </div>
  </div>

  <label class="form-control w-full max-w-xs my-5">
    <div class="label">
      <span class="label-text">Select file(s)</span>
    </div>
    <%= form.file_field :files, multiple: true, class: "file-input file-input-bordered w-full max-w-xs" %>
  </label>

  <div class="inline">
    <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
  </div>
<% end %>
