From c3298877e11ea03e253270be6931000b9a8a2fc8 Mon Sep 17 00:00:00 2001 From: yaso Date: Fri, 27 Sep 2024 13:08:48 +0200 Subject: [PATCH] Add and view note window enhancement --- .../builder/build_notes_list.dart | 319 +++++++++------- .../patient_profile/patient_notes.dart | 342 +++++++++++------- 2 files changed, 401 insertions(+), 260 deletions(-) diff --git a/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_notes_list.dart b/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_notes_list.dart index 3a2e150c..0ddabf74 100644 --- a/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_notes_list.dart +++ b/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_notes_list.dart @@ -2,6 +2,7 @@ import 'dart:convert'; 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_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_error_message.dart'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart'; @@ -129,139 +130,199 @@ class _BuildNotesListState extends State { 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, - // ), - // ) - ], - ), + builder: (context) => MIHWindow( + fullscreen: true, + windowTitle: selectednote.note_name, + windowTools: [ + IconButton( + onPressed: () { + deletePatientPopUp(selectednote.idpatient_notes); + }, + icon: Icon( + Icons.delete, + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), ), - 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, - ), - ), + ), + ], + onWindowTapClose: () { + Navigator.pop(context); + }, + windowBody: [ + MIHTextField( + controller: businessNameController, + hintText: "Office", + editable: false, + required: false, + ), + 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 diff --git a/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart b/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart index f676eb0c..2ec44343 100644 --- a/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart +++ b/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart @@ -1,6 +1,7 @@ import 'dart:convert'; 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_components/mih_pop_up_messages/mih_loading_circle.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; @@ -143,142 +144,221 @@ class _PatientNotesState extends State { 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(), - ), - ) - ], - ), - ), + builder: (context) => MIHWindow( + fullscreen: false, + windowTitle: "Add Note", + windowTools: const [], + onWindowTapClose: () { + Navigator.pop(context); + titleController.clear(); + noteTextController.clear(); + }, + windowBody: [ + MIHTextField( + controller: officeController, + hintText: "Office", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: doctorController, + hintText: "Created By", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: dateController, + hintText: "Created Date", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + 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, ), - Positioned( - top: 5, - right: 5, - width: 50, - height: 50, - child: IconButton( - onPressed: () { + ), + const SizedBox(height: 15.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + onTap: () { + if (isFieldsFilled()) { + addPatientNoteAPICall(); Navigator.pop(context); - titleController.clear(); - noteTextController.clear(); - }, - icon: Icon( - Icons.close, - color: MzanziInnovationHub.of(context)!.theme.errorColor(), - size: 35, - ), - ), + } 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(), ), - ], - ), + ) + ], ), ); + + // 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() {