From 1491a04b3911261a4fa908b43f40f485208f52ad Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 12:54:34 +0200 Subject: [PATCH 1/8] PostPhysicalExam works --- lib/config/config.dart | 1 + lib/core/service/SOAP_service.dart | 12 ++ lib/core/viewModel/SOAP_view_model.dart | 11 ++ .../patients/profile/SOAP/objective_page.dart | 116 ++++++++++++++---- .../SOAP/subjective/subjective_page.dart | 7 +- 5 files changed, 123 insertions(+), 24 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 5355dac4..8d6c0935 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -107,6 +107,7 @@ const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLoo const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; var selectedPatientType = 1; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 1a8c91a1..44b304fc 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'base/lookup-service.dart'; @@ -60,4 +61,15 @@ class SOAPService extends LookupService { super.error = error; }, body: postChiefComplaintRequestModel.toJson()); } + + Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + hasError = false; + await baseAppClient.post(POST_PHYSICAL_EXAM, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postPhysicalExamRequestModel.toJson()); + } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 3ff33389..f43306f0 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -83,5 +84,15 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index a1b91864..894f7745 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -1,9 +1,11 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -49,7 +51,9 @@ class _ObjectivePageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return AppScaffold( + return BaseView( + // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + builder: (_, model, w) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -161,7 +165,12 @@ class _ObjectivePageState extends State { 0.070, decoration: containerBorderDecoration( - Colors.white, + examination + .isNormal + ? Color( + 0xFF515A5D) + : Colors + .white, Colors.grey), child: Center( child: Padding( @@ -173,17 +182,28 @@ class _ObjectivePageState extends State { style: TextStyle( fontSize: 12, color: - Colors.black, + examination + .isNormal + ? Colors.white + : Colors + .black, //Colors.black, fontWeight: - FontWeight - .bold, + FontWeight + .bold, ), ), ), )), ), - onTap: () {}), + onTap: () { + setState(() { + examination.isAbnormal = + !examination.isAbnormal; + examination.isNormal = + !examination.isNormal; + }); + }), SizedBox( width: 12, ), @@ -191,33 +211,49 @@ class _ObjectivePageState extends State { child: Center( child: Container( height: - screenSize.height * - 0.070, + screenSize.height * + 0.070, decoration: - containerBorderDecoration( - Color(0xFF515A5D), - Colors.black), + containerBorderDecoration( + examination + .isAbnormal + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors.black), child: Center( child: Padding( padding: - const EdgeInsets - .all(8.0), + const EdgeInsets + .all(8.0), child: Text( "Abnormal", style: TextStyle( fontSize: 12, color: - Colors.white, + examination + .isAbnormal + ? Colors.white + : Colors + .black, //Colors.black, fontWeight: - FontWeight - .bold, + FontWeight + .bold, ), ), ), )), ), - onTap: () {}), + onTap: () { + setState(() { + examination.isAbnormal = + !examination.isAbnormal; + examination.isNormal = + !examination.isNormal; + }); + }), ], ), InkWell( @@ -267,9 +303,11 @@ class _ObjectivePageState extends State { ), DividerWithSpacesAround(height: 30,), AppButton( - title: TranslationBase.of(context).next, - onPressed: () { - widget.changePageViewIndex(2); + title: TranslationBase + .of(context) + .next, + onPressed: () async { + await submitObjectivePage(model); }, ), SizedBox( @@ -279,7 +317,43 @@ class _ObjectivePageState extends State { ), ), ), - )); + ))); + } + + submitObjectivePage(SOAPViewModel model) async { + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalVM = []; + + postPhysicalExamRequestModel.listHisProgNotePhysicalVM.add( + ListHisProgNotePhysicalVM( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + remarks: exam.remark ?? '', + createdBy: 1485, + createdOn: DateTime.now().toIso8601String(), + editedBy: 1485, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + masterDescription: exam.selectedExamination, + )); + }); + + await model.postPhysicalExam(postPhysicalExamRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + } + // TODO move it back to else stat when it work. + widget.changePageViewIndex(2); + } removeExamination(MasterKeyModel masterKey) { diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index ae024b10..9100cb76 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -140,7 +140,8 @@ class _SubjectivePageState extends State { SizedBox( height: 20, ), - AddMedication(), + // TODO return it back when we need it. + // AddMedication(), ]), ), isExpand: isChiefExpand, @@ -305,9 +306,9 @@ class _SubjectivePageState extends State { remarks: allergy.remark, createdBy: 1485, // - createdOn: "2020-08-14T20:37:22.780Z", + createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", editedBy: 1485, - editedOn: "2020-08-14T20:37:22.780Z", + editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z", isChecked: false, isUpdatedByNurse: false)); }); From f97d11183dd39b130e9f6ee9a1c5dfa71a3d9a46 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 14:42:04 +0200 Subject: [PATCH 2/8] progress Note --- .../post_progress_note_request_model.dart | 25 +++++++++ lib/models/patient/patiant_info_model.dart | 17 ------ .../patients/profile/SOAP/objective_page.dart | 13 +++-- .../patients/profile/SOAP/plan_page.dart | 53 ++++++++++++------- 4 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 lib/models/SOAP/post_progress_note_request_model.dart diff --git a/lib/models/SOAP/post_progress_note_request_model.dart b/lib/models/SOAP/post_progress_note_request_model.dart new file mode 100644 index 00000000..7bbea882 --- /dev/null +++ b/lib/models/SOAP/post_progress_note_request_model.dart @@ -0,0 +1,25 @@ +class PostProgressNoteRequestModel { + int appointmentNo; + int episodeId; + int patientMRN; + String planNote; + + PostProgressNoteRequestModel( + {this.appointmentNo, this.episodeId, this.patientMRN, this.planNote}); + + PostProgressNoteRequestModel.fromJson(Map json) { + appointmentNo = json['appointmentNo']; + episodeId = json['episodeId']; + patientMRN = json['patientMRN']; + planNote = json['planNote']; + } + + Map toJson() { + final Map data = new Map(); + data['appointmentNo'] = this.appointmentNo; + data['episodeId'] = this.episodeId; + data['patientMRN'] = this.patientMRN; + data['planNote'] = this.planNote; + return data; + } +} diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 2b2fd876..9eec55ca 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -1,20 +1,3 @@ -import 'dart:convert'; - -//PatiantInformtion patiantInformtionFromJson(String str) => PatiantInformtion.fromJson(json.decode(str)); - -////String patiantInformtionToJson(PatiantInformtion data) => json.encode(data.toJson()); -//****************************** */ - -/* - *@author: Amjad Amireh - *@Date:27/4/2020 - *@param: - *@return:Patian information Model - - *@desc: - */ - - class PatiantInformtion { final List list; diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 894f7745..922314b9 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -303,13 +303,12 @@ class _ObjectivePageState extends State { ), DividerWithSpacesAround(height: 30,), AppButton( - title: TranslationBase - .of(context) - .next, - onPressed: () async { - await submitObjectivePage(model); - }, - ), + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + onPressed: () async { + await submitObjectivePage(model); + }, + ), SizedBox( height: 30, ), diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart index 7b5ddcdc..9bf907d9 100644 --- a/lib/widgets/patients/profile/SOAP/plan_page.dart +++ b/lib/widgets/patients/profile/SOAP/plan_page.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; @@ -42,7 +44,9 @@ class _PlanPageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return AppScaffold( + return BaseView( + // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + builder: (_, model, w) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -98,7 +102,7 @@ class _PlanPageState extends State { hintText: "Add Progress Note", fontSize: 13.5, onTapTextFields: () { - openExaminationList(context); + openProgressNote(context); }, readOnly: true, // hintColor: Colors.black, @@ -159,10 +163,14 @@ class _PlanPageState extends State { ), Padding( padding: const EdgeInsets.all(0.0), - child: AppText( - "Some progress note about", - fontSize: 10, - color: Colors.grey, + child: Container( + width: MediaQuery.of(context).size.width * 0.6, + child: AppText( + progressNoteController.text, + fontSize: 10, + + color: Colors.grey, + ), ), ), ], @@ -207,7 +215,9 @@ class _PlanPageState extends State { Column( children: [ InkWell( - onTap: () {}, + onTap: () { + openProgressNote(context); + }, child: Icon(EvaIcons.edit2Outline), ) ], @@ -227,20 +237,22 @@ class _PlanPageState extends State { widget.changePageViewIndex(2); }, ), - SizedBox( - height: 30, + SizedBox( + height: 30, + ), + ], ), - ], + ), ), - ), - ), - )); + ),),); } - openExaminationList(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { + openProgressNote(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -291,7 +303,7 @@ class _PlanPageState extends State { Container( margin: EdgeInsets.only(left: 0, right: 0, top: 15), child: TextFields( - hintText: "Remarks", + hintText: "Add progress note here", fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, @@ -300,7 +312,9 @@ class _PlanPageState extends State { controller: progressNoteController, validator: (value) { if (value == null) - return TranslationBase.of(context).emptyMessage; + return TranslationBase + .of(context) + .emptyMessage; else return null; }), @@ -310,6 +324,7 @@ class _PlanPageState extends State { AppButton( title: "Add".toUpperCase(), onPressed: () { + Navigator.of(context).pop(); }, ), ]), From b22fd3f7ba48aac707fd3c91e9107b1a07d2f482 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 15:59:06 +0200 Subject: [PATCH 3/8] fix listHisProgNotePhysicalExaminationVM --- .../post_physical_exam_request_model.dart | 26 +++++++++---------- .../patients/profile/SOAP/objective_page.dart | 10 ++++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart index f9f23897..adc8daf7 100644 --- a/lib/models/SOAP/post_physical_exam_request_model.dart +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -1,31 +1,31 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class PostPhysicalExamRequestModel { - List listHisProgNotePhysicalVM; + List listHisProgNotePhysicalExaminationVM; - PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM}); + PostPhysicalExamRequestModel({this.listHisProgNotePhysicalExaminationVM}); PostPhysicalExamRequestModel.fromJson(Map json) { - if (json['listHisProgNotePhysicalVM'] != null) { - listHisProgNotePhysicalVM = new List(); - json['listHisProgNotePhysicalVM'].forEach((v) { - listHisProgNotePhysicalVM - .add(new ListHisProgNotePhysicalVM.fromJson(v)); + if (json['listHisProgNotePhysicalExaminationVM'] != null) { + listHisProgNotePhysicalExaminationVM = new List(); + json['listHisProgNotePhysicalExaminationVM'].forEach((v) { + listHisProgNotePhysicalExaminationVM + .add(new ListHisProgNotePhysicalExaminationVM.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); - if (this.listHisProgNotePhysicalVM != null) { - data['listHisProgNotePhysicalVM'] = - this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList(); + if (this.listHisProgNotePhysicalExaminationVM != null) { + data['listHisProgNotePhysicalExaminationVM'] = + this.listHisProgNotePhysicalExaminationVM.map((v) => v.toJson()).toList(); } return data; } } -class ListHisProgNotePhysicalVM { +class ListHisProgNotePhysicalExaminationVM { int episodeId; int appointmentNo; int examType; @@ -41,7 +41,7 @@ class ListHisProgNotePhysicalVM { bool notExamined; MasterKeyModel masterDescription; - ListHisProgNotePhysicalVM( + ListHisProgNotePhysicalExaminationVM( {this.episodeId, this.appointmentNo, this.examType, @@ -57,7 +57,7 @@ class ListHisProgNotePhysicalVM { this.notExamined, this.masterDescription}); - ListHisProgNotePhysicalVM.fromJson(Map json) { + ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { episodeId = json['episodeId']; appointmentNo = json['appointmentNo']; examType = json['examType']; diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 922314b9..5f9d6f2c 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -322,12 +322,12 @@ class _ObjectivePageState extends State { submitObjectivePage(SOAPViewModel model) async { PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalVM == + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) - postPhysicalExamRequestModel.listHisProgNotePhysicalVM = []; + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - postPhysicalExamRequestModel.listHisProgNotePhysicalVM.add( - ListHisProgNotePhysicalVM( + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + ListHisProgNotePhysicalExaminationVM( patientMRN: 3120690, episodeId: 200012117, appointmentNo: 2016054573, @@ -341,6 +341,8 @@ class _ObjectivePageState extends State { isAbnormal: exam.isAbnormal, isNormal: exam.isNormal, masterDescription: exam.selectedExamination, + notExamined: false + )); }); From dc4250a4def72b8846f7c4146eb5e03761fe3457 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 18:45:15 +0200 Subject: [PATCH 4/8] Post progress Note --- lib/config/config.dart | 1 + lib/core/service/SOAP_service.dart | 34 ++- lib/core/viewModel/SOAP_view_model.dart | 11 + .../post_progress_note_request_model.dart | 16 +- lib/util/helpers.dart | 5 +- .../patients/profile/SOAP/add_SOAP_index.dart | 11 +- .../patients/profile/SOAP/objective_page.dart | 57 ++-- .../patients/profile/SOAP/plan_page.dart | 282 +++++++++--------- 8 files changed, 230 insertions(+), 187 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 8d6c0935..bc2fd0db 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -108,6 +108,7 @@ const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; var selectedPatientType = 1; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 44b304fc..e5d2023c 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'base/lookup-service.dart'; @@ -56,20 +57,33 @@ class SOAPService extends LookupService { await baseAppClient.post(POST_CHIEF_COMPLAINT, onSuccess: (dynamic response, int statusCode) { print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postChiefComplaintRequestModel.toJson()); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postChiefComplaintRequestModel.toJson()); } - Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { + Future postPhysicalExam( + PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { hasError = false; await baseAppClient.post(POST_PHYSICAL_EXAM, onSuccess: (dynamic response, int statusCode) { - print("Success"); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: postPhysicalExamRequestModel.toJson()); + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postPhysicalExamRequestModel.toJson()); + } + + Future postProgressNote( + PostProgressNoteRequestModel postProgressNoteRequestModel) async { + hasError = false; + await baseAppClient.post(POST_PROGRESS_NOTE, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postProgressNoteRequestModel.toJson()); } } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index f43306f0..b9a96f6c 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -94,5 +95,15 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postProgressNote(postProgressNoteRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + } diff --git a/lib/models/SOAP/post_progress_note_request_model.dart b/lib/models/SOAP/post_progress_note_request_model.dart index 7bbea882..2217d4ee 100644 --- a/lib/models/SOAP/post_progress_note_request_model.dart +++ b/lib/models/SOAP/post_progress_note_request_model.dart @@ -8,18 +8,18 @@ class PostProgressNoteRequestModel { {this.appointmentNo, this.episodeId, this.patientMRN, this.planNote}); PostProgressNoteRequestModel.fromJson(Map json) { - appointmentNo = json['appointmentNo']; - episodeId = json['episodeId']; - patientMRN = json['patientMRN']; - planNote = json['planNote']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + patientMRN = json['PatientMRN']; + planNote = json['PlanNote']; } Map toJson() { final Map data = new Map(); - data['appointmentNo'] = this.appointmentNo; - data['episodeId'] = this.episodeId; - data['patientMRN'] = this.patientMRN; - data['planNote'] = this.planNote; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['PatientMRN'] = this.patientMRN; + data['PlanNote'] = this.planNote; return data; } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 0c3f1b5f..c1d70cef 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -348,7 +348,8 @@ class Helpers { String lang = await sharedPref.getString(APP_Language); await clearSharedPref(); sharedPref.setString(APP_Language, lang); - // Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); - Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); + Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + // TODO Fix it + // Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); } } diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 705bc85f..f1d81812 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -108,10 +108,13 @@ class _AddSOAPIndexState extends State ), ], ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, + Container( + width: MediaQuery.of(context).size.width *0.65, + child: AppText( + "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), ), ], ) diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 5f9d6f2c..add9ca16 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -320,38 +320,41 @@ class _ObjectivePageState extends State { } submitObjectivePage(SOAPViewModel model) async { - PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); - widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + if(widget.mySelectedExamination.isNotEmpty){ + PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( - ListHisProgNotePhysicalExaminationVM( - patientMRN: 3120690, - episodeId: 200012117, - appointmentNo: 2016054573, - remarks: exam.remark ?? '', - createdBy: 1485, - createdOn: DateTime.now().toIso8601String(), - editedBy: 1485, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - masterDescription: exam.selectedExamination, - notExamined: false + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( + ListHisProgNotePhysicalExaminationVM( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + remarks: exam.remark ?? '', + createdBy: 1485, + createdOn: DateTime.now().toIso8601String(), + editedBy: 1485, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + masterDescription: exam.selectedExamination, + notExamined: false - )); - }); + )); + }); - await model.postPhysicalExam(postPhysicalExamRequestModel); + await model.postPhysicalExam(postPhysicalExamRequestModel); - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + } } + // TODO move it back to else stat when it work. widget.changePageViewIndex(2); diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart index 9bf907d9..3e5ca10a 100644 --- a/lib/widgets/patients/profile/SOAP/plan_page.dart +++ b/lib/widgets/patients/profile/SOAP/plan_page.dart @@ -1,5 +1,8 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -27,7 +30,9 @@ class _PlanPageState extends State { List progressNoteList; - TextEditingController progressNoteController = TextEditingController(); + TextEditingController progressNoteController = + TextEditingController(text: null); + BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { return BoxDecoration( @@ -40,6 +45,7 @@ class _PlanPageState extends State { )), ); } + @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; @@ -112,7 +118,8 @@ class _PlanPageState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase.of(context) + return TranslationBase + .of(context) .emptyMessage; else return null; @@ -121,110 +128,117 @@ class _PlanPageState extends State { SizedBox( height: 20, ), - Container( - margin: EdgeInsets.only(left: 5, right: 5, top: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - "12".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "DEC".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + if (progressNoteController.text.isNotEmpty) + Container( + margin: + EdgeInsets.only(left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "12".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "DEC".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - SizedBox( - height: 6, - ), - Padding( - padding: const EdgeInsets.all(0.0), - child: Container( - width: MediaQuery.of(context).size.width * 0.6, - child: AppText( - progressNoteController.text, - fontSize: 10, + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + Padding( + padding: const EdgeInsets.all(0.0), + child: Container( + width: MediaQuery + .of(context) + .size + .width * 0.6, + child: AppText( + progressNoteController.text, + fontSize: 10, - color: Colors.grey, + color: Colors.grey, + ), ), ), - ), - ], - ),SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Created By : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Anas Abdullah on 12 De", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Edited By : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Rahim on 13 Dec", - fontSize: 10, - color: Colors.grey, - ), - ], - ), + ], + ), SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Created By : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Anas Abdullah on 12 De", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Edited By : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Rahim on 13 Dec", + fontSize: 10, + color: Colors.grey, + ), + ], + ), - ], - ), - Column( - children: [ - InkWell( - onTap: () { - openProgressNote(context); - }, - child: Icon(EvaIcons.edit2Outline), - ) - ], - ), - ], - ), - ) + ], + ), + Column( + children: [ + InkWell( + onTap: () { + openProgressNote(context); + }, + child: Icon(EvaIcons.edit2Outline), + ) + ], + ), + ], + ), + ) ], ) ]), @@ -232,50 +246,46 @@ class _PlanPageState extends State { ), DividerWithSpacesAround(height: 30,), AppButton( - title: TranslationBase.of(context).next, + title: TranslationBase + .of(context) + .next, + loading: model.state == ViewState.BusyLocal, onPressed: () { - widget.changePageViewIndex(2); + + submitPlan(model); + // widget.changePageViewIndex(2); }, ), - SizedBox( - height: 30, - ), - ], + SizedBox( + height: 30, ), - ), + ], ), - ),),); + ), + ), + ),),); } - openProgressNote(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); + submitPlan(SOAPViewModel model) async { + if (progressNoteController.text.isNotEmpty) { + PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( + patientMRN: 3120690, + episodeId: 200012117, + appointmentNo: 2016054573, + planNote: progressNoteController.text); + + + await model.postProgressNote(postProgressNoteRequestModel); + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + Navigator.of(context).pop(); + } } + } - ; + openProgressNote(BuildContext context) { showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, From 1672d9a3a0ef83bfd777a3f120617b3d05a0034a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 20:42:24 +0200 Subject: [PATCH 5/8] add assessment_page code --- lib/core/enum/master_lookup_key.dart | 9 +- lib/core/service/base/lookup-service.dart | 17 + lib/core/viewModel/SOAP_view_model.dart | 2 + lib/models/SOAP/my_selected_assement.dart | 47 + .../patients/profile/SOAP/add_SOAP_index.dart | 4 +- .../profile/SOAP/assessment_page.dart | 931 ++++++++++-------- 6 files changed, 598 insertions(+), 412 deletions(-) create mode 100644 lib/models/SOAP/my_selected_assement.dart diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart index 03937710..a4010858 100644 --- a/lib/core/enum/master_lookup_key.dart +++ b/lib/core/enum/master_lookup_key.dart @@ -7,7 +7,9 @@ enum MasterKeysService { HistorySurgical, PhysicalExamination, AllergySeverity, - physiotherapyGoals + physiotherapyGoals, + DiagnosisCondition, + DiagnosisType } extension SelectedMasterKeysService on MasterKeysService { @@ -40,6 +42,11 @@ extension SelectedMasterKeysService on MasterKeysService { break; case MasterKeysService.physiotherapyGoals: return 117; + break;case MasterKeysService.DiagnosisCondition: + return 34; + break; + case MasterKeysService.DiagnosisType: + return 35; break; } } diff --git a/lib/core/service/base/lookup-service.dart b/lib/core/service/base/lookup-service.dart index 02371dd8..2053eb15 100644 --- a/lib/core/service/base/lookup-service.dart +++ b/lib/core/service/base/lookup-service.dart @@ -31,6 +31,8 @@ class LookupService extends BaseService { List _physicalExaminationList = []; List listOfPhysiotherapyGoals = []; + List listOfDiagnosisType = []; + List listOfDiagnosisCondition = []; Future getMasterLookup(MasterKeysService masterKeys) async { hasError = false; @@ -111,6 +113,21 @@ class LookupService extends BaseService { .add(MasterKeyModel.fromJson(v)); }); break; + + case MasterKeysService.DiagnosisType: + listOfDiagnosisType.clear(); + entryList.forEach((v) { + listOfDiagnosisType + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.DiagnosisCondition: + listOfDiagnosisCondition.clear(); + entryList.forEach((v) { + listOfDiagnosisCondition + .add(MasterKeyModel.fromJson(v)); + }); + break; } } } \ No newline at end of file diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index b9a96f6c..e8cde824 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -32,6 +32,8 @@ class SOAPViewModel extends BaseViewModel { List get historySurgicalList => _SOAPService.historySurgicalList; List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; List get physicalExaminationList => _SOAPService.physicalExaminationList; + List get listOfDiagnosisType => _SOAPService.listOfDiagnosisType; + List get listOfDiagnosisCondition => _SOAPService.listOfDiagnosisCondition; diff --git a/lib/models/SOAP/my_selected_assement.dart b/lib/models/SOAP/my_selected_assement.dart new file mode 100644 index 00000000..b5f82379 --- /dev/null +++ b/lib/models/SOAP/my_selected_assement.dart @@ -0,0 +1,47 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAssessment { + MasterKeyModel selectedICD; + MasterKeyModel selectedDiagnosisCondition; + MasterKeyModel selectedDiagnosisType; + String remark; + int appointmentId; + + MySelectedAssessment( + {this.selectedICD, + this.selectedDiagnosisCondition, + this.selectedDiagnosisType, + this.remark, this.appointmentId}); + + MySelectedAssessment.fromJson(Map json) { + selectedICD = json['selectedICD'] != null + ? new MasterKeyModel.fromJson(json['selectedICD']) + : null; + selectedDiagnosisCondition = json['selectedDiagnosisCondition'] != null + ? new MasterKeyModel.fromJson(json['selectedDiagnosisCondition']) + : null; + selectedDiagnosisType = json['selectedDiagnosisType'] != null + ? new MasterKeyModel.fromJson(json['selectedDiagnosisType']) + : null; + remark = json['remark']; + appointmentId = json['appointmentId']; + } + + Map toJson() { + final Map data = new Map(); + + if (this.selectedICD != null) { + data['selectedICD'] = this.selectedICD.toJson(); + } + if (this.selectedDiagnosisCondition != null) { + data['selectedICD'] = this.selectedDiagnosisCondition.toJson(); + } + if (this.selectedDiagnosisType != null) { + data['selectedICD'] = this.selectedDiagnosisType.toJson(); + } + data['remark'] = this.remark; + data['appointmentId'] = this.appointmentId; + + return data; + } +} diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index f1d81812..a6f792c8 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart' import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -32,6 +33,7 @@ class _AddSOAPIndexState extends State List myAllergiesList= List(); List myHistoryList = List(); List mySelectedExamination = List(); + MySelectedAssessment mySelectedAssessment = new MySelectedAssessment(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -159,7 +161,7 @@ class _AddSOAPIndexState extends State children: [ SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination), - AssessmentPage(changePageViewIndex: changePageViewIndex,), + AssessmentPage(changePageViewIndex: changePageViewIndex,mySelectedAssessment:mySelectedAssessment), PlanPage(changePageViewIndex: changePageViewIndex,) ], ), diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 2f747d52..3bd9f0f1 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -1,11 +1,16 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; @@ -14,8 +19,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class AssessmentPage extends StatefulWidget { final Function changePageViewIndex; + final MySelectedAssessment mySelectedAssessment; - AssessmentPage({Key key, this.changePageViewIndex}); + AssessmentPage( + {Key key, this.changePageViewIndex, this.mySelectedAssessment}); @override _AssessmentPageState createState() => _AssessmentPageState(); @@ -33,61 +40,64 @@ class _AssessmentPageState extends State { Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; - return AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('ASSESSMENT', - variant: isAssessmentExpand ? "bodyText" : '', - bold: isAssessmentExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isAssessmentExpand = !isAssessmentExpand; - }); - }, - child: Icon(isAssessmentExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column(children: [ + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ SizedBox( - height: 20, + height: 30, ), - Column( - children: [ - Container( - margin: EdgeInsets.only(left: 5, right: 5, top: 15), - child: TextFields( - hintText: "Add ASSESSMENT", - fontSize: 13.5, - onTapTextFields: () { - openAssessmentDialog(context); + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('ASSESSMENT', + variant: + isAssessmentExpand ? "bodyText" : '', + bold: isAssessmentExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isAssessmentExpand = !isAssessmentExpand; + }); }, + child: Icon(isAssessmentExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 5, right: 5, top: 15), + child: TextFields( + hintText: "Add ASSESSMENT", + fontSize: 13.5, + onTapTextFields: () { + openAssessmentDialog(context); + }, readOnly: true, // hintColor: Colors.black, suffixIcon: EvaIcons.plusCircleOutline, @@ -96,184 +106,247 @@ class _AssessmentPageState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase.of(context) + return TranslationBase + .of(context) .emptyMessage; else return null; }), + ), + SizedBox( + height: 20, + ), + if(widget.mySelectedAssessment != null && + widget.mySelectedAssessment + .appointmentId != + null && widget.mySelectedAssessment + .selectedDiagnosisType != null && + widget.mySelectedAssessment + .selectedDiagnosisCondition != null) + Container( + margin: EdgeInsets.only( + left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment + .start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "12".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "DEC".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Appointment #: ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + widget.mySelectedAssessment + .appointmentId + .toString(), + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Type : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + widget.mySelectedAssessment + .selectedDiagnosisType + .nameEn, + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Doc : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Anas Abdullah", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + SizedBox( + height: 6, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + AppText( + "Some short remark about the allergy", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Row( + + children: [ + AppText( + "ICD: ".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "R07.1".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + children: [ + InkWell( + onTap: () {}, + child: Icon(EvaIcons + .edit2Outline), + ) + ], + ), + ], + ), + ) + ], + ) + ]), + isExpand: isAssessmentExpand, + ), + DividerWithSpacesAround( + height: 30, + ), + AppButton( + title: TranslationBase + .of(context) + .next, + onPressed: () { + widget.changePageViewIndex(3); + }, ), SizedBox( - height: 20, + height: 30, ), - Container( - margin: EdgeInsets.only(left: 5, right: 5, top: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - "12".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "DEC".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Appointment #: ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "2019054946", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Typhoid Fever", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Type : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Possible Diagnosis", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Doc : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Anas Abdullah", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - SizedBox( - height: 6, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - SizedBox( - height: 6, - ), - AppText( - "Some short remark about the allergy", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - - children: [ - AppText( - "ICD: ".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "R07.1".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - children: [ - InkWell( - onTap: () {}, - child: Icon(EvaIcons.edit2Outline), - ) - ], - ), - ], - ), - ) ], - ) - ]), - isExpand: isAssessmentExpand, - ), - DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase.of(context).next, - onPressed: () { - widget.changePageViewIndex(3); - }, - ), - SizedBox( - height: 30, + ), + ), ), - ], - ), - ), - ), - )); + ))); } openAssessmentDialog(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddAssessmentDetails( + mySelectedAssessment: widget.mySelectedAssessment, + addSelectedAssessment: () { + setState(() { + Navigator.of(context).pop(); + }); + }); + }); + } + +} + +class AddAssessmentDetails extends StatefulWidget { + final MySelectedAssessment mySelectedAssessment; + final Function() addSelectedAssessment; + + const AddAssessmentDetails( + {Key key, this.mySelectedAssessment, this.addSelectedAssessment}) + : super(key: key); + + @override + _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); +} + +class _AddAssessmentDetailsState extends State { + MasterKeyModel _selectedDiagnosisCondition; + MasterKeyModel _selectedDiagnosisType; + TextEditingController remarkController = TextEditingController(); + TextEditingController appointmentIdController = TextEditingController( + text: "234567"); + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { //TODO: make one Input InputDecoration for all return InputDecoration( focusedBorder: OutlineInputBorder( @@ -296,199 +369,237 @@ class _AssessmentPageState extends State { ), ); } - - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return FractionallySizedBox( - heightFactor: 0.75, - widthFactor: 0.9, - - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Add Assessment Details".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { + return FractionallySizedBox( + heightFactor: 0.75, + child: BaseView( + onModelReady: (model) async { + if (model.listOfDiagnosisCondition.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisCondition); + } + if (model.listOfDiagnosisType.length == 0) { + await model.getMasterLookup(MasterKeysService.DiagnosisType); + } + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + "Add Assessment Details".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Appointment Number", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + readOnly: true, + controller: appointmentIdController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisCondition != + null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + _selectedDiagnosisCondition = + selectedValue; + widget.mySelectedAssessment + .selectedDiagnosisCondition = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Condition", + _selectedDiagnosisCondition != null + ? _selectedDiagnosisCondition + .nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisCondition != + null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + _selectedDiagnosisCondition = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Condition", + _selectedDiagnosisCondition != null + ? _selectedDiagnosisCondition + .nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + okText: TranslationBase + .of(context) + .ok, + okFunction: ( + MasterKeyModel selectedValue) { + setState(() { + _selectedDiagnosisType = + selectedValue; + widget.mySelectedAssessment + .selectedDiagnosisType = + _selectedDiagnosisType; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Type", + _selectedDiagnosisType != null + ? _selectedDiagnosisType.nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 18, + minLines: 5, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { setState(() { - // model.getDoctorBranch().then((value) { - // _selectedBranch = value; - // if (_referTo['id'] == 1) { - // model.getClinics( - // _selectedBranch['ID']); - // } - // }); + widget.mySelectedAssessment.remark = + remarkController.text; + widget.mySelectedAssessment + .appointmentId = int.parse( + appointmentIdController.text); + + widget.addSelectedAssessment(); }); }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Appointment Number", - _referTo != null ? _referTo['name'] : null, - true), - enabled: false, - ), - ), + ), + ])), ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() {}); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration("Name or ICD", - _referTo != null ? _referTo['name'] : null, true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() {}); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration("Condition", - _referTo != null ? _referTo['name'] : null, true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: assessmentList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: assessmentList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() {}); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration("Type", - _referTo != null ? _referTo['name'] : null, true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 18, - minLines: 8, - controller: remarksController, - validator: (value) { - if (value == null) - return TranslationBase.of(context).emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () {}, - ), - ])), - ); - }); + ), + ))), + ); } } + From ab9740ccdd7a3da12a28a54def11a7754078b6a2 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 28 Dec 2020 20:51:16 +0200 Subject: [PATCH 6/8] remove Vida Auth from config --- lib/config/config.dart | 2 -- pubspec.lock | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 51dd4e37..edb34b5e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -180,8 +180,6 @@ const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; const PATIENT_OUT_SA = false; -const VIDA_AUTH = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiMmI5ZTZlYmYtZmYzMC00ZmEyLTgwYjUtZGJlODM2MmZlNmNhIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1NzU3MTYiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwNzk3Mjk1MCwiZXhwIjoxNjA4ODM2OTUwLCJpYXQiOjE2MDc5NzI5NTB9.nHDltbMuIA3o4Gqa7mQ88fowDy6Oey9fG1zF45dumec'; /// Timer Info const TIMER_MIN = 10; diff --git a/pubspec.lock b/pubspec.lock index 0135ce10..ce581365 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "14.0.0" + version: "12.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.41.1" + version: "0.40.6" archive: dependency: transitive description: @@ -112,7 +112,7 @@ packages: name: build_web_compilers url: "https://pub.dartlang.org" source: hosted - version: "2.15.3" + version: "2.12.2" built_collection: dependency: transitive description: @@ -475,7 +475,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -732,7 +732,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: @@ -867,5 +867,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.11.0-162.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0" From 7c4e0d929f2eae3d824396a8286901d841fcfc4b Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 29 Dec 2020 14:17:19 +0200 Subject: [PATCH 7/8] fix base app client --- ios/Podfile.lock | 56 ++++++++++++++++++++++++++++++--- lib/client/base_app_client.dart | 53 +++++++++++++++++-------------- 2 files changed, 82 insertions(+), 27 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 0575cdb6..62e86469 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -7,6 +7,8 @@ PODS: - connectivity (0.0.1): - Flutter - Reachability + - connectivity_for_web (0.1.0): + - Flutter - connectivity_macos (0.0.1): - Flutter - device_info (0.0.1): @@ -22,17 +24,27 @@ PODS: - Flutter - local_auth (0.0.1): - Flutter + - maps_launcher (0.0.1): + - Flutter - MTBBarcodeScanner (5.0.11) - OpenTok (2.15.3) - - "permission_handler (5.0.0+hotfix.5)": + - path_provider_linux (0.0.1): + - Flutter + - path_provider_windows (0.0.1): + - Flutter + - "permission_handler (5.0.1+1)": - Flutter - Reachability (3.2) - shared_preferences (0.0.1): - Flutter + - shared_preferences_linux (0.0.1): + - Flutter - shared_preferences_macos (0.0.1): - Flutter - shared_preferences_web (0.0.1): - Flutter + - shared_preferences_windows (0.0.1): + - Flutter - speech_to_text (0.0.1): - Flutter - Try @@ -40,15 +52,20 @@ PODS: - Try (2.1.1) - url_launcher (0.0.1): - Flutter + - url_launcher_linux (0.0.1): + - Flutter - url_launcher_macos (0.0.1): - Flutter - url_launcher_web (0.0.1): - Flutter + - url_launcher_windows (0.0.1): + - Flutter DEPENDENCIES: - Alamofire - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) + - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - device_info (from `.symlinks/plugins/device_info/ios`) - Flutter (from `Flutter`) @@ -57,15 +74,22 @@ DEPENDENCIES: - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - imei_plugin (from `.symlinks/plugins/imei_plugin/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) + - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - OpenTok + - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) + - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) + - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) + - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) SPEC REPOS: trunk: @@ -81,6 +105,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/barcode_scan/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" + connectivity_for_web: + :path: ".symlinks/plugins/connectivity_for_web/ios" connectivity_macos: :path: ".symlinks/plugins/connectivity_macos/ios" device_info: @@ -97,27 +123,42 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/imei_plugin/ios" local_auth: :path: ".symlinks/plugins/local_auth/ios" + maps_launcher: + :path: ".symlinks/plugins/maps_launcher/ios" + path_provider_linux: + :path: ".symlinks/plugins/path_provider_linux/ios" + path_provider_windows: + :path: ".symlinks/plugins/path_provider_windows/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_linux: + :path: ".symlinks/plugins/shared_preferences_linux/ios" shared_preferences_macos: :path: ".symlinks/plugins/shared_preferences_macos/ios" shared_preferences_web: :path: ".symlinks/plugins/shared_preferences_web/ios" + shared_preferences_windows: + :path: ".symlinks/plugins/shared_preferences_windows/ios" speech_to_text: :path: ".symlinks/plugins/speech_to_text/ios" url_launcher: :path: ".symlinks/plugins/url_launcher/ios" + url_launcher_linux: + :path: ".symlinks/plugins/url_launcher_linux/ios" url_launcher_macos: :path: ".symlinks/plugins/url_launcher_macos/ios" url_launcher_web: :path: ".symlinks/plugins/url_launcher_web/ios" + url_launcher_windows: + :path: ".symlinks/plugins/url_launcher_windows/ios" SPEC CHECKSUMS: Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18 barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 - connectivity: 6e94255659cc86dcbef1d452ad3e0491bb1b3e75 + connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 + connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec @@ -126,20 +167,27 @@ SPEC CHECKSUMS: hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 imei_plugin: cb1af7c223ac2d82dcd1457a7137d93d65d2a3cd local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd + maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb OpenTok: fde03ecc5ea31fe0a453242847c4ee1f47e1d735 - permission_handler: 6226fcb78b97c7c7458a95c7346a11d5184fec12 + path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 + path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b + permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 + shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932 Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef + url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c + url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.9.3 +COCOAPODS: 1.10.0 diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index ed14ecac..db4e7a56 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -41,6 +41,8 @@ class BaseAppClient { if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + body.containsKey('patientArrivalList'); + if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; @@ -79,7 +81,7 @@ class BaseAppClient { 'Accept': 'application/json' }); final int statusCode = response.statusCode; - if (statusCode < 200 || statusCode >= 400 || json == null) { + if (statusCode < 200 || statusCode >= 400 ) { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); @@ -90,29 +92,12 @@ class BaseAppClient { // helpers.showErrorToast('Your session expired Please login agian'); // } else if (parsed['MessageStatus'] == 1) { - onSuccess(parsed, statusCode); + if(!parsed['IsAuthenticated']) + onFailure(getError(parsed), statusCode); + else + onSuccess(parsed, statusCode); } else { - String error = - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; - - if (parsed["ValidationErrors"] != null) { - error = - parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; - - if (parsed["ValidationErrors"]["ValidationErrors"] != null && - parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { - error = error + - parsed["ValidationErrors"]["ValidationErrors"][i] - ["Messages"][0] + - "\n"; - } - } - } - - onFailure(error, statusCode); + onFailure(getError(parsed), statusCode); } } } else { @@ -123,4 +108,26 @@ class BaseAppClient { onFailure(e.toString(), -1); } } + + String getError(parsed){ + //TODO change this fun + String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; + if (parsed["ValidationErrors"] != null) { + + error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + + if (parsed["ValidationErrors"]["ValidationErrors"] != null && + parsed["ValidationErrors"]["ValidationErrors"].length != 0) { + for (var i = 0; + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { + error = error + + parsed["ValidationErrors"]["ValidationErrors"][i] + ["Messages"][0] + + "\n"; + } + } + } + return error; + } } From df838831399006a140896369b94ef7fa9cd1a582 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 29 Dec 2020 14:17:35 +0200 Subject: [PATCH 8/8] fix base app client --- lib/client/base_app_client.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index db4e7a56..015cf0f5 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -40,9 +40,6 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - - body.containsKey('patientArrivalList'); - if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID;