Moved customer issue counts

This commit is contained in:
2022-02-20 15:22:31 -05:00
parent fc7501c4fe
commit 70e6038215
3 changed files with 7 additions and 9 deletions

View File

@@ -92,6 +92,7 @@ class CustomersController < ApplicationController
@issues = @customer.issues
@billing_address = address_to_s(@customer.billing_address)
@shipping_address = address_to_s(@customer.shipping_address)
@closed_issues = (@issues - @issues.open)
rescue ActiveRecord::RecordNotFound
render_404
end

View File

@@ -25,11 +25,6 @@
<td><%= @shipping_address %></td>
</tr>
<tr>
<th><%=t(:issues)%></th>
<td><%= customer.issues.count %></td>
</tr>
<tr>
<th><%=t(:label_account_balance)%></th>
<td>$<%= customer.balance %></td>

View File

@@ -17,6 +17,7 @@
<h4><%=t(:estimates)%>:</h4>
<%= render :partial => 'estimates/list', locals: {customer: @customer} %>
</div>
<div class="splitcontentleft">
<h4><%=t(:label_invoices)%>:</h4>
<%= render :partial => 'invoices/list', locals: {customer: @customer} %>
@@ -24,18 +25,19 @@
</div>
</div>
<div class="splitcontentleft">
<h4><%=t(:field_vehicles)%>:</h4>
<%= render :partial => 'vehicles/list' %>
<%= button_to "New Vehicle", new_customer_vehicle_path(@customer), method: :get %>
<%= button_to "New Vehicle", new_customer_vehicle_path(@customer), method: :get %>
</div>
</div>
<br/>
<h2><%=t(:label_open_issues)%>:</h2>
<h2><%=@issues.open.count%> <%=t(:label_open_issues)%>:</h2>
<%= render :partial => 'issues/list_simple', locals: {issues: @issues.open} %>
<h2><%=t(:label_closed_issues)%>:</h2>
<%= render :partial => 'issues/list_simple', locals: {issues: (@issues - @issues.open)} %>
<h2><%=@closed_issues.count%> <%=t(:label_closed_issues)%>:</h2>
<%= render :partial => 'issues/list_simple', locals: {issues: @closed_issues} %>
</div>