Merge pull request #101 from yaso-meth/NEW--Access-Redesign

NEW--Access-Redesign
This commit is contained in:
yaso-meth
2025-03-11 11:12:25 +02:00
committed by GitHub
11 changed files with 177 additions and 107 deletions

View File

@@ -258,7 +258,7 @@ class MIHApiCalls {
/// AppUser signedInUser, /// AppUser signedInUser,
/// BuildContext context, /// BuildContext context,
/// ///
/// Returns void (on success 200 navigate to /access-review ). /// Returns void (on success 200 navigate to /mih-access ).
static Future<void> updatePatientAccessAPICall( static Future<void> updatePatientAccessAPICall(
String business_id, String business_id,
String business_name, String business_name,
@@ -290,7 +290,7 @@ class MIHApiCalls {
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/access-review', '/mih-access',
arguments: signedInUser, arguments: signedInUser,
); );
String message = ""; String message = "";
@@ -314,7 +314,7 @@ class MIHApiCalls {
/// String app_id, /// String app_id,
/// BuildContext context, /// BuildContext context,
/// ///
/// Returns void (on success 200 navigate to /access-review ). /// Returns void (on success 200 navigate to /mih-access ).
static Future<void> reapplyPatientAccessAPICall( static Future<void> reapplyPatientAccessAPICall(
String business_id, String business_id,
String app_id, String app_id,

View File

@@ -36,7 +36,7 @@ class MihNotificationApis {
"notification_type": "Forever Access Request", "notification_type": "Forever Access Request",
"notification_message": "notification_message":
"A new Forever Access Request has been sent by $business_name in order to access your Patient Profile. Please review request.", "A new Forever Access Request has been sent by $business_name in order to access your Patient Profile. Please review request.",
"action_path": "/access-review", "action_path": "/mih-access",
}), }),
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {
@@ -83,7 +83,7 @@ class MihNotificationApis {
"notification_type": "Re-applying for Access", "notification_type": "Re-applying for Access",
"notification_message": "notification_message":
"${args.business!.Name} is re-applying for access to your Patient Profile. Please review request.", "${args.business!.Name} is re-applying for access to your Patient Profile. Please review request.",
"action_path": "/access-review", "action_path": "/mih-access",
}), }),
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {

View File

@@ -71,7 +71,6 @@ class _AboutMihState extends State<AboutMih> {
_selcetedIndex = 2; _selcetedIndex = 2;
}); });
}; };
return MihAppTools( return MihAppTools(
tools: temp, tools: temp,
selcetedIndex: _selcetedIndex, selcetedIndex: _selcetedIndex,

View File

@@ -0,0 +1,68 @@
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih_app.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih_app_action.dart';
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih_app_tools.dart';
import 'package:Mzansi_Innovation_Hub/mih_objects/app_user.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/access_review/mih_access_requests.dart';
import 'package:flutter/material.dart';
class MihAccess extends StatefulWidget {
final AppUser signedInUser;
const MihAccess({
super.key,
required this.signedInUser,
});
@override
State<MihAccess> createState() => _MihAccessState();
}
class _MihAccessState extends State<MihAccess> {
int _selcetedIndex = 0;
@override
Widget build(BuildContext context) {
return MihApp(
appActionButton: getAction(),
appTools: getTools(),
appBody: getToolBody(),
selectedbodyIndex: _selcetedIndex,
onIndexChange: (newValue) {
setState(() {
_selcetedIndex = newValue;
});
print("Index: $_selcetedIndex");
},
);
}
MihAppAction getAction() {
return MihAppAction(
icon: const Icon(Icons.arrow_back),
iconSize: 35,
onTap: () {
Navigator.of(context).pop();
},
);
}
MihAppTools getTools() {
Map<Widget, void Function()?> temp = {};
temp[const Icon(Icons.people)] = () {
setState(() {
_selcetedIndex = 0;
});
};
return MihAppTools(
tools: temp,
selcetedIndex: _selcetedIndex,
);
}
List<Widget> getToolBody() {
List<Widget> toolBodies = [
MihAccessRequest(
signedInUser: widget.signedInUser,
),
];
return toolBodies;
}
}

View File

@@ -1,31 +1,30 @@
import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/mih-app_tool_body.dart';
import 'package:Mzansi_Innovation_Hub/mih_objects/arguments.dart'; import 'package:Mzansi_Innovation_Hub/mih_objects/arguments.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../main.dart'; import '../../main.dart';
import '../../mih_apis/mih_api_calls.dart'; import '../../mih_apis/mih_api_calls.dart';
import '../../mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart'; import '../../mih_components/mih_inputs_and_buttons/mih_dropdown_input.dart';
import '../../mih_components/mih_layout/mih_action.dart'; import '../../mih_components/mih_layout/mih_action.dart';
import '../../mih_components/mih_layout/mih_body.dart';
import '../../mih_components/mih_layout/mih_header.dart'; import '../../mih_components/mih_layout/mih_header.dart';
import '../../mih_components/mih_layout/mih_layout_builder.dart';
import '../../mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import '../../mih_components/mih_pop_up_messages/mih_loading_circle.dart';
import '../../mih_env/env.dart'; import '../../mih_env/env.dart';
import '../../mih_objects/app_user.dart'; import '../../mih_objects/app_user.dart';
import '../../mih_objects/patient_access.dart'; import '../../mih_objects/patient_access.dart';
import 'builder/build_business_access_list.dart'; import 'builder/build_business_access_list.dart';
class PatientAccessRequest extends StatefulWidget { class MihAccessRequest extends StatefulWidget {
final AppUser signedInUser; final AppUser signedInUser;
const PatientAccessRequest({ const MihAccessRequest({
super.key, super.key,
required this.signedInUser, required this.signedInUser,
}); });
@override @override
State<PatientAccessRequest> createState() => _PatientAccessRequestState(); State<MihAccessRequest> createState() => _MihAccessRequestState();
} }
class _PatientAccessRequestState extends State<PatientAccessRequest> { class _MihAccessRequestState extends State<MihAccessRequest> {
TextEditingController filterController = TextEditingController(); TextEditingController filterController = TextEditingController();
String baseUrl = AppEnviroment.baseApiUrl; String baseUrl = AppEnviroment.baseApiUrl;
@@ -127,91 +126,100 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
); );
} }
MIHBody getBody() { Widget getBody() {
return MIHBody( return SingleChildScrollView(
borderOn: true, child: Column(
bodyItems: [ children: [
const SizedBox(height: 10), const Text(
Row( "Access List",
mainAxisAlignment: MainAxisAlignment.center, style: TextStyle(
mainAxisSize: MainAxisSize.max, fontWeight: FontWeight.bold,
children: [ fontSize: 25,
Flexible(
child: MIHDropdownField(
controller: filterController,
hintText: "Access Types",
dropdownOptions: const [
"All",
"Approved",
"Pending",
"Declined",
"Cancelled"
],
required: true,
editable: true,
enableSearch: false,
),
), ),
IconButton( ),
onPressed: () { const SizedBox(height: 10),
setState(() { Row(
forceRefresh = true; mainAxisAlignment: MainAxisAlignment.center,
}); mainAxisSize: MainAxisSize.max,
refreshList(); children: [
}, Flexible(
icon: const Icon( child: MIHDropdownField(
Icons.refresh, controller: filterController,
hintText: "Access Types",
dropdownOptions: const [
"All",
"Approved",
"Pending",
"Declined",
"Cancelled"
],
required: true,
editable: true,
enableSearch: false,
),
), ),
), IconButton(
], onPressed: () {
), setState(() {
const SizedBox(height: 10), forceRefresh = true;
FutureBuilder( });
future: accessList, refreshList();
builder: (context, snapshot) { },
//print("patient Queue List ${snapshot.hasData}"); icon: const Icon(
if (snapshot.connectionState == ConnectionState.waiting) { Icons.refresh,
return const Mihloadingcircle(); ),
} else if (snapshot.connectionState == ConnectionState.done) { ),
List<PatientAccess> accessRequestList; ],
accessRequestList = filterSearchResults(snapshot.requireData); ),
if (accessRequestList.isNotEmpty) { const SizedBox(height: 10),
return BuildBusinessAccessList( FutureBuilder(
signedInUser: widget.signedInUser, future: accessList,
patientAccessList: accessRequestList, builder: (context, snapshot) {
); //print("patient Queue List ${snapshot.hasData}");
if (snapshot.connectionState == ConnectionState.waiting) {
return const Mihloadingcircle();
} else if (snapshot.connectionState == ConnectionState.done) {
List<PatientAccess> accessRequestList;
accessRequestList = filterSearchResults(snapshot.requireData);
if (accessRequestList.isNotEmpty) {
return BuildBusinessAccessList(
signedInUser: widget.signedInUser,
patientAccessList: accessRequestList,
);
} else {
return Center(
child: Text(
"No Request have been made.",
style: TextStyle(
fontSize: 25,
color: MzanziInnovationHub.of(context)!
.theme
.messageTextColor()),
textAlign: TextAlign.center,
),
);
}
// return Expanded(
// child: displayAccessRequestList(accessRequestList),
// );
} else { } else {
return Center( return Center(
child: Text( child: Text(
"No Request have been made.", "$errorCode: Error pulling Patients Data\n$baseUrl/queue/patients/\n$errorBody",
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
color: MzanziInnovationHub.of(context)! color: MzanziInnovationHub.of(context)!
.theme .theme
.messageTextColor()), .errorColor()),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
); );
} }
},
// return Expanded( ),
// child: displayAccessRequestList(accessRequestList), ],
// ); ),
} else {
return Center(
child: Text(
"$errorCode: Error pulling Patients Data\n$baseUrl/queue/patients/\n$errorBody",
style: TextStyle(
fontSize: 25,
color:
MzanziInnovationHub.of(context)!.theme.errorColor()),
textAlign: TextAlign.center,
),
);
}
},
),
],
); );
} }
@@ -235,16 +243,9 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MIHLayoutBuilder( return MihAppToolBody(
actionButton: getActionButton(), borderOn: true,
header: getHeader(), bodyItem: getBody(),
secondaryActionButton: null,
body: getBody(),
actionDrawer: null,
secondaryActionDrawer: null,
bottomNavBar: null,
pullDownToRefresh: false,
onPullDown: () async {},
); );
} }
} }

