update Calendar nav
This commit is contained in:
@@ -1,5 +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_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_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';
|
||||||
@@ -552,10 +555,11 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateAppointmentCall(int index) {
|
Future<void> updateAppointmentCall(int index) async {
|
||||||
|
int statusCode;
|
||||||
if (isAppointmentInputValid()) {
|
if (isAppointmentInputValid()) {
|
||||||
if (widget.personalSelected == true) {
|
if (widget.personalSelected == true) {
|
||||||
MihMzansiCalendarApis.updatePersonalAppointment(
|
statusCode = await MihMzansiCalendarApis.updatePersonalAppointment(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
widget.business,
|
widget.business,
|
||||||
null,
|
null,
|
||||||
@@ -568,7 +572,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
);
|
);
|
||||||
} else if (widget.personalSelected == false &&
|
} else if (widget.personalSelected == false &&
|
||||||
widget.inWaitingRoom == false) {
|
widget.inWaitingRoom == false) {
|
||||||
MihMzansiCalendarApis.updateBusinessAppointment(
|
statusCode = await MihMzansiCalendarApis.updateBusinessAppointment(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
widget.business,
|
widget.business,
|
||||||
widget.businessUser,
|
widget.businessUser,
|
||||||
@@ -580,7 +584,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihMzansiCalendarApis.updatePatientAppointment(
|
statusCode = await MihMzansiCalendarApis.updatePatientAppointment(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
widget.business,
|
widget.business,
|
||||||
widget.businessUser,
|
widget.businessUser,
|
||||||
@@ -592,6 +596,25 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
context,
|
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 {
|
} else {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -602,9 +625,8 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteAppointmentCall(int index) {
|
Future<void> deleteAppointmentCall(int index) async {
|
||||||
print("personal selected: ${widget.personalSelected}");
|
int statucCode = await MihMzansiCalendarApis.deleteAppointmentAPICall(
|
||||||
MihMzansiCalendarApis.deleteAppointmentAPICall(
|
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
widget.personalSelected,
|
widget.personalSelected,
|
||||||
widget.business,
|
widget.business,
|
||||||
@@ -613,6 +635,82 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
|
|||||||
widget.appointmentList[index].idappointments,
|
widget.appointmentList[index].idappointments,
|
||||||
context,
|
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) {
|
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.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';
|
||||||
@@ -41,7 +42,14 @@ class _MzansiCalendarState extends State<MzansiCalendar> {
|
|||||||
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(
|
||||||
|
'home',
|
||||||
|
extra: AuthArguments(
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
);
|
||||||
FocusScope.of(context).unfocus();
|
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/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';
|
||||||
@@ -24,10 +25,14 @@ class _MzansiCalendarTileState extends State<MzansiCalendarTile> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MihPackageTile(
|
return MihPackageTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
context.goNamed(
|
||||||
'/calendar',
|
"mihCalendar",
|
||||||
arguments: widget.arguments,
|
extra: widget.arguments,
|
||||||
);
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// '/calendar',
|
||||||
|
// arguments: widget.arguments,
|
||||||
|
// );
|
||||||
},
|
},
|
||||||
appName: "Calendar",
|
appName: "Calendar",
|
||||||
appIcon: Icon(
|
appIcon: Icon(
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
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/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';
|
||||||
@@ -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) {
|
void addAppointmentWindow(double width) {
|
||||||
@@ -284,10 +269,11 @@ class _PatientAccessRequestState extends State<Appointments> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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!,
|
||||||
@@ -299,7 +285,7 @@ class _PatientAccessRequestState extends State<Appointments> {
|
|||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
MihMzansiCalendarApis.addPersonalAppointment(
|
statusCode = await MihMzansiCalendarApis.addPersonalAppointment(
|
||||||
widget.signedInUser,
|
widget.signedInUser,
|
||||||
_appointmentTitleController.text,
|
_appointmentTitleController.text,
|
||||||
_appointmentDescriptionIDController.text,
|
_appointmentDescriptionIDController.text,
|
||||||
@@ -308,6 +294,27 @@ class _PatientAccessRequestState extends State<Appointments> {
|
|||||||
context,
|
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 {
|
} else {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -319,6 +326,77 @@ class _PatientAccessRequestState extends State<Appointments> {
|
|||||||
checkforchange();
|
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() {
|
String getTitle() {
|
||||||
if (widget.personalSelected == false) {
|
if (widget.personalSelected == false) {
|
||||||
return "Business Appointments";
|
return "Business Appointments";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'dart:convert';
|
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_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/app_user.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/appointment.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.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business_user.dart';
|
||||||
import 'package:flutter/material.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 '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_error_message.dart';
|
||||||
import '../mih_components/mih_pop_up_messages/mih_success_message.dart';
|
import '../mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
import '../mih_config/mih_env.dart';
|
import '../mih_config/mih_env.dart';
|
||||||
@@ -39,23 +27,12 @@ class MihMzansiCalendarApis {
|
|||||||
String app_id,
|
String app_id,
|
||||||
String date,
|
String date,
|
||||||
) async {
|
) async {
|
||||||
//print("Patien manager page: $endpoint");
|
|
||||||
final response = await http.get(Uri.parse(
|
final response = await http.get(Uri.parse(
|
||||||
"${AppEnviroment.baseApiUrl}/appointments/personal/$app_id?date=$date"));
|
"${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) {
|
if (response.statusCode == 200) {
|
||||||
//print("Here1");
|
|
||||||
Iterable l = jsonDecode(response.body);
|
Iterable l = jsonDecode(response.body);
|
||||||
//print("Here2");
|
|
||||||
List<Appointment> personalAppointments =
|
List<Appointment> personalAppointments =
|
||||||
List<Appointment>.from(l.map((model) => Appointment.fromJson(model)));
|
List<Appointment>.from(l.map((model) => Appointment.fromJson(model)));
|
||||||
//print("Here3");
|
|
||||||
//print(patientQueue);
|
|
||||||
return personalAppointments;
|
return personalAppointments;
|
||||||
} else {
|
} else {
|
||||||
throw Exception('failed to fatch personal appointments');
|
throw Exception('failed to fatch personal appointments');
|
||||||
@@ -114,7 +91,7 @@ class MihMzansiCalendarApis {
|
|||||||
/// BuildContext context,
|
/// BuildContext context,
|
||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
/// Returns VOID (TRIGGERS NOTIGICATIOPN ON SUCCESS)
|
||||||
static Future<void> deleteAppointmentAPICall(
|
static Future<int> deleteAppointmentAPICall(
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
bool personalSelected,
|
bool personalSelected,
|
||||||
Business? business,
|
Business? business,
|
||||||
@@ -123,6 +100,7 @@ class MihMzansiCalendarApis {
|
|||||||
int idappointments,
|
int idappointments,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
) async {
|
) async {
|
||||||
|
loadingPopUp(context);
|
||||||
var response = await http.delete(
|
var response = await http.delete(
|
||||||
Uri.parse("${AppEnviroment.baseApiUrl}/appointment/delete/"),
|
Uri.parse("${AppEnviroment.baseApiUrl}/appointment/delete/"),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@@ -130,39 +108,41 @@ class MihMzansiCalendarApis {
|
|||||||
},
|
},
|
||||||
body: jsonEncode(<String, dynamic>{"idappointments": idappointments}),
|
body: jsonEncode(<String, dynamic>{"idappointments": idappointments}),
|
||||||
);
|
);
|
||||||
|
context.pop();
|
||||||
|
return response.statusCode;
|
||||||
//print("Here4");
|
//print("Here4");
|
||||||
//print(response.statusCode);
|
//print(response.statusCode);
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
Navigator.of(context).pop();
|
// Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
// Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
// Navigator.of(context).pop();
|
||||||
if (inWaitingRoom == true && personalSelected == false) {
|
// if (inWaitingRoom == true && personalSelected == false) {
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/patient-manager',
|
// '/patient-manager',
|
||||||
arguments: PatManagerArguments(
|
// arguments: PatManagerArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
false,
|
// false,
|
||||||
business,
|
// business,
|
||||||
businessUser,
|
// businessUser,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/calendar',
|
// '/calendar',
|
||||||
arguments: CalendarArguments(
|
// arguments: CalendarArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
personalSelected,
|
// personalSelected,
|
||||||
business,
|
// business,
|
||||||
businessUser,
|
// businessUser,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
String message =
|
// String message =
|
||||||
"The appointment has been deleted successfully. This means it will no longer be visible in your Calendar.";
|
// "The appointment has been deleted successfully. This means it will no longer be visible in your Calendar.";
|
||||||
successPopUp(message, context);
|
// successPopUp(message, context);
|
||||||
} else {
|
// } else {
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is used to add an appointment to users mzansi Calendar.
|
/// This function is used to add an appointment to users mzansi Calendar.
|
||||||
@@ -177,7 +157,7 @@ class MihMzansiCalendarApis {
|
|||||||
/// BuildContext context,
|
/// BuildContext context,
|
||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
||||||
static Future<void> addPersonalAppointment(
|
static Future<int> addPersonalAppointment(
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
String title,
|
String title,
|
||||||
String description,
|
String description,
|
||||||
@@ -200,28 +180,30 @@ class MihMzansiCalendarApis {
|
|||||||
"time": time,
|
"time": time,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 201) {
|
context.pop();
|
||||||
Navigator.pop(context);
|
return response.statusCode;
|
||||||
Navigator.pop(context);
|
// if (response.statusCode == 201) {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
String message =
|
// Navigator.pop(context);
|
||||||
"Your appointment \"$title\" for the $date $title has been deleted.";
|
// Navigator.pop(context);
|
||||||
|
// String message =
|
||||||
|
// "Your appointment \"$title\" for the $date $title has been deleted.";
|
||||||
|
|
||||||
// Navigator.pop(context);
|
// // Navigator.pop(context);
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/calendar',
|
// '/calendar',
|
||||||
arguments: CalendarArguments(
|
// arguments: CalendarArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
true,
|
// true,
|
||||||
null,
|
// null,
|
||||||
null,
|
// null,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
successPopUp(message, context);
|
// successPopUp(message, context);
|
||||||
} else {
|
// } else {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is used to add an appointment to users mzansi Calendar.
|
/// This function is used to add an appointment to users mzansi Calendar.
|
||||||
@@ -236,7 +218,7 @@ class MihMzansiCalendarApis {
|
|||||||
/// BuildContext context,
|
/// BuildContext context,
|
||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
||||||
static Future<void> addBusinessAppointment(
|
static Future<int> addBusinessAppointment(
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
Business business,
|
Business business,
|
||||||
BusinessUser businessUser,
|
BusinessUser businessUser,
|
||||||
@@ -262,42 +244,44 @@ class MihMzansiCalendarApis {
|
|||||||
"time": time,
|
"time": time,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 201) {
|
context.pop();
|
||||||
// Navigator.pop(context);
|
return response.statusCode;
|
||||||
Navigator.pop(context);
|
// if (response.statusCode == 201) {
|
||||||
Navigator.pop(context);
|
// // Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
String message =
|
// Navigator.pop(context);
|
||||||
"Your appointment \"$title\" for the $date $title has been deleted.";
|
// Navigator.pop(context);
|
||||||
|
// String message =
|
||||||
|
// "Your appointment \"$title\" for the $date $title has been deleted.";
|
||||||
|
|
||||||
// Navigator.pop(context);
|
// // Navigator.pop(context);
|
||||||
if (inWaitingRoom) {
|
// if (inWaitingRoom) {
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/patient-manager',
|
// '/patient-manager',
|
||||||
arguments: PatManagerArguments(
|
// arguments: PatManagerArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
false,
|
// false,
|
||||||
business,
|
// business,
|
||||||
businessUser,
|
// businessUser,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/calendar',
|
// '/calendar',
|
||||||
arguments: CalendarArguments(
|
// arguments: CalendarArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
false,
|
// false,
|
||||||
business,
|
// business,
|
||||||
businessUser,
|
// businessUser,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
successPopUp(message, context);
|
// successPopUp(message, context);
|
||||||
} else {
|
// } else {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is used to add an appointment to users mzansi Calendar.
|
/// This function is used to add an appointment to users mzansi Calendar.
|
||||||
@@ -312,7 +296,7 @@ class MihMzansiCalendarApis {
|
|||||||
/// BuildContext context,
|
/// BuildContext context,
|
||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
||||||
static Future<void> addPatientAppointment(
|
static Future<int> addPatientAppointment(
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
bool personalSelected,
|
bool personalSelected,
|
||||||
String patientAppId,
|
String patientAppId,
|
||||||
@@ -338,20 +322,22 @@ class MihMzansiCalendarApis {
|
|||||||
"time": time,
|
"time": time,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 201) {
|
context.pop();
|
||||||
MihNotificationApis.addNewAppointmentNotificationAPICall(
|
return response.statusCode;
|
||||||
patientAppId,
|
// if (response.statusCode == 201) {
|
||||||
personalSelected,
|
// MihNotificationApis.addNewAppointmentNotificationAPICall(
|
||||||
date,
|
// patientAppId,
|
||||||
time,
|
// personalSelected,
|
||||||
businessArgs,
|
// date,
|
||||||
context,
|
// time,
|
||||||
);
|
// businessArgs,
|
||||||
// Navigator.pop(context);
|
// context,
|
||||||
} else {
|
// );
|
||||||
Navigator.pop(context);
|
// // Navigator.pop(context);
|
||||||
internetConnectionPopUp(context);
|
// } else {
|
||||||
}
|
// Navigator.pop(context);
|
||||||
|
// internetConnectionPopUp(context);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is used to update an appointment to users mzansi Calendar.
|
/// This function is used to update an appointment to users mzansi Calendar.
|
||||||
@@ -367,7 +353,7 @@ class MihMzansiCalendarApis {
|
|||||||
/// BuildContext context,
|
/// BuildContext context,
|
||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
||||||
static Future<void> updatePersonalAppointment(
|
static Future<int> updatePersonalAppointment(
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
Business? business,
|
Business? business,
|
||||||
BusinessUser? businessUser,
|
BusinessUser? businessUser,
|
||||||
@@ -392,28 +378,30 @@ class MihMzansiCalendarApis {
|
|||||||
"time": time,
|
"time": time,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200) {
|
context.pop();
|
||||||
Navigator.pop(context);
|
return response.statusCode;
|
||||||
Navigator.pop(context);
|
// if (response.statusCode == 200) {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
String message =
|
// Navigator.pop(context);
|
||||||
"Your appointment \"$title\" has been updates to the $date $title.";
|
// Navigator.pop(context);
|
||||||
|
// String message =
|
||||||
|
// "Your appointment \"$title\" has been updates to the $date $title.";
|
||||||
|
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/calendar',
|
// '/calendar',
|
||||||
arguments: CalendarArguments(
|
// arguments: CalendarArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
true,
|
// true,
|
||||||
business,
|
// business,
|
||||||
businessUser,
|
// businessUser,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
successPopUp(message, context);
|
// successPopUp(message, context);
|
||||||
} else {
|
// } else {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is used to update an appointment to users mzansi Calendar.
|
/// This function is used to update an appointment to users mzansi Calendar.
|
||||||
@@ -429,7 +417,7 @@ class MihMzansiCalendarApis {
|
|||||||
/// BuildContext context,
|
/// BuildContext context,
|
||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
||||||
static Future<void> updateBusinessAppointment(
|
static Future<int> updateBusinessAppointment(
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
Business? business,
|
Business? business,
|
||||||
BusinessUser? businessUser,
|
BusinessUser? businessUser,
|
||||||
@@ -454,28 +442,30 @@ class MihMzansiCalendarApis {
|
|||||||
"time": time,
|
"time": time,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200) {
|
context.pop();
|
||||||
Navigator.pop(context);
|
return response.statusCode;
|
||||||
Navigator.pop(context);
|
// if (response.statusCode == 200) {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
String message =
|
// Navigator.pop(context);
|
||||||
"Your appointment \"$title\" has been updates to the $date $title.";
|
// Navigator.pop(context);
|
||||||
|
// String message =
|
||||||
|
// "Your appointment \"$title\" has been updates to the $date $title.";
|
||||||
|
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/calendar',
|
// '/calendar',
|
||||||
arguments: CalendarArguments(
|
// arguments: CalendarArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
false,
|
// false,
|
||||||
business,
|
// business,
|
||||||
businessUser,
|
// businessUser,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
successPopUp(message, context);
|
// successPopUp(message, context);
|
||||||
} else {
|
// } else {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is used to update an appointment to users mzansi Calendar.
|
/// This function is used to update an appointment to users mzansi Calendar.
|
||||||
@@ -491,7 +481,7 @@ class MihMzansiCalendarApis {
|
|||||||
/// BuildContext context,
|
/// BuildContext context,
|
||||||
///
|
///
|
||||||
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
/// Returns VOID (TRIGGERS SUCCESS pop up)
|
||||||
static Future<void> updatePatientAppointment(
|
static Future<int> updatePatientAppointment(
|
||||||
AppUser signedInUser,
|
AppUser signedInUser,
|
||||||
Business? business,
|
Business? business,
|
||||||
BusinessUser? businessUser,
|
BusinessUser? businessUser,
|
||||||
@@ -516,29 +506,31 @@ class MihMzansiCalendarApis {
|
|||||||
"time": time,
|
"time": time,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200) {
|
context.pop();
|
||||||
Navigator.pop(context);
|
return response.statusCode;
|
||||||
Navigator.pop(context);
|
// if (response.statusCode == 200) {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
String message =
|
// Navigator.pop(context);
|
||||||
"Your appointment \"$title\" has been updates to the $date $title.";
|
// Navigator.pop(context);
|
||||||
|
// String message =
|
||||||
|
// "Your appointment \"$title\" has been updates to the $date $title.";
|
||||||
|
|
||||||
// Navigator.pop(context);
|
// // Navigator.pop(context);
|
||||||
Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
'/patient-manager',
|
// '/patient-manager',
|
||||||
arguments: PatManagerArguments(
|
// arguments: PatManagerArguments(
|
||||||
signedInUser,
|
// signedInUser,
|
||||||
false,
|
// false,
|
||||||
business,
|
// business,
|
||||||
businessUser,
|
// businessUser,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
successPopUp(message, context);
|
// successPopUp(message, context);
|
||||||
} else {
|
// } else {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
internetConnectionPopUp(context);
|
// internetConnectionPopUp(context);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//================== POP UPS ==========================================================================
|
//================== POP UPS ==========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user