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

View File

@@ -36,7 +36,7 @@ class MihNotificationApis {
"notification_type": "Forever Access Request",
"notification_message":
"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) {
@@ -83,7 +83,7 @@ class MihNotificationApis {
"notification_type": "Re-applying for Access",
"notification_message":
"${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) {

View File

@@ -71,7 +71,6 @@ class _AboutMihState extends State<AboutMih> {
_selcetedIndex = 2;
});
};
return MihAppTools(
tools: temp,
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:flutter/material.dart';
import '../../main.dart';
import '../../mih_apis/mih_api_calls.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_body.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_env/env.dart';
import '../../mih_objects/app_user.dart';
import '../../mih_objects/patient_access.dart';
import 'builder/build_business_access_list.dart';
class PatientAccessRequest extends StatefulWidget {
class MihAccessRequest extends StatefulWidget {
final AppUser signedInUser;
const PatientAccessRequest({
const MihAccessRequest({
super.key,
required this.signedInUser,
});
@override
State<PatientAccessRequest> createState() => _PatientAccessRequestState();
State<MihAccessRequest> createState() => _MihAccessRequestState();
}
class _PatientAccessRequestState extends State<PatientAccessRequest> {
class _MihAccessRequestState extends State<MihAccessRequest> {
TextEditingController filterController = TextEditingController();
String baseUrl = AppEnviroment.baseApiUrl;
@@ -127,91 +126,100 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
);
}
MIHBody getBody() {
return MIHBody(
borderOn: true,
bodyItems: [
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: MIHDropdownField(
controller: filterController,
hintText: "Access Types",
dropdownOptions: const [
"All",
"Approved",
"Pending",
"Declined",
"Cancelled"
],
required: true,
editable: true,
enableSearch: false,
),
Widget getBody() {
return SingleChildScrollView(
child: Column(
children: [
const Text(
"Access List",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
IconButton(
onPressed: () {
setState(() {
forceRefresh = true;
});
refreshList();
},
icon: const Icon(
Icons.refresh,
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: MIHDropdownField(
controller: filterController,
hintText: "Access Types",
dropdownOptions: const [
"All",
"Approved",
"Pending",
"Declined",
"Cancelled"
],
required: true,
editable: true,
enableSearch: false,
),
),
),
],
),
const SizedBox(height: 10),
FutureBuilder(
future: accessList,
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,
);
IconButton(
onPressed: () {
setState(() {
forceRefresh = true;
});
refreshList();
},
icon: const Icon(
Icons.refresh,
),
),
],
),
const SizedBox(height: 10),
FutureBuilder(
future: accessList,
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 {
return Center(
child: Text(
"No Request have been made.",
"$errorCode: Error pulling Patients Data\n$baseUrl/queue/patients/\n$errorBody",
style: TextStyle(
fontSize: 25,
color: MzanziInnovationHub.of(context)!
.theme
.messageTextColor()),
.errorColor()),
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
Widget build(BuildContext context) {
return MIHLayoutBuilder(
actionButton: getActionButton(),
header: getHeader(),
secondaryActionButton: null,
body: getBody(),
actionDrawer: null,
secondaryActionDrawer: null,
bottomNavBar: null,
pullDownToRefresh: false,
onPullDown: () async {},
return MihAppToolBody(
borderOn: true,
bodyItem: getBody(),
);
}
}

View File

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

View File

@@ -99,7 +99,7 @@ class _BuildPatientsListState extends State<BuildPatientAccessList> {
"notification_type": "New Appointment Booked",
"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.",
"action_path": "/access-review",
"action_path": "/mih-access",
}),
);
if (response.statusCode == 201) {

View File

@@ -139,7 +139,7 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
"notification_type": "New Appointment Booked",
"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.",
"action_path": "/access-review",
"action_path": "/mih-access",
}),
);
if (response.statusCode == 201) {

View File

@@ -325,7 +325,7 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
"notification_type": "Appointment Cancelled",
"notification_message":
"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) {
@@ -361,7 +361,7 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
"notification_type": "Rescheduled Appointment",
"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}.",
"action_path": "/access-review",
"action_path": "/mih-access",
}),
);
if (response.statusCode == 201) {
@@ -397,7 +397,7 @@ class _BuildPatientsListState extends State<BuildPatientQueueList> {
// "notification_type": "Access Extension Request",
// "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]}.",
// "action_path": "/access-review",
// "action_path": "/mih-access",
// }),
// );
// if (response.statusCode == 201) {

View File

@@ -100,7 +100,7 @@ class _BuildPatientsListState extends State<BuildMihPatientSearchList> {
"notification_type": "New Appointment Booked",
"notification_message":
"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) {

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/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/access_review/mih_access.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/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/patient_profile/full_screen_file.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/manage_business/profile_business_add.dart';
import '../mih_packages/manage_business/business_details.dart';
@@ -214,14 +213,17 @@ class RouteGenerator {
//===============================================================
// Access Review Page
case '/access-review':
case '/mih-access':
if (args is AppUser) {
//print("route generator: $args");
return MaterialPageRoute(
settings: settings,
builder: (_) => PatientAccessRequest(
builder: (_) => MihAccess(
signedInUser: args,
),
// PatientAccessRequest(
// signedInUser: args,
// ),
);
}
return _errorRoute();