mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
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
8 lines
551 B
ERB
8 lines
551 B
ERB
<%# 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 %>
|