remove error rom appointment page and replace with calendar widget

This commit is contained in:
2024-11-07 11:43:52 +02:00
parent 5d287b7eff
commit fd6c1ea9c5

View File

@@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/mih_components/mih_calendar.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_action.dart'; import 'package:patient_manager/mih_components/mih_layout/mih_action.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_body.dart'; import 'package:patient_manager/mih_components/mih_layout/mih_body.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_header.dart'; import 'package:patient_manager/mih_components/mih_layout/mih_header.dart';
@@ -249,85 +250,97 @@ class _PatientAccessRequestState extends State<Appointments> {
return MIHBody( return MIHBody(
borderOn: true, borderOn: true,
bodyItems: [ bodyItems: [
const SizedBox(height: 10), const MIHCalendar(
Row( calendarWidth: 500,
mainAxisAlignment: MainAxisAlignment.center, rowHeight: 35,
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: MIHDropdownField(
controller: filterController,
hintText: "Access Types",
dropdownOptions: const [
"All",
"Approved",
"Pending",
"Declined",
"Cancelled"
],
required: true,
editable: true,
), ),
Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
), ),
IconButton( const Center(
onPressed: () {
setState(() {
forceRefresh = true;
});
refreshList();
},
icon: const Icon(
Icons.refresh,
),
),
],
),
const SizedBox(height: 10),
FutureBuilder(
future: accessRequestResults,
builder: (context, snapshot) {
//print("patient Queue List ${snapshot.hasData}");
if (snapshot.connectionState == ConnectionState.waiting) {
return const Mihloadingcircle();
} else if (snapshot.connectionState == ConnectionState.done) {
List<AccessRequest> accessRequestList;
accessRequestList = filterSearchResults(snapshot.requireData);
if (accessRequestList.isNotEmpty) {
return BuildAccessRequestList(
signedInUser: widget.signedInUser,
accessRequests: accessRequestList,
);
} else {
return Center(
child: Text( child: Text(
"No Request have been made.", "Work Inprogress!!!",
style: TextStyle( style: TextStyle(fontSize: 35),
fontSize: 25, ))
color: MzanziInnovationHub.of(context)! // const SizedBox(height: 10),
.theme // Row(
.messageTextColor()), // mainAxisAlignment: MainAxisAlignment.center,
textAlign: TextAlign.center, // mainAxisSize: MainAxisSize.max,
), // children: [
); // Flexible(
} // child: MIHDropdownField(
// controller: filterController,
// return Expanded( // hintText: "Access Types",
// child: displayAccessRequestList(accessRequestList), // dropdownOptions: const [
// "All",
// "Approved",
// "Pending",
// "Declined",
// "Cancelled"
// ],
// required: true,
// editable: true,
// ),
// ),
// IconButton(
// onPressed: () {
// setState(() {
// forceRefresh = true;
// });
// refreshList();
// },
// icon: const Icon(
// Icons.refresh,
// ),
// ),
// ],
// ),
// const SizedBox(height: 10),
// FutureBuilder(
// future: accessRequestResults,
// builder: (context, snapshot) {
// //print("patient Queue List ${snapshot.hasData}");
// if (snapshot.connectionState == ConnectionState.waiting) {
// return const Mihloadingcircle();
// } else if (snapshot.connectionState == ConnectionState.done) {
// List<AccessRequest> accessRequestList;
// accessRequestList = filterSearchResults(snapshot.requireData);
// if (accessRequestList.isNotEmpty) {
// return BuildAccessRequestList(
// signedInUser: widget.signedInUser,
// accessRequests: accessRequestList,
// ); // );
} else { // } else {
return Center( // return Center(
child: Text( // child: Text(
"$errorCode: Error pulling Patients Data\n$baseUrl/queue/patients/\n$errorBody", // "No Request have been made.",
style: TextStyle( // style: TextStyle(
fontSize: 25, // fontSize: 25,
color: // color: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.errorColor()), // .theme
textAlign: TextAlign.center, // .messageTextColor()),
), // 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,
// ),
// );
// }
// },
// ),
], ],
); );
} }
@@ -340,12 +353,12 @@ class _PatientAccessRequestState extends State<Appointments> {
@override @override
void initState() { void initState() {
selectedDropdown = "All"; // selectedDropdown = "All";
filterController.text = "All"; // filterController.text = "All";
filterController.addListener(refreshList); // filterController.addListener(refreshList);
setState(() { // setState(() {
accessRequestResults = fetchAccessRequests(); // accessRequestResults = fetchAccessRequests();
}); // });
super.initState(); super.initState();
} }