NEW: MIh Alerts

This commit is contained in:
2025-11-20 10:56:15 +02:00
parent b69a52a5a8
commit 00cd5488e3
66 changed files with 3188 additions and 5130 deletions

View File

@@ -78,6 +78,12 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
return accessStatus;
}
Future<void> refreshMyPatientList(MzansiProfileProvider mzansiProfileProvider,
PatientManagerProvider patientManagerProvider) async {
await MihPatientServices().getPatientAccessListOfBusiness(
patientManagerProvider, mzansiProfileProvider.business!.business_id);
}
void patientProfileChoicePopUp(
MzansiProfileProvider profileProvider,
PatientManagerProvider patientManagerProvider,
@@ -300,7 +306,7 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
// "business",
// ));
} else {
MihAlertServices().warningMessage(
MihAlertServices().warningAlert(
"Access Pending",
"Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.",
context,
@@ -344,6 +350,8 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
),
context,
);
refreshMyPatientList(
profileProvider, patientManagerProvider);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==
@@ -380,6 +388,8 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
),
context,
);
refreshMyPatientList(
profileProvider, patientManagerProvider);
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode ==

View File

@@ -1,6 +1,5 @@
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
@@ -64,69 +63,43 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
successPopUp("Successfully Added Appointment",
"You appointment has been successfully added to your calendar.");
} else {
MihAlertServices().internetConnectionLost(context);
MihAlertServices().internetConnectionAlert(context);
}
}
void successPopUp(String title, String message) {
showDialog(
context: context,
builder: (context) {
return MihPackageAlert(
alertIcon: Icon(
Icons.check_circle_outline_rounded,
size: 150,
color: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
),
alertTitle: title,
alertBody: Column(
children: [
Text(
message,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25),
Center(
child: MihButton(
onPressed: () {
context.pop();
context.pop();
setState(() {
dateController.clear();
timeController.clear();
idController.clear();
fnameController.clear();
lnameController.clear();
});
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
)
],
),
alertColour: MihColors.getGreenColor(
MihAlertServices().successAdvancedAlert(
title,
message,
[
MihButton(
onPressed: () {
context.pop();
context.pop();
setState(() {
dateController.clear();
timeController.clear();
idController.clear();
fnameController.clear();
lnameController.clear();
});
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
);
},
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
context,
);
}
@@ -242,10 +215,10 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
submitApointment(
profileProvider, patientManagerProvider, index);
} else {
MihAlertServices().inputErrorMessage(context);
MihAlertServices().inputErrorAlert(context);
}
} else {
MihAlertServices().inputErrorMessage(context);
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
@@ -276,13 +249,13 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
void noAccessWarning(
PatientManagerProvider patientManagerProvider, int index) {
if (patientManagerProvider.myPaitentList![index].status == "pending") {
MihAlertServices().warningMessage(
MihAlertServices().warningAlert(
"Access Pending",
"Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.",
context,
);
} else {
MihAlertServices().warningMessage(
MihAlertServices().errorBasicAlert(
"Access Declined",
"Your request to access the patient's profile has been denied. Please contact the patient directly to inquire about the reason for this restriction.",
context,

View File

@@ -2,7 +2,6 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_package_alert.dart';
import 'package:mzansi_innovation_hub/mih_providers/mih_calendar_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/patient_manager_provider.dart';
@@ -266,7 +265,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
patientManagerProvider.setPatientManagerIndex(1);
context.pop();
},
buttonColor: MihColors.getGreenColor(
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 300,
child: Text(
@@ -285,7 +284,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
patientManagerProvider.setPatientManagerIndex(2);
context.pop();
},
buttonColor: MihColors.getGreenColor(
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 300,
child: Text(
@@ -305,7 +304,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
addAppointmentWindow(
profileProvider, mihCalendarProvider, width);
},
buttonColor: MihColors.getGreenColor(
buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
width: 300,
child: Text(
@@ -410,7 +409,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
addAppointmentCall(
profileProvider, mihCalendarProvider);
} else {
MihAlertServices().inputErrorMessage(context);
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.getGreenColor(
@@ -462,71 +461,45 @@ class _WaitingRoomState extends State<WaitingRoom> {
"You appointment has been successfully added to your calendar.");
_loadInitialAppointments();
} else {
MihAlertServices().internetConnectionLost(context);
MihAlertServices().internetConnectionAlert(context);
}
} else {
MihAlertServices().inputErrorMessage(context);
MihAlertServices().inputErrorAlert(context);
}
checkforchange();
}
void successPopUp(String title, String message) {
showDialog(
context: context,
builder: (context) {
return MihPackageAlert(
alertIcon: Icon(
Icons.check_circle_outline_rounded,
size: 150,
color: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
),
alertTitle: title,
alertBody: Column(
children: [
Text(
message,
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25),
Center(
child: MihButton(
onPressed: () {
context.pop();
setState(() {
_appointmentDateController.clear();
_appointmentTimeController.clear();
_appointmentTitleController.clear();
_appointmentDescriptionIDController.clear();
});
},
buttonColor: MihColors.getGreenColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
)
],
),
alertColour: MihColors.getGreenColor(
MihAlertServices().successAdvancedAlert(
title,
message,
[
MihButton(
onPressed: () {
context.pop();
setState(() {
_appointmentDateController.clear();
_appointmentTimeController.clear();
_appointmentTitleController.clear();
_appointmentDescriptionIDController.clear();
});
},
buttonColor: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
);
},
elevation: 10,
width: 300,
child: Text(
"Dismiss",
style: TextStyle(
color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
context,
);
}