diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c2d77da5..53981e90 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -654,8 +654,8 @@ const Map> localizedValues = { }, 'progressNoteSOAP': {'en': "Progress Note", 'ar': "ملاحظة التقدم"}, 'addProgressNote': {'en': "Add Progress Note", 'ar': "أضف ملاحظة التقدم"}, - 'createdBy': {'en': "Created By :", 'ar': "أضيفت : "}, - 'editedBy': {'en': "Edited By :", 'ar': "عدلت : "}, + 'createdBy': {'en': "Created By :", 'ar': "أضيفت من قبل : "}, + 'editedBy': {'en': "Edited By :", 'ar': "عدلت من قبل : "}, 'currentMedications': {'en': "Current Medications", 'ar': "الأدوية الحالية"}, 'noItem': { 'en': "No items exists in this list", @@ -783,7 +783,7 @@ const Map> localizedValues = { "open-rad": {"en": "Open Radiology Image", "ar": "فتح صور الاشعة"}, - 'fileNumber': {'en': "File Number: ", 'ar': " :رقم الملف"}, + 'fileNumber': {'en': "File Number: ", 'ar': "رقم الملف : "}, 'searchPatient-name': { 'en': 'Search Name, Medical File, Phone Number', 'ar': "اسم البحث ، الملف الطبي ، رقم الهاتف" @@ -946,4 +946,16 @@ const Map> localizedValues = { "approvals22": {"en": "Approvals", "ar": "التامين"}, "severe": {"en": "Severe", "ar": "الشدة"}, "graphDetails": {"en": "Graph Details", "ar": "تفاصيل الرسم البياني"}, + "addNewOrderSheet": {"en": "Add a New Order Sheet", "ar": "أضف ورقة طلب جديدة"}, + "addNewProgressNote": {"en": "Add a New Progress Note", "ar": "أضف ملاحظة تقدم جديدة"}, + "notePending": {"en": "Pending", "ar": "قيد الانتظار"}, + "noteCanceled": {"en": "Canceled", "ar": "ألغيت"}, + "noteVerified": {"en": "Verified", "ar": "تم التحقق"}, + 'noteVerify': {'en': 'Verify', 'ar': 'تحقق'}, + 'noteConfirm': {'en': 'Confirm', 'ar': 'تاكيد'}, + 'noteAdd': {'en': 'Add ', 'ar': 'اضف '}, + 'noteUpdateْْ': {'en': 'Update ', 'ar': 'تحديت'}, + 'orderSheet': {'en': 'Order Sheet', 'ar': 'ورقة الطلب'}, + + }; diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index d7506402..173115f9 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -42,9 +43,10 @@ class _ProgressNoteState extends State { var _isInit = true; bool isDischargedPatient = false; AuthViewModel authProvider; + ProjectViewModel projectViewModel; - - getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async { + getProgressNoteList(BuildContext context, PatientViewModel model, + {bool isLocalBusy = false}) async { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String token = await sharedPref.getString(TOKEN); @@ -59,7 +61,10 @@ class _ProgressNoteState extends State { tokenID: token, patientTypeID: patient.patientType, languageID: 2); - model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) { + model + .getPatientProgressNote(progressNoteRequest.toJson(), + isLocalBusy: isLocalBusy) + .then((c) { notesList = model.patientProgressNoteList; }); } @@ -67,97 +72,124 @@ class _ProgressNoteState extends State { @override Widget build(BuildContext context) { authProvider = Provider.of(context); - final routeArgs = ModalRoute.of(context).settings.arguments as Map; + projectViewModel = Provider.of(context); + final routeArgs = ModalRoute + .of(context) + .settings + .arguments as Map; PatiantInformtion patient = routeArgs['patient']; String arrivalType = routeArgs['arrivalType']; - if(routeArgs.containsKey('isDischargedPatient')) - isDischargedPatient = routeArgs['isDischargedPatient']; + if (routeArgs.containsKey('isDischargedPatient')) + isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( onModelReady: (model) => getProgressNoteList(context, model), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - // appBarTitle: TranslationBase.of(context).progressNote, - appBar: PatientProfileHeaderNewDesignAppBar( - patient, patient.patientType.toString() ?? '0', arrivalType,isInpatient: true,), - body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase.of(context).errorNoProgressNote) - : Container( - color: Colors.grey[200], + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + backgroundColor: Theme + .of(context) + .scaffoldBackgroundColor, + // appBarTitle: TranslationBase.of(context).progressNote, + appBar: PatientProfileHeaderNewDesignAppBar( + patient, + patient.patientType.toString() ?? '0', + arrivalType, + isInpatient: true, + ), + body: model.patientProgressNoteList == null || + model.patientProgressNoteList.length == 0 + ? DrAppEmbeddedError( + error: TranslationBase + .of(context) + .errorNoProgressNote) + : Container( + color: Colors.grey[200], child: Column( - children: [ - if(!isDischargedPatient) - AddNewOrder( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => UpdateNoteOrder( - patientModel: model, - patient: patient, - visitType: widget.visitType, - isUpdate: false, - )), - ); - },label: widget.visitType ==3?'Add a New Order Sheet':'Create a New Progress Note',), - Expanded( - child: Container( - - child: ListView.builder( - itemCount: model.patientProgressNoteList.length, - itemBuilder: (BuildContext ctxt, int index) { - return FractionallySizedBox( - widthFactor: 0.95, - child: CardWithBgWidget( - hasBorder: false, - bgColor: model.patientProgressNoteList[index] - .status == - 1 && - authProvider.doctorProfile.doctorID != - model - .patientProgressNoteList[ - index] - .createdBy - ? Color(0xFFCC9B14):model - .patientProgressNoteList[ - index] - .status == - 4?Colors.red.shade700 - : model - .patientProgressNoteList[ - index] - .status == - 2?Colors.green[600]:Color(0xFFCC9B14), - widget: Column( - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (model - .patientProgressNoteList[ - index] - .status == - 1 && - authProvider - .doctorProfile.doctorID != - model - .patientProgressNoteList[ - index] - .createdBy) - AppText( - 'Pending', - fontWeight: FontWeight.bold, - color: Color(0xFFCC9B14), - fontSize: 12, - ), + children: [ + if (!isDischargedPatient) + AddNewOrder( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + UpdateNoteOrder( + patientModel: model, + patient: patient, + visitType: widget.visitType, + isUpdate: false, + )), + ); + }, + label: widget.visitType == 3 + ? TranslationBase + .of(context) + .addNewOrderSheet + : TranslationBase + .of(context) + .addProgressNote, + ), + Expanded( + child: Container( + child: ListView.builder( + itemCount: model.patientProgressNoteList.length, + itemBuilder: (BuildContext ctxt, int index) { + return FractionallySizedBox( + widthFactor: 0.95, + child: CardWithBgWidget( + hasBorder: false, + bgColor: model.patientProgressNoteList[index] + .status == + 1 && + authProvider.doctorProfile.doctorID != + model + .patientProgressNoteList[ + index] + .createdBy + ? Color(0xFFCC9B14) + : model.patientProgressNoteList[index] + .status == + 4 + ? Colors.red.shade700 + : model.patientProgressNoteList[index] + .status == + 2 + ? Colors.green[600] + : Color(0xFFCC9B14), + widget: Column( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + if (model + .patientProgressNoteList[ + index] + .status == + 1 && + authProvider + .doctorProfile.doctorID != + model + .patientProgressNoteList[ + index] + .createdBy) + AppText( + TranslationBase + .of(context) + .notePending, + fontWeight: FontWeight.bold, + color: Color(0xFFCC9B14), + fontSize: 12, + ), if (model .patientProgressNoteList[ index] .status == 4) AppText( - 'Canceled', + TranslationBase + .of(context) + .noteCanceled, fontWeight: FontWeight.bold, color: Colors.red.shade700, fontSize: 12, @@ -168,7 +200,9 @@ class _ProgressNoteState extends State { .status == 2) AppText( - 'Verified', + TranslationBase + .of(context) + .noteVerified, fontWeight: FontWeight.bold, color: Colors.green[600], fontSize: 12, @@ -229,7 +263,10 @@ class _ProgressNoteState extends State { width: 2, ), AppText( - 'Update', + TranslationBase + .of( + context) + .update, fontSize: 10, color: Colors.white, ), @@ -309,7 +346,10 @@ class _ProgressNoteState extends State { width: 2, ), AppText( - 'Verify', + TranslationBase + .of( + context) + .noteVerify, fontSize: 10, color: Colors.white, ), @@ -325,22 +365,26 @@ class _ProgressNoteState extends State { onTap: () async { showMyDialog( context: context, - actionName: "cancel", + actionName: + TranslationBase + .of( + context) + .cancel, confirmFun: () async { GifLoaderDialogUtils .showMyDialog( context, ); UpdateNoteReqModel - reqModel = - UpdateNoteReqModel( + reqModel = + UpdateNoteReqModel( admissionNo: int .parse(patient - .admissionNo), + .admissionNo), cancelledNote: true, lineItemNo: model .patientProgressNoteList[ - index] + index] .lineItemNo, createdBy: model .patientProgressNoteList[ @@ -398,7 +442,6 @@ class _ProgressNoteState extends State { padding: EdgeInsets.all(6), ), ), - SizedBox( width: 10, ) @@ -428,7 +471,10 @@ class _ProgressNoteState extends State { .start, children: [ AppText( - 'Created By: ', + TranslationBase + .of( + context) + .createdBy, fontSize: 10, ), Expanded( @@ -452,26 +498,34 @@ class _ProgressNoteState extends State { children: [ AppText( model + .patientProgressNoteList[ + index] + .createdOn != + null + ? DateUtils + .getDayMonthYearDateFormatted( + DateUtils + .getDateTimeFromServerFormat( + model .patientProgressNoteList[ - index] - .createdOn != - null - ? DateUtils.getDayMonthYearDateFormatted( - DateUtils.getDateTimeFromServerFormat( - model - .patientProgressNoteList[ - index] - .createdOn)) + index] + .createdOn), + isArabic: + projectViewModel + .isArabic) : DateUtils - .getDayMonthYearDateFormatted( - DateTime.now()), + .getDayMonthYearDateFormatted( + DateTime.now(), + isArabic: + projectViewModel + .isArabic), fontWeight: FontWeight.w600, fontSize: 14, ), AppText( model - .patientProgressNoteList[ - index] + .patientProgressNoteList[ + index] .createdOn != null ? DateUtils.getHour(DateUtils @@ -508,21 +562,21 @@ class _ProgressNoteState extends State { ), ), ]) - ], - ), - SizedBox( - height: 20, - ), - ], - ), + ], + ), + SizedBox( + height: 20, + ), + ], ), - ); - }), - ), + ), + ); + }), ), - ], + ), + ], ), - ), + ), ), ); } @@ -541,38 +595,49 @@ class _ProgressNoteState extends State { isShowAppBar: false, body: Container( color: Colors.white, - child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ // SizedBox(height: 20,), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ AppText( - "Confirm", fontWeight: FontWeight.w600, + TranslationBase + .of(context) + .noteConfirm, + fontWeight: FontWeight.w600, color: Colors.black, - fontSize: 16,), + fontSize: 16, + ), ], ), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), DividerWithSpacesAround(), - SizedBox(height: 12,), + SizedBox( + height: 12, + ), Container( padding: EdgeInsets.all(20), color: Colors.white, child: AppText( - 'Are you sure you want $actionName this order?', + projectViewModel.isArabic?"هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟":'Are you sure you want $actionName this order?', fontSize: 15, textAlign: TextAlign.center, ), ), - SizedBox(height: 8,), + SizedBox( + height: 8, + ), DividerWithSpacesAround(), FractionallySizedBox( widthFactor: 0.75, @@ -581,22 +646,29 @@ class _ProgressNoteState extends State { children: [ FlatButton( child: AppText( - "Cancel", fontWeight: FontWeight.w600, + TranslationBase + .of(context) + .cancel, + fontWeight: FontWeight.w600, color: Colors.black, - fontSize: 16,),//Text("Cancel"), + fontSize: 16, + ), //Text("Cancel"), onPressed: () { Navigator.of(context).pop(); }), FlatButton( child: AppText( - "Confirm", fontWeight: FontWeight.w600, + TranslationBase + .of(context) + .noteConfirm, + fontWeight: FontWeight.w600, color: Colors.red.shade700, - fontSize: 16,), //Text("Confirm", ), + fontSize: 16, + ), //Text("Confirm", ), onPressed: () async { - await confirmFun(); + await confirmFun(); Navigator.of(context).pop(); }) - ], ), ) @@ -608,8 +680,4 @@ class _ProgressNoteState extends State { ), )); } - - - - } diff --git a/lib/screens/patients/profile/note/update_note.dart b/lib/screens/patients/profile/note/update_note.dart index 207e56a6..673a6e2b 100644 --- a/lib/screens/patients/profile/note/update_note.dart +++ b/lib/screens/patients/profile/note/update_note.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; @@ -22,6 +23,7 @@ import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; @@ -51,6 +53,8 @@ class _UpdateNoteOrderState extends State { stt.SpeechToText speech = stt.SpeechToText(); var reconizedWord; var event = RobotProvider(); + ProjectViewModel projectViewModel; + TextEditingController progressNoteController = TextEditingController(); setSelectedType(int val) { @@ -74,6 +78,8 @@ class _UpdateNoteOrderState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + if (widget.note != null) { progressNoteController.text = widget.note.notes; } @@ -91,8 +97,10 @@ class _UpdateNoteOrderState extends State { children: [ BottomSheetTitle( title: widget.visitType == 3 - ? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet' - : (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note', + ? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).orderSheet + : (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).progressNote, ), SizedBox( height: 10.0, @@ -106,10 +114,10 @@ class _UpdateNoteOrderState extends State { children: [ AppTextFieldCustom( hintText: widget.visitType == 3 - ? (widget.isUpdate ? 'Update' : 'Add') + - ' Order Sheet' - : (widget.isUpdate ? 'Update' : 'Add') + - ' Progress Note', + ? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).orderSheet + : (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).progressNote, //TranslationBase.of(context).addProgressNote, controller: progressNoteController, maxLines: 35, @@ -124,8 +132,8 @@ class _UpdateNoteOrderState extends State { : null, ), Positioned( - top: 0, //MediaQuery.of(context).size.height * 0, - right: 15, + top: -2, //MediaQuery.of(context).size.height * 0, + right: projectViewModel.isArabic? MediaQuery.of(context).size.width * 0.75 : 15, child: IconButton( icon: Icon( DoctorApp.speechtotext, @@ -155,8 +163,10 @@ class _UpdateNoteOrderState extends State { children: [ AppButton( title: widget.visitType == 3 - ? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet' - : (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note', + ? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).orderSheet + : (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + + TranslationBase.of(context).progressNote, color: Color(0xff359846), // disabled: progressNoteController.text.isEmpty, fontWeight: FontWeight.w700, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index cc6513d0..0519d99e 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1303,6 +1303,28 @@ class TranslationBase { String get severe => localizedValues["severe"][locale.languageCode]; String get graphDetails => localizedValues["graphDetails"][locale.languageCode]; + String get addNewOrderSheet => + localizedValues["addNewOrderSheet"][locale.languageCode]; + String get addNewProgressNote => + localizedValues["addNewProgressNote"][locale.languageCode]; + String get notePending => + localizedValues["notePending"][locale.languageCode]; + String get noteCanceled => + localizedValues["noteCanceled"][locale.languageCode]; + String get noteVerified => + localizedValues["noteVerified"][locale.languageCode]; + String get noteVerify => + localizedValues["noteVerify"][locale.languageCode]; + String get noteConfirm => + localizedValues["noteConfirm"][locale.languageCode]; + String get noteAdd => + localizedValues["noteAdd"][locale.languageCode]; + + String get noteUpdate => + localizedValues["noteUpdate"][locale.languageCode]; + + String get orderSheet => + localizedValues["orderSheet"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {