Refactor customer details and form views for improved readability and consistency

This commit is contained in:
2026-08-11 18:39:23 -04:00
parent ea29990cfa
commit 75e5aeb668
2 changed files with 34 additions and 41 deletions
+25 -29
View File
@@ -2,59 +2,55 @@
<tbody> <tbody>
<tr> <tr>
<th><%=t(:label_name)%></th> <th><%= t(:label_name) %></th>
<td><%= customer.name %></td> <td><%= customer.name %></td>
</tr> </tr>
<tr> <tr>
<th><%=t(:label_email)%></th> <th><%= t(:label_email) %></th>
<td><%= customer.email %></td> <td><%= customer.email %></td>
</tr> </tr>
<tr> <tr>
<th><%=t(:label_primary_phone)%></th> <th><%= t(:label_primary_phone) %></th>
<td><%= number_to_phone(customer&.primary_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %></td> <td><%= number_to_phone(customer&.primary_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %></td>
</tr> </tr>
<tr> <tr>
<th><%=t(:label_mobile_phone)%></th> <th><%= t(:label_mobile_phone) %></th>
<td><%= number_to_phone(customer&.mobile_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %></td> <td><%= number_to_phone(customer&.mobile_phone&.gsub(/[^\d]/, '').to_i, area_code: true) %></td>
</tr> </tr>
<tr> <tr>
<th><%=t(:label_billing_address)%></th> <th><%= t(:label_billing_address) %></th>
<td><pre><%= @billing_address %></pre></td> <td><pre><%= @billing_address %></pre></td>
</tr>
<tr>
<th><%=t(:label_shipping_address)%></th>
<td><pre><%= @shipping_address %></pre></td>
</tr> </tr>
<tr> <tr>
<th><%=t(:label_account_balance)%></th> <th><%= t(:label_shipping_address) %></th>
<td>$<%= customer.balance %></td> <td><pre><%= @shipping_address %></pre></td>
</tr> </tr>
<tr> <tr>
<th colspan="2"><h4><%=t(:field_notes)%></hr></th> <th><%= t(:label_account_balance) %></th>
<td>$<%= customer.balance %></td>
</tr> </tr>
<% if customer.notes.present? %>
<tr>
<th colspan="2"><h4><%= t(:field_notes) %></h4></th>
</tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<pre id="note-display" style="text-align: left; white-space: pre-wrap; font-family: inherit;"> <div class="wiki">
<%= customer.notes %> <%= textilizable(customer, :notes) %>
</pre> </div>
</td> </td>
</tr> </tr>
<% end %>
<script>
const preElement = document.getElementById('note-display');
// This takes the text, trims the edges, and puts it back
preElement.textContent = preElement.textContent.trim();
</script>
</tbody> </tbody>
</table> </table>
<br/> <br/>
<br/> <br/>
+9 -12
View File
@@ -32,20 +32,17 @@
</div> </div>
</div> </div>
<div class="clearfix"> <div class="clearfix">
<%=t(:field_notes)%>: <%=t(:field_notes)%>:
<div class="input"> <div class="input">
<p> <p>
<%= content_tag :span, id: "issue_description_and_toolbar" do %> <%= f.text_area :notes,
<%= f.text_area :notes, rows: 8,
cols: 60, class: 'wiki-edit',
rows: 10, style: 'width: 95%;',
accesskey: accesskey(:edit), id: 'customer_appointment_description' %>
class: 'wiki-edit', <%= wikitoolbar_for 'customer_appointment_description' %>
no_label: true %> </p>
<% end %>
</p>
<%= wikitoolbar_for :issue_description %>
</div> </div>
</div> </div>