configurable slot duration: UI picker + genRanges stepMinutes

- Fix TimeOfDayExtension.add() to handle minute overflow via total-minutes math
- genRanges() now takes stepMinutes param (default 30, clamp 5-480)
- Profesional model: slotDurationMinutes field (parsed from slot_duration_minutes)
- ProfessionalFormProvider: saves slot duration alongside schedules on Guardar
- schedule_view: _SlotDurationPicker chip selector (15/20/30/45/60/90/120 min)
- ProfessionalCalendarView + CalendarView: pass slotDurationMinutes to genRanges

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-12 19:25:08 -05:00
co-authored by Claude Sonnet 4.6
parent 46acad0b55
commit 920ae7144d
7 changed files with 105 additions and 20 deletions
+10 -3
View File
@@ -32,6 +32,7 @@ class ProfessionalFormProvider with ChangeNotifier {
List<String>? specializationsPictures,
Schedules? schedules,
PaymentMethodEntity? paymentMethods,
int? slotDurationMinutes,
}) {
profesional = Profesional(
id: id ?? profesional!.id,
@@ -53,6 +54,7 @@ class ProfessionalFormProvider with ChangeNotifier {
specializationsPictures: specializationsPictures ?? profesional!.specializationsPictures,
schedules: schedules ?? profesional!.schedules,
paymentMethods: paymentMethods ?? profesional!.paymentMethods,
slotDurationMinutes: slotDurationMinutes ?? profesional!.slotDurationMinutes,
);
notifyListeners();
}
@@ -106,9 +108,14 @@ class ProfessionalFormProvider with ChangeNotifier {
Future<bool> updateProfesionalProfileScheduleInfo(String userId) async {
try {
await _api.patch('/professionals/me/schedules', {
'schedules': profesional!.schedules.toSchedulesArray(),
});
await Future.wait([
_api.patch('/professionals/me/schedules', {
'schedules': profesional!.schedules.toSchedulesArray(),
}),
_api.patch('/professionals/me', {
'slot_duration_minutes': profesional!.slotDurationMinutes,
}),
]);
} catch (e) {
NotificationsService.showSnackbar('Error al guardar: $e');
return false;