From 43ab2b6681379d40ba3b3f646141bfd95ae52e2d Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 18 Aug 2025 16:22:07 +0200 Subject: [PATCH] update Calendar nav --- .../builder/build_appointment_list.dart | 112 ++++- .../calendar/mzansi_calendar.dart | 10 +- .../package_tiles/mzansi_calendar_tile.dart | 11 +- .../calendar/package_tools/appointments.dart | 118 +++++- .../mih_mzansi_calendar_services.dart | 382 +++++++++--------- 5 files changed, 407 insertions(+), 226 deletions(-) diff --git a/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart b/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart index b6a206b2..c70c23d3 100644 --- a/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart +++ b/Frontend/lib/mih_packages/calendar/builder/build_appointment_list.dart @@ -1,5 +1,8 @@ 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_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_config/mih_colors.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; @@ -552,10 +555,11 @@ class _BuildAppointmentListState extends State { ); } - void updateAppointmentCall(int index) { + Future updateAppointmentCall(int index) async { + int statusCode; if (isAppointmentInputValid()) { if (widget.personalSelected == true) { - MihMzansiCalendarApis.updatePersonalAppointment( + statusCode = await MihMzansiCalendarApis.updatePersonalAppointment( widget.signedInUser, widget.business, null, @@ -568,7 +572,7 @@ class _BuildAppointmentListState extends State { ); } else if (widget.personalSelected == false && widget.inWaitingRoom == false) { - MihMzansiCalendarApis.updateBusinessAppointment( + statusCode = await MihMzansiCalendarApis.updateBusinessAppointment( widget.signedInUser, widget.business, widget.businessUser, @@ -580,7 +584,7 @@ class _BuildAppointmentListState extends State { context, ); } else { - MihMzansiCalendarApis.updatePatientAppointment( + statusCode = await MihMzansiCalendarApis.updatePatientAppointment( widget.signedInUser, widget.business, widget.businessUser, @@ -592,6 +596,25 @@ class _BuildAppointmentListState extends State { context, ); } + if (statusCode == 200) { + context.pop(); + context.pop(); + if (!widget.inWaitingRoom) { + context.goNamed( + "mihCalendar", + extra: CalendarArguments( + widget.signedInUser, + widget.personalSelected, + widget.business, + widget.businessUser, + ), + ); + } else { + //to-Do waiting room apointments + } + } else { + internetConnectionPopUp(); + } } else { showDialog( context: context, @@ -602,9 +625,8 @@ class _BuildAppointmentListState extends State { } } - void deleteAppointmentCall(int index) { - print("personal selected: ${widget.personalSelected}"); - MihMzansiCalendarApis.deleteAppointmentAPICall( + Future deleteAppointmentCall(int index) async { + int statucCode = await MihMzansiCalendarApis.deleteAppointmentAPICall( widget.signedInUser, widget.personalSelected, widget.business, @@ -613,6 +635,82 @@ class _BuildAppointmentListState extends State { widget.appointmentList[index].idappointments, context, ); + if (statucCode == 200) { + context.pop(); + context.pop(); + setState(() { + widget.appointmentList.removeAt(index); + }); + successPopUp("Successfully Deleted Appointment", + "You appointment has been successfully deleted from your calendar."); + } else { + internetConnectionPopUp(); + } + } + + 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(); + }, + 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"), + ); + }, + ); + } + + void internetConnectionPopUp() { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage( + errorType: "Internet Connection", + ); + }, + ); } bool canEditAppointment(int index) { diff --git a/Frontend/lib/mih_packages/calendar/mzansi_calendar.dart b/Frontend/lib/mih_packages/calendar/mzansi_calendar.dart index ed6c30a6..4d0298b9 100644 --- a/Frontend/lib/mih_packages/calendar/mzansi_calendar.dart +++ b/Frontend/lib/mih_packages/calendar/mzansi_calendar.dart @@ -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_action.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart'; @@ -41,7 +42,14 @@ class _MzansiCalendarState extends State { icon: const Icon(Icons.arrow_back), iconSize: 35, onTap: () { - Navigator.of(context).pop(); + // Navigator.of(context).pop(); + context.goNamed( + 'home', + extra: AuthArguments( + true, + false, + ), + ); FocusScope.of(context).unfocus(); }, ); diff --git a/Frontend/lib/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart b/Frontend/lib/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart index 7ec7b80d..7abb6097 100644 --- a/Frontend/lib/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart +++ b/Frontend/lib/mih_packages/calendar/package_tiles/mzansi_calendar_tile.dart @@ -1,3 +1,4 @@ +import 'package:go_router/go_router.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_icons.dart'; @@ -24,10 +25,14 @@ class _MzansiCalendarTileState extends State { Widget build(BuildContext context) { return MihPackageTile( onTap: () { - Navigator.of(context).pushNamed( - '/calendar', - arguments: widget.arguments, + context.goNamed( + "mihCalendar", + extra: widget.arguments, ); + // Navigator.of(context).pushNamed( + // '/calendar', + // arguments: widget.arguments, + // ); }, appName: "Calendar", appIcon: Icon( diff --git a/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart b/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart index 31637f54..db9bb941 100644 --- a/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart +++ b/Frontend/lib/mih_packages/calendar/package_tools/appointments.dart @@ -1,5 +1,7 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart'; +import 'package:go_router/go_router.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_services/mih_alert_services.dart'; import 'package:mzansi_innovation_hub/mih_services/mih_mzansi_calendar_services.dart'; @@ -143,23 +145,6 @@ class _PatientAccessRequestState extends State { ), ), ); - // return Expanded( - // child: Padding( - // padding: const EdgeInsets.only(top: 35.0), - // child: Align( - // alignment: Alignment.center, - // child: Text( - // "No Appointments for $selectedDay", - // style: TextStyle( - // fontSize: 25, - // color: MihColors.getGreyColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"), - // ), - // textAlign: TextAlign.center, - // softWrap: true, - // ), - // ), - // ), - // ); } void addAppointmentWindow(double width) { @@ -284,10 +269,11 @@ class _PatientAccessRequestState extends State { } } - void addAppointmentCall() { + Future addAppointmentCall() async { if (isAppointmentInputValid()) { + int statusCode; if (widget.personalSelected == false) { - MihMzansiCalendarApis.addBusinessAppointment( + statusCode = await MihMzansiCalendarApis.addBusinessAppointment( widget.signedInUser, widget.business!, widget.businessUser!, @@ -299,7 +285,7 @@ class _PatientAccessRequestState extends State { context, ); } else { - MihMzansiCalendarApis.addPersonalAppointment( + statusCode = await MihMzansiCalendarApis.addPersonalAppointment( widget.signedInUser, _appointmentTitleController.text, _appointmentDescriptionIDController.text, @@ -308,6 +294,27 @@ class _PatientAccessRequestState extends State { context, ); } + if (statusCode == 201) { + context.pop(); + successPopUp("Successfully Added Appointment", + "You appointment has been successfully added to your calendar."); + setState(() { + if (widget.personalSelected) { + appointmentResults = MihMzansiCalendarApis.getPersonalAppointments( + widget.signedInUser.app_id, + selectedDay, + ); + } else { + appointmentResults = MihMzansiCalendarApis.getBusinessAppointments( + widget.business!.business_id, + false, + selectedDay, + ); + } + }); + } else { + internetConnectionPopUp(); + } } else { showDialog( context: context, @@ -319,6 +326,77 @@ class _PatientAccessRequestState extends State { 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( + MzansiInnovationHub.of(context)!.theme.mode == "Dark"), + ); + }, + ); + } + + void internetConnectionPopUp() { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage( + errorType: "Internet Connection", + ); + }, + ); + } + String getTitle() { if (widget.personalSelected == false) { return "Business Appointments"; diff --git a/Frontend/lib/mih_services/mih_mzansi_calendar_services.dart b/Frontend/lib/mih_services/mih_mzansi_calendar_services.dart index 2a4639b2..d01785aa 100644 --- a/Frontend/lib/mih_services/mih_mzansi_calendar_services.dart +++ b/Frontend/lib/mih_services/mih_mzansi_calendar_services.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:mzansi_innovation_hub/mih_services/mih_notification_services.dart'; +import 'package:go_router/go_router.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/app_user.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/appointment.dart'; @@ -8,19 +8,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart' import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart'; import 'package:flutter/material.dart'; -// import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; -// import '../mih_components/mih_pop_up_messages/mih_success_message.dart'; -// import '../mih_env/mih_env.dart'; -// import '../mih_objects/app_user.dart'; -// import '../mih_objects/arguments.dart'; -// import '../mih_objects/business.dart'; -// import '../mih_objects/business_user.dart'; -// import '../mih_objects/notification.dart'; -// import '../mih_objects/patient_access.dart'; -// import '../mih_objects/patient_queue.dart'; -// import '../mih_objects/patients.dart'; import 'package:supertokens_flutter/http.dart' as http; - import '../mih_components/mih_pop_up_messages/mih_error_message.dart'; import '../mih_components/mih_pop_up_messages/mih_success_message.dart'; import '../mih_config/mih_env.dart'; @@ -39,23 +27,12 @@ class MihMzansiCalendarApis { String app_id, String date, ) async { - //print("Patien manager page: $endpoint"); final response = await http.get(Uri.parse( "${AppEnviroment.baseApiUrl}/appointments/personal/$app_id?date=$date")); - // print("Here"); - // print("Body: ${response.body}"); - // print("Code: ${response.statusCode}"); - // errorCode = response.statusCode.toString(); - // errorBody = response.body; - if (response.statusCode == 200) { - //print("Here1"); Iterable l = jsonDecode(response.body); - //print("Here2"); List personalAppointments = List.from(l.map((model) => Appointment.fromJson(model))); - //print("Here3"); - //print(patientQueue); return personalAppointments; } else { throw Exception('failed to fatch personal appointments'); @@ -114,7 +91,7 @@ class MihMzansiCalendarApis { /// BuildContext context, /// /// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS) - static Future deleteAppointmentAPICall( + static Future deleteAppointmentAPICall( AppUser signedInUser, bool personalSelected, Business? business, @@ -123,6 +100,7 @@ class MihMzansiCalendarApis { int idappointments, BuildContext context, ) async { + loadingPopUp(context); var response = await http.delete( Uri.parse("${AppEnviroment.baseApiUrl}/appointment/delete/"), headers: { @@ -130,39 +108,41 @@ class MihMzansiCalendarApis { }, body: jsonEncode({"idappointments": idappointments}), ); + context.pop(); + return response.statusCode; //print("Here4"); //print(response.statusCode); - if (response.statusCode == 200) { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - Navigator.of(context).pop(); - if (inWaitingRoom == true && personalSelected == false) { - Navigator.of(context).pushNamed( - '/patient-manager', - arguments: PatManagerArguments( - signedInUser, - false, - business, - businessUser, - ), - ); - } else { - Navigator.of(context).pushNamed( - '/calendar', - arguments: CalendarArguments( - signedInUser, - personalSelected, - business, - businessUser, - ), - ); - } - String message = - "The appointment has been deleted successfully. This means it will no longer be visible in your Calendar."; - successPopUp(message, context); - } else { - internetConnectionPopUp(context); - } + // if (response.statusCode == 200) { + // Navigator.of(context).pop(); + // Navigator.of(context).pop(); + // Navigator.of(context).pop(); + // if (inWaitingRoom == true && personalSelected == false) { + // Navigator.of(context).pushNamed( + // '/patient-manager', + // arguments: PatManagerArguments( + // signedInUser, + // false, + // business, + // businessUser, + // ), + // ); + // } else { + // Navigator.of(context).pushNamed( + // '/calendar', + // arguments: CalendarArguments( + // signedInUser, + // personalSelected, + // business, + // businessUser, + // ), + // ); + // } + // String message = + // "The appointment has been deleted successfully. This means it will no longer be visible in your Calendar."; + // successPopUp(message, context); + // } else { + // internetConnectionPopUp(context); + // } } /// This function is used to add an appointment to users mzansi Calendar. @@ -177,7 +157,7 @@ class MihMzansiCalendarApis { /// BuildContext context, /// /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future addPersonalAppointment( + static Future addPersonalAppointment( AppUser signedInUser, String title, String description, @@ -200,28 +180,30 @@ class MihMzansiCalendarApis { "time": time, }), ); - if (response.statusCode == 201) { - Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); - String message = - "Your appointment \"$title\" for the $date $title has been deleted."; + context.pop(); + return response.statusCode; + // if (response.statusCode == 201) { + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // String message = + // "Your appointment \"$title\" for the $date $title has been deleted."; - // Navigator.pop(context); - Navigator.of(context).pushNamed( - '/calendar', - arguments: CalendarArguments( - signedInUser, - true, - null, - null, - ), - ); - successPopUp(message, context); - } else { - Navigator.pop(context); - internetConnectionPopUp(context); - } + // // Navigator.pop(context); + // Navigator.of(context).pushNamed( + // '/calendar', + // arguments: CalendarArguments( + // signedInUser, + // true, + // null, + // null, + // ), + // ); + // successPopUp(message, context); + // } else { + // Navigator.pop(context); + // internetConnectionPopUp(context); + // } } /// This function is used to add an appointment to users mzansi Calendar. @@ -236,7 +218,7 @@ class MihMzansiCalendarApis { /// BuildContext context, /// /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future addBusinessAppointment( + static Future addBusinessAppointment( AppUser signedInUser, Business business, BusinessUser businessUser, @@ -262,42 +244,44 @@ class MihMzansiCalendarApis { "time": time, }), ); - if (response.statusCode == 201) { - // Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); - String message = - "Your appointment \"$title\" for the $date $title has been deleted."; + context.pop(); + return response.statusCode; + // if (response.statusCode == 201) { + // // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // String message = + // "Your appointment \"$title\" for the $date $title has been deleted."; - // Navigator.pop(context); - if (inWaitingRoom) { - Navigator.of(context).pushNamed( - '/patient-manager', - arguments: PatManagerArguments( - signedInUser, - false, - business, - businessUser, - ), - ); - } else { - Navigator.of(context).pushNamed( - '/calendar', - arguments: CalendarArguments( - signedInUser, - false, - business, - businessUser, - ), - ); - } + // // Navigator.pop(context); + // if (inWaitingRoom) { + // Navigator.of(context).pushNamed( + // '/patient-manager', + // arguments: PatManagerArguments( + // signedInUser, + // false, + // business, + // businessUser, + // ), + // ); + // } else { + // Navigator.of(context).pushNamed( + // '/calendar', + // arguments: CalendarArguments( + // signedInUser, + // false, + // business, + // businessUser, + // ), + // ); + // } - successPopUp(message, context); - } else { - Navigator.pop(context); - internetConnectionPopUp(context); - } + // successPopUp(message, context); + // } else { + // Navigator.pop(context); + // internetConnectionPopUp(context); + // } } /// This function is used to add an appointment to users mzansi Calendar. @@ -312,7 +296,7 @@ class MihMzansiCalendarApis { /// BuildContext context, /// /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future addPatientAppointment( + static Future addPatientAppointment( AppUser signedInUser, bool personalSelected, String patientAppId, @@ -338,20 +322,22 @@ class MihMzansiCalendarApis { "time": time, }), ); - if (response.statusCode == 201) { - MihNotificationApis.addNewAppointmentNotificationAPICall( - patientAppId, - personalSelected, - date, - time, - businessArgs, - context, - ); - // Navigator.pop(context); - } else { - Navigator.pop(context); - internetConnectionPopUp(context); - } + context.pop(); + return response.statusCode; + // if (response.statusCode == 201) { + // MihNotificationApis.addNewAppointmentNotificationAPICall( + // patientAppId, + // personalSelected, + // date, + // time, + // businessArgs, + // context, + // ); + // // Navigator.pop(context); + // } else { + // Navigator.pop(context); + // internetConnectionPopUp(context); + // } } /// This function is used to update an appointment to users mzansi Calendar. @@ -367,7 +353,7 @@ class MihMzansiCalendarApis { /// BuildContext context, /// /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future updatePersonalAppointment( + static Future updatePersonalAppointment( AppUser signedInUser, Business? business, BusinessUser? businessUser, @@ -392,28 +378,30 @@ class MihMzansiCalendarApis { "time": time, }), ); - if (response.statusCode == 200) { - Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); - String message = - "Your appointment \"$title\" has been updates to the $date $title."; + context.pop(); + return response.statusCode; + // if (response.statusCode == 200) { + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // String message = + // "Your appointment \"$title\" has been updates to the $date $title."; - Navigator.pop(context); - Navigator.of(context).pushNamed( - '/calendar', - arguments: CalendarArguments( - signedInUser, - true, - business, - businessUser, - ), - ); - successPopUp(message, context); - } else { - Navigator.pop(context); - internetConnectionPopUp(context); - } + // Navigator.pop(context); + // Navigator.of(context).pushNamed( + // '/calendar', + // arguments: CalendarArguments( + // signedInUser, + // true, + // business, + // businessUser, + // ), + // ); + // successPopUp(message, context); + // } else { + // Navigator.pop(context); + // internetConnectionPopUp(context); + // } } /// This function is used to update an appointment to users mzansi Calendar. @@ -429,7 +417,7 @@ class MihMzansiCalendarApis { /// BuildContext context, /// /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future updateBusinessAppointment( + static Future updateBusinessAppointment( AppUser signedInUser, Business? business, BusinessUser? businessUser, @@ -454,28 +442,30 @@ class MihMzansiCalendarApis { "time": time, }), ); - if (response.statusCode == 200) { - Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); - String message = - "Your appointment \"$title\" has been updates to the $date $title."; + context.pop(); + return response.statusCode; + // if (response.statusCode == 200) { + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // String message = + // "Your appointment \"$title\" has been updates to the $date $title."; - Navigator.pop(context); - Navigator.of(context).pushNamed( - '/calendar', - arguments: CalendarArguments( - signedInUser, - false, - business, - businessUser, - ), - ); - successPopUp(message, context); - } else { - Navigator.pop(context); - internetConnectionPopUp(context); - } + // Navigator.pop(context); + // Navigator.of(context).pushNamed( + // '/calendar', + // arguments: CalendarArguments( + // signedInUser, + // false, + // business, + // businessUser, + // ), + // ); + // successPopUp(message, context); + // } else { + // Navigator.pop(context); + // internetConnectionPopUp(context); + // } } /// This function is used to update an appointment to users mzansi Calendar. @@ -491,7 +481,7 @@ class MihMzansiCalendarApis { /// BuildContext context, /// /// Returns VOID (TRIGGERS SUCCESS pop up) - static Future updatePatientAppointment( + static Future updatePatientAppointment( AppUser signedInUser, Business? business, BusinessUser? businessUser, @@ -516,29 +506,31 @@ class MihMzansiCalendarApis { "time": time, }), ); - if (response.statusCode == 200) { - Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); - String message = - "Your appointment \"$title\" has been updates to the $date $title."; + context.pop(); + return response.statusCode; + // if (response.statusCode == 200) { + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // String message = + // "Your appointment \"$title\" has been updates to the $date $title."; - // Navigator.pop(context); - Navigator.of(context).pushNamed( - '/patient-manager', - arguments: PatManagerArguments( - signedInUser, - false, - business, - businessUser, - ), - ); - successPopUp(message, context); - } else { - Navigator.pop(context); - internetConnectionPopUp(context); - } + // // Navigator.pop(context); + // Navigator.of(context).pushNamed( + // '/patient-manager', + // arguments: PatManagerArguments( + // signedInUser, + // false, + // business, + // businessUser, + // ), + // ); + // successPopUp(message, context); + // } else { + // Navigator.pop(context); + // internetConnectionPopUp(context); + // } } //================== POP UPS ==========================================================================