Merge pull request #98 from yaso-meth/BUG--Appointment-list-overflow

BUG--Appointment-list-overflow
This commit is contained in:
yaso-meth
2025-03-10 13:58:51 +02:00
committed by GitHub
4 changed files with 278 additions and 261 deletions

View File

@@ -243,57 +243,60 @@ class _PatientAccessRequestState extends State<Appointments> {
Widget getBody() { Widget getBody() {
return Stack( return Stack(
children: [ children: [
Column( SingleChildScrollView(
children: [ child: Column(
Text( children: [
getTitle(), Text(
style: const TextStyle( getTitle(),
fontWeight: FontWeight.bold, style: const TextStyle(
fontSize: 25, fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
), MIHCalendar(
MIHCalendar( calendarWidth: 500,
calendarWidth: 500, rowHeight: 35,
rowHeight: 35, setDate: (value) {
setDate: (value) { setState(() {
setState(() { selectedDay = value;
selectedDay = value; selectedAppointmentDateController.text = selectedDay;
selectedAppointmentDateController.text = selectedDay; });
}); }),
}), // Divider(
// Divider( // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), // ),
// ), Row(
Row( mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, children: [
children: [ FutureBuilder(
FutureBuilder( future: appointmentResults,
future: appointmentResults, builder: (context, snapshot) {
builder: (context, snapshot) { if (snapshot.connectionState ==
if (snapshot.connectionState == ConnectionState.waiting) { ConnectionState.waiting) {
return const Expanded( return const Expanded(
child: Center(child: Mihloadingcircle())); child: Center(child: Mihloadingcircle()));
} else if (snapshot.connectionState == } else if (snapshot.connectionState ==
ConnectionState.done && ConnectionState.done &&
snapshot.hasData) { snapshot.hasData) {
return displayAppointmentList(snapshot.requireData); return displayAppointmentList(snapshot.requireData);
} else { } else {
return Center( return Center(
child: Text( child: Text(
"Error pulling appointments", "Error pulling appointments",
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
color: MzanziInnovationHub.of(context)! color: MzanziInnovationHub.of(context)!
.theme .theme
.errorColor()), .errorColor()),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
); );
} }
}), }),
], ],
) )
], ],
),
), ),
Positioned( Positioned(
right: 0, right: 0,

View File

@@ -51,82 +51,87 @@ class _MihPatientSearchState extends State<MihPatientSearch> {
// print("To-Do: Implement the search function"); // print("To-Do: Implement the search function");
} }
}, },
child: Column(mainAxisSize: MainAxisSize.max, children: [ child: SingleChildScrollView(
const Text( child: Column(mainAxisSize: MainAxisSize.max, children: [
"MIH Patient Lookup", const Text(
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), "MIH Patient Lookup",
), style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), ),
//spacer Divider(
const SizedBox(height: 10), color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
Row( //spacer
mainAxisSize: MainAxisSize.min, const SizedBox(height: 10),
children: [ Row(
Flexible( mainAxisSize: MainAxisSize.min,
flex: 1, children: [
child: MIHSearchField( Flexible(
controller: _mihPatientSearchController, flex: 1,
hintText: "ID or Medical Aid No. Search", child: MIHSearchField(
required: false, controller: _mihPatientSearchController,
editable: true, hintText: "ID or Medical Aid No. Search",
onTap: () { required: false,
// submitPatientForm(); editable: true,
submitPatientSearch(); onTap: () {
//To-Do: Implement the search function // submitPatientForm();
// print("To-Do: Implement the search function"); 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<Patient> 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,
), ),
); ),
} 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<Patient> 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,
),
);
}
},
),
]),
),
); );
} }

View File

@@ -52,95 +52,101 @@ class _MyPatientListState extends State<MyPatientList> {
}); });
} }
}, },
child: Column(mainAxisSize: MainAxisSize.max, children: [ child: SingleChildScrollView(
Row( child: Column(mainAxisSize: MainAxisSize.max, children: [
mainAxisAlignment: MainAxisAlignment.center, Row(
children: [ mainAxisAlignment: MainAxisAlignment.center,
const Text( children: [
"My Patient List", const Text(
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), "My Patient List",
), style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
IconButton(
iconSize: 20,
icon: const Icon(
Icons.refresh,
), ),
onPressed: () { IconButton(
getMyPatientList(); iconSize: 20,
}, icon: const Icon(
), Icons.refresh,
], ),
),
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: () { onPressed: () {
setState(() {
_myPatientSearchController.clear();
_myPatientIdSearchString = "";
});
getMyPatientList(); getMyPatientList();
}, },
icon: const Icon( ),
Icons.filter_alt_off, ],
size: 25, ),
)) Divider(
], color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
), //spacer
//spacer const SizedBox(height: 10),
const SizedBox(height: 10), Row(
FutureBuilder( mainAxisSize: MainAxisSize.min,
future: _myPatientList, children: [
builder: (context, snapshot) { Flexible(
//print("patient Liust ${snapshot.data}"); flex: 1,
if (snapshot.connectionState == ConnectionState.waiting) { child: MIHSearchField(
return const Mihloadingcircle(); controller: _myPatientSearchController,
} else if (snapshot.connectionState == ConnectionState.done && hintText: "Patient ID Search",
snapshot.hasData) { required: false,
List<PatientAccess> patientsAccessList; editable: true,
if (_myPatientIdSearchString == "") { onTap: () {
patientsAccessList = snapshot.data!; setState(() {
} else { _myPatientIdSearchString =
patientsAccessList = filterAccessResults( _myPatientSearchController.text;
snapshot.data!, _myPatientIdSearchString); _myPatientList =
//print(patientsList); MIHApiCalls.getPatientAccessListOfBusiness(
} widget.business!.business_id);
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,
), ),
); ),
} 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<PatientAccess> 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,
),
);
}
},
),
]),
),
); );
} }

