Add and view note window enhancement

This commit is contained in:
2024-09-27 13:08:48 +02:00
parent fb615d9c3f
commit c3298877e1
2 changed files with 401 additions and 260 deletions

View File

@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.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_layout/mih_window.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_delete_message.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_delete_message.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_multiline_text_input.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart';
@@ -129,139 +130,199 @@ class _BuildNotesListState extends State<BuildNotesList> {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) => Dialog( builder: (context) => MIHWindow(
child: Stack( fullscreen: true,
children: [ windowTitle: selectednote.note_name,
Container( windowTools: [
padding: const EdgeInsets.all(15.0), IconButton(
width: 700.0, onPressed: () {
//height: 475.0, deletePatientPopUp(selectednote.idpatient_notes);
decoration: BoxDecoration( },
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), icon: Icon(
borderRadius: BorderRadius.circular(25.0), Icons.delete,
border: Border.all( color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
const SizedBox(
height: 25,
),
Text(
selectednote.note_name,
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: businessNameController,
hintText: "Office",
editable: false,
required: false,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: userNameController,
hintText: "Created By",
editable: false,
required: false,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: dateController,
hintText: "Created Date",
editable: false,
required: false,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: noteTitleController,
hintText: "Note Title",
editable: false,
required: false,
),
),
const SizedBox(height: 10.0),
Expanded(
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
editable: false,
required: false,
),
),
//const SizedBox(height: 25.0),
// SizedBox(
// width: 300,
// height: 100,
// child: MIHButton(
// onTap: () {
// Navigator.pop(context);
// },
// buttonText: "Close",
// buttonColor: Colors.blueAccent,
// textColor: Colors.white,
// ),
// )
],
),
), ),
Positioned( ),
top: 5, ],
right: 5, onWindowTapClose: () {
width: 50, Navigator.pop(context);
height: 50, },
child: IconButton( windowBody: [
onPressed: () { MIHTextField(
Navigator.pop(context); controller: businessNameController,
}, hintText: "Office",
icon: Icon( editable: false,
Icons.close, required: false,
color: MzanziInnovationHub.of(context)!.theme.errorColor(), ),
size: 35, const SizedBox(height: 10.0),
), MIHTextField(
), controller: userNameController,
hintText: "Created By",
editable: false,
required: false,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: dateController,
hintText: "Created Date",
editable: false,
required: false,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: noteTitleController,
hintText: "Note Title",
editable: false,
required: false,
),
const SizedBox(height: 10.0),
Expanded(
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
editable: false,
required: false,
), ),
Positioned( ),
top: 5, ],
left: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
deletePatientPopUp(selectednote.idpatient_notes);
},
icon: Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
],
),
), ),
); );
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) => Dialog(
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.all(15.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: Column(
// mainAxisSize: MainAxisSize.max,
// children: [
// const SizedBox(
// height: 25,
// ),
// Text(
// selectednote.note_name,
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: 35.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 25.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: businessNameController,
// hintText: "Office",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: userNameController,
// hintText: "Created By",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: dateController,
// hintText: "Created Date",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: noteTitleController,
// hintText: "Note Title",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.0),
// Expanded(
// child: MIHMLTextField(
// controller: noteTextController,
// hintText: "Note Details",
// editable: false,
// required: false,
// ),
// ),
// //const SizedBox(height: 25.0),
// // SizedBox(
// // width: 300,
// // height: 100,
// // child: MIHButton(
// // onTap: () {
// // Navigator.pop(context);
// // },
// // buttonText: "Close",
// // buttonColor: Colors.blueAccent,
// // textColor: Colors.white,
// // ),
// // )
// ],
// ),
// ),
// 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,
// ),
// ),
// ),
// Positioned(
// top: 5,
// left: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// deletePatientPopUp(selectednote.idpatient_notes);
// },
// icon: Icon(
// Icons.delete,
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// ),
// ),
// ),
// ],
// ),
// ),
// );
} }
@override @override

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_layout/mih_window.dart';
import 'package:patient_manager/mih_packages/patient_profile/builder/build_notes_list.dart'; import 'package:patient_manager/mih_packages/patient_profile/builder/build_notes_list.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.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';
@@ -143,142 +144,221 @@ class _PatientNotesState extends State<PatientNotes> {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) => Dialog( builder: (context) => MIHWindow(
child: Stack( fullscreen: false,
children: [ windowTitle: "Add Note",
Container( windowTools: const [],
padding: const EdgeInsets.all(10.0), onWindowTapClose: () {
width: 700.0, Navigator.pop(context);
//height: 500.0, titleController.clear();
decoration: BoxDecoration( noteTextController.clear();
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), },
borderRadius: BorderRadius.circular(25.0), windowBody: [
border: Border.all( MIHTextField(
color: controller: officeController,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), hintText: "Office",
width: 5.0), editable: false,
), required: true,
child: SingleChildScrollView( ),
padding: const EdgeInsets.symmetric(horizontal: 10), const SizedBox(height: 10.0),
child: Column( MIHTextField(
mainAxisSize: MainAxisSize.min, controller: doctorController,
children: [ hintText: "Created By",
Text( editable: false,
"Add Note", required: true,
textAlign: TextAlign.center, ),
style: TextStyle( const SizedBox(height: 10.0),
color: MzanziInnovationHub.of(context)! MIHTextField(
.theme controller: dateController,
.secondaryColor(), hintText: "Created Date",
fontSize: 35.0, editable: false,
fontWeight: FontWeight.bold, required: true,
), ),
), const SizedBox(height: 10.0),
const SizedBox(height: 25.0), MIHTextField(
SizedBox( controller: titleController,
width: 700, hintText: "Note Title",
child: MIHTextField( editable: true,
controller: officeController, required: true,
hintText: "Office", ),
editable: false, const SizedBox(height: 10.0),
required: true, SizedBox(
), //width: 700,
), height: 250,
const SizedBox(height: 10.0), child: MIHMLTextField(
SizedBox( controller: noteTextController,
width: 700, hintText: "Note Details",
child: MIHTextField( editable: true,
controller: doctorController, required: true,
hintText: "Created By",
editable: false,
required: true,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: dateController,
hintText: "Created Date",
editable: false,
required: true,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: titleController,
hintText: "Note Title",
editable: true,
required: true,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
height: 250,
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
editable: true,
required: true,
),
),
const SizedBox(height: 30.0),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: () {
if (isFieldsFilled()) {
addPatientNoteAPICall();
Navigator.pop(context);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
},
buttonText: "Add Note",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
)
],
),
),
), ),
Positioned( ),
top: 5, const SizedBox(height: 15.0),
right: 5, SizedBox(
width: 50, width: 300,
height: 50, height: 50,
child: IconButton( child: MIHButton(
onPressed: () { onTap: () {
if (isFieldsFilled()) {
addPatientNoteAPICall();
Navigator.pop(context); Navigator.pop(context);
titleController.clear(); } else {
noteTextController.clear(); showDialog(
}, context: context,
icon: Icon( builder: (context) {
Icons.close, return const MIHErrorMessage(errorType: "Input Error");
color: MzanziInnovationHub.of(context)!.theme.errorColor(), },
size: 35, );
), }
), },
buttonText: "Add Note",
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
), ),
], )
), ],
), ),
); );
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) => Dialog(
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.all(10.0),
// width: 700.0,
// //height: 500.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(
// "Add Note",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: 35.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 25.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: officeController,
// hintText: "Office",
// editable: false,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: doctorController,
// hintText: "Created By",
// editable: false,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: dateController,
// hintText: "Created Date",
// editable: false,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: titleController,
// hintText: "Note Title",
// editable: true,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// height: 250,
// child: MIHMLTextField(
// controller: noteTextController,
// hintText: "Note Details",
// editable: true,
// required: true,
// ),
// ),
// const SizedBox(height: 30.0),
// SizedBox(
// width: 300,
// height: 50,
// child: MIHButton(
// onTap: () {
// if (isFieldsFilled()) {
// addPatientNoteAPICall();
// Navigator.pop(context);
// } else {
// showDialog(
// context: context,
// builder: (context) {
// return const MIHErrorMessage(
// errorType: "Input Error");
// },
// );
// }
// },
// buttonText: "Add Note",
// buttonColor: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// textColor: MzanziInnovationHub.of(context)!
// .theme
// .primaryColor(),
// ),
// )
// ],
// ),
// ),
// ),
// Positioned(
// top: 5,
// right: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// Navigator.pop(context);
// titleController.clear();
// noteTextController.clear();
// },
// icon: Icon(
// Icons.close,
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
// size: 35,
// ),
// ),
// ),
// ],
// ),
// ),
// );
} }
bool isFieldsFilled() { bool isFieldsFilled() {