diff --git a/lib/src/presentation/screens/map/service.dart b/lib/src/presentation/screens/map/service.dart index 9b821a5..ea5360f 100644 --- a/lib/src/presentation/screens/map/service.dart +++ b/lib/src/presentation/screens/map/service.dart @@ -29,7 +29,6 @@ import 'package:prosappco/src/presentation/widgets/shared/drawer_menu.dart'; import 'package:prosappco/src/presentation/widgets/shared/primary_button.dart'; import 'package:prosappco/src/presentation/widgets/shared/warning_snackbar.dart'; import 'package:prosappco/src/providers/user_provider.dart'; -import 'package:prosappco/src/utils/time_of_day_extension.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -75,11 +74,9 @@ class _ServiceScreenState extends State { int? professionalTarifa; double? professionalLatitude; double? professionalLongitude; - DateTime? _selectedDate; String _ciudad = '...'; - TimeOfDay? _selectedTime; final DateFormat formatter = DateFormat('dd/MM/yyyy'); dynamic coordinates; Set markers = {}; @@ -387,10 +384,13 @@ class _ServiceScreenState extends State { ); if (datos != null) { - Professional? profesional = datos[0]; - ubicacion = datos[1]; + fechaSeleccionada = datos[0]; + horaSeleccionada = datos[1]; + Professional? profesional = datos[2]; + profesionalSeleccionado = profesional; if (profesional != null) { + ubicacion = datos[3]; if (mounted) { setState(() { _profesionalController.text = @@ -515,7 +515,7 @@ class _ServiceScreenState extends State { profesionalSeleccionado = profesional; if (profesional != null) { - ubicacion = profesional.ubicacion; + ubicacion = datos[3]; if (mounted) { setState(() { _profesionalController.text = @@ -751,7 +751,7 @@ class _ServiceScreenState extends State { WarningSnackbar.show( title: 'Llena todos los campos', message: - 'Asegurate de llenar todos los campos antes de solicitar un servicio. $e', + 'Asegurate de llenar todos los campos antes de solicitar un servicio.', ); } } @@ -1101,10 +1101,7 @@ class _ServiceScreenState extends State { } if (mounted) { - setState(() { - _selectedDate = pickedDate; - _selectedTime = pickedTime; - }); + setState(() {}); } } } diff --git a/lib/src/presentation/screens/professional.dart b/lib/src/presentation/screens/professional.dart index caab246..25524fe 100644 --- a/lib/src/presentation/screens/professional.dart +++ b/lib/src/presentation/screens/professional.dart @@ -358,39 +358,55 @@ class _ProfessionalScreenState extends State { ), ) : const SizedBox(), - professionals[index].ubicacion == 'ambos' + professionals[index].ubicacion == 'ambos' && + settings?.domicilios == true ? const Text( 'Disponibilidad a domicilio y en sitio', style: TextStyle( color: Colors.blue, ), ) - : professionals[index].ubicacion == 'sitio' - ? Text( - 'Disponibilidad en ${professionals[index].ubicacion} ', - style: const TextStyle( + : professionals[index].ubicacion == 'sitio' || + settings?.domicilios == false + ? const Text( + 'Disponibilidad en sitio', + style: TextStyle( color: Colors.blue, ), ) - : Text( - 'Disponibilidad a ${professionals[index].ubicacion}', - style: const TextStyle( + : const Text( + 'Disponibilidad a domicilio', + style: TextStyle( color: Colors.blue, ), ), ], ), onTap: () async { - if (professionals[index].ubicacion == 'ambos') { - _showChoiceDialog(context).then((String? value) { + if (professionals[index].ubicacion == 'ambos' && + settings?.domicilios == true) { + _showChoiceDialog(context) + .then((String? value) async { if (value != null) { - Navigator.pop( - context, [professionals[index], value]); + var datos = await Navigator.of(context).push( + CupertinoPageRoute( + builder: (BuildContext context) { + return CalendarProScreen( + professional: professionals[index], + ); + }, + ), + ); + + if (datos != null) { + datos.add(value); + Navigator.pop(context, datos); + } } }); } else if (professionals[index].ubicacion == - 'sitio') { - // Navigator.pop(context, [professionals[index], 'sitio']); + 'sitio' || + settings?.domicilios == false) { var datos = await Navigator.of(context).push( CupertinoPageRoute( builder: (BuildContext context) { @@ -402,6 +418,7 @@ class _ProfessionalScreenState extends State { ); if (datos != null) { + datos.add('sitio'); Navigator.pop(context, datos); } } else {