Add status legend to calendar view and refactor status retrieval in appointment show

This commit is contained in:
ricky committed 2026-08-10 16:44:49 -04:00
1 parent c3064c75f9
commit 01925c60fd
3 files changed
+26 -1

No files matched your search

+4
View File
@@ -108,6 +108,10 @@ class CustomerAppointment < ActiveRecord::Base
subject subject
end end
def self.statuses
STATUSES
end
private private
def log(msg) def log(msg)
+21
View File
@@ -42,6 +42,27 @@
end end
%> %>
<%# Calendar Status Legend Key %>
<%
# Collect status keys from CustomerAppointment enum
statuses = CustomerAppointment.statuses
%>
<% if statuses.any? %>
<div class="calendar-status-legend" style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0;">
<span class="legend-label" style="font-weight: 600; font-size: 0.85em; color: #666;">
<%= l(:label_legend, default: 'Legend') %>:
</span>
<% statuses.each do |status_key| %>
<span class="status-key-badge status-<%= status_key.parameterize %>"
style="padding: 2px 8px; border-radius: 4px; font-size: 0.8em; font-weight: 600; text-transform: capitalize;">
<%= status_key.humanize %>
</span>
<% end %>
</div>
<% end %>
<!-- Toggle Bar --> <!-- Toggle Bar -->
<div class="calendar-filter-toolbar" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: flex-end;"> <div class="calendar-filter-toolbar" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: flex-end;">
<label for="toggle-only-appointments" style="cursor: pointer; font-weight: 600; font-size: 0.9em; color: #444; display: inline-flex; align-items: center; gap: 6px;"> <label for="toggle-only-appointments" style="cursor: pointer; font-weight: 600; font-size: 0.9em; color: #444; display: inline-flex; align-items: center; gap: 6px;">
@@ -38,7 +38,7 @@
<%# Quick Status Action Buttons %> <%# Quick Status Action Buttons %>
<% <%
statuses = %w[scheduled checked_in in_progress ready completed cancelled] statuses = CustomerAppointment.statuses
current_status = @appointment.status.to_s.parameterize.underscore current_status = @appointment.status.to_s.parameterize.underscore
%> %>
<div class="appointment-quick-actions"> <div class="appointment-quick-actions">