|
| 1 | +<div class="calendar-section"> |
| 2 | + <h6 class="mb-3"> |
| 3 | + <i class="fas fa-calendar me-2" aria-hidden="true"></i> |
| 4 | + <%= t('better_together.people.calendar.title', default: 'Personal Calendar') %> |
| 5 | + </h6> |
| 6 | + |
| 7 | + <% if person.primary_calendar.calendar_entries.any? %> |
| 8 | + <!-- Simple Calendar View --> |
| 9 | + <div class="calendar-container"> |
| 10 | + <%= month_calendar(events: person.primary_calendar.events.includes(:string_translations)) do |date, events| %> |
| 11 | + <% events.each do |event| %> |
| 12 | + <div class="calendar-event"> |
| 13 | + <%= link_to event, class: 'text-decoration-none' do %> |
| 14 | + <small class="d-block text-truncate" title="<%= event.name %>"> |
| 15 | + <i class="fas fa-circle me-1" style="color: #007bff; font-size: 0.5rem;" aria-hidden="true"></i> |
| 16 | + <%= event.name %> |
| 17 | + </small> |
| 18 | + <% end %> |
| 19 | + </div> |
| 20 | + <% end %> |
| 21 | + <% end %> |
| 22 | + </div> |
| 23 | + |
| 24 | + <!-- Upcoming Events List --> |
| 25 | + <div class="upcoming-events mt-4"> |
| 26 | + <h6 class="mb-3"> |
| 27 | + <i class="fas fa-clock me-2" aria-hidden="true"></i> |
| 28 | + <%= t('better_together.people.calendar.upcoming_events', default: 'Upcoming Events') %> |
| 29 | + </h6> |
| 30 | + |
| 31 | + <% upcoming_events = person.primary_calendar.events.upcoming.includes(:string_translations).limit(5) %> |
| 32 | + <% if upcoming_events.any? %> |
| 33 | + <div class="list-group"> |
| 34 | + <% upcoming_events.each do |event| %> |
| 35 | + <div class="list-group-item d-flex justify-content-between align-items-start"> |
| 36 | + <div class="ms-2 me-auto"> |
| 37 | + <%= link_to event, class: 'text-decoration-none' do %> |
| 38 | + <div class="fw-bold"><%= event.name %></div> |
| 39 | + <small class="text-muted"> |
| 40 | + <i class="fas fa-calendar-alt me-1" aria-hidden="true"></i> |
| 41 | + <%= l(event.starts_at, format: :long) if event.starts_at %> |
| 42 | + </small> |
| 43 | + <% end %> |
| 44 | + </div> |
| 45 | + <span class="badge bg-primary rounded-pill"> |
| 46 | + <%= privacy_display_value(event) %> |
| 47 | + </span> |
| 48 | + </div> |
| 49 | + <% end %> |
| 50 | + </div> |
| 51 | + <% else %> |
| 52 | + <p class="text-muted"> |
| 53 | + <i class="fas fa-info-circle me-2" aria-hidden="true"></i> |
| 54 | + <%= t('better_together.people.calendar.no_upcoming_events', default: 'No upcoming events.') %> |
| 55 | + </p> |
| 56 | + <% end %> |
| 57 | + </div> |
| 58 | + |
| 59 | + <!-- Past Events (Limited) --> |
| 60 | + <div class="past-events mt-4"> |
| 61 | + <h6 class="mb-3"> |
| 62 | + <i class="fas fa-history me-2" aria-hidden="true"></i> |
| 63 | + <%= t('better_together.people.calendar.recent_past_events', default: 'Recent Past Events') %> |
| 64 | + </h6> |
| 65 | + |
| 66 | + <% past_events = person.primary_calendar.events.past.includes(:string_translations).order(starts_at: :desc).limit(3) %> |
| 67 | + <% if past_events.any? %> |
| 68 | + <div class="list-group"> |
| 69 | + <% past_events.each do |event| %> |
| 70 | + <div class="list-group-item d-flex justify-content-between align-items-start"> |
| 71 | + <div class="ms-2 me-auto"> |
| 72 | + <%= link_to event, class: 'text-decoration-none text-muted' do %> |
| 73 | + <div class="fw-bold"><%= event.name %></div> |
| 74 | + <small class="text-muted"> |
| 75 | + <i class="fas fa-calendar-alt me-1" aria-hidden="true"></i> |
| 76 | + <%= l(event.starts_at, format: :long) if event.starts_at %> |
| 77 | + </small> |
| 78 | + <% end %> |
| 79 | + </div> |
| 80 | + <span class="badge bg-secondary rounded-pill"> |
| 81 | + <%= t('better_together.people.calendar.attended', default: 'Attended') %> |
| 82 | + </span> |
| 83 | + </div> |
| 84 | + <% end %> |
| 85 | + </div> |
| 86 | + <% else %> |
| 87 | + <p class="text-muted"> |
| 88 | + <i class="fas fa-info-circle me-2" aria-hidden="true"></i> |
| 89 | + <%= t('better_together.people.calendar.no_past_events', default: 'No past events attended.') %> |
| 90 | + </p> |
| 91 | + <% end %> |
| 92 | + </div> |
| 93 | + <% else %> |
| 94 | + <!-- Empty State --> |
| 95 | + <div class="text-center py-5"> |
| 96 | + <i class="fas fa-calendar-times fa-3x text-muted mb-3" aria-hidden="true"></i> |
| 97 | + <h6 class="text-muted"> |
| 98 | + <%= t('better_together.people.calendar.no_events', default: 'No events in calendar') %> |
| 99 | + </h6> |
| 100 | + <p class="text-muted"> |
| 101 | + <%= t('better_together.people.calendar.no_events_description', |
| 102 | + default: 'Events will appear here when you RSVP as "Going" to events.') %> |
| 103 | + </p> |
| 104 | + </div> |
| 105 | + <% end %> |
| 106 | +</div> |
| 107 | + |
| 108 | +<style> |
| 109 | + .calendar-event { |
| 110 | + margin: 2px 0; |
| 111 | + } |
| 112 | + |
| 113 | + .calendar-event small { |
| 114 | + font-size: 0.7rem; |
| 115 | + line-height: 1.2; |
| 116 | + } |
| 117 | + |
| 118 | + .calendar-container .simple-calendar { |
| 119 | + font-size: 0.9rem; |
| 120 | + } |
| 121 | + |
| 122 | + .calendar-container .simple-calendar td { |
| 123 | + height: 100px; |
| 124 | + vertical-align: top; |
| 125 | + padding: 5px; |
| 126 | + } |
| 127 | + |
| 128 | + .calendar-day { |
| 129 | + font-weight: bold; |
| 130 | + margin-bottom: 3px; |
| 131 | + } |
| 132 | +</style> |
0 commit comments