% html_title @customer.to_s %>
<%= link_to l(:label_customers), customers_path %> » <%= @customer.to_s %>
<%# Under the title rather than beside it, so a long name and the many actions don't crowd each other %>
<%# New issue for this customer; picks up what's ticked on this page (an estimate, other plugins' items) %>
<%= link_to sprite_icon('add', l(:label_new_issue)), new_issue_path(issue: { customer_id: @customer.id }),
id: 'dynamic-new-issue-link', class: 'icon icon-add', target: :_blank %>
<%# Plugins add their customer actions here (e.g. redmine_qbo_calendar's Add appointment) %>
<%= call_hook :view_customers_show_contextual, { customer: @customer } %>
<%# Estimates, invoices and payments are handled here, each shown to users with its permission; Open in
QuickBooks goes to their QuickBooks account page for anything else. %>
<% if RedmineQboBilling.writer? %>
<%= render partial: 'qbo_estimates/customer_link', locals: { customer: @customer } %>
<% end %>
<% if RedmineQboBilling.invoice_writer? %>
<%= render partial: 'qbo_invoices/customer_link', locals: { customer: @customer } %>
<% end %>
<% if RedmineQboBilling.payment_viewer? %>
<%= link_to sprite_icon('list', l(:label_payments)), qbo_payments_path(customer_id: @customer.id), class: 'icon icon-list' %>
<% end %>
<% if RedmineQboBilling.payment_receiver? %>
<%= link_to sprite_icon('add', l(:button_receive_payment)), new_qbo_payment_path(customer_id: @customer.id), class: 'icon icon-add' %>
<% end %>
<% if User.current.allowed_to?(:edit_customers, nil, global: true) %>
<%= link_to sprite_icon('edit', l(:button_edit)), edit_customer_path(@customer),
class: 'icon icon-edit', accesskey: accesskey(:edit) %>
<% end %>
<%= link_to sprite_icon('link', l(:button_open_in_quickbooks)),
"https://#{RedmineQbo.sandbox_mode? ? 'sandbox' : 'app'}.qbo.intuit.com/app/customerdetail?nameId=#{@customer.id}",
class: 'icon icon-link', target: :_blank, rel: 'noopener' %>
<%=t(:label_details)%>:
<%= render partial: 'customers/details', locals: {customer: @customer} %>
<%=t(:estimates)%>:
<%= render partial: 'estimates/list', locals: {estimates: @customer.estimates} %>
<%=t(:label_invoices)%>:
<%= render partial: 'invoices/list', locals: {invoices: @customer.invoices} %>
<%= call_hook :show_customer_view_right, {customer: @customer} %>
<%=@open_issues.count%> <%=t(:label_open_issues)%> - <%=@hours.round(1)%> <%=t(:label_hours)%>
<%= render partial: 'issues/list_simple', locals: {issues: @open_issues.open} %>
<%=@closed_issues.count%> <%=t(:label_closed_issues)%> - <%= @closed_hours.round(1)%> <%=t(:label_hours)%>
<%= render partial: 'issues/list_simple', locals: {issues: @closed_issues} %>
<%= render partial: 'customers/new_issue_link_script' %>