feat: normalizar la hora de finalización de citas que cruzan la medianoche y ajustar la lógica de ordenamiento en CalendarRowView
This commit is contained in:
@@ -1131,7 +1131,12 @@ class AppointmentManager implements IAppointmentsManager {
|
||||
serviceId: String(appointment.serviceId),
|
||||
employeeId: String(appointment.employeeId),
|
||||
startTime: appointment.startHour,
|
||||
endTime: appointment.endHour,
|
||||
// Cross-midnight appointments store endHour wrapped into 0-23 (e.g. 23:00 -> 01:00
|
||||
// stores 1). Normalize it to a >24 value so schedule views can position it.
|
||||
endTime:
|
||||
appointment.endHour < appointment.startHour
|
||||
? appointment.endHour + 24
|
||||
: appointment.endHour,
|
||||
title: isNull<string>(clientName, clientUserName),
|
||||
avatar: clientAvatar,
|
||||
color: isNull<string>(employee.calendarColor, "#ff9900"),
|
||||
@@ -1257,16 +1262,21 @@ class AppointmentManager implements IAppointmentsManager {
|
||||
|
||||
//get min startTime hour from returnData
|
||||
let minStartTime = 24;
|
||||
let maxEndTime = 24;
|
||||
for (const event of returnData) {
|
||||
if (event.startTime < minStartTime) {
|
||||
minStartTime = event.startTime;
|
||||
}
|
||||
if (event.endTime > maxEndTime) {
|
||||
maxEndTime = event.endTime;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
events: returnData,
|
||||
from: Math.floor(minStartTime),
|
||||
to: 24,
|
||||
// Extend past 24 when an appointment crosses midnight, so the block keeps its real height.
|
||||
to: Math.max(24, Math.ceil(maxEndTime)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user