Files
redmine_qbo_calendar/app/views/customer_appointments/_calendar_event.html.erb
T
rickyandClaude Opus 5.5 3a5d83aa69 Calendar review fixes; working day hours setting
- Issues' estimated hours are spread over their working days from start to due date, instead of
  counted in full on both the start and due dates
- Tooltips in the two rightmost columns open leftward again (the rule targeted the old table layout)
- Today scrolls when today is on the page (the check read calendar values that don't exist)
- "Day N of M" on calendar cards and My Page skips holidays; My Page uses the user's date
- Each appointment's working days are worked out once per page (CustomerAppointment#working_days),
  and shared by placement, hours, day numbers and the end date
- The calendar toggles are kept in the session, so changing month loads the page once
- Clicking inside an open tooltip keeps it open; estimates load with the appointments
- Hours in a working day is a plugin setting (default 8)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 21:12:31 -05:00

67 lines
2.2 KiB
ERB

<%
# Which working day of the appointment this is (the calendar passes it; weekends and holidays skipped)
duration = [appointment.duration.to_i, 1].max
day_number = local_assigns[:day_number] || appointment.working_day_number(day).to_i
%>
<%
status = appointment.status_record
css = ['appointment-block', 'tooltip', (appointment.call_out? ? 'call-out' : status.key.parameterize), ('no-hours' if status && !status.counts_hours?)]
%>
<%= tag.div class: css.compact, style: status&.style do %>
<div class="appointment-bar"></div>
<div class="appointment-card">
<%# Row 1: Avatar | Title %>
<div class="appointment-header">
<% if appointment.user %>
<%= avatar(appointment.user, size: 25, class: "appointment-avatar") %>
<% end %>
<span class="appointment-title">
<%= link_to(appointment.subject, customer_appointment_path(appointment), class: "appointment-link") %>
</span>
</div>
<hr class="appointment-divider" />
<%# Row 2: Time | Day Count | Hours %>
<div class="appointment-meta">
<span class="appointment-time">
<%= appointment.date.strftime('%I:%M %p') if appointment.date.present? %>
</span>
<% if duration > 1 && day_number.positive? && day_number <= duration %>
<span class="appointment-days">(Day <%= day_number %> of <%= duration %>)</span>
<% end %>
<%# Call-outs don't use hours %>
<% if appointment.call_out? %>
<span class="appointment-call-out-label" title="<%= l(:label_call_out) %>"><i class="fa-solid fa-user-slash"></i></span>
<% else %>
<span class="appointment-hours">
<%= number_with_precision(appointment.estimated_hours.to_f, precision: 1) %>h
</span>
<% end %>
</div>
<%# Row 3: Details %>
<% if appointment.customer %>
<hr class="appointment-divider" />
<div class="appointment-detail">
<%= appointment.customer.name %>
<% if appointment.vehicle %>
<br/> <%= appointment.vehicle.name %>
<% end %>
</div>
<% end %>
</div>
<span class="tip">
<%= render partial: "customer_appointments/tooltip", locals: { appointment: appointment, day: day } %>
</span>
<% end %>