Updated views for items and accounts

This commit is contained in:
2026-03-17 19:18:03 -04:00
parent 2703d6cc3e
commit 6bf5575f9c
9 changed files with 216 additions and 171 deletions

View File

@@ -1,35 +1,44 @@
<h2 style="margin-bottom: 1em; border-bottom: 2px solid #ccc; padding-bottom: 4px;"><%= @item.name %></h2>
<div class="contextual">
<%= link_to l(:button_edit), edit_item_path(@item), class: 'icon icon-edit' %>
<%= link_to l(:button_back), items_path, class: 'icon icon-list' %>
</div>
<table style="width: 100%; border-collapse: collapse; margin-bottom: 1.5em;">
<tbody>
<tr style="background-color: #f9f9f9;">
<td style="padding: 8px; font-weight: bold; width: 150px;">SKU:</td>
<td style="padding: 8px;"><%= @item.sku.presence || "-" %></td>
</tr>
<tr>
<td style="padding: 8px; font-weight: bold;">Description:</td>
<td style="padding: 8px;"><%= @item.description.presence || "-" %></td>
</tr>
<tr style="background-color: #f9f9f9;">
<td style="padding: 8px; font-weight: bold;">Unit Price:</td>
<td style="padding: 8px;"><%= number_to_currency(@item.unit_price) %></td>
</tr>
<tr>
<td style="padding: 8px; font-weight: bold;">Type:</td>
<td style="padding: 8px;"><%= @item.type.presence || "-" %></td>
</tr>
<tr style="background-color: #f9f9f9;">
<td style="padding: 8px; font-weight: bold;">Account:</td>
<td style="padding: 8px;"><%= @item.account&.name || "-" %></td>
</tr>
<tr>
<td style="padding: 8px; font-weight: bold;">Active:</td>
<td style="padding: 8px;"><%= @item.active ? "Yes" : "No" %></td>
</tr>
</tbody>
</table>
<h2><%= t(:item) %># <%= @item.id %> <%= @item.name %></h2>
<div style="margin-top: 1em;">
<%= link_to "Edit", edit_item_path(@item), class: "btn btn-primary", style: "margin-right: 8px;" %>
<%= link_to "Back", items_path, class: "btn btn-secondary" %>
<div class="issue details"> <div class="attributes">
<div class="splitcontent">
<div class="splitcontentleft">
<p><strong>SKU:</strong> <%= @item.sku.presence || "-" %></p>
<p><strong>Type:</strong> <%= @item.type.presence || "-" %></p>
<p><strong>Unit Price:</strong> <%= number_to_currency(@item.unit_price) %></p>
</div>
<div class="splitcontentleft">
<p><strong>Account:</strong> <%= @item.account&.name || "-" %></p>
<p>
<strong>Taxable:</strong>
<% if @item.taxable %>
<span class="icon icon-ok" style="color: green;">Yes</span>
<% else %>
<span class="icon icon-not-ok" style="color: #999;">No</span>
<% end %>
</p>
<p>
<strong>Active:</strong>
<% if @item.active %>
<span class="icon icon-ok" style="color: green;">Yes</span>
<% else %>
<span class="icon icon-not-ok" style="color: #999;">No</span>
<% end %>
</p>
</div>
</div>
<hr />
<p><strong>Description:</strong></p>
<div class="wiki" style="padding-left: 20px;">
<%= @item.description.presence || "<em>No description provided</em>".html_safe %>
</div>
</div>
</div>