add queue date picker
This commit is contained in:
@@ -41,6 +41,10 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
String errorBody = "";
|
String errorBody = "";
|
||||||
|
|
||||||
String searchString = "";
|
String searchString = "";
|
||||||
|
var now = DateTime.now();
|
||||||
|
var formatter = DateFormat('yyyy-MM-dd');
|
||||||
|
late String formattedDate;
|
||||||
|
bool start = true;
|
||||||
|
|
||||||
late Future<List<Patient>> patientSearchResults;
|
late Future<List<Patient>> patientSearchResults;
|
||||||
late Future<List<PatientQueue>> patientQueueResults;
|
late Future<List<PatientQueue>> patientQueueResults;
|
||||||
@@ -79,6 +83,7 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
templist.add(item);
|
templist.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//print(templist);
|
||||||
return templist;
|
return templist;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +283,7 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"Enter ID or Medical Aid No. of Patient",
|
"No Appointments for $formattedDate",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
color: MzanziInnovationHub.of(context)!.theme.messageTextColor()),
|
color: MzanziInnovationHub.of(context)!.theme.messageTextColor()),
|
||||||
@@ -307,7 +312,7 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
//spacer
|
//spacer
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: fetchPatientQueue(queueDateController.text),
|
future: patientQueueResults,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
//print("patient Queue List ${snapshot.hasData}");
|
//print("patient Queue List ${snapshot.hasData}");
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
@@ -375,20 +380,30 @@ class _PatientManagerState extends State<PatientManager> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkforchange() {
|
||||||
|
if (start == true) {
|
||||||
|
setState(() {
|
||||||
|
patientQueueResults = fetchPatientQueue(queueDateController.text);
|
||||||
|
start = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (formattedDate != queueDateController.text) {
|
||||||
|
setState(() {
|
||||||
|
patientQueueResults = fetchPatientQueue(queueDateController.text);
|
||||||
|
formattedDate = queueDateController.text;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// errorCode = "";
|
|
||||||
// errorBody = "";
|
|
||||||
//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);
|
queueDateController.addListener(checkforchange);
|
||||||
setState(() {
|
setState(() {
|
||||||
|
formattedDate = formatter.format(now);
|
||||||
queueDateController.text = formattedDate;
|
queueDateController.text = formattedDate;
|
||||||
});
|
});
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user