<%# Add appointment link on an estimate's page (redmine_qbo) %> <% 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 %>