Patient Search window enhancement

This commit is contained in:
2024-09-27 12:30:26 +02:00
parent 58453132e4
commit 05a877c6db

View File

@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_date_input.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_date_input.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_text_input.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_time_input.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_time_input.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_button.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_button.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_success_message.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_success_message.dart';
@@ -129,126 +130,200 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) => Dialog( builder: (context) => MIHWindow(
child: Stack( fullscreen: false,
children: [ windowTitle: "Patient Appointment",
Container( windowTools: const [],
padding: const EdgeInsets.all(10.0), onWindowTapClose: () {
width: 700.0, Navigator.pop(context);
//height: 475.0, },
decoration: BoxDecoration( windowBody: [
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), MIHTextField(
borderRadius: BorderRadius.circular(25.0), controller: idController,
border: Border.all( hintText: "ID No.",
color: editable: false,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), required: true,
width: 5.0), ),
), const SizedBox(height: 10.0),
child: SingleChildScrollView( MIHTextField(
padding: const EdgeInsets.symmetric(horizontal: 10), controller: fnameController,
child: Column( hintText: "First Name",
mainAxisSize: MainAxisSize.min, editable: false,
children: [ required: true,
Text( ),
"Patient Appointment", const SizedBox(height: 10.0),
textAlign: TextAlign.center, MIHTextField(
style: TextStyle( controller: lnameController,
color: MzanziInnovationHub.of(context)! hintText: "Surname",
.theme editable: false,
.secondaryColor(), required: true,
fontSize: 35.0, ),
fontWeight: FontWeight.bold, const SizedBox(height: 10.0),
), MIHDateField(
), controller: dateController,
const SizedBox(height: 25.0), lableText: "Date",
MIHTextField( required: true,
controller: idController, ),
hintText: "ID No.", const SizedBox(height: 10.0),
editable: false, MIHTimeField(
required: true, controller: timeController,
), lableText: "Time",
const SizedBox(height: 10.0), required: true,
MIHTextField( ),
controller: fnameController, const SizedBox(height: 30.0),
hintText: "First Name", SizedBox(
editable: false, width: 300,
required: true, height: 50,
), child: MIHButton(
const SizedBox(height: 10.0), buttonText: "Book",
MIHTextField( buttonColor:
controller: lnameController, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
hintText: "Surname", textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
editable: false, onTap: () {
required: true, //print("here1");
), bool filled = isAppointmentFieldsFilled();
const SizedBox(height: 10.0), //print("fields filled: $filled");
MIHDateField( if (filled) {
controller: dateController, //print("here2");
lableText: "Date", submitApointment(index);
required: true, //print("here3");
), } else {
const SizedBox(height: 10.0), showDialog(
MIHTimeField( context: context,
controller: timeController, builder: (context) {
lableText: "Time", return const MIHErrorMessage(errorType: "Input Error");
required: true, },
), );
const SizedBox(height: 30.0), }
SizedBox( },
width: 300,
height: 50,
child: MIHButton(
buttonText: "Book",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () {
//print("here1");
bool filled = isAppointmentFieldsFilled();
//print("fields filled: $filled");
if (filled) {
//print("here2");
submitApointment(index);
//print("here3");
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
},
),
)
],
),
),
), ),
Positioned( )
top: 5, ],
right: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.close,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
),
),
),
],
),
), ),
); );
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) => Dialog(
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.all(10.0),
// width: 700.0,
// //height: 475.0,
// decoration: BoxDecoration(
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
// borderRadius: BorderRadius.circular(25.0),
// border: Border.all(
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// width: 5.0),
// ),
// child: SingleChildScrollView(
// padding: const EdgeInsets.symmetric(horizontal: 10),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Text(
// "Patient Appointment",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: 35.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 25.0),
// MIHTextField(
// controller: idController,
// hintText: "ID No.",
// editable: false,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: fnameController,
// hintText: "First Name",
// editable: false,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHTextField(
// controller: lnameController,
// hintText: "Surname",
// editable: false,
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHDateField(
// controller: dateController,
// lableText: "Date",
// required: true,
// ),
// const SizedBox(height: 10.0),
// MIHTimeField(
// controller: timeController,
// lableText: "Time",
// required: true,
// ),
// const SizedBox(height: 30.0),
// SizedBox(
// width: 300,
// height: 50,
// child: MIHButton(
// buttonText: "Book",
// buttonColor: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// textColor: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// onTap: () {
// //print("here1");
// bool filled = isAppointmentFieldsFilled();
// //print("fields filled: $filled");
// if (filled) {
// //print("here2");
// submitApointment(index);
// //print("here3");
// } else {
// showDialog(
// context: context,
// builder: (context) {
// return const MIHErrorMessage(
// errorType: "Input Error");
// },
// );
// }
// },
// ),
// )
// ],
// ),
// ),
// ),
// Positioned(
// top: 5,
// right: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// Navigator.pop(context);
// },
// icon: Icon(
// Icons.close,
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
// size: 35,
// ),
// ),
// ),
// ],
// ),
// ),
// );
} }
Widget isMainMember(int index) { Widget isMainMember(int index) {