Cancell appointment enhancement.
This commit is contained in:
@@ -118,6 +118,146 @@ class _MIHDeleteMessageState extends State<MIHWarningMessage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAppointmentCanelled() {
|
||||||
|
messageTypes["Appointment Canelled"] = Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(popUpPaddingSize),
|
||||||
|
width: popUpWidth,
|
||||||
|
height: popUpheight,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
width: 5.0),
|
||||||
|
),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.warning_amber_rounded,
|
||||||
|
size: popUpIconSize,
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
//const SizedBox(height: 15),
|
||||||
|
Text(
|
||||||
|
"Appointment Cancelled",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
fontSize: popUpTitleSize,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Text(
|
||||||
|
"This appointment has been canceled. As a result, you no longer have access to the patient's profile. If you would like to view the patient's profile again, please book a new appointment.",
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
fontSize: popUpBodySize,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 5,
|
||||||
|
right: 5,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAccessCanelled() {
|
||||||
|
messageTypes["Access Cancelled"] = Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(popUpPaddingSize),
|
||||||
|
width: popUpWidth,
|
||||||
|
height: popUpheight,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
width: 5.0),
|
||||||
|
),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.warning_amber_rounded,
|
||||||
|
size: popUpIconSize,
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
//const SizedBox(height: 15),
|
||||||
|
Text(
|
||||||
|
"Access Cancelled",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
fontSize: popUpTitleSize,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Text(
|
||||||
|
"This appointment has been canceled. As a result, access has been cancelled and the doctor no longer have access to the patient's profile. If you would like them to view the patient's profile again, please book a new appointment through them.",
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
fontSize: popUpBodySize,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 5,
|
||||||
|
right: 5,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void setAccessDeclined() {
|
void setAccessDeclined() {
|
||||||
messageTypes["Access Declined"] = Stack(
|
messageTypes["Access Declined"] = Stack(
|
||||||
children: [
|
children: [
|
||||||
@@ -278,6 +418,8 @@ class _MIHDeleteMessageState extends State<MIHWarningMessage> {
|
|||||||
setNoAccess();
|
setNoAccess();
|
||||||
setExpiredAccess();
|
setExpiredAccess();
|
||||||
setAccessDeclined();
|
setAccessDeclined();
|
||||||
|
setAppointmentCanelled();
|
||||||
|
setAccessCanelled();
|
||||||
//print(size);
|
//print(size);
|
||||||
// setState(() {
|
// setState(() {
|
||||||
// width = size.width;
|
// width = size.width;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_button
|
|||||||
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
|
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_warning_message.dart';
|
||||||
import 'package:patient_manager/mih_env/env.dart';
|
import 'package:patient_manager/mih_env/env.dart';
|
||||||
import 'package:patient_manager/main.dart';
|
import 'package:patient_manager/main.dart';
|
||||||
import 'package:patient_manager/mih_objects/access_request.dart';
|
import 'package:patient_manager/mih_objects/access_request.dart';
|
||||||
@@ -94,6 +95,15 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void accessCancelledWarning() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MIHWarningMessage(warningType: "Access Cancelled");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget displayQueue(int index) {
|
Widget displayQueue(int index) {
|
||||||
String line1 =
|
String line1 =
|
||||||
"Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}";
|
"Appointment: ${widget.accessRequests[index].date_time.substring(0, 16).replaceAll("T", " ")}";
|
||||||
@@ -160,7 +170,11 @@ class _BuildPatientsListState extends State<BuildAccessRequestList> {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
viewApprovalPopUp(index);
|
if (access == "CANCELLED") {
|
||||||
|
accessCancelledWarning();
|
||||||
|
} else {
|
||||||
|
viewApprovalPopUp(index);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// trailing: Icon(
|
// trailing: Icon(
|
||||||
// Icons.arrow_forward,
|
// Icons.arrow_forward,
|
||||||
|
|||||||
@@ -262,7 +262,8 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
|
|||||||
"All",
|
"All",
|
||||||
"Approved",
|
"Approved",
|
||||||
"Pending",
|
"Pending",
|
||||||
"Declined"
|
"Declined",
|
||||||
|
"Cancelled"
|
||||||
],
|
],
|
||||||
required: true,
|
required: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_button.dart';
|
||||||
|
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
|
||||||
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_warning_message.dart';
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_warning_message.dart';
|
||||||
import 'package:patient_manager/mih_env/env.dart';
|
import 'package:patient_manager/mih_env/env.dart';
|
||||||
import 'package:patient_manager/main.dart';
|
import 'package:patient_manager/main.dart';
|
||||||
@@ -33,6 +37,45 @@ class BuildPatientQueueList extends StatefulWidget {
|
|||||||
class _BuildPatientsListState extends State<BuildPatientQueueList> {
|
class _BuildPatientsListState extends State<BuildPatientQueueList> {
|
||||||
String baseAPI = AppEnviroment.baseApiUrl;
|
String baseAPI = AppEnviroment.baseApiUrl;
|
||||||
|
|
||||||
|
Future<void> updateAccessAPICall(int index, String accessType) async {
|
||||||
|
var response = await http.put(
|
||||||
|
Uri.parse("$baseAPI/access-requests/update/"),
|
||||||
|
headers: <String, String>{
|
||||||
|
"Content-Type": "application/json; charset=UTF-8"
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, dynamic>{
|
||||||
|
"business_id": widget.business!.business_id,
|
||||||
|
"app_id": widget.patientQueue[index].app_id,
|
||||||
|
"date_time": widget.patientQueue[index].date_time,
|
||||||
|
"access": accessType,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
//Navigator.of(context).pushNamed('/home');
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
'/patient-manager',
|
||||||
|
arguments: BusinessArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
widget.businessUser,
|
||||||
|
widget.business,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// '/patient-access-review',
|
||||||
|
// arguments: widget.signedInUser,
|
||||||
|
// );
|
||||||
|
String message =
|
||||||
|
"The appointment for ${widget.patientQueue[index].first_name} ${widget.patientQueue[index].last_name} at ${widget.patientQueue[index].date_time} has been successfully canceled.";
|
||||||
|
|
||||||
|
successPopUp(message);
|
||||||
|
} else {
|
||||||
|
internetConnectionPopUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<Patient> fetchPatients(String app_id) async {
|
Future<Patient> fetchPatients(String app_id) async {
|
||||||
//print("pat man drawer: " + endpointUserData + widget.userEmail);
|
//print("pat man drawer: " + endpointUserData + widget.userEmail);
|
||||||
|
|
||||||
@@ -55,6 +98,121 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void internetConnectionPopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MIHErrorMessage(errorType: "Internet Connection");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void successPopUp(String message) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return MIHSuccessMessage(
|
||||||
|
successType: "Success",
|
||||||
|
successMessage: message,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void viewConfirmationPopUp(int index) {
|
||||||
|
String subtitle =
|
||||||
|
"Appointment: ${widget.patientQueue[index].date_time.substring(0, 16).replaceAll("T", " ")}\n";
|
||||||
|
subtitle +=
|
||||||
|
"Patient: ${widget.patientQueue[index].first_name} ${widget.patientQueue[index].last_name}\n\n";
|
||||||
|
//subtitle += "Business Type: ${widget.patientQueue[index].last_name}\n\n";
|
||||||
|
subtitle +=
|
||||||
|
"Would you like to view the patient's profile before the appointment or cancel the appointment now?\n";
|
||||||
|
//"You are about to approve an access request to your patient profile.\nPlease be aware that once approved, ${widget.accessRequests[index].Name} will have access to your profile information until ${widget.accessRequests[index].revoke_date.substring(0, 16).replaceAll("T", " ")}.\nIf you are unsure about an upcoming appointment with ${widget.accessRequests[index].Name}, please contact ${widget.accessRequests[index].contact_no} for clarification before approving this request.\n";
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) => MIHWindow(
|
||||||
|
fullscreen: false,
|
||||||
|
windowTitle: "Appointment Confirmation",
|
||||||
|
windowBody: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
|
child: Text(
|
||||||
|
subtitle,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
fontSize: 15,
|
||||||
|
//fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Wrap(
|
||||||
|
runSpacing: 10,
|
||||||
|
spacing: 10,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 300,
|
||||||
|
height: 50,
|
||||||
|
child: MIHButton(
|
||||||
|
onTap: () {
|
||||||
|
updateAccessAPICall(index, "cancelled");
|
||||||
|
},
|
||||||
|
buttonText: "Cancel Appointment",
|
||||||
|
buttonColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
textColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 300,
|
||||||
|
height: 50,
|
||||||
|
child: MIHButton(
|
||||||
|
onTap: () {
|
||||||
|
//updateAccessAPICall(index, "approved");
|
||||||
|
Patient selectedPatient;
|
||||||
|
fetchPatients(widget.patientQueue[index].app_id).then(
|
||||||
|
(result) {
|
||||||
|
setState(() {
|
||||||
|
selectedPatient = result;
|
||||||
|
Navigator.of(context)
|
||||||
|
.pushNamed('/patient-manager/patient',
|
||||||
|
arguments: PatientViewArguments(
|
||||||
|
widget.signedInUser,
|
||||||
|
selectedPatient,
|
||||||
|
widget.businessUser,
|
||||||
|
widget.business,
|
||||||
|
"business",
|
||||||
|
));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
buttonText: "View Patient Profile",
|
||||||
|
buttonColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
textColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
windowTools: const [],
|
||||||
|
onWindowTapClose: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget displayQueue(int index) {
|
Widget displayQueue(int index) {
|
||||||
String fname = widget.patientQueue[index].first_name[0] + "********";
|
String fname = widget.patientQueue[index].first_name[0] + "********";
|
||||||
String lname = widget.patientQueue[index].last_name[0] + "********";
|
String lname = widget.patientQueue[index].last_name[0] + "********";
|
||||||
@@ -83,7 +241,8 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
|
|||||||
}
|
}
|
||||||
String line5 = "\nAccess Request: ";
|
String line5 = "\nAccess Request: ";
|
||||||
String access = "";
|
String access = "";
|
||||||
if (expireyDate.isBefore(nowDate)) {
|
if (expireyDate.isBefore(nowDate) &&
|
||||||
|
widget.patientQueue[index].access != "cacelled") {
|
||||||
access += "EXPIRED";
|
access += "EXPIRED";
|
||||||
} else {
|
} else {
|
||||||
access += widget.patientQueue[index].access.toUpperCase();
|
access += widget.patientQueue[index].access.toUpperCase();
|
||||||
@@ -140,24 +299,27 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
|
|||||||
if (revokeDate.isBefore(todayDate)) {
|
if (revokeDate.isBefore(todayDate)) {
|
||||||
expiredAccessWarning();
|
expiredAccessWarning();
|
||||||
} else if (widget.patientQueue[index].access == "approved") {
|
} else if (widget.patientQueue[index].access == "approved") {
|
||||||
Patient selectedPatient;
|
viewConfirmationPopUp(index);
|
||||||
fetchPatients(widget.patientQueue[index].app_id).then(
|
// Patient selectedPatient;
|
||||||
(result) {
|
// fetchPatients(widget.patientQueue[index].app_id).then(
|
||||||
setState(() {
|
// (result) {
|
||||||
selectedPatient = result;
|
// setState(() {
|
||||||
Navigator.of(context).pushNamed('/patient-manager/patient',
|
// selectedPatient = result;
|
||||||
arguments: PatientViewArguments(
|
// Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||||
widget.signedInUser,
|
// arguments: PatientViewArguments(
|
||||||
selectedPatient,
|
// widget.signedInUser,
|
||||||
widget.businessUser,
|
// selectedPatient,
|
||||||
widget.business,
|
// widget.businessUser,
|
||||||
"business",
|
// widget.business,
|
||||||
));
|
// "business",
|
||||||
});
|
// ));
|
||||||
},
|
// });
|
||||||
);
|
// },
|
||||||
|
// );
|
||||||
} else if (widget.patientQueue[index].access == "declined") {
|
} else if (widget.patientQueue[index].access == "declined") {
|
||||||
accessDeclinedWarning();
|
accessDeclinedWarning();
|
||||||
|
} else if (widget.patientQueue[index].access == "cancelled") {
|
||||||
|
appointmentCancelledWarning();
|
||||||
} else {
|
} else {
|
||||||
noAccessWarning();
|
noAccessWarning();
|
||||||
}
|
}
|
||||||
@@ -187,6 +349,15 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void appointmentCancelledWarning() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MIHWarningMessage(warningType: "Appointment Canelled");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void expiredAccessWarning() {
|
void expiredAccessWarning() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
Reference in New Issue
Block a user