View File

@@ -61,59 +61,62 @@ class _WaitingRoomState extends State<WaitingRoom> {
Widget getBusinessAppointmentsTool() { Widget getBusinessAppointmentsTool() {
return Stack( return Stack(
children: [ children: [
Column( SingleChildScrollView(
children: [ child: Column(
const Text( children: [
"Waiting Room", const Text(
style: const TextStyle( "Waiting Room",
fontWeight: FontWeight.bold, style: const TextStyle(
fontSize: 25, fontWeight: FontWeight.bold,
fontSize: 25,
),
), ),
), MIHCalendar(
MIHCalendar( calendarWidth: 500,
calendarWidth: 500, rowHeight: 35,
rowHeight: 35, setDate: (value) {
setDate: (value) { setState(() {
setState(() { selectedDay = value;
selectedDay = value; selectedAppointmentDateController.text = selectedDay;
selectedAppointmentDateController.text = selectedDay; });
}); }),
}), // Divider(
// Divider( // color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), // ),
// ), Row(
Row( mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, children: [
children: [ FutureBuilder(
FutureBuilder( future: appointmentResults,
future: appointmentResults, builder: (context, snapshot) {
builder: (context, snapshot) { if (snapshot.connectionState ==
if (snapshot.connectionState == ConnectionState.waiting) { ConnectionState.waiting) {
return const Expanded( return const Expanded(
child: Center(child: Mihloadingcircle())); child: Center(child: Mihloadingcircle()));
} else if (snapshot.connectionState == } else if (snapshot.connectionState ==
ConnectionState.done && ConnectionState.done &&
snapshot.hasData) { snapshot.hasData) {
return return
// Container(child: const Placeholder()); // Container(child: const Placeholder());
displayAppointmentList(snapshot.requireData); displayAppointmentList(snapshot.requireData);
} else { } else {
return Center( return Center(
child: Text( child: Text(
"Error pulling appointments", "Error pulling appointments",
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
color: MzanziInnovationHub.of(context)! color: MzanziInnovationHub.of(context)!
.theme .theme
.errorColor()), .errorColor()),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
); );
} }
}), }),
], ],
) )
], ],
),
), ),
Positioned( Positioned(
right: 0, right: 0,