diff --git a/lib/screens/user/user_map_screen.dart b/lib/screens/user/user_map_screen.dart index 645601f..5351c18 100644 --- a/lib/screens/user/user_map_screen.dart +++ b/lib/screens/user/user_map_screen.dart @@ -391,48 +391,100 @@ class _UserMapScreenState extends State { // tODO: Crear servicio if (serviceLocationPreference == ServiceLocationPreferences.office) { - context.read().add( - CreateService( - professionalId: profesionalSeleccionado! - .professionalInfo.id, - userId: state.user!.id, - address: profesionalSeleccionado! - .professionalInfo.address, - aditionalAddress: profesionalSeleccionado! - .professionalInfo.aditionalAddress, - latitude: profesionalSeleccionado! - .professionalInfo.latitude, - longitude: profesionalSeleccionado! - .professionalInfo.longitude, - day: fechaSeleccionada.toString(), - createdAt: Timestamp.now(), - description: _observationController.text, - range1Hour1: horaSeleccionada!, - range1Hour2: horaSeleccionada!.add(hour: 2), - rate: '0', - location: serviceLocationPreference!, - ), - ); + if (settings?.tarifas == true) { + context.read().add( + CreateService( + professionalId: profesionalSeleccionado! + .professionalInfo.id, + userId: state.user!.id, + address: profesionalSeleccionado! + .professionalInfo.address, + aditionalAddress: profesionalSeleccionado! + .professionalInfo.aditionalAddress, + latitude: profesionalSeleccionado! + .professionalInfo.latitude, + longitude: profesionalSeleccionado! + .professionalInfo.longitude, + day: fechaSeleccionada.toString(), + createdAt: Timestamp.now(), + description: _observationController.text, + range1Hour1: horaSeleccionada!, + range1Hour2: + horaSeleccionada!.add(hour: 2), + rate: profesionalSeleccionado! + .professionalInfo.rate, + location: serviceLocationPreference!, + ), + ); + } else { + context.read().add( + CreateService( + professionalId: profesionalSeleccionado! + .professionalInfo.id, + userId: state.user!.id, + address: profesionalSeleccionado! + .professionalInfo.address, + aditionalAddress: profesionalSeleccionado! + .professionalInfo.aditionalAddress, + latitude: profesionalSeleccionado! + .professionalInfo.latitude, + longitude: profesionalSeleccionado! + .professionalInfo.longitude, + day: fechaSeleccionada.toString(), + createdAt: Timestamp.now(), + description: _observationController.text, + range1Hour1: horaSeleccionada!, + range1Hour2: + horaSeleccionada!.add(hour: 2), + rate: '0', + location: serviceLocationPreference!, + ), + ); + } } else if (serviceLocationPreference == ServiceLocationPreferences.delivery) { - context.read().add( - CreateService( - professionalId: profesionalSeleccionado! - .professionalInfo.id, - userId: state.user!.id, - address: _addressController.text, - aditionalAddress: '', - latitude: 0, - longitude: 0, - day: fechaSeleccionada.toString(), - createdAt: Timestamp.now(), - description: _observationController.text, - range1Hour1: horaSeleccionada!, - range1Hour2: horaSeleccionada!.add(hour: 2), - rate: '0', - location: serviceLocationPreference!, - ), - ); + if (settings?.tarifas == true) { + context.read().add( + CreateService( + professionalId: profesionalSeleccionado! + .professionalInfo.id, + userId: state.user!.id, + address: _addressController.text, + aditionalAddress: '', + latitude: 0, + longitude: 0, + day: fechaSeleccionada.toString(), + createdAt: Timestamp.now(), + description: _observationController.text, + range1Hour1: horaSeleccionada!, + range1Hour2: + horaSeleccionada!.add(hour: 2), + rate: profesionalSeleccionado! + .professionalInfo.rate, + location: serviceLocationPreference!, + ), + ); + } else { + context.read().add( + CreateService( + professionalId: profesionalSeleccionado! + .professionalInfo.id, + userId: state.user!.id, + address: _addressController.text, + aditionalAddress: '', + latitude: 0, + longitude: 0, + day: fechaSeleccionada.toString(), + createdAt: Timestamp.now(), + description: _observationController.text, + range1Hour1: horaSeleccionada!, + range1Hour2: + horaSeleccionada!.add(hour: 2), + rate: '0', + location: serviceLocationPreference!, + ), + ); + } } else { // TODO: error inesperado }