Add patient queue display
This commit is contained in:
@@ -0,0 +1,110 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:patient_manager/env/env.dart';
|
||||||
|
import 'package:patient_manager/main.dart';
|
||||||
|
import 'package:patient_manager/objects/appUser.dart';
|
||||||
|
import 'package:patient_manager/objects/arguments.dart';
|
||||||
|
import 'package:patient_manager/objects/patientQueue.dart';
|
||||||
|
import 'package:patient_manager/objects/patients.dart';
|
||||||
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
|
||||||
|
class BuildPatientQueueList extends StatefulWidget {
|
||||||
|
final List<PatientQueue> patientQueue;
|
||||||
|
final AppUser signedInUser;
|
||||||
|
|
||||||
|
const BuildPatientQueueList({
|
||||||
|
super.key,
|
||||||
|
required this.patientQueue,
|
||||||
|
required this.signedInUser,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<BuildPatientQueueList> createState() => _BuildPatientsListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BuildPatientsListState extends State<BuildPatientQueueList> {
|
||||||
|
String baseAPI = AppEnviroment.baseApiUrl;
|
||||||
|
|
||||||
|
Future<Patient> fetchPatients(String app_id) async {
|
||||||
|
//print("pat man drawer: " + endpointUserData + widget.userEmail);
|
||||||
|
|
||||||
|
var response = await http.get(Uri.parse("$baseAPI/patients/$app_id"));
|
||||||
|
|
||||||
|
// print(response.statusCode);
|
||||||
|
// print(response.body);
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
// print("here");
|
||||||
|
String body = response.body;
|
||||||
|
var decodedData = jsonDecode(body);
|
||||||
|
Patient u = Patient.fromJson(decodedData);
|
||||||
|
// print(u.email);
|
||||||
|
//setState(() {
|
||||||
|
//_widgetOptions = setLayout(u);
|
||||||
|
//});
|
||||||
|
return u;
|
||||||
|
} else {
|
||||||
|
throw Exception("Error: GetUserData status code ${response.statusCode}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget displayQueue(int index) {
|
||||||
|
String title =
|
||||||
|
widget.patientQueue[index].date_time.split('T')[1].substring(0, 5);
|
||||||
|
String subtitle =
|
||||||
|
"Name: ${widget.patientQueue[index].first_name} ${widget.patientQueue[index].last_name}\nID No.: ${widget.patientQueue[index].id_no}\nMedical Aid No: ";
|
||||||
|
if (widget.patientQueue[index].medical_aid_no == "") {
|
||||||
|
subtitle += "No Medical Aid";
|
||||||
|
} else {
|
||||||
|
subtitle += widget.patientQueue[index].medical_aid_no;
|
||||||
|
}
|
||||||
|
return ListTile(
|
||||||
|
title: Text(
|
||||||
|
"Appointment: $title",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
subtitle,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Patient selectedPatient;
|
||||||
|
fetchPatients(widget.patientQueue[index].app_id).then(
|
||||||
|
(result) {
|
||||||
|
setState(() {
|
||||||
|
selectedPatient = result;
|
||||||
|
Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||||
|
arguments: PatientViewArguments(
|
||||||
|
widget.signedInUser, selectedPatient, "business"));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
trailing: Icon(
|
||||||
|
Icons.arrow_forward,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListView.separated(
|
||||||
|
separatorBuilder: (BuildContext context, index) {
|
||||||
|
return Divider(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
itemCount: widget.patientQueue.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
//final patient = widget.patients[index].id_no.contains(widget.searchString);
|
||||||
|
//print(index);
|
||||||
|
return displayQueue(index);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
51
Frontend/patient_manager/lib/objects/patientQueue.dart
Normal file
51
Frontend/patient_manager/lib/objects/patientQueue.dart
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
class PatientQueue {
|
||||||
|
final int idpatient_queue;
|
||||||
|
final String business_id;
|
||||||
|
final String app_id;
|
||||||
|
final String date_time;
|
||||||
|
final String access;
|
||||||
|
final String id_no;
|
||||||
|
final String first_name;
|
||||||
|
final String last_name;
|
||||||
|
final String medical_aid_no;
|
||||||
|
|
||||||
|
const PatientQueue({
|
||||||
|
required this.idpatient_queue,
|
||||||
|
required this.business_id,
|
||||||
|
required this.app_id,
|
||||||
|
required this.date_time,
|
||||||
|
required this.access,
|
||||||
|
required this.id_no,
|
||||||
|
required this.first_name,
|
||||||
|
required this.last_name,
|
||||||
|
required this.medical_aid_no,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory PatientQueue.fromJson(Map<String, dynamic> json) {
|
||||||
|
return switch (json) {
|
||||||
|
{
|
||||||
|
"idpatient_queue": int idpatient_queue,
|
||||||
|
'business_id': String business_id,
|
||||||
|
'app_id': String app_id,
|
||||||
|
'date_time': String date_time,
|
||||||
|
'access': String access,
|
||||||
|
'id_no': String id_no,
|
||||||
|
'first_name': String first_name,
|
||||||
|
'last_name': String last_name,
|
||||||
|
'medical_aid_no': String medical_aid_no,
|
||||||
|
} =>
|
||||||
|
PatientQueue(
|
||||||
|
idpatient_queue: idpatient_queue,
|
||||||
|
business_id: business_id,
|
||||||
|
app_id: app_id,
|
||||||
|
date_time: date_time,
|
||||||
|
access: access,
|
||||||
|
id_no: id_no,
|
||||||
|
first_name: first_name,
|
||||||
|
last_name: last_name,
|
||||||
|
medical_aid_no: medical_aid_no,
|
||||||
|
),
|
||||||
|
_ => throw const FormatException('Failed to load album.'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,16 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:patient_manager/components/buildPatientList.dart';
|
import 'package:patient_manager/components/buildPatientList.dart';
|
||||||
|
import 'package:patient_manager/components/buildPatientQueueList.dart';
|
||||||
import 'package:patient_manager/components/mihAppBar.dart';
|
import 'package:patient_manager/components/mihAppBar.dart';
|
||||||
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
import 'package:patient_manager/components/mihLoadingCircle.dart';
|
||||||
import 'package:patient_manager/objects/appUser.dart';
|
import 'package:patient_manager/components/myDateInput.dart';
|
||||||
|
import 'package:patient_manager/objects/arguments.dart';
|
||||||
|
import 'package:patient_manager/objects/patientQueue.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
import 'package:patient_manager/components/mySearchInput.dart';
|
import 'package:patient_manager/components/mySearchInput.dart';
|
||||||
import 'package:patient_manager/env/env.dart';
|
import 'package:patient_manager/env/env.dart';
|
||||||
@@ -14,11 +18,11 @@ import 'package:patient_manager/main.dart';
|
|||||||
import 'package:patient_manager/objects/patients.dart';
|
import 'package:patient_manager/objects/patients.dart';
|
||||||
|
|
||||||
class PatientManager extends StatefulWidget {
|
class PatientManager extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
//final AppUser signedInUser;
|
||||||
|
final BusinessArguments arguments;
|
||||||
const PatientManager({
|
const PatientManager({
|
||||||
super.key,
|
super.key,
|
||||||
required this.signedInUser,
|
required this.arguments,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -28,6 +32,8 @@ class PatientManager extends StatefulWidget {
|
|||||||
//
|
//
|
||||||
class _PatientManagerState extends State<PatientManager> {
|
class _PatientManagerState extends State<PatientManager> {
|
||||||
TextEditingController searchController = TextEditingController();
|
TextEditingController searchController = TextEditingController();
|
||||||
|
TextEditingController queueDateController = TextEditingController();
|
||||||
|
|
||||||
String baseUrl = AppEnviroment.baseApiUrl;
|
String baseUrl = AppEnviroment.baseApiUrl;
|
||||||
|
|
||||||
final FocusNode _focusNode = FocusNode();
|
final FocusNode _focusNode = FocusNode();
|
||||||
@@ -37,11 +43,12 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
String searchString = "";
|
String searchString = "";
|
||||||
|
|
||||||
late Future<List<Patient>> patientSearchResults;
|
late Future<List<Patient>> patientSearchResults;
|
||||||
|
late Future<List<PatientQueue>> patientQueueResults;
|
||||||
|
|
||||||
Future<List<Patient>> fetchPatients(String search) async {
|
Future<List<PatientQueue>> fetchPatientQueue(String date) async {
|
||||||
//print("Patien manager page: $endpoint");
|
//print("Patien manager page: $endpoint");
|
||||||
final response =
|
final response = await http.get(Uri.parse(
|
||||||
await http.get(Uri.parse("$baseUrl/patients/search/$search"));
|
"$baseUrl/queue/patients/${widget.arguments.businessUser!.business_id}"));
|
||||||
// print("Here");
|
// print("Here");
|
||||||
// print("Body: ${response.body}");
|
// print("Body: ${response.body}");
|
||||||
// print("Code: ${response.statusCode}");
|
// print("Code: ${response.statusCode}");
|
||||||
@@ -52,20 +59,49 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
//print("Here1");
|
//print("Here1");
|
||||||
Iterable l = jsonDecode(response.body);
|
Iterable l = jsonDecode(response.body);
|
||||||
//print("Here2");
|
//print("Here2");
|
||||||
|
List<PatientQueue> patientQueue = List<PatientQueue>.from(
|
||||||
|
l.map((model) => PatientQueue.fromJson(model)));
|
||||||
|
//print("Here3");
|
||||||
|
//print(patientQueue);
|
||||||
|
return patientQueue;
|
||||||
|
} else {
|
||||||
|
throw Exception('failed to load patients');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PatientQueue> filterQueueResults(
|
||||||
|
List<PatientQueue> queueList, String query) {
|
||||||
|
List<PatientQueue> templist = [];
|
||||||
|
//print(query);
|
||||||
|
for (var item in queueList) {
|
||||||
|
if (item.date_time.contains(query)) {
|
||||||
|
//print(item.medical_aid_no);
|
||||||
|
templist.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return templist;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<Patient>> fetchPatients(String search) async {
|
||||||
|
final response =
|
||||||
|
await http.get(Uri.parse("$baseUrl/patients/search/$search"));
|
||||||
|
errorCode = response.statusCode.toString();
|
||||||
|
errorBody = response.body;
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
Iterable l = jsonDecode(response.body);
|
||||||
List<Patient> patients =
|
List<Patient> patients =
|
||||||
List<Patient>.from(l.map((model) => Patient.fromJson(model)));
|
List<Patient>.from(l.map((model) => Patient.fromJson(model)));
|
||||||
// print("Here3");
|
|
||||||
// print(patients);
|
|
||||||
return patients;
|
return patients;
|
||||||
} else {
|
} else {
|
||||||
throw Exception('failed to load patients');
|
throw Exception('failed to load patients');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Patient> filterSearchResults(List<Patient> mainList, String query) {
|
List<Patient> filterSearchResults(List<Patient> patList, String query) {
|
||||||
List<Patient> templist = [];
|
List<Patient> templist = [];
|
||||||
//print(query);
|
//print(query);
|
||||||
for (var item in mainList) {
|
for (var item in patList) {
|
||||||
if (item.id_no.contains(searchString) ||
|
if (item.id_no.contains(searchString) ||
|
||||||
item.medical_aid_no.contains(searchString)) {
|
item.medical_aid_no.contains(searchString)) {
|
||||||
//print(item.medical_aid_no);
|
//print(item.medical_aid_no);
|
||||||
@@ -75,14 +111,7 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
return templist;
|
return templist;
|
||||||
}
|
}
|
||||||
|
|
||||||
void submitForm() {
|
Widget displayPatientList(List<Patient> patientsList, String searchString) {
|
||||||
setState(() {
|
|
||||||
searchString = searchController.text;
|
|
||||||
patientSearchResults = fetchPatients(searchString);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget displayList(List<Patient> patientsList, String searchString) {
|
|
||||||
if (searchString.isNotEmpty && searchString != "") {
|
if (searchString.isNotEmpty && searchString != "") {
|
||||||
return Container(
|
return Container(
|
||||||
height: 500,
|
height: 500,
|
||||||
@@ -96,12 +125,12 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
),
|
),
|
||||||
child: BuildPatientsList(
|
child: BuildPatientsList(
|
||||||
patients: patientsList,
|
patients: patientsList,
|
||||||
signedInUser: widget.signedInUser,
|
signedInUser: widget.arguments.signedInUser,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Container(
|
return Container(
|
||||||
height: 500,
|
//height: 500,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
@@ -128,106 +157,238 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
onKeyEvent: (event) async {
|
onKeyEvent: (event) async {
|
||||||
if (event is KeyDownEvent &&
|
if (event is KeyDownEvent &&
|
||||||
event.logicalKey == LogicalKeyboardKey.enter) {
|
event.logicalKey == LogicalKeyboardKey.enter) {
|
||||||
submitForm();
|
submitPatientForm();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: SizedBox(
|
||||||
padding: const EdgeInsets.only(
|
width: w,
|
||||||
left: 25,
|
height: 600,
|
||||||
right: 25,
|
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||||
bottom: 25,
|
const SizedBox(height: 15),
|
||||||
),
|
const Text(
|
||||||
child: SizedBox(
|
"Patient Search",
|
||||||
width: w,
|
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
height: h,
|
),
|
||||||
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
//spacer
|
||||||
//spacer
|
const SizedBox(height: 10),
|
||||||
const SizedBox(height: 10),
|
MySearchField(
|
||||||
MySearchField(
|
controller: searchController,
|
||||||
controller: searchController,
|
hintText: "ID or Medical Aid No. Search",
|
||||||
hintText: "ID or Medical Aid No. Search",
|
required: false,
|
||||||
required: false,
|
editable: true,
|
||||||
editable: true,
|
onTap: () {
|
||||||
onTap: () {
|
submitPatientForm();
|
||||||
submitForm();
|
},
|
||||||
},
|
onChanged: (value) {},
|
||||||
onChanged: (value) {},
|
),
|
||||||
),
|
//spacer
|
||||||
//spacer
|
const SizedBox(height: 10),
|
||||||
const SizedBox(height: 10),
|
FutureBuilder(
|
||||||
FutureBuilder(
|
future: patientSearchResults,
|
||||||
future: patientSearchResults,
|
builder: (context, snapshot) {
|
||||||
builder: (context, snapshot) {
|
//print("patient Liust ${snapshot.data}");
|
||||||
//print("patient Liust ${snapshot.data}");
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
return Container(
|
||||||
return Container(
|
//height: 500,
|
||||||
height: 500,
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
color:
|
||||||
color:
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
border: Border.all(
|
||||||
border: Border.all(
|
color: MzanziInnovationHub.of(context)!
|
||||||
color: MzanziInnovationHub.of(context)!
|
.theme
|
||||||
.theme
|
.secondaryColor(),
|
||||||
.secondaryColor(),
|
width: 3.0),
|
||||||
width: 3.0),
|
),
|
||||||
),
|
child: const Mihloadingcircle(),
|
||||||
child: const Mihloadingcircle(),
|
);
|
||||||
);
|
} else if (snapshot.connectionState == ConnectionState.done &&
|
||||||
} else if (snapshot.connectionState == ConnectionState.done &&
|
snapshot.hasData) {
|
||||||
snapshot.hasData) {
|
List<Patient> patientsList;
|
||||||
List<Patient> patientsList;
|
if (searchString == "") {
|
||||||
if (searchString == "") {
|
patientsList = [];
|
||||||
patientsList = [];
|
|
||||||
} else {
|
|
||||||
patientsList =
|
|
||||||
filterSearchResults(snapshot.data!, searchString);
|
|
||||||
//print(patientsList);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Expanded(
|
|
||||||
child: displayList(patientsList, searchString),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return Container(
|
patientsList =
|
||||||
height: 500,
|
filterSearchResults(snapshot.data!, searchString);
|
||||||
decoration: BoxDecoration(
|
//print(patientsList);
|
||||||
color:
|
}
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
return Expanded(
|
||||||
border: Border.all(
|
child: displayPatientList(patientsList, searchString),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container(
|
||||||
|
//height: 500,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
width: 3.0),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"$errorCode: Error pulling Patients Data\n$baseUrl/patients/search/$searchString\n$errorBody",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
color: MzanziInnovationHub.of(context)!
|
color: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.errorColor()),
|
||||||
width: 3.0),
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
child: Center(
|
),
|
||||||
child: Text(
|
);
|
||||||
"$errorCode: Error pulling Patients Data\n$baseUrl${widget.signedInUser.email}\n$errorBody",
|
}
|
||||||
style: TextStyle(
|
},
|
||||||
fontSize: 25,
|
),
|
||||||
color: MzanziInnovationHub.of(context)!
|
]),
|
||||||
.theme
|
),
|
||||||
.errorColor()),
|
);
|
||||||
textAlign: TextAlign.center,
|
}
|
||||||
),
|
|
||||||
),
|
Widget displayQueueList(List<PatientQueue> patientQueueList) {
|
||||||
);
|
if (patientQueueList.isNotEmpty) {
|
||||||
}
|
return Container(
|
||||||
},
|
height: 500,
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
]),
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
width: 3.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: BuildPatientQueueList(
|
||||||
|
patientQueue: patientQueueList,
|
||||||
|
signedInUser: widget.arguments.signedInUser,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
//height: 500,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
width: 3.0),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Enter ID or Medical Aid No. of Patient",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.messageTextColor()),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget patientQueue(double w, double h) {
|
||||||
|
return SizedBox(
|
||||||
|
width: w,
|
||||||
|
height: 600,
|
||||||
|
child: Column(mainAxisSize: MainAxisSize.max, children: [
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
const Text(
|
||||||
|
"Waiting Room",
|
||||||
|
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MyDateField(
|
||||||
|
controller: queueDateController,
|
||||||
|
LableText: "Date",
|
||||||
|
required: false,
|
||||||
|
),
|
||||||
|
//spacer
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
FutureBuilder(
|
||||||
|
future: fetchPatientQueue(queueDateController.text),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
print("patient Queue List ${snapshot.hasData}");
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return Container(
|
||||||
|
//height: 500,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
width: 3.0),
|
||||||
|
),
|
||||||
|
child: const Mihloadingcircle(),
|
||||||
|
);
|
||||||
|
} else if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
List<PatientQueue> patientQueueList;
|
||||||
|
// if (searchString == "") {
|
||||||
|
// patientQueueList = [];
|
||||||
|
// } else {
|
||||||
|
patientQueueList = filterQueueResults(
|
||||||
|
snapshot.requireData, queueDateController.text);
|
||||||
|
// print(patientQueueList);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return Expanded(
|
||||||
|
child: displayQueueList(patientQueueList),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container(
|
||||||
|
//height: 500,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
width: 3.0),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"$errorCode: Error pulling Patients Data\n$baseUrl/patients/search/$searchString\n$errorBody",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
color: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.errorColor()),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void submitPatientForm() {
|
||||||
|
setState(() {
|
||||||
|
searchString = searchController.text;
|
||||||
|
patientSearchResults = fetchPatients(searchString);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// errorCode = "";
|
// errorCode = "";
|
||||||
// errorBody = "";
|
// errorBody = "";
|
||||||
//print("patient manager page: ${widget.userEmail}");
|
//print("patient manager page: ${widget.userEmail}");
|
||||||
|
var now = DateTime.now();
|
||||||
|
var formatter = DateFormat('yyyy-MM-dd');
|
||||||
|
String formattedDate = formatter.format(now);
|
||||||
|
|
||||||
patientSearchResults = fetchPatients("abc");
|
patientSearchResults = fetchPatients("abc");
|
||||||
|
//patientQueueResults = fetchPatientQueue(formattedDate);
|
||||||
|
setState(() {
|
||||||
|
queueDateController.text = formattedDate;
|
||||||
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +421,27 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
body: patientSearch(screenWidth, screenHeight),
|
body: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Wrap(
|
||||||
|
spacing: 10.0,
|
||||||
|
runSpacing: 10.0,
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
runAlignment: WrapAlignment.center,
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 660,
|
||||||
|
child: patientSearch(screenWidth, screenHeight),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 660,
|
||||||
|
child: patientQueue(screenWidth, screenHeight),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.2"
|
version: "4.0.2"
|
||||||
intl:
|
intl:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: intl
|
name: intl
|
||||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ dependencies:
|
|||||||
mysql_client: ^0.0.27
|
mysql_client: ^0.0.27
|
||||||
args: 2.5.0
|
args: 2.5.0
|
||||||
gif: ^2.3.0
|
gif: ^2.3.0
|
||||||
|
intl: ^0.19.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user