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();
}
class _ProfessionalCalendarScreenState
extends State<ProfessionalCalendarScreen> {
class _ProfessionalCalendarScreenState extends State<ProfessionalCalendarScreen> {
final settingRepository = Injector.appInstance.get<SettingRepository>();
final serviceRepository =
Injector.appInstance.get<FirebaseServiceRepository>();
@@ -238,8 +237,7 @@ class _ProfessionalCalendarScreenState
return false;
}
List<Widget> rangesItemList(List<TimeOfDay> ranges,
List<ServiceEntity>? events, DateTime selectedDay, BuildContext context) {
List<Widget> rangesItemList(List<TimeOfDay> ranges, List<ServiceEntity>? events, DateTime selectedDay, BuildContext context) {
return ranges.map((time) {
if (_isHora1Ocupada(time, events, selectedDay)) {
return Card(
@@ -112,6 +112,9 @@ class _ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
_addressController.text = proInfo.address;
_aditionalAddressController.text = proInfo.aditionalAddress;
_longitudeController = proInfo.longitude;
_latitudeController = proInfo.latitude;
isNequiActive = proInfo.paymentMethods.nequi;
isDatafonoActive = proInfo.paymentMethods.datafono;
isTransferActive = proInfo.paymentMethods.transferencia;
@@ -606,22 +609,22 @@ class _ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
String timeList(ScheduleEntity? schedule, BuildContext context) {
if (schedule == null) {
return 'N/A';
return 'No hay horarios';
}
if (!schedule.enabled) {
return 'N/A';
return 'No hay horarios';
}
if (schedule.range1Hour1 == null || schedule.range2Hour2 == null) {
return 'N/A';
return 'No hay horarios';
}
if (schedule.continuousDay) {
return '${ScheduleEntity.getFormatTime(schedule.range1Hour1)} - ${ScheduleEntity.getFormatTime(schedule.range2Hour2)}';
return '${ScheduleEntity.getFormatTime(schedule.range1Hour1)} a ${ScheduleEntity.getFormatTime(schedule.range2Hour2)}';
} else {
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});
@override
State<ProfileRegisterPhoneScreen> createState() =>
_ProfileRegisterPhoneScreenState();
State<ProfileRegisterPhoneScreen> createState() => _ProfileRegisterPhoneScreenState();
}
class _ProfileRegisterPhoneScreenState
extends State<ProfileRegisterPhoneScreen> {
class _ProfileRegisterPhoneScreenState extends State<ProfileRegisterPhoneScreen> {
late final AuthBloc authBloc;
late String verificationCode;
+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: '',