View tech bonuses permission, for the Foreman

A global "View tech bonuses" permission shows the weeks run and each
week's hours, tiers and bonuses, read-only: no attendance boxes, run
button or Email again, and no customer accounts, emailed-to addresses,
or QuickBooks/PDF links. "Run tech bonuses" is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-16 12:45:57 -05:00
1 parent a2ecb74c1d
commit 07e79a3c00
7 files changed
+58 -9

No files matched your search

+12 -7
View File
@@ -69,13 +69,16 @@
<% credit = @credits[tech.user_id] %>
<% credited = credit&.credited? %>
<tr class="<%= 'ineligible' unless line.eligible? %>">
<td class="name"><%= link_to_user tech.user %><br><small><%= tech.customer&.name || l(:text_tech_bonus_no_customer) %></small></td>
<td class="name">
<%= link_to_user tech.user %>
<% if @can_run %><br><small><%= tech.customer&.name || l(:text_tech_bonus_no_customer) %></small><% end %>
</td>
<td><%= tech.role_name %></td>
<td><%= bonus_hours(line.hours) %></td>
<td>
<% if credited %>
<%= sprite_icon('checked', l(:general_text_Yes)) %>
<% elsif line.eligible? %>
<% elsif @can_run && line.eligible? %>
<%= check_box_tag 'attended[]', tech.user_id, credit.nil? || credit.message != l(:text_tech_bonus_missed_shift),
id: "attended_#{tech.user_id}", disabled: !report.goal_met? %>
<% end %>
@@ -89,15 +92,15 @@
<td><%= bonus_money(line.tier_amount) %></td>
<td><%= bonus_money(line.amount) %></td>
<% end %>
<td><%= credit_memo_link(credit) %></td>
<td><%= @can_run ? credit_memo_link(credit) : (credit&.doc_number.presence && "##{credit.doc_number}") %></td>
<td class="message">
<%= bonus_status_tag(credit) %>
<% message = credit&.message.presence || line.ineligible_reason %>
<% if credit&.emailed_to.present? %><br><small><%= credit.emailed_to %></small><% end %>
<% if @can_run && credit&.emailed_to.present? %><br><small><%= credit.emailed_to %></small><% end %>
<% if message %><br><small><%= message %></small><% end %>
</td>
<td>
<% if credited %>
<% if credited && @can_run %>
<%= link_to sprite_icon('email', l(:button_tech_bonus_resend)), resend_tech_bonus_credit_path(credit),
method: :post, class: 'icon icon-email',
data: { confirm: l(:text_tech_bonus_resend_confirm) } %>
@@ -108,9 +111,11 @@
</tbody>
</table>
</div>
<p><em class="info"><%= l(:text_tech_bonus_attendance) %></em></p>
<% if @can_run %>
<p><em class="info"><%= l(:text_tech_bonus_attendance) %></em></p>
<% end %>
<% if @week.completed? %>
<% if @can_run && @week.completed? %>
<p>
<% label = report.goal_met? ? l(:button_tech_bonus_run) : l(:button_tech_bonus_record) %>
<%= submit_tag label, data: { confirm: report.goal_met? ? l(:text_tech_bonus_run_confirm) : nil } %>