View File

@@ -303,11 +303,11 @@ class _MIHHomeState extends State<MIHHome> {
videoID: "", videoID: "",
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/access-review', '/mih-access',
arguments: widget.signedInUser, arguments: widget.signedInUser,
); );
}, },
tileName: "Access", tileName: "MIH Access",
tileIcon: Center( tileIcon: Center(
child: FaIcon( child: FaIcon(
FontAwesomeIcons.userCheck, FontAwesomeIcons.userCheck,
@@ -383,7 +383,7 @@ class _MIHHomeState extends State<MIHHome> {
// tileList.add(MIHTile( // tileList.add(MIHTile(
// onTap: () { // onTap: () {
// Navigator.of(context).pushNamed( // Navigator.of(context).pushNamed(
// '/access-review', // '/mih-access',
// arguments: widget.signedInUser, // arguments: widget.signedInUser,
// ); // );
// }, // },

View File

@@ -99,7 +99,7 @@ class _BuildPatientsListState extends State<BuildPatientAccessList> {
"notification_type": "New Appointment Booked", "notification_type": "New Appointment Booked",
"notification_message": "notification_message":
"A new Appointment has been booked by ${widget.arguments.business!.Name} for the ${dateController.text} ${timeController.text}. Please approve the Access Review request.", "A new Appointment has been booked by ${widget.arguments.business!.Name} for the ${dateController.text} ${timeController.text}. Please approve the Access Review request.",
"action_path": "/access-review", "action_path": "/mih-access",
}), }),
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {

View File

@@ -139,7 +139,7 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
"notification_type": "New Appointment Booked", "notification_type": "New Appointment Booked",
"notification_message": "notification_message":
"A new Appointment has been booked by ${widget.arguments.business!.Name} for the ${dateController.text} ${timeController.text}. Please approve the Access Review request.", "A new Appointment has been booked by ${widget.arguments.business!.Name} for the ${dateController.text} ${timeController.text}. Please approve the Access Review request.",
"action_path": "/access-review", "action_path": "/mih-access",
}), }),
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {

View File

@@ -325,7 +325,7 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
"notification_type": "Appointment Cancelled", "notification_type": "Appointment Cancelled",
"notification_message": "notification_message":
"Your appointment with ${widget.business!.Name} for the ${widget.patientQueue[index].date_time.replaceAll("T", " ")} has been cancelled.", "Your appointment with ${widget.business!.Name} for the ${widget.patientQueue[index].date_time.replaceAll("T", " ")} has been cancelled.",
"action_path": "/access-review", "action_path": "/mih-access",
}), }),
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {
@@ -361,7 +361,7 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
"notification_type": "Rescheduled Appointment", "notification_type": "Rescheduled Appointment",
"notification_message": "notification_message":
"Your appointment with ${widget.business!.Name} for the ${widget.patientQueue[index].date_time.replaceAll("T", " ").substring(0, widget.patientQueue[index].date_time.length - 3)} has been rescheduled to the ${dateController.text} ${timeController.text}.", "Your appointment with ${widget.business!.Name} for the ${widget.patientQueue[index].date_time.replaceAll("T", " ").substring(0, widget.patientQueue[index].date_time.length - 3)} has been rescheduled to the ${dateController.text} ${timeController.text}.",
"action_path": "/access-review", "action_path": "/mih-access",
}), }),
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {
@@ -397,7 +397,7 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
// "notification_type": "Access Extension Request", // "notification_type": "Access Extension Request",
// "notification_message": // "notification_message":
// "${widget.business!.Name} - access expiry date extension for appointment: ${widget.patientQueue[index].date_time.split("T")[0]}. Expiry Date: from ${widget.patientQueue[index].revoke_date.split("T")[0]} to ${revokeDate.split(" ")[0]}.", // "${widget.business!.Name} - access expiry date extension for appointment: ${widget.patientQueue[index].date_time.split("T")[0]}. Expiry Date: from ${widget.patientQueue[index].revoke_date.split("T")[0]} to ${revokeDate.split(" ")[0]}.",
// "action_path": "/access-review", // "action_path": "/mih-access",
// }), // }),
// ); // );
// if (response.statusCode == 201) { // if (response.statusCode == 201) {

View File

@@ -100,7 +100,7 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
"notification_type": "New Appointment Booked", "notification_type": "New Appointment Booked",
"notification_message": "notification_message":
"A new Appointment has been booked by ${widget.business!.Name} for the ${dateController.text} ${timeController.text}. Please approve the Access Review request.", "A new Appointment has been booked by ${widget.business!.Name} for the ${dateController.text} ${timeController.text}. Please approve the Access Review request.",
"action_path": "/access-review", "action_path": "/mih-access",
}), }),
); );
if (response.statusCode == 201) { if (response.statusCode == 201) {

View File

@@ -2,6 +2,7 @@ import 'package:Mzansi_Innovation_Hub/mih_components/mih_package/test/package_te
import 'package:Mzansi_Innovation_Hub/mih_packages/about_mih/about_mih.dart'; import 'package:Mzansi_Innovation_Hub/mih_packages/about_mih/about_mih.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/about_mih/mih_policy_tos_ext/mih_privacy_polocy_external.dart'; import 'package:Mzansi_Innovation_Hub/mih_packages/about_mih/mih_policy_tos_ext/mih_privacy_polocy_external.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/about_mih/mih_policy_tos_ext/mih_terms_of_service_external.dart'; import 'package:Mzansi_Innovation_Hub/mih_packages/about_mih/mih_policy_tos_ext/mih_terms_of_service_external.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/access_review/mih_access.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/calculator/mih_calculator.dart'; import 'package:Mzansi_Innovation_Hub/mih_packages/calculator/mih_calculator.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/calendar/mzansi_calendar.dart'; import 'package:Mzansi_Innovation_Hub/mih_packages/calendar/mzansi_calendar.dart';
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_ai/mzansi_ai.dart'; import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_ai/mzansi_ai.dart';
@@ -23,8 +24,6 @@ import '../mih_packages/authentication/forgot_password.dart';
import '../mih_packages/authentication/reset_password.dart'; import '../mih_packages/authentication/reset_password.dart';
import '../mih_packages/patient_profile/full_screen_file.dart'; import '../mih_packages/patient_profile/full_screen_file.dart';
import '../mih_packages/manage_business/manage_business_profile.dart'; import '../mih_packages/manage_business/manage_business_profile.dart';
import '../mih_packages/access_review/patient_access_review.dart';
import '../mih_packages/patient_profile/patient_view.dart'; import '../mih_packages/patient_profile/patient_view.dart';
import '../mih_packages/manage_business/profile_business_add.dart'; import '../mih_packages/manage_business/profile_business_add.dart';
import '../mih_packages/manage_business/business_details.dart'; import '../mih_packages/manage_business/business_details.dart';
@@ -214,14 +213,17 @@ class RouteGenerator {
//=============================================================== //===============================================================
// Access Review Page // Access Review Page
case '/access-review': case '/mih-access':
if (args is AppUser) { if (args is AppUser) {
//print("route generator: $args"); //print("route generator: $args");
return MaterialPageRoute( return MaterialPageRoute(
settings: settings, settings: settings,
builder: (_) => PatientAccessRequest( builder: (_) => MihAccess(
signedInUser: args, signedInUser: args,
), ),
// PatientAccessRequest(
// signedInUser: args,
// ),
); );
} }
return _errorRoute(); return _errorRoute();