Files
redmine_qbo/app/views/customers/_details.html.erb
T
rickyandClaude Opus 5.5 ff9556e728 Show the customer's addresses again; blank missing phones
The customer page's Billing and Shipping Address were always empty: the
controller stopped setting them in March and the view still read them.
The page now formats the QuickBooks addresses itself. A missing phone
number showed as "0", and the balance as "$125.0"; they're now blank
and "$125.00".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 18:02:32 -05:00

58 lines
1.5 KiB
ERB

<%# Phone numbers as (401) 555-0101, left blank when the customer has none %>
<% phone = ->(number) { digits = number.to_s.gsub(/\D/, ''); digits.present? ? number_to_phone(digits.to_i, area_code: true) : '' } %>
<table>
<tbody>
<tr>
<th><%= t(:label_name) %></th>
<td><%= customer.name %></td>
</tr>
<tr>
<th><%= t(:label_email) %></th>
<td><%= customer.email %></td>
</tr>
<tr>
<th><%= t(:label_primary_phone) %></th>
<td><%= phone.call(customer&.primary_phone) %></td>
</tr>
<tr>
<th><%= t(:label_mobile_phone) %></th>
<td><%= phone.call(customer&.mobile_phone) %></td>
</tr>
<tr>
<th><%= t(:label_billing_address) %></th>
<td><pre><%= RedmineQboBilling::EstimateWriter.format_address(customer.billing_address) %></pre></td>
</tr>
<tr>
<th><%= t(:label_shipping_address) %></th>
<td><pre><%= RedmineQboBilling::EstimateWriter.format_address(customer.shipping_address) %></pre></td>
</tr>
<tr>
<th><%= t(:label_account_balance) %></th>
<td><%= number_to_currency(customer.balance || 0) %></td>
</tr>
<% if customer.notes.present? %>
<tr>
<th colspan="2"><h4><%= t(:field_notes) %></h4></th>
</tr>
<tr>
<td colspan="2">
<div class="wiki">
<%= textilizable(customer, :notes) %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<br/>
<br/>