antes de notificaciones
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_sign_in/google_sign_in.dart';
|
||||
import 'package:prosappco/src/authentication/exceptions/register_failed.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/screens/login.dart';
|
||||
import 'package:prosappco/src/screens/service.dart';
|
||||
|
||||
|
||||
@@ -9,26 +9,31 @@ class UserModel {
|
||||
final String? state;
|
||||
final Reference? photo;
|
||||
final int? tarifa;
|
||||
final String? phoneNumber;
|
||||
final String? token;
|
||||
|
||||
UserModel(this.name, this.city, this.profession, this.state, this.photo,
|
||||
this.tarifa);
|
||||
this.tarifa, this.phoneNumber, this.token);
|
||||
|
||||
static Future<UserModel> fromJson(
|
||||
Map<String, dynamic>? json, String uid) async {
|
||||
try {
|
||||
if (json == null) return UserModel('', '', '', null, null, 0);
|
||||
if (json == null) return UserModel('', '', '', null, null, 0, '', '');
|
||||
|
||||
String? avatar = json['photo'];
|
||||
return UserModel(
|
||||
json['name'],
|
||||
json['city'],
|
||||
json['profesion'],
|
||||
json['estado'],
|
||||
avatar != null ? storage.ref().child(avatar) : null,
|
||||
json['tarifa'] ?? 0);
|
||||
json['name'],
|
||||
json['city'],
|
||||
json['profesion'],
|
||||
json['estado'],
|
||||
avatar != null ? storage.ref().child(avatar) : null,
|
||||
json['tarifa'] ?? 0,
|
||||
json['phoneNumber'],
|
||||
json['token'],
|
||||
);
|
||||
} catch (e) {
|
||||
print('XD user $e');
|
||||
return UserModel('', '', '', null, null, 0);
|
||||
return UserModel('', '', '', null, null, 0, '', '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +45,7 @@ class UserModel {
|
||||
return fromJson(data, uid);
|
||||
} catch (e) {
|
||||
print('Error getting user: $e');
|
||||
return UserModel('', '', '', null, null, 0);
|
||||
return UserModel('', '', '', null, null, 0, '', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
_selectedTime2 = pickedTime2;
|
||||
});
|
||||
}
|
||||
|
||||
return pickedTime2;
|
||||
}
|
||||
|
||||
@@ -308,7 +309,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
'$combinedDate1',
|
||||
'$combinedDate2',
|
||||
uid.toString(),
|
||||
'',
|
||||
'sitio',
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
|
||||
@@ -78,7 +78,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
style: const TextStyle(
|
||||
color: Colors.black, fontWeight: FontWeight.w600),
|
||||
),
|
||||
subtitle: Text('${user?.profession}'),
|
||||
subtitle: Text(user?.profession ?? ''),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||
),
|
||||
),
|
||||
|
||||
+42
-26
@@ -3,13 +3,13 @@ import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
import 'package:prosappco/src/models/scores_model.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/screens/chat.dart';
|
||||
import 'package:prosappco/src/screens/score.dart';
|
||||
@@ -29,11 +29,11 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
UserModel? user;
|
||||
DateTime today = DateTime.now();
|
||||
String nombre = '';
|
||||
String numberPhone = '';
|
||||
int tarifa = 0;
|
||||
Reference? ref_photo;
|
||||
ScoresModel? scoresModel;
|
||||
|
||||
final phoneNumber = '+573022548060';
|
||||
bool? ver = true;
|
||||
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
@@ -51,7 +51,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _sendWhatsapp() async {
|
||||
Future<void> _sendWhatsapp(String phoneNumber) async {
|
||||
final whatsappUrl =
|
||||
'https://wa.me/$phoneNumber?text=${Uri.parse('Hola! me contactaste por Prossapp')}';
|
||||
if (!await launch(whatsappUrl)) {
|
||||
@@ -59,10 +59,19 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
SettingModel? settings;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (scoresModel == null) {
|
||||
if (uid != widget.evento.userId) {
|
||||
ScoresModel.scoreTo(widget.evento.userId, false, false).then(
|
||||
@@ -83,7 +92,6 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
today.difference(DateTime.parse(widget.evento.range1Hour1));
|
||||
// DateTime todays = DateFormat('hh:mm a').parse(today.timeZoneName);
|
||||
final eventDate = DateFormat('yyyy-MM-dd').parse(widget.evento.day);
|
||||
|
||||
if (nombre == '') {
|
||||
@@ -91,18 +99,18 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
UserModel.getUser(widget.evento.userId).then((value) {
|
||||
UserModel.getUser(uid.toString()).then((me) {
|
||||
setState(() {
|
||||
tarifa = me.tarifa ?? 0;
|
||||
nombre = value.name;
|
||||
ref_photo = value.photo;
|
||||
numberPhone = value.phoneNumber ?? '';
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
UserModel.getUser(widget.evento.professionalId).then((value) {
|
||||
setState(() {
|
||||
tarifa = value.tarifa ?? 0;
|
||||
nombre = value.name;
|
||||
ref_photo = value.photo;
|
||||
numberPhone = value.phoneNumber ?? '';
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -211,17 +219,19 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
formatCurrency(tarifa),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 25),
|
||||
),
|
||||
Text('Tarifa consulta ${widget.evento.tarifa}',
|
||||
style: const TextStyle(fontSize: 15)),
|
||||
],
|
||||
),
|
||||
settings?.tarifas == true && widget.evento.tarifa != 0
|
||||
? Column(
|
||||
children: [
|
||||
Text(
|
||||
formatCurrency(widget.evento.tarifa ?? 0),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 25),
|
||||
),
|
||||
const Text('Tarifa consulta',
|
||||
style: TextStyle(fontSize: 15)),
|
||||
],
|
||||
)
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 15),
|
||||
Text(
|
||||
textAlign: TextAlign.center,
|
||||
@@ -240,7 +250,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
children: [
|
||||
const Expanded(child: SizedBox()),
|
||||
ElevatedButton(
|
||||
onPressed: () => launch("tel:+573163225944"),
|
||||
onPressed: () => launch("tel:$numberPhone"),
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: const Color(0xFF2BA4EC),
|
||||
backgroundColor: Colors.white,
|
||||
@@ -327,7 +337,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
const SizedBox(width: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_sendWhatsapp();
|
||||
_sendWhatsapp(numberPhone);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: const Color(0xFF2BA4EC),
|
||||
@@ -401,10 +411,11 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
eventDate.month == today.month &&
|
||||
eventDate.day == today.day
|
||||
? (DateTime.now()
|
||||
.difference(
|
||||
DateTime.parse(widget.evento.range1Hour1))
|
||||
.abs() <=
|
||||
const Duration(minutes: 30))
|
||||
.difference(
|
||||
DateTime.parse(widget.evento.range1Hour1))
|
||||
.abs() <=
|
||||
const Duration(minutes: 30) &&
|
||||
ver == true)
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: Column(
|
||||
@@ -416,7 +427,12 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
FirebaseFirestore.instance
|
||||
.collection("services")
|
||||
.doc('${widget.evento.id}')
|
||||
.update({"status": "iniciado"});
|
||||
.update({"status": "iniciado"}).then(
|
||||
(value) {
|
||||
setState(() {
|
||||
ver = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2BA4EC),
|
||||
@@ -536,7 +552,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
widget.evento.status == 'iniciado'
|
||||
widget.evento.status == 'iniciado' || ver == false
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: Column(
|
||||
|
||||
@@ -123,11 +123,17 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
|
||||
color: Colors.blue,
|
||||
size: 40,
|
||||
)
|
||||
: const Icon(
|
||||
Icons.close,
|
||||
color: Colors.red,
|
||||
size: 40,
|
||||
),
|
||||
: event.status == 'terminado'
|
||||
? const Icon(
|
||||
Icons.rocket_launch,
|
||||
color: Colors.blue,
|
||||
size: 40,
|
||||
)
|
||||
: const Icon(
|
||||
Icons.close,
|
||||
color: Colors.red,
|
||||
size: 40,
|
||||
),
|
||||
title: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
|
||||
+154
-108
@@ -3,9 +3,11 @@ import 'package:diacritic/diacritic.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/screens/professional_info.dart';
|
||||
|
||||
import '../models/scores_model.dart';
|
||||
@@ -69,6 +71,7 @@ class Professional {
|
||||
' latitude: $latitude,\n'
|
||||
' longitude: $longitude,\n'
|
||||
' professionalEspecializado: ${getEspecializaciones()}\n'
|
||||
' tarifa: $tarifa,\n'
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -114,6 +117,12 @@ class Professional {
|
||||
}
|
||||
|
||||
class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
|
||||
return '\$${formatter.format(number)}';
|
||||
}
|
||||
|
||||
Future<String?> _showChoiceDialog(BuildContext context) async {
|
||||
String? selectedOption = await showDialog(
|
||||
context: context,
|
||||
@@ -193,6 +202,7 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
latitude: data['latitude'] ?? 0,
|
||||
longitude: data['longitude'] ?? 0,
|
||||
scores: await ScoresModel.scoreTo(user.id, true, true),
|
||||
tarifa: data['tarifa'] ?? 0,
|
||||
);
|
||||
professionals.add(professional);
|
||||
}
|
||||
@@ -206,10 +216,19 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
return professionals;
|
||||
}
|
||||
|
||||
SettingModel? settings;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
searchController.addListener(() {
|
||||
setState(() {
|
||||
if (_professionals != null) {
|
||||
@@ -250,121 +269,148 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
var professionals = filteredProfessionals!;
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: PopAppbar(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
label: 'Seleccione un profesional'),
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: TextField(
|
||||
controller: searchController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Escriba un nombre',
|
||||
prefixIcon: Icon(Icons.assignment_ind_rounded),
|
||||
child: Scaffold(
|
||||
appBar: PopAppbar(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
label: 'Seleccione un profesional'),
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: TextField(
|
||||
controller: searchController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Escriba un nombre',
|
||||
prefixIcon: Icon(Icons.assignment_ind_rounded),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: professionals.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: ReferencePhoto(
|
||||
ref: professionals[index].professionalRef,
|
||||
sizeCircle: 50,
|
||||
size: 50,
|
||||
sizeIcon: 35,
|
||||
),
|
||||
),
|
||||
trailing: GestureDetector(
|
||||
child: const Icon(Icons.keyboard_arrow_right),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: RichText(
|
||||
text: TextSpan(
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black,
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: professionals.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: ReferencePhoto(
|
||||
ref: professionals[index].professionalRef,
|
||||
sizeCircle: 50,
|
||||
size: 50,
|
||||
sizeIcon: 35,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: '${professionals[index].name}, ',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
"${professionals[index].professionName}, ${professionals[index].cityName}",
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
),
|
||||
trailing: GestureDetector(
|
||||
child: const Icon(Icons.keyboard_arrow_right),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: RichText(
|
||||
text: TextSpan(
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: '${professionals[index].name}, ',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
"${professionals[index].professionName}, ${professionals[index].cityName}",
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
settings?.tarifas == true
|
||||
? professionals[index].tarifa == 0
|
||||
? const SizedBox()
|
||||
: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
color: const Color(0xFFD6F4FF),
|
||||
),
|
||||
child: Text(
|
||||
formatCurrency(
|
||||
professionals[index].tarifa ?? 0),
|
||||
style: TextStyle(
|
||||
color: Colors.grey[850],
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
professionals[index].ubicacion == 'ambos'
|
||||
? Text(
|
||||
'Disponibilidad a domicilio y en sitio ${professionals[index].tarifa}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: professionals[index].ubicacion == 'sitio'
|
||||
? Text(
|
||||
'Disponibilidad en ${professionals[index].ubicacion} ',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Disponibilidad a ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: professionals[index].ubicacion == 'ambos'
|
||||
? const Text(
|
||||
'Disponibilidad a domicilio y en sitio',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: professionals[index].ubicacion == 'sitio'
|
||||
? Text(
|
||||
'Disponibilidad en ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Disponibilidad a ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (professionals[index].ubicacion == 'ambos') {
|
||||
_showChoiceDialog(context).then((String? value) {
|
||||
if (value != null) {
|
||||
Navigator.pop(context, [professionals[index], value]);
|
||||
}
|
||||
});
|
||||
} else if (professionals[index].ubicacion == 'sitio') {
|
||||
Navigator.pop(context, [professionals[index], 'sitio']);
|
||||
} else {
|
||||
Navigator.pop(
|
||||
context, [professionals[index], 'domicilio']);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
onTap: () {
|
||||
if (professionals[index].ubicacion == 'ambos') {
|
||||
_showChoiceDialog(context).then((String? value) {
|
||||
if (value != null) {
|
||||
Navigator.pop(
|
||||
context, [professionals[index], value]);
|
||||
}
|
||||
});
|
||||
} else if (professionals[index].ubicacion == 'sitio') {
|
||||
Navigator.pop(context, [professionals[index], 'sitio']);
|
||||
} else {
|
||||
Navigator.pop(
|
||||
context, [professionals[index], 'domicilio']);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/screens/professional.dart';
|
||||
import 'package:prosappco/src/screens/reputation.dart';
|
||||
|
||||
@@ -18,9 +20,24 @@ class ProfessionalInfoScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
||||
SettingModel? settings;
|
||||
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
|
||||
return '\$${formatter.format(number)}';
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -116,6 +133,30 @@ class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
||||
)
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 10),
|
||||
settings?.tarifas == true
|
||||
? RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: 'Tarifa consulta ',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: formatCurrency(
|
||||
widget.professional.tarifa ?? 0),
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'Se unió el 02 de abril del 2023',
|
||||
style: TextStyle(fontSize: 12),
|
||||
@@ -138,7 +179,7 @@ class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ReputationScreen();
|
||||
return const ReputationScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -213,6 +213,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
|
||||
Future<void> updateInfo() async {
|
||||
final currentUser = _auth.currentUser;
|
||||
final currentPhoneNumber = _auth.currentUser!.phoneNumber;
|
||||
|
||||
String newName = _nameController.text.trim();
|
||||
String newEmail = _emailController.text.trim();
|
||||
@@ -262,6 +263,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await FirebaseFirestore.instance
|
||||
.collection('users')
|
||||
.doc(uid)
|
||||
.update({'phoneNumber': currentPhoneNumber});
|
||||
} catch (e) {
|
||||
print('e');
|
||||
}
|
||||
|
||||
try {
|
||||
if (imagen_to_upload == null) {
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
final _serviceTypeController = TextEditingController();
|
||||
final _observacionController = TextEditingController();
|
||||
String professionalId = '';
|
||||
int professionalTarifa = 0;
|
||||
int? professionalTarifa;
|
||||
String professionalAddress = '';
|
||||
String professionalUbicacion = '';
|
||||
double? professionalLatitude;
|
||||
@@ -138,9 +138,21 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final String token = '50002';
|
||||
|
||||
final userRef = FirebaseFirestore.instance.collection('users').doc(uid);
|
||||
|
||||
userRef.get().then((docSnapshot) {
|
||||
if (docSnapshot.exists) {
|
||||
userRef.update({'token': token});
|
||||
} else {
|
||||
userRef.set({'token': token}, SetOptions(merge: true));
|
||||
}
|
||||
});
|
||||
|
||||
BitmapDescriptor.fromAssetImage(
|
||||
ImageConfiguration(size: Size(48, 48)), 'images/pro_marke.png')
|
||||
const ImageConfiguration(size: Size(48, 48)),
|
||||
'images/pro_marke.png')
|
||||
.then((icon) {
|
||||
setState(() {
|
||||
_markerIcon = icon;
|
||||
@@ -582,7 +594,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
? coordinates.longitude
|
||||
: professionalLongitude,
|
||||
'pendiente',
|
||||
professionalTarifa,
|
||||
professionalTarifa == 0
|
||||
? 0
|
||||
: professionalTarifa,
|
||||
)
|
||||
.then((value) {
|
||||
Navigator.pushReplacement(
|
||||
@@ -615,6 +629,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Text('${_selectedDate?.weekday}')
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
@@ -9,9 +6,8 @@ import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
import 'package:prosappco/src/models/scores_model.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/screens/profile.dart';
|
||||
import 'package:prosappco/src/screens/profile_pro.dart';
|
||||
import 'package:prosappco/src/screens/service.dart';
|
||||
|
||||
class ServiceAfterScreen extends StatefulWidget {
|
||||
@@ -26,11 +22,20 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
Event? evento;
|
||||
UserModel? user;
|
||||
ScoresModel? scoresModel;
|
||||
SettingModel? settings;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Event.getEventById(widget.eventoId).then((value) {
|
||||
setState(() {
|
||||
evento = value;
|
||||
@@ -50,6 +55,12 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
|
||||
return '\$${formatter.format(number)}';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -93,7 +104,11 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: ' ${evento?.range1Hour1}',
|
||||
text: evento?.range1Hour1 != null
|
||||
? TimeOfDay.fromDateTime(
|
||||
DateTime.parse(evento!.range1Hour1))
|
||||
.format(context)
|
||||
: '',
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
@@ -124,7 +139,7 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'(${scoresModel?.total.toString()}) ${scoresModel?.average.toString()}'),
|
||||
'(${scoresModel?.total.toString()}) ${scoresModel?.average.toStringAsFixed(1)}'),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -166,6 +181,17 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
settings?.tarifas == true && evento?.tarifa != 0
|
||||
? Column(children: [
|
||||
Text(
|
||||
formatCurrency(evento?.tarifa ?? 0),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 25),
|
||||
),
|
||||
const Text('Tarifa consulta'),
|
||||
const SizedBox(height: 10)
|
||||
])
|
||||
: const SizedBox(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.near_me),
|
||||
title: Text(
|
||||
|
||||
Reference in New Issue
Block a user