From 01925c60fda00787dfe90056304a7158100fa0c7 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 10 Aug 2026 16:44:49 -0400 Subject: [PATCH] Add status legend to calendar view and refactor status retrieval in appointment show --- app/models/customer_appointment.rb | 4 ++++ app/views/common/_calendar.html.erb | 21 +++++++++++++++++++ app/views/customer_appointments/show.html.erb | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/models/customer_appointment.rb b/app/models/customer_appointment.rb index ca69492..1c94610 100644 --- a/app/models/customer_appointment.rb +++ b/app/models/customer_appointment.rb @@ -108,6 +108,10 @@ class CustomerAppointment < ActiveRecord::Base subject end + def self.statuses + STATUSES + end + private def log(msg) diff --git a/app/views/common/_calendar.html.erb b/app/views/common/_calendar.html.erb index c9d7100..ab607a6 100644 --- a/app/views/common/_calendar.html.erb +++ b/app/views/common/_calendar.html.erb @@ -42,6 +42,27 @@ end %> +<%# Calendar Status Legend Key %> +<% + # Collect status keys from CustomerAppointment enum + statuses = CustomerAppointment.statuses +%> + +<% if statuses.any? %> +
+ + <%= l(:label_legend, default: 'Legend') %>: + + + <% statuses.each do |status_key| %> + + <%= status_key.humanize %> + + <% end %> +
+<% end %> +