forked from yaso_meth/mih-project
update Calendar nav
This commit is contained in:
@@ -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<BuildAppointmentList> {
|
||||
);
|
||||
}
|
||||
|
||||
void updateAppointmentCall(int index) {
|
||||
Future<void> 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<BuildAppointmentList> {
|
||||
);
|
||||
} 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<BuildAppointmentList> {
|
||||
context,
|
||||
);
|
||||
} else {
|
||||
MihMzansiCalendarApis.updatePatientAppointment(
|
||||
statusCode = await MihMzansiCalendarApis.updatePatientAppointment(
|
||||
widget.signedInUser,
|
||||
widget.business,
|
||||
widget.businessUser,
|
||||
@@ -592,6 +596,25 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
||||
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<BuildAppointmentList> {
|
||||
}
|
||||
}
|
||||
|
||||
void deleteAppointmentCall(int index) {
|
||||
print("personal selected: ${widget.personalSelected}");
|
||||
MihMzansiCalendarApis.deleteAppointmentAPICall(
|
||||
Future<void> deleteAppointmentCall(int index) async {
|
||||
int statucCode = await MihMzansiCalendarApis.deleteAppointmentAPICall(
|
||||
widget.signedInUser,
|
||||
widget.personalSelected,
|
||||
widget.business,
|
||||
@@ -613,6 +635,82 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
||||
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) {
|
||||
|
||||
@@ -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<MzansiCalendar> {
|
||||
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();
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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<MzansiCalendarTile> {
|
||||
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(
|
||||
|
||||
@@ -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<Appointments> {
|
||||
),
|
||||
),
|
||||
);
|
||||
// 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<Appointments> {
|
||||
}
|
||||
}
|
||||
|
||||
void addAppointmentCall() {
|
||||
Future<void> 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<Appointments> {
|
||||
context,
|
||||
);
|
||||
} else {
|
||||
MihMzansiCalendarApis.addPersonalAppointment(
|
||||
statusCode = await MihMzansiCalendarApis.addPersonalAppointment(
|
||||
widget.signedInUser,
|
||||
_appointmentTitleController.text,
|
||||
_appointmentDescriptionIDController.text,
|
||||
@@ -308,6 +294,27 @@ class _PatientAccessRequestState extends State<Appointments> {
|
||||
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<Appointments> {
|
||||
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";
|
||||
|
||||
@@ -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<Appointment> personalAppointments =
|
||||
List<Appointment>.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<void> deleteAppointmentAPICall(
|
||||
static Future<int> 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: <String, String>{
|
||||
@@ -130,39 +108,41 @@ class MihMzansiCalendarApis {
|
||||
},
|
||||
body: jsonEncode(<String, dynamic>{"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<void> addPersonalAppointment(
|
||||
static Future<int> 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<void> addBusinessAppointment(
|
||||
static Future<int> 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<void> addPatientAppointment(
|
||||
static Future<int> 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<void> updatePersonalAppointment(
|
||||
static Future<int> 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<void> updateBusinessAppointment(
|
||||
static Future<int> 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<void> updatePatientAppointment(
|
||||
static Future<int> 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 ==========================================================================
|
||||
|
||||
Reference in New Issue
Block a user