From b0c1da0b514646acd89609b6da3950a901e8be09 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Sat, 7 Mar 2026 09:35:02 -0500 Subject: [PATCH] display line items on issue if any exist --- .../line_items/_issue_line_items.html.erb | 40 +++++++++++++++++++ .../hooks/view_hook_listener.rb | 1 + 2 files changed, 41 insertions(+) create mode 100644 app/views/line_items/_issue_line_items.html.erb diff --git a/app/views/line_items/_issue_line_items.html.erb b/app/views/line_items/_issue_line_items.html.erb new file mode 100644 index 0000000..6026027 --- /dev/null +++ b/app/views/line_items/_issue_line_items.html.erb @@ -0,0 +1,40 @@ +<% if @issue.line_items.any? %> +
+
+

Line Items

+ + + + + + + + + + + + + <% total = 0 %> + + <% @issue.line_items.each do |item| %> + <% line_total = item.quantity.to_f * item.unit_price.to_f %> + <% total += line_total %> + + + + + + + + <% end %> + + + + + + + + +
DescriptionQuantityUnit PriceTotal
<%= h item.description %><%= item.quantity %><%= number_to_currency(item.unit_price) %><%= number_to_currency(line_total) %>
Total<%= number_to_currency(total) %>
+
+<% end %> \ No newline at end of file diff --git a/lib/redmine_qbo_line_items/hooks/view_hook_listener.rb b/lib/redmine_qbo_line_items/hooks/view_hook_listener.rb index 9470128..cefac6a 100644 --- a/lib/redmine_qbo_line_items/hooks/view_hook_listener.rb +++ b/lib/redmine_qbo_line_items/hooks/view_hook_listener.rb @@ -30,6 +30,7 @@ module RedmineQboLineItems ) end + render_on :view_issues_show_description_bottom , partial: 'line_items/issue_line_items' end end