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
+90 -6
View File
@@ -162,26 +162,55 @@ class UserCalendarScreenState extends State<UserCalendarScreen> {
}
List<Widget> _rangesItems(ScheduleEntity? schedule) {
if (schedule == null ||
schedule.enabled == false ||
schedule.range1Hour1 == null ||
schedule.range2Hour2 == null) {
if (schedule == null) {
return [
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"),
)
];
}
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(
schedule.range1Hour1!,
schedule.range2Hour2!,
);
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(
schedule.range1Hour1!,
@@ -214,7 +243,62 @@ class UserCalendarScreenState extends State<UserCalendarScreen> {
List<Widget> rangesItemList(List<TimeOfDay> ranges,
List<ServiceEntity>? events, DateTime selectedDay) {
final currentDateTime = DateTime.now();
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)) {
return Card(
elevation: 4,
+3 -3
View File
@@ -262,7 +262,8 @@ class _UserMapScreenState extends State<UserMapScreen> {
}));
},
onCameraMove: (position) {
if (serviceLocationPreference != ServiceLocationPreferences.office) {
if (serviceLocationPreference !=
ServiceLocationPreferences.office) {
coordenadas = position.target;
}
},
@@ -609,8 +610,7 @@ class _UserMapScreenState extends State<UserMapScreen> {
} else {
context.read<ServiceBloc>().add(
CreateService(
professionalId: profesionalSeleccionado!
.professionalInfo.id,
professionalId: profesionalSeleccionado!.professionalInfo.id,
userId: state.user!.id,
address: _addressController.text,
aditionalAddress: '',