<div class="container">
  <div class="row">
    <div class="offset-lg-2 col-lg-8">
      <%= render partial: 'leader' %>
      <%= render partial: 'rsvp_nav', locals: { active: 3 } %>

      <h2>Bestätigung</h2>

      <%= form_with(model: @guest, url: complete_guest_path(@guest), local: true) do |form| %>
      <div class="row">
        <div class="col-md-12">
          <%= errors_for(@guest) %>
        </div>
      </div>

      <% if @guest.attending? %>
      <h3>Deine Angaben</h3>
      <div class="card mb-3">
        <h5 class="card-header"><%= @guest.name %></h5>
        <div class="card-body">
          <div class="row">
            <div class="col-md-4">
              E-Mail
            </div>
            <div class="col-md-8">
              <p><tt><%= @guest.email %></tt></p>
            </div>
          </div>
          <div class="row">
            <div class="col-md-4">
              Ernährungspräferenzen
            </div>
            <div class="col-md-8">
              <% if @guest.diet.present? %>
                <pre><%= @guest.diet %></pre>
              <% else %>
                <p>(Keine)</p>
              <% end %>
            </div>
          </div>
          <div class="row">
            <div class="col-md-4">
              Song‑Vorschläge
            </div>
            <div class="col-md-8">
              <% if @guest.songs.present? %>
                <pre><%= @guest.songs %></pre>
              <% else %>
                <p>(Keine)</p>
              <% end %>
            </div>
          </div>
          <div class="row">
            <div class="col-md-12 text-right">
              <%= link_to 'Bearbeiten', guest_path(@guest), class: 'card-link', data: { disable_with: 'Loading...' } %>
            </div>
          </div>
        </div>
      </div>

      <h3>Begleitung</h3>
      <% if @guest.plus_ones.any? %>
        <%= render @guest.plus_ones %>
      <% else %>
        <p>(Keiner &mdash; nur du.)</p>
      <% end %>
      <% else %>
      <p>Schade, dass du nicht teilnehmen kannst.</p>
      <h3>Deine Angaben</h3>
      <div class="card mb-3">
        <h5 class="card-header"><%= @guest.name %></h5>
        <div class="card-body">
          <div class="row">
            <div class="col-md-4">
              E-Mail
            </div>
            <div class="col-md-8">
              <p><tt><%= @guest.email %></tt></p>
            </div>
          </div>
        </div>
      </div>
      <% end %>

      <h3>Sonstige Kommentare?</h3>

      <%= form.text_area :notes, class: 'form-control' %>
      <small class="form-text text-muted">Hast du noch etwas, das wir wissen sollten?</small>

      <div class="row guests-buttons">
        <div class="offset-md-3 col-md-6 text-center">
          <%= form.submit 'Final bestätigen', class: 'btn btn-primary', data: { disable_with: 'Sending...' } %>
        </div>
      </div>
      <% end %>
    </div>
  </div>
</div>
