From c779568d243408cefe9270ea8eeb3aa457d2621f Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Tue, 27 Aug 2024 12:37:00 +0200 Subject: [PATCH] Add note creator details --- .../components/builders/buildNotesList.dart | 14 ++++- .../lib/components/patientNotes.dart | 62 ++++++++++++++++--- 2 files changed, 66 insertions(+), 10 deletions(-) diff --git a/Frontend/patient_manager/lib/components/builders/buildNotesList.dart b/Frontend/patient_manager/lib/components/builders/buildNotesList.dart index 86b80338..c9a8a367 100644 --- a/Frontend/patient_manager/lib/components/builders/buildNotesList.dart +++ b/Frontend/patient_manager/lib/components/builders/buildNotesList.dart @@ -37,6 +37,7 @@ class BuildNotesList extends StatefulWidget { } class _BuildNotesListState extends State { + final noteTitleController = TextEditingController(); final noteTextController = TextEditingController(); final businessNameController = TextEditingController(); final userNameController = TextEditingController(); @@ -119,6 +120,7 @@ class _BuildNotesListState extends State { void viewNotePopUp(Note selectednote) { setState(() { + noteTitleController.text = selectednote.note_name; noteTextController.text = selectednote.note_text; businessNameController.text = selectednote.doc_office; userNameController.text = selectednote.doctor; @@ -184,7 +186,17 @@ class _BuildNotesListState extends State { width: 700, child: MIHTextField( controller: dateController, - hintText: "Created", + 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, ), diff --git a/Frontend/patient_manager/lib/components/patientNotes.dart b/Frontend/patient_manager/lib/components/patientNotes.dart index d227bd4f..01740a86 100644 --- a/Frontend/patient_manager/lib/components/patientNotes.dart +++ b/Frontend/patient_manager/lib/components/patientNotes.dart @@ -43,6 +43,9 @@ class _PatientNotesState extends State { String apiUrlAddNote = "${AppEnviroment.baseApiUrl}/notes/insert/"; final titleController = TextEditingController(); final noteTextController = TextEditingController(); + final officeController = TextEditingController(); + final dateController = TextEditingController(); + final doctorController = TextEditingController(); late Future> futueNotes; Future> fetchNotes(String endpoint) async { @@ -61,10 +64,10 @@ class _PatientNotesState extends State { } Future addPatientNoteAPICall() async { - String title = ""; - if (widget.businessUser!.title == "Doctor") { - title = "Dr."; - } + // String title = ""; + // if (widget.businessUser!.title == "Doctor") { + // title = "Dr."; + // } var response = await http.post( Uri.parse("${AppEnviroment.baseApiUrl}/notes/insert/"), headers: { @@ -73,9 +76,8 @@ class _PatientNotesState extends State { body: jsonEncode({ "note_name": titleController.text, "note_text": noteTextController.text, - "doc_office": widget.business!.Name, - "doctor": - "$title ${widget.signedInUser.fname} ${widget.signedInUser.lname}", + "doc_office": officeController.text, + "doctor": doctorController.text, "app_id": widget.selectedPatient.app_id, }), ); @@ -126,6 +128,18 @@ class _PatientNotesState extends State { } void addNotePopUp() { + DateTime now = new DateTime.now(); + DateTime date = new DateTime(now.year, now.month, now.day); + var title = ""; + if (widget.businessUser!.title == "Doctor") { + title = "Dr."; + } + setState(() { + officeController.text = widget.business!.Name; + doctorController.text = + "$title ${widget.signedInUser.fname} ${widget.signedInUser.lname}"; + dateController.text = date.toString().substring(0, 10); + }); showDialog( context: context, barrierDismissible: false, @@ -159,16 +173,46 @@ class _PatientNotesState extends State { ), ), 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: "Title of Note", + hintText: "Note Title", editable: true, required: true, ), ), - const SizedBox(height: 25.0), + const SizedBox(height: 10.0), Expanded( child: MIHMLTextField( controller: noteTextController,