From 9fb3abab7ed7e0b8dd253a5cb72fa6a8cce7f904 Mon Sep 17 00:00:00 2001 From: yaso Date: Thu, 7 Nov 2024 09:34:24 +0200 Subject: [PATCH] Doctor to only be able to delete their notes. --- .../patient_profile/builder/build_files_list.dart | 6 +++++- .../patient_profile/builder/build_notes_list.dart | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_files_list.dart b/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_files_list.dart index 66747056..c69d1d10 100644 --- a/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_files_list.dart +++ b/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_files_list.dart @@ -188,6 +188,10 @@ class _BuildFilesListState extends State { } void viewFilePopUp(String fileName, String filePath, int fileID, String url) { + bool hasAccessToDelete = false; + if (widget.type == "business") { + hasAccessToDelete = true; + } showDialog( context: context, barrierDismissible: false, @@ -206,7 +210,7 @@ class _BuildFilesListState extends State { ], windowTools: [ Visibility( - visible: widget.type == "business", + visible: hasAccessToDelete, child: IconButton( onPressed: () { deleteFilePopUp(filePath, fileID); 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 a31fc2d5..d79d37ef 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 @@ -129,6 +129,11 @@ class _BuildNotesListState extends State { userNameController.text = selectednote.doctor; dateController.text = selectednote.insert_date; }); + bool hasAccessToDelete = false; + if (widget.type == "business" && + selectednote.doc_office == widget.business!.Name) { + hasAccessToDelete = true; + } showDialog( context: context, barrierDismissible: false, @@ -137,7 +142,7 @@ class _BuildNotesListState extends State { windowTitle: selectednote.note_name, windowTools: [ Visibility( - visible: widget.type == "business", + visible: hasAccessToDelete, child: IconButton( onPressed: () { deletePatientPopUp(selectednote.idpatient_notes);