%
# 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 %>
<%# Row 1: Avatar | Title %>
<%# Row 2: Time | Day Count | Hours %>
<%= appointment.date.strftime('%I:%M %p') if appointment.date.present? %>
<% if duration > 1 && day_number.positive? && day_number <= duration %>
(Day <%= day_number %> of <%= duration %>)
<% end %>
<%# Call-outs don't use hours %>
<% if appointment.call_out? %>
<% else %>
<%= number_with_precision(appointment.estimated_hours.to_f, precision: 1) %>h
<% end %>
<%# Row 3: Details %>
<% if appointment.customer %>
<%= appointment.customer.name %>
<% if appointment.vehicle %>
<%= appointment.vehicle.name %>
<% end %>
<% end %>
<%= render partial: "customer_appointments/tooltip", locals: { appointment: appointment, day: day } %>
<% end %>