ikuseiGmbH/smart-village-app-cms

View on GitHub
app/views/waste_calendar/index.html.erb

Summary

Maintainability
Test Coverage
<div class="d-flex flex-wrap align-items-center row-gap justify-content-between mb-5">
  <h1 class="h3 mb-0 pb-0 font-weight-bold mr-3">Abfallkalender (nur die ersten 100 Datensätze)</h1>
  <div>
    <%= link_to new_waste_calendar_path, class: "btn btn-sm btn-secondary shadow-sm" do %>
      <i class="fas fa-plus fa-sm text-white-50"></i>
      Daten bearbeiten
    <% end %>
    <%= link_to import_waste_calendar_index_path, class: "btn btn-sm btn-primary shadow-sm" do %>
      <i class="fas fa-plus fa-sm text-white-50"></i>
      CSV Daten importieren
    <% end %>
  </div>
</div>

<div class="table-responsive pb-4">
  <table class="table data_table bg-white">
    <thead>
      <tr>
        <th scope="col">ID</th>
        <th scope="col">Straße</th>
        <th scope="col">Ort</th>
        <th scope="col">PLZ</th>
        <% @waste_types.each do |key, waste_type| %>
          <th><%= waste_type["label"] %></th>
        <% end %>
      </tr>
    </thead>
    <tbody>
      <% @waste_locations.each do |waste_address| %>
        <tr>
          <th scope="row"><%= waste_address.id %></th>
          <td><%= waste_address.street %></td>
          <td><%= waste_address.city %></td>
          <td><%= waste_address.zip %></td>
          <% @waste_types.each do |key, waste_type| %>
            <% waste_location_types = waste_address.waste_location_types.select{ |a| a.waste_type == key } %>
            <td class="text-nowrap">
              <ul>
                <% waste_location_types.map(&:list_pick_up_dates).each do |list_pick_up_dates| %>
                  <% list_pick_up_dates.each do |list_pick_up_date| %>
                    <li><%= list_pick_up_date %></li>
                  <% end %>
                <% end %>
              </ul>
            </td>
          <% end %>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>