fix: location preference bug and service detail 404
- When professional accepts 'both' modes, add office/delivery toggle so the patient can explicitly choose instead of defaulting to delivery. Reset _bookAsDelivery when a professional is selected; office-only professionals still force office, delivery-only force delivery. - Fix 'sin servicio' on ServiceView: getServiceForUser was calling /users/:professionalId using the professionals-table UUID (not user UUID), returning 404 and setting service=null. Use the embedded professionals.users data from findById instead. - Convert ServiceView to StatefulWidget; fetch in initState to avoid re-fetching on every parent rebuild. - Remove client-side FCM notification from _requestService; backend create() now notifies the professional directly with the server key. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
735d8c2ba0
commit
646e44d126
@@ -16,7 +16,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:prosapp_web_app/utils/local_notifications.dart';
|
||||
|
||||
class ServiceView extends StatelessWidget {
|
||||
class ServiceView extends StatefulWidget {
|
||||
final String type;
|
||||
final String serviceId;
|
||||
|
||||
@@ -26,19 +26,25 @@ class ServiceView extends StatelessWidget {
|
||||
required this.serviceId,
|
||||
});
|
||||
|
||||
@override
|
||||
State<ServiceView> createState() => _ServiceViewState();
|
||||
}
|
||||
|
||||
class _ServiceViewState extends State<ServiceView> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final sp = Provider.of<ServicesProvider>(context, listen: false);
|
||||
if (widget.type == 'user') {
|
||||
sp.getServiceForUser(widget.serviceId);
|
||||
} else if (widget.type == 'professional') {
|
||||
sp.getServiceForProfessional(widget.serviceId);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settingsProvider = Provider.of<SettingsProvider>(context);
|
||||
final servicesProvider =
|
||||
Provider.of<ServicesProvider>(context, listen: false);
|
||||
|
||||
if (type == 'user') {
|
||||
servicesProvider.getServiceForUser(serviceId);
|
||||
}
|
||||
|
||||
if (type == 'professional') {
|
||||
servicesProvider.getServiceForProfessional(serviceId);
|
||||
}
|
||||
|
||||
return Consumer<ServicesProvider>(
|
||||
builder: (context, servicesProvider, child) {
|
||||
|
||||
Reference in New Issue
Block a user