<%= form_with(url: url, model: donation, local: true) do |form| %>
  <% if donation.errors.any? %>
    <section id="error_explanation">
      <h3><%= pluralize(donation.errors.count, "error") %> prohibited this donation from being saved:</h3>
      <ul class="list-disc list-inside">
        <% donation.errors.full_messages.each do |message| %>
          <li><%= message %></li>
        <% end %>
      </ul>
    </section>
  <% end %>

  <section class="sm:w-1/2 grid grid-cols-2 items-center gap-y-2">
    <%= form.label :user_id %>
    <%= form.collection_select :user_id, User.where(ou: Setting.primary_domain).order(:cn), :id, :cn, {} %>

    <%= form.label :amount_sats, "Amount BTC (sats)" %>
    <%= form.number_field :amount_sats %>

    <%= form.label :amount_eur, "Amount EUR (cents)" %>
    <%= form.number_field :amount_eur %>

    <%= form.label :amount_usd, "Amount USD (cents)"%>
    <%= form.number_field :amount_usd %>

    <%= form.label :public_name %>
    <%= form.text_field :public_name %>

    <%= form.label :paid_at %>
    <%= form.text_field :paid_at %>
  </section>

  <section>
    <p class="pt-6 border-t border-gray-200 text-right">
      <%= link_to 'Cancel',
            @donation.id.present? ? admin_donation_path(@donation) : admin_donations_path,
            class: 'btn-md btn-gray' %>
      <%= form.submit class: 'ml-2 btn-md btn-blue' %>
    </p>
  </section>
<% end %>
