datos para el servicio
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/professional_list_bloc/professional_list_bloc.dart';
|
||||
import 'package:prosappco/utils/time_of_day_utils.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
import 'package:setting_repository/setting_repository.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
|
||||
class UserCalendarScreen extends StatefulWidget {
|
||||
@@ -17,6 +19,9 @@ class UserCalendarScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class UserCalendarScreenState extends State<UserCalendarScreen> {
|
||||
final settingRepository = Injector.appInstance.get<SettingRepository>();
|
||||
SettingEntity? settings;
|
||||
|
||||
DateTime today = DateTime.now();
|
||||
DateTime now = DateTime.now();
|
||||
late int numDay;
|
||||
@@ -29,6 +34,16 @@ class UserCalendarScreenState extends State<UserCalendarScreen> {
|
||||
|
||||
today = DateTime.utc(today.year, today.month, today.day);
|
||||
numDay = today.weekday;
|
||||
|
||||
_loadSettings();
|
||||
}
|
||||
|
||||
void _loadSettings() {
|
||||
settingRepository.getSettings().then(
|
||||
(value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
void _onDaySelected(DateTime day, DateTime focusedDay) {
|
||||
@@ -135,7 +150,12 @@ class UserCalendarScreenState extends State<UserCalendarScreen> {
|
||||
schedule.enabled == false ||
|
||||
schedule.range1Hour1 == null ||
|
||||
schedule.range2Hour2 == null) {
|
||||
return [const Text("No hay horarios disponibles")];
|
||||
return [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 25),
|
||||
child: Text("No hay horarios disponibles"),
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
if (schedule.continuousDay) {
|
||||
@@ -241,7 +261,74 @@ class UserCalendarScreenState extends State<UserCalendarScreen> {
|
||||
),
|
||||
child: ListTile(
|
||||
onTap: () {
|
||||
Navigator.pop(context, [today, time, widget.userProfessional]);
|
||||
if (settings?.domicilios == true) {
|
||||
if (widget.userProfessional.professionalInfo
|
||||
.locationPreferences ==
|
||||
LocationPreferences.both) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context, [
|
||||
today,
|
||||
time,
|
||||
ServiceLocationPreferences.delivery,
|
||||
widget.userProfessional,
|
||||
]);
|
||||
},
|
||||
child: const Text('A domicilio'),
|
||||
),
|
||||
const Divider(color: Colors.black54),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context, [
|
||||
today,
|
||||
time,
|
||||
ServiceLocationPreferences.office,
|
||||
widget.userProfessional,
|
||||
]);
|
||||
},
|
||||
child: const Text('En sitio'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
} else if (widget.userProfessional.professionalInfo
|
||||
.locationPreferences ==
|
||||
LocationPreferences.delivery) {
|
||||
Navigator.pop(context, [
|
||||
today,
|
||||
time,
|
||||
ServiceLocationPreferences.delivery,
|
||||
widget.userProfessional,
|
||||
]);
|
||||
} else {
|
||||
Navigator.pop(context, [
|
||||
today,
|
||||
time,
|
||||
ServiceLocationPreferences.office,
|
||||
widget.userProfessional,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
Navigator.pop(context, [
|
||||
today,
|
||||
time,
|
||||
ServiceLocationPreferences.office,
|
||||
widget.userProfessional,
|
||||
]);
|
||||
}
|
||||
},
|
||||
contentPadding: const EdgeInsets.all(16),
|
||||
leading: Container(
|
||||
|
||||
Reference in New Issue
Block a user