feat: mejorar la funcionalidad del selector de tiempo al copiar citas
This commit is contained in:
+21
-1
@@ -612,7 +612,27 @@ export default function OrganizationProfile() {
|
||||
</div>
|
||||
<div
|
||||
className={style.buttonPaste}
|
||||
onClick={() => timePicker.show((newDay) => handleMoveAppointment(newDay))}
|
||||
onClick={() => {
|
||||
// Seed the controlled picker value with the copied
|
||||
// appointment's current time. MUI only fires onAccept when the
|
||||
// accepted value differs from its internal lastCommittedValue;
|
||||
// without this, picking the same time twice in a row silently
|
||||
// does nothing.
|
||||
if (copiedAppointment) {
|
||||
const currentHour = Math.floor(copiedAppointment.startTime);
|
||||
const currentMinute = Math.round(
|
||||
(copiedAppointment.startTime - currentHour) * 60
|
||||
);
|
||||
timePicker.setValue(
|
||||
dayjs()
|
||||
.hour(currentHour)
|
||||
.minute(currentMinute)
|
||||
.second(0)
|
||||
.millisecond(0)
|
||||
);
|
||||
}
|
||||
timePicker.show((newDay) => handleMoveAppointment(newDay));
|
||||
}}
|
||||
>
|
||||
<ContentPasteIcon />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user