Kercode/tutti_gruppi

View on GitHub
app/views/groupment/manager_groupment.html.erb

Summary

Maintainability
Test Coverage
<h1 class="text-center">Commandes du groupement (<%= @groupment.groupment.name %>)</h1>

<section>
  <div class="row">
    <div class="col-1-of-2">
      <% total = 0 %>
      <% @member_gpmt.each do |member_groupment| %>
        <% order = Order.where(authentication_id: member_groupment.authentication_id, date: Date.today.beginning_of_month..Date.today.end_of_month) %>
        <% if order != [] %>
          <div class="m-3 p-4" style="border: 2px solid black;">
            <%= member_groupment.authentication.fullname %>
            <% order.each do |o| %>
              <div class="d-flex">
                <div class="w-100">
                  <p>Numero de commande : <%= o.id %></p>
                  <p>Total : <%= render_price_to_euros(o.total) %></p>
                  <% total += o.total if o.accept == true %>
                </div> 
                
                <div class="w-100"> 
                  <div class="pt-4 mt-3 text-right">
                    <%= link_to 'Voir', order_path(o.id), id: 'btns' %>
                    
                    <% if !o.accept %>
                      <td><%= link_to image_tag('dollars_grey.png', class:'icons', title: "en attente de paiement"), "unavailable/#{o.id}" %></td>
                    <% else %>
                      <td><%= link_to image_tag('dollars.png', class:'icons', title: "en attente de paiement"), "available/#{o.id}" %></td>
                    <% end %>

                  </div>
                </div>
              </div>
            <% end %>
          </div>
        <% end %>
      <% end %>
    </div>
    
    <div class="col-1-of-2">
      <div id="bloc_facture">
        <div class="col-1-of-2 text-center">
          <p>Total : <%= total %> €</p>
          <p>Date de livraison :</p>
          <%= link_to 'Récap commandes', order_groupment_quantity_path, id: 'btns' %>
        </div>  

        <div class="col-1-of-2 text-center">
          <p>Responsable :</p>
          <p>Accompagnateur :</p>
          <%= link_to 'Facture', order_groupment_total_path, id: 'btns' %>
        </div>  
      </div>
    </div> 
  </div>   
</section>

<%= link_to 'Back', '/groupment/show' || root_path, id: 'btns' %>