update pat man nav
This commit is contained in:
@@ -21,8 +21,10 @@ import 'package:mzansi_innovation_hub/mih_packages/mzansi_profile/personal_profi
|
|||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/mih_wallet.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/mih_wallet.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_manager/pat_manager.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/add_or_view_patient.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/add_or_view_patient.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/patient_edit.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/patient_edit.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/patient_profile.dart';
|
||||||
import 'package:supertokens_flutter/supertokens.dart';
|
import 'package:supertokens_flutter/supertokens.dart';
|
||||||
|
|
||||||
class MihGoRouterPaths {
|
class MihGoRouterPaths {
|
||||||
@@ -385,6 +387,38 @@ class MihGoRouter {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: "patientManager",
|
||||||
|
path: MihGoRouterPaths.patientManager,
|
||||||
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
|
final PatManagerArguments? args = state.extra as PatManagerArguments?;
|
||||||
|
if (args == null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
context.go(MihGoRouterPaths.mihHome);
|
||||||
|
});
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return PatManager(
|
||||||
|
key: UniqueKey(),
|
||||||
|
arguments: args,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
name: "patientManagerPatient",
|
||||||
|
path: MihGoRouterPaths.patientManagerPatient,
|
||||||
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
|
final PatientViewArguments? args =
|
||||||
|
state.extra as PatientViewArguments?;
|
||||||
|
if (args == null) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
context.go(MihGoRouterPaths.mihHome);
|
||||||
|
});
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
return PatientProfile(arguments: args);
|
||||||
|
},
|
||||||
|
),
|
||||||
// ========================== Mzansi Directory ==================================
|
// ========================== Mzansi Directory ==================================
|
||||||
GoRoute(
|
GoRoute(
|
||||||
name: "mzansiDirectory",
|
name: "mzansiDirectory",
|
||||||
@@ -403,12 +437,6 @@ class MihGoRouter {
|
|||||||
),
|
),
|
||||||
// ========================== End ==================================
|
// ========================== End ==================================
|
||||||
// GoRoute(
|
// GoRoute(
|
||||||
// name: "mihAuthentication",
|
|
||||||
// path: MihGoRouterPaths.mihAuthentication,
|
|
||||||
// builder: (BuildContext context, GoRouterState state) =>
|
|
||||||
// MihAuthentication(),
|
|
||||||
// ),
|
|
||||||
// GoRoute(
|
|
||||||
// name: "notifications",
|
// name: "notifications",
|
||||||
// path: MihGoRouterPaths.notifications,
|
// path: MihGoRouterPaths.notifications,
|
||||||
// builder: (BuildContext context, GoRouterState state) {
|
// builder: (BuildContext context, GoRouterState state) {
|
||||||
@@ -417,41 +445,6 @@ class MihGoRouter {
|
|||||||
// },
|
// },
|
||||||
// ),
|
// ),
|
||||||
// GoRoute(
|
// GoRoute(
|
||||||
// name: "patientProfileSetup",
|
|
||||||
// path: MihGoRouterPaths.patientProfileSetup,
|
|
||||||
// builder: (BuildContext context, GoRouterState state) {
|
|
||||||
// final AppUser? signedInUser = state.extra as AppUser?;
|
|
||||||
// return AddPatient(signedInUser: signedInUser!);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// // Note: You can't have two separate GoRoutes with the same path.
|
|
||||||
// // 'appointments' and 'calendar' now need a distinct path, or be sub-routes.
|
|
||||||
// // Here, we'll assume they should be separate.
|
|
||||||
// GoRoute(
|
|
||||||
// name: "mihAppointments",
|
|
||||||
// path: MihGoRouterPaths.appointments,
|
|
||||||
// builder: (BuildContext context, GoRouterState state) {
|
|
||||||
// final CalendarArguments? args = state.extra as CalendarArguments?;
|
|
||||||
// return MzansiCalendar(arguments: args!);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// GoRoute(
|
|
||||||
// name: "patientManager",
|
|
||||||
// path: MihGoRouterPaths.patientManager,
|
|
||||||
// builder: (BuildContext context, GoRouterState state) {
|
|
||||||
// final PatManagerArguments? args = state.extra as PatManagerArguments?;
|
|
||||||
// return PatManager(arguments: args!);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// GoRoute(
|
|
||||||
// name: "patientManagerPatient",
|
|
||||||
// path: MihGoRouterPaths.patientManagerPatient,
|
|
||||||
// builder: (BuildContext context, GoRouterState state) {
|
|
||||||
// final PatientViewArguments? args = state.extra as PatientViewArguments?;
|
|
||||||
// return PatientProfile(arguments: args!);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// GoRoute(
|
|
||||||
// name: "fileViewer",
|
// name: "fileViewer",
|
||||||
// path: MihGoRouterPaths.fileViewer,
|
// path: MihGoRouterPaths.fileViewer,
|
||||||
// builder: (BuildContext context, GoRouterState state) {
|
// builder: (BuildContext context, GoRouterState state) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
||||||
@@ -201,7 +202,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
widget.dateController.clear();
|
widget.dateController.clear();
|
||||||
widget.timeController.clear();
|
widget.timeController.clear();
|
||||||
widget.titleController.clear();
|
widget.titleController.clear();
|
||||||
@@ -323,7 +324,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
widget.dateController.clear();
|
widget.dateController.clear();
|
||||||
widget.timeController.clear();
|
widget.timeController.clear();
|
||||||
widget.titleController.clear();
|
widget.titleController.clear();
|
||||||
@@ -424,7 +425,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
.split('T')[1]
|
.split('T')[1]
|
||||||
.substring(0, 5);
|
.substring(0, 5);
|
||||||
});
|
});
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
windowBody: Padding(
|
windowBody: Padding(
|
||||||
padding:
|
padding:
|
||||||
@@ -600,6 +601,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop();
|
||||||
if (!widget.inWaitingRoom) {
|
if (!widget.inWaitingRoom) {
|
||||||
|
KenLogger.warning("calendar route");
|
||||||
context.goNamed(
|
context.goNamed(
|
||||||
"mihCalendar",
|
"mihCalendar",
|
||||||
extra: CalendarArguments(
|
extra: CalendarArguments(
|
||||||
@@ -610,7 +612,22 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
//to-Do waiting room apointments
|
KenLogger.warning("waiting room route");
|
||||||
|
// GoRouter.of(context).refresh();
|
||||||
|
context.goNamed(
|
||||||
|
'mihHome',
|
||||||
|
extra: false,
|
||||||
|
);
|
||||||
|
context.goNamed(
|
||||||
|
'patientManager',
|
||||||
|
extra: PatManagerArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
false,
|
||||||
|
widget.business,
|
||||||
|
widget.businessUser,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
// context.pop();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
internetConnectionPopUp();
|
internetConnectionPopUp();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_service_calls.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_service_calls.dart';
|
||||||
@@ -363,15 +364,24 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
|
|||||||
child: MihButton(
|
child: MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (hasAccess) {
|
if (hasAccess) {
|
||||||
Navigator.of(context)
|
context.pop();
|
||||||
.pushNamed('/patient-manager/patient',
|
context.pushNamed('patientManagerPatient',
|
||||||
arguments: PatientViewArguments(
|
extra: PatientViewArguments(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
widget.patients[index],
|
widget.patients[index],
|
||||||
widget.businessUser,
|
widget.businessUser,
|
||||||
widget.business,
|
widget.business,
|
||||||
"business",
|
"business",
|
||||||
));
|
));
|
||||||
|
// Navigator.of(context)
|
||||||
|
// .pushNamed('/patient-manager/patient',
|
||||||
|
// arguments: PatientViewArguments(
|
||||||
|
// widget.signedInUser,
|
||||||
|
// widget.patients[index],
|
||||||
|
// widget.businessUser,
|
||||||
|
// widget.business,
|
||||||
|
// "business",
|
||||||
|
// ));
|
||||||
} else {
|
} else {
|
||||||
noAccessWarning();
|
noAccessWarning();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_service_calls.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_service_calls.dart';
|
||||||
@@ -49,14 +51,15 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
|
|||||||
|
|
||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
final baseAPI = AppEnviroment.baseApiUrl;
|
||||||
|
|
||||||
void submitApointment(int index) {
|
Future<void> submitApointment(int index) async {
|
||||||
//To-Do: Add the appointment to the database
|
//To-Do: Add the appointment to the database
|
||||||
// print("To-Do: Add the appointment to the database");
|
// print("To-Do: Add the appointment to the database");
|
||||||
String description =
|
String description =
|
||||||
"Date: ${dateController.text}\nTime: ${timeController.text}\n";
|
"Date: ${dateController.text}\nTime: ${timeController.text}\n";
|
||||||
description += "Medical Practice: ${widget.business!.Name}\n";
|
description += "Medical Practice: ${widget.business!.Name}\n";
|
||||||
description += "Contact Number: ${widget.business!.contact_no}";
|
description += "Contact Number: ${widget.business!.contact_no}";
|
||||||
MihMzansiCalendarApis.addPatientAppointment(
|
int statusCode;
|
||||||
|
statusCode = await MihMzansiCalendarApis.addPatientAppointment(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
false,
|
false,
|
||||||
widget.patientAccesses[index].app_id,
|
widget.patientAccesses[index].app_id,
|
||||||
@@ -71,6 +74,86 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
|
|||||||
timeController.text,
|
timeController.text,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
if (statusCode == 201) {
|
||||||
|
context.pop();
|
||||||
|
successPopUp("Successfully Added Appointment",
|
||||||
|
"You appointment has been successfully added to your calendar.");
|
||||||
|
} else {
|
||||||
|
internetConnectionPopUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void internetConnectionPopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MIHErrorMessage(
|
||||||
|
errorType: "Internet Connection",
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAppointmentFieldsFilled() {
|
bool isAppointmentFieldsFilled() {
|
||||||
@@ -341,15 +424,24 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
|
|||||||
),
|
),
|
||||||
MihButton(
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context)
|
context.pop();
|
||||||
.pushNamed('/patient-manager/patient',
|
context.pushNamed('patientManagerPatient',
|
||||||
arguments: PatientViewArguments(
|
extra: PatientViewArguments(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
patientProfile,
|
patientProfile,
|
||||||
widget.businessUser,
|
widget.businessUser,
|
||||||
widget.business,
|
widget.business,
|
||||||
"business",
|
"business",
|
||||||
));
|
));
|
||||||
|
// Navigator.of(context)
|
||||||
|
// .pushNamed('/patient-manager/patient',
|
||||||
|
// arguments: PatientViewArguments(
|
||||||
|
// widget.signedInUser,
|
||||||
|
// patientProfile,
|
||||||
|
// widget.businessUser,
|
||||||
|
// widget.business,
|
||||||
|
// "business",
|
||||||
|
// ));
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getSecondaryColor(
|
buttonColor: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tile.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tile.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
@@ -22,11 +23,16 @@ class _PatManagerTileState extends State<PatManagerTile> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihPackageTile(
|
return MihPackageTile(
|
||||||
|
authenticateUser: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
context.goNamed(
|
||||||
'/patient-manager',
|
'patientManager',
|
||||||
arguments: widget.arguments,
|
extra: widget.arguments,
|
||||||
);
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// '/patient-manager',
|
||||||
|
// arguments: widget.arguments,
|
||||||
|
// );
|
||||||
},
|
},
|
||||||
appName: "Patient Manager",
|
appName: "Patient Manager",
|
||||||
appIcon: Icon(
|
appIcon: Icon(
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
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/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_alert.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart';
|
import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart';
|
||||||
@@ -269,7 +271,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: "Appointment Type",
|
windowTitle: "Appointment Type",
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
windowBody: Column(
|
windowBody: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -285,7 +287,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
MihButton(
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
widget.onIndexChange(1);
|
widget.onIndexChange(1);
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
@@ -304,7 +306,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
MihButton(
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
widget.onIndexChange(2);
|
widget.onIndexChange(2);
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
},
|
},
|
||||||
buttonColor: MihColors.getGreenColor(
|
buttonColor: MihColors.getGreenColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
@@ -354,7 +356,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
windowTitle: "Add Appointment",
|
windowTitle: "Add Appointment",
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.of(context).pop();
|
context.pop();
|
||||||
_appointmentDateController.clear();
|
_appointmentDateController.clear();
|
||||||
_appointmentTimeController.clear();
|
_appointmentTimeController.clear();
|
||||||
_appointmentTitleController.clear();
|
_appointmentTitleController.clear();
|
||||||
@@ -457,10 +459,11 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addAppointmentCall() {
|
Future<void> addAppointmentCall() async {
|
||||||
if (isAppointmentInputValid()) {
|
if (isAppointmentInputValid()) {
|
||||||
|
int statusCode;
|
||||||
if (widget.personalSelected == false) {
|
if (widget.personalSelected == false) {
|
||||||
MihMzansiCalendarApis.addBusinessAppointment(
|
statusCode = await MihMzansiCalendarApis.addBusinessAppointment(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
widget.business!,
|
widget.business!,
|
||||||
widget.businessUser!,
|
widget.businessUser!,
|
||||||
@@ -472,7 +475,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihMzansiCalendarApis.addPersonalAppointment(
|
statusCode = await MihMzansiCalendarApis.addPersonalAppointment(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
_appointmentTitleController.text,
|
_appointmentTitleController.text,
|
||||||
_appointmentDescriptionIDController.text,
|
_appointmentDescriptionIDController.text,
|
||||||
@@ -481,6 +484,13 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (statusCode == 201) {
|
||||||
|
context.pop();
|
||||||
|
successPopUp("Successfully Added Appointment",
|
||||||
|
"You appointment has been successfully added to your calendar.");
|
||||||
|
} else {
|
||||||
|
internetConnectionPopUp();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -492,6 +502,77 @@ class _WaitingRoomState extends State<WaitingRoom> {
|
|||||||
checkforchange();
|
checkforchange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void internetConnectionPopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MIHErrorMessage(
|
||||||
|
errorType: "Internet Connection",
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bool isAppointmentInputValid() {
|
bool isAppointmentInputValid() {
|
||||||
if (_appointmentDescriptionIDController.text.isEmpty ||
|
if (_appointmentDescriptionIDController.text.isEmpty ||
|
||||||
_appointmentDateController.text.isEmpty ||
|
_appointmentDateController.text.isEmpty ||
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||||
@@ -48,7 +49,11 @@ class _PatManagerState extends State<PatManager> {
|
|||||||
icon: const Icon(Icons.arrow_back),
|
icon: const Icon(Icons.arrow_back),
|
||||||
iconSize: 35,
|
iconSize: 35,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pop();
|
// Navigator.of(context).pop();
|
||||||
|
context.goNamed(
|
||||||
|
'mihHome',
|
||||||
|
extra: false,
|
||||||
|
);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,10 +43,14 @@ class _PatientProfileState extends State<PatientProfile> {
|
|||||||
icon: const Icon(Icons.arrow_back),
|
icon: const Icon(Icons.arrow_back),
|
||||||
iconSize: 35,
|
iconSize: 35,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.goNamed(
|
if (widget.arguments.type == "business") {
|
||||||
'mihHome',
|
context.pop();
|
||||||
extra: true,
|
} else {
|
||||||
);
|
context.goNamed(
|
||||||
|
'mihHome',
|
||||||
|
extra: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user