update
This commit is contained in:
@@ -186,19 +186,6 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
void name() {
|
||||
_horarios!.forEach((dia, horario) {
|
||||
print('Día: $dia');
|
||||
print('Habilitado: ${horario.habilitado}');
|
||||
print('Jornada Continua: ${horario.jornadaContinua}');
|
||||
print('Rango 1 Hora 1: ${horario.range1Hour1}');
|
||||
print('Rango 1 Hora 2: ${horario.range1Hour2}');
|
||||
print('Rango 2 Hora 1: ${horario.range2Hour1}');
|
||||
print('Rango 2 Hora 2: ${horario.range2Hour2}');
|
||||
print('-----------------------------------');
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> updateImage(image) async {
|
||||
try {
|
||||
await FirebaseFirestore.instance
|
||||
@@ -221,6 +208,91 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void createSchedules() async {
|
||||
if (_horarios == null || _horarios!.isEmpty) {
|
||||
final defaultSchedule = {
|
||||
'Lunes': {
|
||||
'habilitado': false,
|
||||
'jornadaContinua': false,
|
||||
'range1Hour1': null,
|
||||
'range1Hour2': null,
|
||||
'range2Hour1': null,
|
||||
'range2Hour2': null
|
||||
},
|
||||
'Martes': {
|
||||
'habilitado': false,
|
||||
'jornadaContinua': false,
|
||||
'range1Hour1': null,
|
||||
'range1Hour2': null,
|
||||
'range2Hour1': null,
|
||||
'range2Hour2': null
|
||||
},
|
||||
'Miercoles': {
|
||||
'habilitado': false,
|
||||
'jornadaContinua': false,
|
||||
'range1Hour1': null,
|
||||
'range1Hour2': null,
|
||||
'range2Hour1': null,
|
||||
'range2Hour2': null
|
||||
},
|
||||
'Jueves': {
|
||||
'habilitado': false,
|
||||
'jornadaContinua': false,
|
||||
'range1Hour1': null,
|
||||
'range1Hour2': null,
|
||||
'range2Hour1': null,
|
||||
'range2Hour2': null
|
||||
},
|
||||
'Viernes': {
|
||||
'habilitado': false,
|
||||
'jornadaContinua': false,
|
||||
'range1Hour1': null,
|
||||
'range1Hour2': null,
|
||||
'range2Hour1': null,
|
||||
'range2Hour2': null
|
||||
},
|
||||
'Sabado': {
|
||||
'habilitado': false,
|
||||
'jornadaContinua': false,
|
||||
'range1Hour1': null,
|
||||
'range1Hour2': null,
|
||||
'range2Hour1': null,
|
||||
'range2Hour2': null
|
||||
},
|
||||
'Domingo': {
|
||||
'habilitado': false,
|
||||
'jornadaContinua': false,
|
||||
'range1Hour1': null,
|
||||
'range1Hour2': null,
|
||||
'range2Hour1': null,
|
||||
'range2Hour2': null
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
await FirebaseFirestore.instance
|
||||
.collection('users')
|
||||
.doc(uid)
|
||||
.update({'horario': defaultSchedule});
|
||||
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
} else {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return HorarioScreen(
|
||||
horarios: _horarios!,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> uploadImage(File image) async {
|
||||
final String namefile = image.path.split('/').last;
|
||||
|
||||
@@ -376,16 +448,7 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return HorarioScreen(
|
||||
horarios: _horarios!,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
createSchedules();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
@@ -517,7 +580,6 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
|
||||
PrimaryButtom(
|
||||
onPressed: () {
|
||||
updateInfo();
|
||||
// name();
|
||||
},
|
||||
label: 'Guardar'),
|
||||
const SizedBox(
|
||||
|
||||
Reference in New Issue
Block a user