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,
),
),
IconButton(
onPressed: () {
setState(() {
forceRefresh = true;
});
refreshList();
},
icon: const Icon(
Icons.refresh,
),
),
],
), ),
const SizedBox(height: 10), Divider(
FutureBuilder( color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
future: accessRequestResults, ),
builder: (context, snapshot) { const Center(
//print("patient Queue List ${snapshot.hasData}"); child: Text(
if (snapshot.connectionState == ConnectionState.waiting) { "Work Inprogress!!!",
return const Mihloadingcircle(); style: TextStyle(fontSize: 35),
} else if (snapshot.connectionState == ConnectionState.done) { ))
List<AccessRequest> accessRequestList; // const SizedBox(height: 10),
accessRequestList = filterSearchResults(snapshot.requireData); // Row(
if (accessRequestList.isNotEmpty) { // mainAxisAlignment: MainAxisAlignment.center,
return BuildAccessRequestList( // mainAxisSize: MainAxisSize.max,
signedInUser: widget.signedInUser, // children: [
accessRequests: accessRequestList, // Flexible(
); // child: MIHDropdownField(
} else { // controller: filterController,
return Center( // hintText: "Access Types",
child: Text( // dropdownOptions: const [
"No Request have been made.", // "All",
style: TextStyle( // "Approved",
fontSize: 25, // "Pending",
color: MzanziInnovationHub.of(context)! // "Declined",
.theme // "Cancelled"
.messageTextColor()), // ],
textAlign: TextAlign.center, // 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 {
// return Center(
// child: Text(
// "No Request have been made.",
// style: TextStyle(
// fontSize: 25,
// color: MzanziInnovationHub.of(context)!
// .theme
// .messageTextColor()),
// textAlign: TextAlign.center,
// ),
// );
// }
// return Expanded( // // return Expanded(
// child: displayAccessRequestList(accessRequestList), // // child: displayAccessRequestList(accessRequestList),
// ); // // );
} else { // } else {
return Center( // return Center(
child: Text( // child: Text(
"$errorCode: Error pulling Patients Data\n$baseUrl/queue/patients/\n$errorBody", // "$errorCode: Error pulling Patients Data\n$baseUrl/queue/patients/\n$errorBody",
style: TextStyle( // style: TextStyle(
fontSize: 25, // fontSize: 25,
color: // color:
MzanziInnovationHub.of(context)!.theme.errorColor()), // MzanziInnovationHub.of(context)!.theme.errorColor()),
textAlign: TextAlign.center, // 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();
} }