mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
Link appointment history from customer page and calendar
- Customer page list now shows a History link and a 'View all N past appointments' link; it also renders when a customer has history but nothing upcoming - Calendar toolbar gets an Appointment History button - Calendar tooltip gets a history icon next 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:
6 files changed
+93
-61
No files matched your search
@@ -20,12 +20,19 @@ module RedmineQboCalendar
|
||||
log "show_customer_view_right called"
|
||||
|
||||
customer = context[:customer]
|
||||
appointments = customer.customer_appointments.where('date >= ?', Date.today).order(date: :asc)
|
||||
return unless customer
|
||||
return unless User.current.allowed_to?(:view_customer_appointments, nil, global: true)
|
||||
|
||||
return if appointments.empty?
|
||||
cutoff = Time.zone.now.beginning_of_day
|
||||
appointments = customer.customer_appointments.where('date >= ?', cutoff).order(date: :asc)
|
||||
past_count = customer.customer_appointments.where('date < ?', cutoff).count
|
||||
|
||||
context[:controller].send(:render_to_string, {
|
||||
partial: 'customer_appointments/list_simple', locals: { appointments: appointments }
|
||||
# Nothing upcoming and no history: keep the customer page clean
|
||||
return if appointments.empty? && past_count.zero?
|
||||
|
||||
context[:controller].send(:render_to_string, {
|
||||
partial: 'customer_appointments/list_simple',
|
||||
locals: { appointments: appointments, customer: customer, past_count: past_count }
|
||||
})
|
||||
|
||||
end
|
||||
@@ -37,4 +44,4 @@ module RedmineQboCalendar
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end␍
|
||||
Reference in new issue
Block a user