From b693dfd63101f81ac9e9617baf37fb15e35fb253 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Mon, 10 Mar 2025 13:50:50 +0200 Subject: [PATCH] Fix Pat Manager --- .../app_tools/mih_patient_search.dart | 155 ++++++++-------- .../app_tools/my_patient_list.dart | 174 +++++++++--------- .../pat_manager/app_tools/waiting_room.dart | 107 +++++------ 3 files changed, 225 insertions(+), 211 deletions(-) diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/mih_patient_search.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/mih_patient_search.dart index 45aa6e24..c44c5018 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/mih_patient_search.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/mih_patient_search.dart @@ -51,82 +51,87 @@ class _MihPatientSearchState extends State { // print("To-Do: Implement the search function"); } }, - child: Column(mainAxisSize: MainAxisSize.max, children: [ - const Text( - "MIH Patient Lookup", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - ), - Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), - //spacer - const SizedBox(height: 10), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Flexible( - flex: 1, - child: MIHSearchField( - controller: _mihPatientSearchController, - hintText: "ID or Medical Aid No. Search", - required: false, - editable: true, - onTap: () { - // submitPatientForm(); - submitPatientSearch(); - //To-Do: Implement the search function - // print("To-Do: Implement the search function"); - }, - ), - ), - IconButton( - onPressed: () { - setState(() { - _mihPatientSearchController.clear(); - _mihPatientSearchString = ""; - }); - submitPatientSearch(); - //To-Do: Implement the search function - // print("To-Do: Implement the search function"); - }, - icon: const Icon( - Icons.filter_alt_off, - size: 25, - )) - ], - ), - //spacer - const SizedBox(height: 10), - FutureBuilder( - future: _mihPatientSearchResults, - builder: (context, snapshot) { - //print("patient Liust ${snapshot.data}"); - if (snapshot.connectionState == ConnectionState.waiting) { - return const Mihloadingcircle(); - } else if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - List patientsList; - if (_mihPatientSearchString == "") { - patientsList = []; - } else { - patientsList = filterSearchResults( - snapshot.data!, _mihPatientSearchString); - //print(patientsList); - } - return displayPatientList(patientsList, _mihPatientSearchString); - } else { - return Center( - child: Text( - "Error pulling Patients Data\n$baseUrl/patients/search/$_mihPatientSearchString", - style: TextStyle( - fontSize: 25, - color: - MzanziInnovationHub.of(context)!.theme.errorColor()), - textAlign: TextAlign.center, + child: SingleChildScrollView( + child: Column(mainAxisSize: MainAxisSize.max, children: [ + const Text( + "MIH Patient Lookup", + style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), + ), + Divider( + color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), + //spacer + const SizedBox(height: 10), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Flexible( + flex: 1, + child: MIHSearchField( + controller: _mihPatientSearchController, + hintText: "ID or Medical Aid No. Search", + required: false, + editable: true, + onTap: () { + // submitPatientForm(); + submitPatientSearch(); + //To-Do: Implement the search function + // print("To-Do: Implement the search function"); + }, ), - ); - } - }, - ), - ]), + ), + IconButton( + onPressed: () { + setState(() { + _mihPatientSearchController.clear(); + _mihPatientSearchString = ""; + }); + submitPatientSearch(); + //To-Do: Implement the search function + // print("To-Do: Implement the search function"); + }, + icon: const Icon( + Icons.filter_alt_off, + size: 25, + )) + ], + ), + //spacer + const SizedBox(height: 10), + FutureBuilder( + future: _mihPatientSearchResults, + builder: (context, snapshot) { + //print("patient Liust ${snapshot.data}"); + if (snapshot.connectionState == ConnectionState.waiting) { + return const Mihloadingcircle(); + } else if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + List patientsList; + if (_mihPatientSearchString == "") { + patientsList = []; + } else { + patientsList = filterSearchResults( + snapshot.data!, _mihPatientSearchString); + //print(patientsList); + } + return displayPatientList( + patientsList, _mihPatientSearchString); + } else { + return Center( + child: Text( + "Error pulling Patients Data\n$baseUrl/patients/search/$_mihPatientSearchString", + style: TextStyle( + fontSize: 25, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor()), + textAlign: TextAlign.center, + ), + ); + } + }, + ), + ]), + ), ); } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/my_patient_list.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/my_patient_list.dart index a3e0ec70..a6ce5509 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/my_patient_list.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/my_patient_list.dart @@ -52,95 +52,101 @@ class _MyPatientListState extends State { }); } }, - child: Column(mainAxisSize: MainAxisSize.max, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - "My Patient List", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - ), - IconButton( - iconSize: 20, - icon: const Icon( - Icons.refresh, + child: SingleChildScrollView( + child: Column(mainAxisSize: MainAxisSize.max, children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + "My Patient List", + style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), ), - onPressed: () { - getMyPatientList(); - }, - ), - ], - ), - Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), - //spacer - const SizedBox(height: 10), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Flexible( - flex: 1, - child: MIHSearchField( - controller: _myPatientSearchController, - hintText: "Patient ID Search", - required: false, - editable: true, - onTap: () { - setState(() { - _myPatientIdSearchString = _myPatientSearchController.text; - _myPatientList = MIHApiCalls.getPatientAccessListOfBusiness( - widget.business!.business_id); - }); - }, - ), - ), - IconButton( + IconButton( + iconSize: 20, + icon: const Icon( + Icons.refresh, + ), onPressed: () { - setState(() { - _myPatientSearchController.clear(); - _myPatientIdSearchString = ""; - }); getMyPatientList(); }, - icon: const Icon( - Icons.filter_alt_off, - size: 25, - )) - ], - ), - //spacer - const SizedBox(height: 10), - FutureBuilder( - future: _myPatientList, - builder: (context, snapshot) { - //print("patient Liust ${snapshot.data}"); - if (snapshot.connectionState == ConnectionState.waiting) { - return const Mihloadingcircle(); - } else if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - List patientsAccessList; - if (_myPatientIdSearchString == "") { - patientsAccessList = snapshot.data!; - } else { - patientsAccessList = filterAccessResults( - snapshot.data!, _myPatientIdSearchString); - //print(patientsList); - } - return displayMyPatientList(patientsAccessList); - } else { - return Center( - child: Text( - "Error pulling Patient Access Data\n$baseUrl/access-requests/business/patient/${widget.business!.business_id}", - style: TextStyle( - fontSize: 25, - color: - MzanziInnovationHub.of(context)!.theme.errorColor()), - textAlign: TextAlign.center, + ), + ], + ), + Divider( + color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), + //spacer + const SizedBox(height: 10), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Flexible( + flex: 1, + child: MIHSearchField( + controller: _myPatientSearchController, + hintText: "Patient ID Search", + required: false, + editable: true, + onTap: () { + setState(() { + _myPatientIdSearchString = + _myPatientSearchController.text; + _myPatientList = + MIHApiCalls.getPatientAccessListOfBusiness( + widget.business!.business_id); + }); + }, ), - ); - } - }, - ), - ]), + ), + IconButton( + onPressed: () { + setState(() { + _myPatientSearchController.clear(); + _myPatientIdSearchString = ""; + }); + getMyPatientList(); + }, + icon: const Icon( + Icons.filter_alt_off, + size: 25, + )) + ], + ), + //spacer + const SizedBox(height: 10), + FutureBuilder( + future: _myPatientList, + builder: (context, snapshot) { + //print("patient Liust ${snapshot.data}"); + if (snapshot.connectionState == ConnectionState.waiting) { + return const Mihloadingcircle(); + } else if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + List patientsAccessList; + if (_myPatientIdSearchString == "") { + patientsAccessList = snapshot.data!; + } else { + patientsAccessList = filterAccessResults( + snapshot.data!, _myPatientIdSearchString); + //print(patientsList); + } + return displayMyPatientList(patientsAccessList); + } else { + return Center( + child: Text( + "Error pulling Patient Access Data\n$baseUrl/access-requests/business/patient/${widget.business!.business_id}", + style: TextStyle( + fontSize: 25, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor()), + textAlign: TextAlign.center, + ), + ); + } + }, + ), + ]), + ), ); } diff --git a/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/waiting_room.dart b/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/waiting_room.dart index 95afc6db..26f27d27 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/waiting_room.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_manager/app_tools/waiting_room.dart @@ -61,59 +61,62 @@ class _WaitingRoomState extends State { Widget getBusinessAppointmentsTool() { return Stack( children: [ - Column( - children: [ - const Text( - "Waiting Room", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, + SingleChildScrollView( + child: Column( + children: [ + const Text( + "Waiting Room", + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), ), - ), - MIHCalendar( - calendarWidth: 500, - rowHeight: 35, - setDate: (value) { - setState(() { - selectedDay = value; - selectedAppointmentDateController.text = selectedDay; - }); - }), - // Divider( - // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - // ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - FutureBuilder( - future: appointmentResults, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Expanded( - child: Center(child: Mihloadingcircle())); - } else if (snapshot.connectionState == - ConnectionState.done && - snapshot.hasData) { - return - // Container(child: const Placeholder()); - displayAppointmentList(snapshot.requireData); - } else { - return Center( - child: Text( - "Error pulling appointments", - style: TextStyle( - fontSize: 25, - color: MzanziInnovationHub.of(context)! - .theme - .errorColor()), - textAlign: TextAlign.center, - ), - ); - } - }), - ], - ) - ], + MIHCalendar( + calendarWidth: 500, + rowHeight: 35, + setDate: (value) { + setState(() { + selectedDay = value; + selectedAppointmentDateController.text = selectedDay; + }); + }), + // Divider( + // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + FutureBuilder( + future: appointmentResults, + builder: (context, snapshot) { + if (snapshot.connectionState == + ConnectionState.waiting) { + return const Expanded( + child: Center(child: Mihloadingcircle())); + } else if (snapshot.connectionState == + ConnectionState.done && + snapshot.hasData) { + return + // Container(child: const Placeholder()); + displayAppointmentList(snapshot.requireData); + } else { + return Center( + child: Text( + "Error pulling appointments", + style: TextStyle( + fontSize: 25, + color: MzanziInnovationHub.of(context)! + .theme + .errorColor()), + textAlign: TextAlign.center, + ), + ); + } + }), + ], + ) + ], + ), ), Positioned( right: 0,