diff --git a/app/views/customers/show.html.erb b/app/views/customers/show.html.erb
index 54045b5..cb7ca1e 100644
--- a/app/views/customers/show.html.erb
+++ b/app/views/customers/show.html.erb
@@ -27,12 +27,12 @@
<%=t(:estimates)%>:
- <%= render partial: 'estimates/list', locals: {customer: @customer} %>
+ <%= render partial: 'estimates/list', locals: {estimates: @customer.estimates} %>
<%=t(:label_invoices)%>:
- <%= render partial: 'invoices/list', locals: {customer: @customer} %>
+ <%= render partial: 'invoices/list', locals: {invoices: @customer.invoices} %>
diff --git a/app/views/estimates/_list.html.erb b/app/views/estimates/_list.html.erb
index d078a69..2429fc8 100644
--- a/app/views/estimates/_list.html.erb
+++ b/app/views/estimates/_list.html.erb
@@ -1,6 +1,6 @@
-<% if @customer.present? %>
+<% if estimates.empty? %>
- <% @customer.estimates.order(id: :desc).each do |estimate| %>
+ <% estimates.sort.reverse.each do |estimate| %>
<%= check_box_tag "select-all-invoices", "1", false, id: "select-all-invoices" %>
<%= label_tag "select-all-invoices", t(:label_select_all) %>
-
<%= check_box_tag "invoice_ids[]", invoice.id, false, class: "invoice-checkbox" %>
<%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %> <%= invoice.txn_date %>
<% end %>
- <% if @customer.invoices.count > 1 %>
+ <% if invoices.count > 1 %>
<%= form.submit t(:button_bulk_pdf) %>
<% end %>
<% end %>