Add appointment link on estimate pages

Listens for redmine_qbo_billing's view_qbo_estimate_contextual hook and adds
an Add appointment link with the customer, the estimate, and the vehicle
whose VIN matches the estimate's. The new appointment form uses the estimate
and vehicle only when they belong to the customer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-30 13:49:25 -04:00
1 parent 41e1a7ecf9
commit 3b753c1f35
3 files changed
+32

No files matched your search

@@ -0,0 +1,7 @@
<%# Add appointment link on an estimate's page (redmine_qbo_billing) %>
<% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
<% vehicle = customer.vehicles.detect { |v| v.vin.to_s.casecmp?(vin.to_s.strip) } if vin.present? && customer.respond_to?(:vehicles) %>
<%= link_to sprite_icon('time-add', l(:label_add_appointment)),
new_customer_appointment_path(customer_id: customer.id, estimate_id: estimate_id, vehicle_id: vehicle&.id),
class: 'icon icon-time-add', target: :_blank %>
<% end %>