build tables for project and subproject/s views

This commit is contained in:
Stefan Tollkühn
2025-07-23 15:19:59 +02:00
parent 440750881b
commit 53e2dba32d
5 changed files with 76 additions and 35 deletions

View File

@@ -1,27 +1,14 @@
<div id="<%= dom_id subproject %>">
<p>
<strong>Subproject name:</strong>
<%= subproject.subproject_name %>
</p>
<p>
<strong>Project:</strong>
<%= subproject.project_id %>
</p>
<p>
<strong>Client:</strong>
<%= link_to "#{subproject.client&.company_name} (#{subproject.client&.lastname}, #{subproject.client&.firstname})", client_path(subproject.client&.id) %>
</p>
<p>
<strong>Owner:</strong>
<%= link_to "#{subproject.owner&.company_name} (#{subproject.owner&.lastname}, #{subproject.owner&.firstname})", client_path(subproject.owner&.id) %>
</p>
<p>
<strong>Builder:</strong>
<%= link_to "#{subproject.builder&.company_name} (#{subproject.builder&.lastname}, #{subproject.builder&.firstname})", client_path(subproject.builder&.id) %>
</p>
</div>
<% subproject_view_fields.each do |attrib| %>
<td>
<% value = subproject.send(attrib) %>
<% if attrib == :subproject_name %>
<%= link_to value, subproject_path(subproject) %>
<% elsif attrib == :project %>
<%= link_to value.name, project_path(value) %>
<% elsif attrib == :client || attrib == :owner || attrib == :builder %>
<%= link_to "#{value&.company_name} (#{value&.lastname}, #{value&.firstname})", client_path(value&.id) %>
<% else %>
<%= value.is_a?(Date) ? l(value) : value %>
<% end %>
</td>
<% end %>