update lat, lng 0 y horarios

This commit is contained in:
Felipe
2024-08-17 11:41:25 -05:00
parent a7f62dec6d
commit f6f2e403d8
5 changed files with 106 additions and 23 deletions
@@ -25,8 +25,7 @@ class ProfessionalCalendarScreen extends StatefulWidget {
_ProfessionalCalendarScreenState(); _ProfessionalCalendarScreenState();
} }
class _ProfessionalCalendarScreenState class _ProfessionalCalendarScreenState extends State<ProfessionalCalendarScreen> {
extends State<ProfessionalCalendarScreen> {
final settingRepository = Injector.appInstance.get<SettingRepository>(); final settingRepository = Injector.appInstance.get<SettingRepository>();
final serviceRepository = final serviceRepository =
Injector.appInstance.get<FirebaseServiceRepository>(); Injector.appInstance.get<FirebaseServiceRepository>();
@@ -238,8 +237,7 @@ class _ProfessionalCalendarScreenState
return false; return false;
} }
List<Widget> rangesItemList(List<TimeOfDay> ranges, List<Widget> rangesItemList(List<TimeOfDay> ranges, List<ServiceEntity>? events, DateTime selectedDay, BuildContext context) {
List<ServiceEntity>? events, DateTime selectedDay, BuildContext context) {
return ranges.map((time) { return ranges.map((time) {
if (_isHora1Ocupada(time, events, selectedDay)) { if (_isHora1Ocupada(time, events, selectedDay)) {
return Card( return Card(
@@ -112,6 +112,9 @@ class _ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
_addressController.text = proInfo.address; _addressController.text = proInfo.address;
_aditionalAddressController.text = proInfo.aditionalAddress; _aditionalAddressController.text = proInfo.aditionalAddress;
_longitudeController = proInfo.longitude;
_latitudeController = proInfo.latitude;
isNequiActive = proInfo.paymentMethods.nequi; isNequiActive = proInfo.paymentMethods.nequi;
isDatafonoActive = proInfo.paymentMethods.datafono; isDatafonoActive = proInfo.paymentMethods.datafono;
isTransferActive = proInfo.paymentMethods.transferencia; isTransferActive = proInfo.paymentMethods.transferencia;
@@ -606,22 +609,22 @@ class _ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
String timeList(ScheduleEntity? schedule, BuildContext context) { String timeList(ScheduleEntity? schedule, BuildContext context) {
if (schedule == null) { if (schedule == null) {
return 'N/A'; return 'No hay horarios';
} }
if (!schedule.enabled) { if (!schedule.enabled) {
return 'N/A'; return 'No hay horarios';
} }
if (schedule.range1Hour1 == null || schedule.range2Hour2 == null) { if (schedule.range1Hour1 == null || schedule.range2Hour2 == null) {
return 'N/A'; return 'No hay horarios';
} }
if (schedule.continuousDay) { if (schedule.continuousDay) {
return '${ScheduleEntity.getFormatTime(schedule.range1Hour1)} - ${ScheduleEntity.getFormatTime(schedule.range2Hour2)}'; return '${ScheduleEntity.getFormatTime(schedule.range1Hour1)} a ${ScheduleEntity.getFormatTime(schedule.range2Hour2)}';
} else { } else {
if (schedule.range1Hour2 == null || schedule.range2Hour1 == null) { if (schedule.range1Hour2 == null || schedule.range2Hour1 == null) {
return 'N/A'; return 'No hay horarios';
} }
return '${ScheduleEntity.getFormatTime(schedule.range1Hour1)} - ${ScheduleEntity.getFormatTime(schedule.range1Hour2)}; ${ScheduleEntity.getFormatTime(schedule.range2Hour1)} - ${ScheduleEntity.getFormatTime(schedule.range2Hour2)}'; return '${ScheduleEntity.getFormatTime(schedule.range1Hour1)} a ${ScheduleEntity.getFormatTime(schedule.range1Hour2)} - ${ScheduleEntity.getFormatTime(schedule.range2Hour1)} a ${ScheduleEntity.getFormatTime(schedule.range2Hour2)}';
} }
} }
} }
@@ -15,12 +15,10 @@ class ProfileRegisterPhoneScreen extends StatefulWidget {
const ProfileRegisterPhoneScreen({super.key}); const ProfileRegisterPhoneScreen({super.key});
@override @override
State<ProfileRegisterPhoneScreen> createState() => State<ProfileRegisterPhoneScreen> createState() => _ProfileRegisterPhoneScreenState();
_ProfileRegisterPhoneScreenState();
} }
class _ProfileRegisterPhoneScreenState class _ProfileRegisterPhoneScreenState extends State<ProfileRegisterPhoneScreen> {
extends State<ProfileRegisterPhoneScreen> {
late final AuthBloc authBloc; late final AuthBloc authBloc;
late String verificationCode; late String verificationCode;
+89 -5
View File
@@ -162,25 +162,54 @@ class UserCalendarScreenState extends State<UserCalendarScreen> {
} }
List<Widget> _rangesItems(ScheduleEntity? schedule) { List<Widget> _rangesItems(ScheduleEntity? schedule) {
if (schedule == null || if (schedule == null) {
schedule.enabled == false ||
schedule.range1Hour1 == null ||
schedule.range2Hour2 == null) {
return [ return [
const Padding( const Padding(
padding: EdgeInsets.symmetric(vertical: 25), padding: EdgeInsets.symmetric(vertical: 20),
child: Text("No hay horarios disponibles"),
)
];
}
if (!schedule.enabled) {
return [
const Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text("No hay horarios disponibles"), child: Text("No hay horarios disponibles"),
) )
]; ];
} }
if (schedule.continuousDay) { if (schedule.continuousDay) {
if (schedule.range1Hour1 == null ||
schedule.range2Hour2 == null ||
schedule.range1Hour1!.compareTo(schedule.range2Hour2!) >= 0) {
return [
const Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text("No hay horarios disponibles"),
)
];
}
List<TimeOfDay> ranges = TimeOfDayUtils.genRanges( List<TimeOfDay> ranges = TimeOfDayUtils.genRanges(
schedule.range1Hour1!, schedule.range1Hour1!,
schedule.range2Hour2!, schedule.range2Hour2!,
); );
return rangesItemList(ranges, _services, today); return rangesItemList(ranges, _services, today);
} else {
if (schedule.range1Hour1 == null ||
schedule.range1Hour2 == null ||
schedule.range2Hour1 == null ||
schedule.range2Hour2 == null ||
schedule.range1Hour1!.compareTo(schedule.range1Hour2!) >= 0 ||
schedule.range2Hour1!.compareTo(schedule.range2Hour2!) >= 0) {
return [
const Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text("No hay horarios disponibles"),
)
];
} }
List<TimeOfDay> ranges1 = TimeOfDayUtils.genRanges( List<TimeOfDay> ranges1 = TimeOfDayUtils.genRanges(
@@ -214,7 +243,62 @@ class UserCalendarScreenState extends State<UserCalendarScreen> {
List<Widget> rangesItemList(List<TimeOfDay> ranges, List<Widget> rangesItemList(List<TimeOfDay> ranges,
List<ServiceEntity>? events, DateTime selectedDay) { List<ServiceEntity>? events, DateTime selectedDay) {
final currentDateTime = DateTime.now();
return ranges.map((time) { return ranges.map((time) {
final selectedDateTime = DateTime(
selectedDay.year,
selectedDay.month,
selectedDay.day,
time.hour,
time.minute,
);
if (selectedDateTime
.isBefore(currentDateTime.add(const Duration(hours: 3)))) {
return Card(
elevation: 4,
margin: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: ListTile(
contentPadding: const EdgeInsets.all(16),
leading: Container(
width: 40,
height: 40,
decoration: const BoxDecoration(
gradient: LinearGradient(
color: Colors.grey,
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
shape: BoxShape.circle,
),
child: const Center(
child: Icon(
Icons.access_time,
color: Colors.white,
),
),
),
title: Text(
ScheduleEntity.getFormatTime(time) ?? '',
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
subtitle: const Text(
'No disponible',
style: TextStyle(
color: Colors.red, fontSize: 13, fontWeight: FontWeight.bold),
),
trailing: const Icon(
Icons.arrow_forward_ios,
color: Colors.grey,
),
),
);
}
if (_isHora1Ocupada(time, events, selectedDay)) { if (_isHora1Ocupada(time, events, selectedDay)) {
return Card( return Card(
elevation: 4, elevation: 4,
+3 -3
View File
@@ -262,7 +262,8 @@ class _UserMapScreenState extends State<UserMapScreen> {
})); }));
}, },
onCameraMove: (position) { onCameraMove: (position) {
if (serviceLocationPreference != ServiceLocationPreferences.office) { if (serviceLocationPreference !=
ServiceLocationPreferences.office) {
coordenadas = position.target; coordenadas = position.target;
} }
}, },
@@ -609,8 +610,7 @@ class _UserMapScreenState extends State<UserMapScreen> {
} else { } else {
context.read<ServiceBloc>().add( context.read<ServiceBloc>().add(
CreateService( CreateService(
professionalId: profesionalSeleccionado! professionalId: profesionalSeleccionado!.professionalInfo.id,
.professionalInfo.id,
userId: state.user!.id, userId: state.user!.id,
address: _addressController.text, address: _addressController.text,
aditionalAddress: '', aditionalAddress: '',