From a618292d20c333b7f7ae541f94ae1045bbfdf4dd Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 7 Feb 2021 10:23:22 +0200 Subject: [PATCH 01/10] bug fixes for DA-284-DA-285 --- lib/config/config.dart | 2 +- lib/config/localized_values.dart | 2 ++ .../service/patient-doctor-referral-service.dart | 1 + .../profile/referral/my-referral-detail-screen.dart | 6 ++++++ lib/util/translations_delegate_base.dart | 2 ++ .../patients/patient-referral-item-widget.dart | 13 ++++++++----- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 765874b4..c09f57e5 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -72,7 +72,7 @@ const CREATE_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/CreateReferral'; const RESPONSE_PENDING_REFERRAL_PATIENT = - 'Services/DoctorApplication.svc/REST/CreateReferral'; + 'Services/DoctorApplication.svc/REST/RespondReferral'; const GET_PATIENT_REFERRAL = 'Services/DoctorApplication.svc/REST/GetRefferal'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ea4df903..4d47d71c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -697,5 +697,7 @@ const Map> localizedValues = { 'referralResponse': {'en': "Referral Response : ", 'ar': " : استجابة الإحالة"}, 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, + 'referralSuccessMsgAccept': {'en': "Referral Accepted Successfully", 'ar': "تم قبول الإحالة بنجاح"}, + 'referralSuccessMsgReject': {'en': "Referral Rejected Successfully", 'ar': "تم رفض الإحالة بنجاح"}, // 'icd': {'en': "ICD", 'ar': " "}, }; diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index 69f8e5e5..77af017c 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -209,6 +209,7 @@ class PatientReferralService extends LookupService { await baseAppClient.post( RESPONSE_PENDING_REFERRAL_PATIENT, onSuccess: (dynamic response, int statusCode) { + print(response); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 433fe232..f1f3c918 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -154,6 +154,9 @@ class MyReferralDetailScreen extends StatelessWidget { pendingReferral, true); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); + Navigator.pop(context); } }, ), @@ -174,6 +177,9 @@ class MyReferralDetailScreen extends StatelessWidget { pendingReferral, true); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); + Navigator.pop(context); } }, ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c0c7d73d..11b5fa7f 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1086,6 +1086,8 @@ class TranslationBase { String get referralResponse => localizedValues['referralResponse'][locale.languageCode]; String get estimatedCost => localizedValues['estimatedCost'][locale.languageCode]; String get diagnosisDetail => localizedValues['diagnosisDetail'][locale.languageCode]; + String get referralSuccessMsgAccept => localizedValues['referralSuccessMsgAccept'][locale.languageCode]; + String get referralSuccessMsgReject => localizedValues['referralSuccessMsgReject'][locale.languageCode]; String get patientName => localizedValues['patient-name'][locale.languageCode]; diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index 5924c89c..ee54917b 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -175,6 +175,7 @@ class PatientReferralItemWidget extends StatelessWidget { height: 8, ), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context).referralRemark, @@ -182,11 +183,13 @@ class PatientReferralItemWidget extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 12, ), - AppText( - remark, - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 12, + Expanded( + child: AppText( + remark, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), ), ], ), From a5a7425a099d7a61b3dd1d08660797e7c93e54b3 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 7 Feb 2021 14:58:32 +0200 Subject: [PATCH 02/10] fix DA-149 --- lib/config/localized_values.dart | 1 + .../SOAP/GetPhysicalExamListResModel.dart | 26 ++- lib/models/SOAP/my_selected_examination.dart | 12 +- .../post_physical_exam_request_model.dart | 150 ++++++++++-------- lib/util/translations_delegate_base.dart | 1 + .../soap_update/update_objective_page.dart | 70 +++++++- 6 files changed, 184 insertions(+), 76 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2ded6152..cbd6436c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -592,6 +592,7 @@ const Map> localizedValues = { 'allergicTO': {'en': "ALLERGIC TO ", 'ar': " حساس من"}, 'normal': {'en': "Normal", 'ar': "عادي"}, 'abnormal': {'en': "Abnormal", 'ar': " غير عادي"}, + 'notExamined': {'en': "Not Examined", 'ar': "لم يتم الفحص"}, "systolic-lng": {"en": "Systolic", "ar": "الإنقباض"}, "diastolic-lng": {"en": "Diastolic", "ar": "الإنبساط"}, "mass": {"en": "Mass", "ar": "كتلة"}, diff --git a/lib/models/SOAP/GetPhysicalExamListResModel.dart b/lib/models/SOAP/GetPhysicalExamListResModel.dart index f9b2f44f..c97189b1 100644 --- a/lib/models/SOAP/GetPhysicalExamListResModel.dart +++ b/lib/models/SOAP/GetPhysicalExamListResModel.dart @@ -1,13 +1,19 @@ class GetPhysicalExamResModel { int appointmentNo; int createdBy; + String createdByName; String createdOn; - int editedBy; + Null editedBy; + String editedByName; String editedOn; int episodeId; int examId; + String examName; int examType; + int examinationType; + String examinationTypeName; bool isAbnormal; + bool isNew; bool isNormal; bool notExamined; int patientMRN; @@ -16,13 +22,19 @@ class GetPhysicalExamResModel { GetPhysicalExamResModel( {this.appointmentNo, this.createdBy, + this.createdByName, this.createdOn, this.editedBy, + this.editedByName, this.editedOn, this.episodeId, this.examId, + this.examName, this.examType, + this.examinationType, + this.examinationTypeName, this.isAbnormal, + this.isNew, this.isNormal, this.notExamined, this.patientMRN, @@ -31,13 +43,19 @@ class GetPhysicalExamResModel { GetPhysicalExamResModel.fromJson(Map json) { appointmentNo = json['appointmentNo']; createdBy = json['createdBy']; + createdByName = json['createdByName']; createdOn = json['createdOn']; editedBy = json['editedBy']; + editedByName = json['editedByName']; editedOn = json['editedOn']; episodeId = json['episodeId']; examId = json['examId']; + examName = json['examName']; examType = json['examType']; + examinationType = json['examinationType']; + examinationTypeName = json['examinationTypeName']; isAbnormal = json['isAbnormal']; + isNew = json['isNew']; isNormal = json['isNormal']; notExamined = json['notExamined']; patientMRN = json['patientMRN']; @@ -48,13 +66,19 @@ class GetPhysicalExamResModel { final Map data = new Map(); data['appointmentNo'] = this.appointmentNo; data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; data['createdOn'] = this.createdOn; data['editedBy'] = this.editedBy; + data['editedByName'] = this.editedByName; data['editedOn'] = this.editedOn; data['episodeId'] = this.episodeId; data['examId'] = this.examId; + data['examName'] = this.examName; data['examType'] = this.examType; + data['examinationType'] = this.examinationType; + data['examinationTypeName'] = this.examinationTypeName; data['isAbnormal'] = this.isAbnormal; + data['isNew'] = this.isNew; data['isNormal'] = this.isNormal; data['notExamined'] = this.notExamined; data['patientMRN'] = this.patientMRN; diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart index 5a717a4e..d2946f29 100644 --- a/lib/models/SOAP/my_selected_examination.dart +++ b/lib/models/SOAP/my_selected_examination.dart @@ -5,6 +5,8 @@ class MySelectedExamination { String remark; bool isNormal; bool isAbnormal; + bool notExamined; + bool isNew; int createdBy; MySelectedExamination( @@ -12,6 +14,8 @@ class MySelectedExamination { this.remark, this.isNormal = true, this.isAbnormal = false, + this.notExamined = false, + this.isNew = true, this.createdBy}); MySelectedExamination.fromJson(Map json) { @@ -19,8 +23,10 @@ class MySelectedExamination { ? new MasterKeyModel.fromJson(json['selectedExamination']) : null; remark = json['remark']; - remark = json['isNormal']; - remark = json['isAbnormal']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + isNew = json['isNew']; createdBy = json['createdBy']; } @@ -33,6 +39,8 @@ class MySelectedExamination { data['remark'] = this.remark; data['isNormal'] = this.isNormal; data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['isNew'] = this.isNew; data['createdBy'] = this.createdBy; return data; } diff --git a/lib/models/SOAP/post_physical_exam_request_model.dart b/lib/models/SOAP/post_physical_exam_request_model.dart index 46a104f1..d1b64837 100644 --- a/lib/models/SOAP/post_physical_exam_request_model.dart +++ b/lib/models/SOAP/post_physical_exam_request_model.dart @@ -25,75 +25,91 @@ class PostPhysicalExamRequestModel { } } -class ListHisProgNotePhysicalExaminationVM { - int episodeId; - int appointmentNo; - int examType; - int examId; - int patientMRN; - bool isNormal; - bool isAbnormal; - String remarks; - int createdBy; - String createdOn; - int editedBy; - String editedOn; - bool notExamined; - MasterKeyModel masterDescription; + class ListHisProgNotePhysicalExaminationVM { + int episodeId; + int appointmentNo; + int examType; + int examId; + int patientMRN; + bool isNormal; + bool isAbnormal; + bool notExamined; + String examName; + String examinationTypeName; + int examinationType; + String remarks; + bool isNew; + int createdBy; + String createdOn; + String createdByName; + int editedBy; + String editedOn; + String editedByName; - ListHisProgNotePhysicalExaminationVM( - {this.episodeId, - this.appointmentNo, - this.examType, - this.examId, - this.patientMRN, - this.isNormal, - this.isAbnormal, - this.remarks, - this.createdBy, - this.createdOn, - this.editedBy, - this.editedOn, - this.notExamined, - this.masterDescription}); + ListHisProgNotePhysicalExaminationVM( + {this.episodeId, + this.appointmentNo, + this.examType, + this.examId, + this.patientMRN, + this.isNormal, + this.isAbnormal, + this.notExamined, + this.examName, + this.examinationTypeName, + this.examinationType, + this.remarks, + this.isNew, + this.createdBy, + this.createdOn, + this.createdByName, + this.editedBy, + this.editedOn, + this.editedByName}); - ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { - episodeId = json['episodeId']; - appointmentNo = json['appointmentNo']; - examType = json['examType']; - examId = json['examId']; - patientMRN = json['patientMRN']; - isNormal = json['isNormal']; - isAbnormal = json['isAbnormal']; - remarks = json['remarks']; - createdBy = json['createdBy']; - createdOn = json['createdOn']; - editedBy = json['editedBy']; - editedOn = json['editedOn']; - notExamined = json['notExamined']; - masterDescription = json['masterDescription'] != null - ? new MasterKeyModel.fromJson(json['masterDescription']) - : null; - } + ListHisProgNotePhysicalExaminationVM.fromJson(Map json) { + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + examType = json['examType']; + examId = json['examId']; + patientMRN = json['patientMRN']; + isNormal = json['isNormal']; + isAbnormal = json['isAbnormal']; + notExamined = json['notExamined']; + examName = json['examName']; + examinationTypeName = json['examinationTypeName']; + examinationType = json['examinationType']; + remarks = json['remarks']; + isNew = json['isNew']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + createdByName = json['createdByName']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + editedByName = json['editedByName']; + } - Map toJson() { - final Map data = new Map(); - data['episodeId'] = this.episodeId; - data['appointmentNo'] = this.appointmentNo; - data['examType'] = this.examType; - data['examId'] = this.examId; - data['patientMRN'] = this.patientMRN; - data['isNormal'] = this.isNormal; - data['isAbnormal'] = this.isAbnormal; - data['remarks'] = this.remarks; - data['createdBy'] = this.createdBy; - data['createdOn'] = this.createdOn; - data['editedBy'] = this.editedBy; - data['editedOn'] = this.editedOn; - data['notExamined'] = this.notExamined; - if (this.masterDescription != null) { - data['masterDescription'] = this.masterDescription.toJson(); + Map toJson() { + final Map data = new Map(); + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['examType'] = this.examType; + data['examId'] = this.examId; + data['patientMRN'] = this.patientMRN; + data['isNormal'] = this.isNormal; + data['isAbnormal'] = this.isAbnormal; + data['notExamined'] = this.notExamined; + data['examName'] = this.examName; + data['examinationTypeName'] = this.examinationTypeName; + data['examinationType'] = this.examinationType; + data['remarks'] = this.remarks; + data['isNew'] = this.isNew; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['createdByName'] = this.createdByName; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + data['editedByName'] = this.editedByName; + return data; } - return data; } -} \ No newline at end of file diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c192d7b9..a3c058a8 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -940,6 +940,7 @@ class TranslationBase { String get allergicTO => localizedValues['allergicTO'][locale.languageCode]; String get normal => localizedValues['normal'][locale.languageCode]; + String get notExamined => localizedValues['notExamined'][locale.languageCode]; String get abnormal => localizedValues['abnormal'][locale.languageCode]; diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index 93182207..af960ff7 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -85,6 +85,8 @@ class _UpdateObjectivePageState extends State { remark: element.remarks, isNormal: element.isNormal, createdBy: element.createdBy, + notExamined: element.notExamined, + isNew: element.isNew, isAbnormal: element.isAbnormal); widget.mySelectedExamination.add(tempEam); }); @@ -243,9 +245,10 @@ class _UpdateObjectivePageState extends State { onTap: () { setState(() { examination.isAbnormal = - !examination.isAbnormal; + false; examination.isNormal = - !examination.isNormal; + true; + examination.notExamined = false; }); }), SizedBox( @@ -290,12 +293,63 @@ class _UpdateObjectivePageState extends State { ), )), ), + onTap: () { + setState(() { + examination.isNormal = + false; + examination.isAbnormal = + true; + examination.notExamined = false; + }); + }),SizedBox( + width: 12, + ), + InkWell( + child: Center( + child: Container( + height: + screenSize.height * + 0.070, + decoration: + containerBorderDecoration( + examination + .notExamined + ? Color( + 0xFF515A5D) + : Colors + .white, + Colors.black), + child: Center( + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: Text( + "Not Examined", + style: TextStyle( + fontSize: 12, + color: + examination + .notExamined + ? Colors.white + : Colors + .black, + //Colors.black, + fontWeight: + FontWeight + .bold, + ), + ), + ), + )), + ), onTap: () { setState(() { examination.isAbnormal = - !examination.isAbnormal; + false; examination.isNormal = - !examination.isNormal; + false; + examination.notExamined = true; }); }), ], @@ -394,13 +448,17 @@ class _UpdateObjectivePageState extends State { examType: exam.selectedExamination.typeId, isAbnormal: exam.isAbnormal, isNormal: exam.isNormal, - masterDescription: exam.selectedExamination, - notExamined: false + // masterDescription: exam.selectedExamination, + notExamined: exam.notExamined, + examinationType: exam.isNormal?1:exam.isAbnormal?2:3, + examinationTypeName: exam.isNormal?"Normal":exam.isAbnormal?'AbNormal':"Not Examined", + isNew:exam.isNew )); }); if(model.patientPhysicalExamList.isEmpty) { + await model.postPhysicalExam(postPhysicalExamRequestModel); } else { await model.patchPhysicalExam(postPhysicalExamRequestModel); From 248367fbe9f7d6c263a1611854b74f99150e2efd Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 7 Feb 2021 15:36:19 +0200 Subject: [PATCH 03/10] fix DA-220 --- lib/config/localized_values.dart | 2 +- .../profile/lab_result/lab_orders_screen.dart | 29 ++++++++++++- .../lab_result/lab_result_secreen.dart | 42 ++++++++++++++----- lib/util/translations_delegate_base.dart | 1 + lib/widgets/doctor/lab_result_widget.dart | 2 +- .../patients/profile/large_avatar.dart | 17 +++++--- 6 files changed, 73 insertions(+), 20 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 697900bf..9b9012b7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -698,5 +698,5 @@ const Map> localizedValues = { 'referralResponse': {'en': "Referral Response : ", 'ar': " : استجابة الإحالة"}, 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, - // 'icd': {'en': "ICD", 'ar': " "}, + 'orderNo': {'en': "Order No : ", 'ar': "رقم الطلب"}, }; diff --git a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart index 3dff441c..75e4c33b 100644 --- a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart +++ b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart @@ -143,6 +143,9 @@ class _LabOrdersScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ + if(model + .patientLabResultOrdersList[index] + .doctorName != null ) AppText( '${model .patientLabResultOrdersList[index] @@ -171,7 +174,7 @@ class _LabOrdersScreenState extends State { MainAxisAlignment.start, children: [ AppText( - ' Invoice No :', + TranslationBase.of(context).invoiceNo, fontSize: 2 * SizeConfig .textMultiplier, @@ -187,6 +190,30 @@ class _LabOrdersScreenState extends State { color: Colors.grey[800], ), ], + ),SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).orderNo, + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${model + .patientLabResultOrdersList[index] + .orderNo}', + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Colors.grey[800], + ), + ], ) ], ), diff --git a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart index d41f388d..dd8ace01 100644 --- a/lib/screens/patients/profile/lab_result/lab_result_secreen.dart +++ b/lib/screens/patients/profile/lab_result/lab_result_secreen.dart @@ -37,19 +37,39 @@ class _LabResultState extends State { child: ListView( children: [ CardWithBgWidgetNew( - widget: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).invoiceNo, - fontSize: 2 * SizeConfig.textMultiplier, - color: Colors.grey[800], + widget: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).orderNo, + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${widget.labOrders.orderNo}', + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + ], ), - AppText( - ' ${widget.labOrders.invoiceNo}', - fontSize: 2 * SizeConfig.textMultiplier, - color: Colors.grey[800], + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).invoiceNo, + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + AppText( + ' ${widget.labOrders.invoiceNo}', + fontSize: 2 * SizeConfig.textMultiplier, + color: Colors.grey[800], + ), + ], ), + ], ), ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 30585015..44fc9532 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -248,6 +248,7 @@ class TranslationBase { localizedValues['errorNoProgressNote'][locale.languageCode]; String get invoiceNo => localizedValues['invoiceNo:'][locale.languageCode]; + String get orderNo => localizedValues['orderNo'][locale.languageCode]; String get generalResult => localizedValues['generalResult'][locale.languageCode]; diff --git a/lib/widgets/doctor/lab_result_widget.dart b/lib/widgets/doctor/lab_result_widget.dart index 8b2ab0c4..e897f33e 100644 --- a/lib/widgets/doctor/lab_result_widget.dart +++ b/lib/widgets/doctor/lab_result_widget.dart @@ -27,7 +27,7 @@ class _LabResultWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( diff --git a/lib/widgets/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart index d18fdf3d..e98c2de4 100644 --- a/lib/widgets/patients/profile/large_avatar.dart +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -24,16 +25,20 @@ class LargeAvatar extends StatelessWidget { Widget _getAvatar() { if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) { - return Center( + return CircleAvatar( + radius: + SizeConfig.imageSizeMultiplier * 12, + // radius: (52) child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(radius)), + borderRadius:BorderRadius.circular(50), + child: Image.network( - url.trim(), - fit: BoxFit.cover, - width: width, - height: height, + url, + fit: BoxFit.fill, + width: 700, ), ), + backgroundColor: Colors.transparent, ); } else if (name == null || name.isEmpty) { return Center( From ff33afd124c9be3fbdcd1490774942e7af408fa0 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 7 Feb 2021 17:10:09 +0200 Subject: [PATCH 04/10] fix DA-149 --- lib/models/SOAP/my_selected_examination.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart index d2946f29..393af944 100644 --- a/lib/models/SOAP/my_selected_examination.dart +++ b/lib/models/SOAP/my_selected_examination.dart @@ -12,9 +12,9 @@ class MySelectedExamination { MySelectedExamination( {this.selectedExamination, this.remark, - this.isNormal = true, + this.isNormal = false, this.isAbnormal = false, - this.notExamined = false, + this.notExamined = true, this.isNew = true, this.createdBy}); From 8d154239bb76d61f7dd89bc373515fe42d0dbbf1 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 8 Feb 2021 10:57:32 +0200 Subject: [PATCH 05/10] finish admission request feature --- lib/config/config.dart | 2 + lib/config/localized_values.dart | 9 + .../patient-admission-request-service.dart | 49 +- .../patient-admission-request-viewmodel.dart | 24 + lib/routes.dart | 3 +- .../admission-request-first-screen.dart | 487 +++++++++ .../admission-request-third-screen.dart | 717 +++++++------- .../admission-request_second-screen.dart | 932 +++++++----------- lib/util/translations_delegate_base.dart | 12 +- 9 files changed, 1291 insertions(+), 944 deletions(-) create mode 100644 lib/screens/patients/profile/admission-request/admission-request-first-screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index c09f57e5..6c4da7b1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -192,7 +192,9 @@ const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; const DRUG_TO_DRUG = 'Services/DoctorApplication.svc/REST/DrugToDrugInteraction'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; +const GET_FLOORS = 'Services/DoctorApplication.svc/REST/GetFloors'; const GET_WARDS = 'Services/DoctorApplication.svc/REST/GetWards'; +const GET_ROOM_CATEGORIES = 'Services/DoctorApplication.svc/REST/GetRoomCategories'; const GET_DIAGNOSIS_TYPES = 'Services/DoctorApplication.svc/REST/DiagnosisTypes'; const GET_DIET_TYPES = 'Services/DoctorApplication.svc/REST/DietTypes'; const GET_ICD_CODES = 'Services/DoctorApplication.svc/REST/GetICDCodes'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4d47d71c..bad03075 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -699,5 +699,14 @@ const Map> localizedValues = { 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, 'referralSuccessMsgAccept': {'en': "Referral Accepted Successfully", 'ar': "تم قبول الإحالة بنجاح"}, 'referralSuccessMsgReject': {'en': "Referral Rejected Successfully", 'ar': "تم رفض الإحالة بنجاح"}, + 'sickLeaveComments': {'en': "Sick leave comments", 'ar': "تعليقات إجازة مرضية"}, + 'pastMedicalHistory': {'en': "Past medical history", 'ar': "التاريخ الطبي"}, + 'pastSurgicalHistory': {'en': "Past surgical history", 'ar': "التاريخ الجراحي"}, + 'complications': {'en': "Complications", 'ar': "المضاعفات"}, + 'floor': {'en': "Floor", 'ar': "الطابق"}, + 'roomCategory': {'en': "Room category", 'ar': "فئة الغرفة"}, + 'otherDepartmentsInterventions': {'en': "Other departments interventions", 'ar': "تدخلات الأقسام الأخرى"}, + 'otherProcedure': {'en': "Other procedure", 'ar': "إجراء آخر"}, + 'admissionRequestSuccessMsg': {'en': "Admission Request Created Successfully", 'ar': "تم إنشاء طلب القبول بنجاح"}, // 'icd': {'en': "ICD", 'ar': " "}, }; diff --git a/lib/core/service/patient-admission-request-service.dart b/lib/core/service/patient-admission-request-service.dart index c287c160..093c4066 100644 --- a/lib/core/service/patient-admission-request-service.dart +++ b/lib/core/service/patient-admission-request-service.dart @@ -8,12 +8,15 @@ class AdmissionRequestService extends LookupService { List clinicList = []; List doctorsList = []; List specialityList = []; + List floorList = []; List wardList = []; + List roomCategoryList = []; List diagnosisTypesList = []; List allergiesLookupList = []; List dietTypesList = []; List icdCodes = []; + setSpecialityList() { specialityList.clear(); listOfSpeciality.forEach((element) { @@ -68,6 +71,28 @@ class AdmissionRequestService extends LookupService { ); } + Future getFloors() async { + hasError = false; + + await baseAppClient.post( + GET_FLOORS, + onSuccess: (dynamic response, int statusCode) { + floorList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + floorList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + Future getWardList() async { hasError = false; @@ -91,6 +116,28 @@ class AdmissionRequestService extends LookupService { ); } + Future getRoomCategories() async { + hasError = false; + + await baseAppClient.post( + GET_ROOM_CATEGORIES, + onSuccess: (dynamic response, int statusCode) { + roomCategoryList.clear(); + if (response['AdmissionMasterList'] != null && + response['AdmissionMasterList']['entityList'] != null) { + response['AdmissionMasterList']['entityList'].forEach((v) { + roomCategoryList.add(v); + }); + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: Map(), + ); + } + Future getDiagnosisTypesList() async { hasError = false; @@ -173,7 +220,7 @@ class AdmissionRequestService extends LookupService { await baseAppClient.post( POST_ADMISSION_REQUEST, onSuccess: (dynamic response, int statusCode) { - print(response); + print(response["admissionResponse"]["success"]); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/patient-admission-request-viewmodel.dart b/lib/core/viewModel/patient-admission-request-viewmodel.dart index 5b079512..44261c26 100644 --- a/lib/core/viewModel/patient-admission-request-viewmodel.dart +++ b/lib/core/viewModel/patient-admission-request-viewmodel.dart @@ -19,8 +19,12 @@ class AdmissionRequestViewModel extends BaseViewModel{ List get speciality => _admissionRequestService.specialityList; + List get floorList => _admissionRequestService.floorList; + List get wardList => _admissionRequestService.wardList; + List get roomCategoryList => _admissionRequestService.roomCategoryList; + List get admissionTypeList => _admissionRequestService.listOfAdmissionType; List get diagnosisTypesList => _admissionRequestService.diagnosisTypesList; @@ -63,6 +67,16 @@ class AdmissionRequestViewModel extends BaseViewModel{ setState(ViewState.Idle); } + Future getFloors() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getFloors(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future getWards() async { setState(ViewState.BusyLocal); await _admissionRequestService.getWardList(); @@ -73,6 +87,16 @@ class AdmissionRequestViewModel extends BaseViewModel{ setState(ViewState.Idle); } + Future getRoomCategories() async { + setState(ViewState.BusyLocal); + await _admissionRequestService.getRoomCategories(); + if (_admissionRequestService.hasError) { + error = _admissionRequestService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future getDiagnosis() async { setState(ViewState.BusyLocal); await _admissionRequestService.getDiagnosisTypesList(); diff --git a/lib/routes.dart b/lib/routes.dart index 6c5fc954..a339e664 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -45,6 +45,7 @@ import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; import 'screens/patients/profile/admission-request/admission-request-detail-screen.dart'; +import 'screens/patients/profile/admission-request/admission-request-first-screen.dart'; import 'screens/patients/profile/admission-request/admission-request-third-screen.dart'; import 'screens/patients/profile/admission-request/admission-request_second-screen.dart'; import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; @@ -137,7 +138,7 @@ var routes = { PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), PATIENT_VITAL_SIGN: (_) => PatientVitalSignScreen(), - PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestThirdScreen(), + PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestFirstScreen(), PATIENT_ADMISSION_REQUEST_2: (_) => AdmissionRequestSecondScreen(), PATIENT_ADMISSION_REQUEST_3: (_) => AdmissionRequestThirdScreen(), // PATIENT_ADMISSION_REQUEST: (_) => AdmissionRequestDetailScreen(), diff --git a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart new file mode 100644 index 00000000..0c1f0de2 --- /dev/null +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -0,0 +1,487 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.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/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class AdmissionRequestFirstScreen extends StatefulWidget { + @override + _AdmissionRequestThirdScreenState createState() => + _AdmissionRequestThirdScreenState(); +} + +class _AdmissionRequestThirdScreenState + extends State { + final _dietTypeRemarksController = TextEditingController(); + final _sickLeaveCommentsController = TextEditingController(); + final _postMedicalHistoryController = TextEditingController(); + final _postSurgicalHistoryController = TextEditingController(); + + dynamic _selectedClinic; + dynamic _selectedDoctor; + dynamic _selectedDietType; + + bool _isSickLeaveRequired = false; + bool _patientPregnant = false; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: (){ + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .specialityAndDoctorDetail, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.clinicList != null && + model.clinicList.length > 0 + ? () { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, + (selectedValue) { + setState(() { + _selectedClinic = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getClinics().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.clinicList.length > 0) { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, + (selectedValue) { + setState(() { + _selectedClinic = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .clinic, + _selectedClinic != null + ? _selectedClinic[ + 'clinicGroupName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 20, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedClinic != null + ? model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + openListDialogField( + 'DoctorName', + 'DoctorID', + model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils + .showMyDialog(context); + await model + .getClinicDoctors( + _selectedClinic[ + 'clinicID']) + .then((_) => + GifLoaderDialogUtils + .hideDialog( + context)); + if (model.state == + ViewState.Idle && + model.doctorsList.length > + 0) { + openListDialogField( + 'DoctorName', + 'DoctorID', + model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + } + : null, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .doctor, + _selectedDoctor != null + ? _selectedDoctor[ + 'DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).patientDetails, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).patientPregnant, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _patientPregnant, + onChanged: (newValue) { + setState(() { + _patientPregnant = newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context) + .isSickLeaveRequired, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: _isSickLeaveRequired, + onChanged: (newValue) { + setState(() { + _isSickLeaveRequired = newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .sickLeaveComments, + null, + false), + enabled: true, + controller: _sickLeaveCommentsController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.dietTypesList != null && + model.dietTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDietTypes().then( + (_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.dietTypesList.length > + 0) { + openListDialogField('nameEn', + 'id', model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .dietType, + _selectedDietType != null + ? _selectedDietType['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .dietTypeRemarks, + null, + false), + enabled: true, + controller: _dietTypeRemarksController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .pastMedicalHistory, + null, + false), + enabled: true, + controller: _postMedicalHistoryController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .pastSurgicalHistory, + null, + false), + enabled: true, + controller: _postSurgicalHistoryController, + keyboardType: TextInputType.text, + minLines: 2, + maxLines: 4, + )), + ], + ), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + model.admissionRequestData = AdmissionRequest(); + if (_selectedClinic != null && + _selectedDoctor != null && + _sickLeaveCommentsController.text != "" && + _postMedicalHistoryController.text != "" && + _postSurgicalHistoryController.text != "") { + model.admissionRequestData.patientMRN = + patient.patientMRN; + model.admissionRequestData.appointmentNo = + patient.appointmentNo; + model.admissionRequestData.episodeID = + patient.episodeNo; + model.admissionRequestData.admissionRequestNo = 0; + + model.admissionRequestData.admitToClinic = + _selectedClinic['clinicID']; + model.admissionRequestData.mrpDoctorID = + _selectedDoctor['DoctorID']; + + model.admissionRequestData.isPregnant = + _patientPregnant; + model.admissionRequestData.isSickLeaveRequired = + _isSickLeaveRequired; + model.admissionRequestData.sickLeaveComments = + _sickLeaveCommentsController.text; + model.admissionRequestData.isDietType = + _selectedDietType != null ? true : false; + model.admissionRequestData.dietType = + _selectedDietType != null + ? _selectedDietType['id'] + : 0; + model.admissionRequestData.dietRemarks = + _dietTypeRemarksController.text; + model.admissionRequestData.pastMedicalHistory = + _postMedicalHistoryController.text; + model.admissionRequestData.pastSurgicalHistory = + _postSurgicalHistoryController.text; + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_2, + arguments: { + 'patient': patient, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], + ), + ), + ), + ); + } + + Future _selectDate(BuildContext context, DateTime dateTime, + Function(DateTime picked) updateDate) async { + final DateTime picked = await showDatePicker( + context: context, + initialDate: dateTime, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != dateTime) { + updateDate(picked); + } + } + + void openListDialogField(String attributeName, String attributeValueId, + List list, Function(dynamic selectedValue) okFunction) { + ListSelectDialog dialog = ListSelectDialog( + list: list, + attributeName: attributeName, + attributeValueId: attributeValueId, + usingSearch: true, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + okFunction(selectedValue); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } +} diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index f5dbf704..342d2e72 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_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/model/admissionRequest/admission-request.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; @@ -31,19 +32,21 @@ class AdmissionRequestThirdScreen extends StatefulWidget { class _AdmissionRequestThirdScreenState extends State { - final _postPlansEstimatedCostController = TextEditingController(); - final _dietTypeRemarksController = TextEditingController(); - final _estimatedCostController = TextEditingController(); + final _treatmentLineController = TextEditingController(); + final _complicationsController = TextEditingController(); + final _otherProceduresController = TextEditingController(); - // DateTime _dischargeDate; - dynamic _selectedClinic; - dynamic _selectedDoctor; - dynamic _selectedDietType; + dynamic _selectedAdmissionType; + dynamic _selectedDiagnosis; + dynamic _selectedIcd; + dynamic _selectedDiagnosisType; @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; + AdmissionRequest admissionRequest = routeArgs['admission-data']; + final screenSize = MediaQuery.of(context).size; ProjectViewModel projectViewModel = Provider.of(context); @@ -51,375 +54,375 @@ class _AdmissionRequestThirdScreenState builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).admissionRequest, - body: model.doctorsList != null - ? Column( - children: [ - Expanded( - child: SingleChildScrollView( + body: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientPageHeaderWidget(patient), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).treatmentLine, + null, + false), + enabled: true, + controller: _treatmentLineController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).complications, + null, + false), + enabled: true, + controller: _complicationsController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).otherProcedure, + null, + false), + enabled: true, + controller: _otherProceduresController, + keyboardType: TextInputType.text, + minLines: 3, + maxLines: 5, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.admissionTypeList != null && + model.admissionTypeList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup(MasterKeysService + .AdmissionRequestType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.admissionTypeList.length > 0) { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).admissionType, + _selectedAdmissionType != null + ? _selectedAdmissionType['nameEn'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).diagnosisDetail, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context) - .specialityAndDoctorDetail, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - SizedBox( - height: 20, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.clinicList != null && - model.clinicList.length > 0 - ? () { - openListDialogField( - 'clinicGroupName', - 'clinicID', - model.clinicList, - (selectedValue) { - setState(() { - _selectedClinic = selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getClinics().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.clinicList.length > 0) { - openListDialogField( - 'clinicGroupName', - 'clinicID', - model.clinicList, - (selectedValue) { - setState(() { - _selectedClinic = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .clinic, - _selectedClinic != null - ? _selectedClinic[ - 'clinicGroupName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 20, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: _selectedClinic != null - ? model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - openListDialogField( - 'DoctorName', - 'DoctorID', - model.doctorsList, - (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils - .showMyDialog(context); - await model - .getClinicDoctors( - _selectedClinic[ - 'clinicID']) - .then((_) => - GifLoaderDialogUtils - .hideDialog( - context)); - if (model.state == - ViewState.Idle && - model.doctorsList.length > - 0) { - openListDialogField( - 'DoctorName', - 'DoctorID', - model.doctorsList, - (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - } + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.diagnosisTypesList != null && + model.diagnosisTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDiagnosis().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.diagnosisTypesList.length > 0) { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).diagnosis, + _selectedDiagnosis != null + ? _selectedDiagnosis['nameEn'] : null, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .doctor, - _selectedDoctor != null - ? _selectedDoctor[ - 'DoctorName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - AppText( - TranslationBase.of(context) - .postPlansEstimatedCost, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .estimatedCost, - null, - false), - enabled: true, - controller: _estimatedCostController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).postPlans, - null, - false), - enabled: true, - controller: _postPlansEstimatedCostController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, - ), - /* Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - if (_dischargeDate == null) { - _dischargeDate = DateTime.now(); + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.icdCodes != null && + model.icdCodes.length > 0 + ? () { + openListDialogField( + 'description', 'code', model.icdCodes, + (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getICDCodes(patient.patientMRN) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.icdCodes.length > 0) { + openListDialogField( + 'description', + 'code', + model.icdCodes, (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - _selectDate(context, _dischargeDate, - (picked) { + }, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).icd, + _selectedIcd != null + ? _selectedIcd['description'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfDiagnosisSelectionTypes != + null && + model.listOfDiagnosisSelectionTypes + .length > + 0 + ? () { + openListDialogField('description', 'code', + model.listOfDiagnosisSelectionTypes, + (selectedValue) { setState(() { - _dischargeDate = picked; + _selectedDiagnosisType = + selectedValue; }); }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup(MasterKeysService + .DiagnosisSelectionType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.listOfDiagnosisSelectionTypes + .length > + 0) { + openListDialogField( + 'description', + 'code', + model.listOfDiagnosisSelectionTypes, + (selectedValue) { + setState(() { + _selectedDiagnosisType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedAdmissionDate, - _dischargeDate != null - ? "${DateUtils.convertStringToDateFormat(_dischargeDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ),*/ - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.dietTypesList != null && - model.dietTypesList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.dietTypesList, - (selectedValue) { - setState(() { - _selectedDietType = - selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getDietTypes().then( - (_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.dietTypesList.length > - 0) { - openListDialogField('nameEn', - 'id', model.dietTypesList, - (selectedValue) { - setState(() { - _selectedDietType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .dietType, - _selectedDietType != null - ? _selectedDietType['nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .dietTypeRemarks, - null, - false), - enabled: true, - controller: _dietTypeRemarksController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - ], + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).diagnoseType, + _selectedDiagnosisType != null + ? _selectedDiagnosisType['description'] + : null, + true), + enabled: false, + ), ), ), + SizedBox( + height: 10, + ), ], ), ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () { - model.admissionRequestData = AdmissionRequest(); - if (_selectedClinic != null && - _selectedDoctor != null && - _estimatedCostController.text != "" && - _postPlansEstimatedCostController.text != "") { - model.admissionRequestData.patientMRN = patient.patientMRN; - model.admissionRequestData.appointmentNo = patient.appointmentNo; - model.admissionRequestData.episodeID = patient.episodeNo; - model.admissionRequestData.admissionRequestNo = 0; + ], + ), + )), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () async { + if (_treatmentLineController.text != "" && + _complicationsController.text != "" && + _otherProceduresController.text != "" && + _selectedAdmissionType != null && + _selectedDiagnosis != null && + _selectedIcd != null && + _selectedDiagnosisType != null) { + model.admissionRequestData = admissionRequest; + + model.admissionRequestData.mainLineOfTreatment = + _treatmentLineController.text; + model.admissionRequestData.complications = + _complicationsController.text; + model.admissionRequestData.otherProcedures = + _otherProceduresController.text; + model.admissionRequestData.admissionType = + _selectedAdmissionType['id']; - model.admissionRequestData.admitToClinic = _selectedClinic['clinicID']; - model.admissionRequestData.mrpDoctorID = _selectedDoctor['DoctorID']; - model.admissionRequestData.estimatedCost = int.parse(_estimatedCostController.text); - model.admissionRequestData.elementsForImprovement = _postPlansEstimatedCostController.text; - model.admissionRequestData.isDietType = _selectedDietType != null ? true : false; - model.admissionRequestData.dietType = _selectedDietType != null ? _selectedDietType['id'] : 0; - model.admissionRequestData.dietRemarks = _dietTypeRemarksController.text; - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_2, - arguments: {'patient': patient, 'admission-data' : model.admissionRequestData}); - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + dynamic admissionRequestDiagnoses = [ + { + 'diagnosisDescription': _selectedDiagnosis['nameEn'], + 'diagnosisType': _selectedDiagnosis['id'], + 'icdCode': _selectedIcd['code'], + 'icdCodeDescription': _selectedIcd['description'], + 'type': _selectedDiagnosisType['code'], + 'remarks': "", + 'isActive': true, } - }, - ), - ), - ], - ) - : Container(), - ), - ); - } + ]; + model.admissionRequestData.admissionRequestDiagnoses = + admissionRequestDiagnoses; - Future _selectDate(BuildContext context, DateTime dateTime, - Function(DateTime picked) updateDate) async { - final DateTime picked = await showDatePicker( - context: context, - initialDate: dateTime, - firstDate: DateTime.now(), - lastDate: DateTime(2040), - initialEntryMode: DatePickerEntryMode.calendar, + await model.makeAdmissionRequest(); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context).admissionRequestSuccessMsg); + Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], + ), + ), + ), ); - if (picked != null && picked != dateTime) { - updateDate(picked); - } } void openListDialogField(String attributeName, String attributeValueId, diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 2ffd5455..91885724 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -32,24 +32,16 @@ class AdmissionRequestSecondScreen extends StatefulWidget { class _AdmissionRequestSecondScreenState extends State { + final _postPlansEstimatedCostController = TextEditingController(); + final _estimatedCostController = TextEditingController(); final _expectedDaysController = TextEditingController(); - final _treatmentLineController = TextEditingController(); + final _otherDepartmentsInterventionsController = TextEditingController(); - // final _preOperativeOrdersController = TextEditingController(); DateTime _expectedAdmissionDate; - // bool _emergencyAdmission = false; - bool _isSickLeaveRequired = false; - bool _patientPregnant = false; - - // bool _preAnesthesiaReferred = false; + dynamic _selectedFloor; dynamic _selectedWard; - dynamic _selectedAdmissionType; - dynamic _selectedDiagnosis; - dynamic _selectedIcd; - dynamic _selectedDiagnosisType; - - // dynamic _selectedAllergies; + dynamic _selectedRoomCategory; @override Widget build(BuildContext context) { @@ -62,614 +54,388 @@ class _AdmissionRequestSecondScreenState return BaseView( builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).admissionRequest, - body: model.doctorsList != null - ? Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - PatientPageHeaderWidget(patient), - Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).otherInformation, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedDays, - null, - false), - enabled: true, - controller: _expectedDaysController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), - SizedBox( - height: 10, - ), - Container( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).admissionRequest, + body: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientPageHeaderWidget(patient), + Container( + margin: EdgeInsets.symmetric( + vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .postPlansEstimatedCost, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .estimatedCost, + null, + false), + enabled: true, + controller: _estimatedCostController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).postPlans, + null, + false), + enabled: true, + controller: _postPlansEstimatedCostController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .otherDepartmentsInterventions, + null, + false), + enabled: true, + controller: + _otherDepartmentsInterventionsController, + keyboardType: TextInputType.multiline, + minLines: 2, + maxLines: 4, + )), + SizedBox( + height: 10, + ), + AppText( + TranslationBase.of(context).otherInformation, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 10, + ), + Container( height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - if (_expectedAdmissionDate == null) { - _expectedAdmissionDate = DateTime.now(); - } - _selectDate( - context, _expectedAdmissionDate, - (picked) { - setState(() { - _expectedAdmissionDate = picked; - }); + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedDays, + null, + false), + enabled: true, + controller: _expectedDaysController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () { + if (_expectedAdmissionDate == null) { + _expectedAdmissionDate = DateTime.now(); + } + _selectDate(context, _expectedAdmissionDate, + (picked) { + setState(() { + _expectedAdmissionDate = picked; }); - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedAdmissionDate, - _expectedAdmissionDate != null - ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), -/* - CheckboxListTile( - title: AppText( - TranslationBase.of(context) - .emergencyAdmission, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _emergencyAdmission, - onChanged: (newValue) { - setState(() { - _emergencyAdmission = newValue; }); }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), -*/ - CheckboxListTile( - title: AppText( - TranslationBase.of(context) - .isSickLeaveRequired, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .expectedAdmissionDate, + _expectedAdmissionDate != null + ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, ), - value: _isSickLeaveRequired, - onChanged: (newValue) { - setState(() { - _isSickLeaveRequired = newValue; - }); - }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context).patientPregnant, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _patientPregnant, - onChanged: (newValue) { - setState(() { - _patientPregnant = newValue; - }); - }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .treatmentLine, - null, - false), - enabled: true, - controller: _treatmentLineController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.wardList != null && - model.wardList.length > 0 - ? () { + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.floorList != null && + model.floorList.length > 0 + ? () { + openListDialogField( + 'description', + 'floorID', + model.floorList, (selectedValue) { + setState(() { + _selectedFloor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getFloors().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.floorList.length > 0) { openListDialogField('description', - 'description', model.wardList, + 'floorID', model.floorList, (selectedValue) { setState(() { - _selectedWard = selectedValue; + _selectedFloor = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getWards().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.wardList.length > 0) { - openListDialogField('description', - 'description', model.wardList, - (selectedValue) { - setState(() { - _selectedWard = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).ward, - _selectedWard != null - ? _selectedWard['description'] - : null, - true), - enabled: false, - ), + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).floor, + _selectedFloor != null + ? _selectedFloor['description'] + : null, + true), + enabled: false, ), ), - /* CheckboxListTile( - title: AppText( - TranslationBase.of(context) - .preAnesthesiaReferred, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _preAnesthesiaReferred, - onChanged: (newValue) { - setState(() { - _preAnesthesiaReferred = newValue; - }); - }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ),*/ - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.admissionTypeList != null && - model.admissionTypeList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.wardList != null && + model.wardList.length > 0 + ? () { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, (selectedValue) { + setState(() { + _selectedWard = selectedValue; }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getMasterLookup( - MasterKeysService - .AdmissionRequestType) - .then((_) => - GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.admissionTypeList.length > - 0) { - openListDialogField('nameEn', - 'id', model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .admissionType, - _selectedAdmissionType != null - ? _selectedAdmissionType[ - 'nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).diagnosisDetail, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.diagnosisTypesList != null && - model.diagnosisTypesList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getWards().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.wardList.length > 0) { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, (selectedValue) { setState(() { - _selectedDiagnosis = - selectedValue; + _selectedWard = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getDiagnosis().then( - (_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.diagnosisTypesList - .length > - 0) { - openListDialogField( - 'nameEn', - 'id', - model.diagnosisTypesList, - (selectedValue) { - setState(() { - _selectedDiagnosis = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .diagnosis, - _selectedDiagnosis != null - ? _selectedDiagnosis['nameEn'] - : null, - true), - enabled: false, - ), + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).ward, + _selectedWard != null + ? _selectedWard['description'] + : null, + true), + enabled: false, ), ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.icdCodes != null && - model.icdCodes.length > 0 - ? () { - openListDialogField('description', - 'code', model.icdCodes, - (selectedValue) { - setState(() { - _selectedIcd = selectedValue; - }); + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.roomCategoryList != null && + model.roomCategoryList.length > 0 + ? () { + openListDialogField( + 'description', + 'categoryID', + model.roomCategoryList, + (selectedValue) { + setState(() { + _selectedRoomCategory = + selectedValue; }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getICDCodes(patient.patientMRN) - .then((_) => - GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.icdCodes.length > 0) { - openListDialogField('description', - 'code', model.icdCodes, - (selectedValue) { - setState(() { - _selectedIcd = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).icd, - _selectedIcd != null - ? _selectedIcd['description'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisSelectionTypes != - null && - model.listOfDiagnosisSelectionTypes - .length > - 0 - ? () { + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getRoomCategories().then( + (_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.roomCategoryList.length > + 0) { openListDialogField( 'description', - 'code', - model - .listOfDiagnosisSelectionTypes, + 'categoryID', + model.roomCategoryList, (selectedValue) { setState(() { - _selectedDiagnosisType = + _selectedRoomCategory = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getMasterLookup( - MasterKeysService - .DiagnosisSelectionType) - .then((_) => - GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.listOfDiagnosisSelectionTypes - .length > - 0) { - openListDialogField( - 'description', - 'code', - model - .listOfDiagnosisSelectionTypes, - (selectedValue) { - setState(() { - _selectedDiagnosisType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .diagnoseType, - _selectedDiagnosisType != null - ? _selectedDiagnosisType[ - 'description'] - : null, - true), - enabled: false, - ), + }, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .roomCategory, + _selectedRoomCategory != null + ? _selectedRoomCategory[ + 'description'] + : null, + true), + enabled: false, ), ), - SizedBox( - height: 10, - ), - /*Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .preOperativeOrders, - null, - false), - enabled: true, - controller: _preOperativeOrdersController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergiesList != null && - model.allergiesList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.allergiesList, - (selectedValue) { - setState(() { - _selectedAllergies = - selectedValue; - }); - }); - } - : () async { - await model.getAllergies(); - if (model.state == ViewState.Idle && - model.allergiesList.length > - 0) { - openListDialogField('nameEn', - 'id', model.allergiesList, - (selectedValue) { - setState(() { - _selectedAllergies = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .allergies, - _selectedAllergies != null - ? _selectedAllergies['nameEn'] - : null, - true), - enabled: false, - ), - ), - ),*/ - ], - ), + ), + SizedBox( + height: 10, + ), + ], ), - ], - ), + ), + ], ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).save, - color: HexColor("#B8382B"), - onPressed: () async { - if (_expectedDaysController.text != "" && - _expectedAdmissionDate != null && - _treatmentLineController.text != "" && - _selectedWard != null && - _selectedAdmissionType != null && - _selectedDiagnosis != null && - _selectedIcd != null && - _selectedDiagnosisType != null) { - model.admissionRequestData = admissionRequest; + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () async { + if (_estimatedCostController.text != "" && + _postPlansEstimatedCostController.text != "" && + _expectedDaysController.text != "" && + _expectedAdmissionDate != null && + _otherDepartmentsInterventionsController.text != "" && + _selectedFloor != null && + _selectedRoomCategory != + null /*_selectedWard is not required*/) { + model.admissionRequestData = admissionRequest; - model.admissionRequestData.expectedDays = int.parse(_expectedDaysController.text); - model.admissionRequestData.admissionDate = _expectedAdmissionDate.toIso8601String(); - model.admissionRequestData.isSickLeaveRequired = _isSickLeaveRequired; - model.admissionRequestData.isPregnant = _patientPregnant; - model.admissionRequestData.mainLineOfTreatment = _treatmentLineController.text; - model.admissionRequestData.wardID = 0; - model.admissionRequestData.admissionType = _selectedAdmissionType['id']; - dynamic admissionRequestDiagnoses = [ - { - 'diagnosisDescription' : _selectedDiagnosis['nameEn'], - 'diagnosisType' : _selectedDiagnosis['id'], - 'icdCode' : _selectedIcd['code'], - 'icdCodeDescription' : _selectedIcd['description'], - 'type' : _selectedDiagnosisType['code'], - 'remarks' : "", - 'isActive' : true, - } - ]; - model.admissionRequestData.admissionRequestDiagnoses = admissionRequestDiagnoses; - model.admissionRequestData.admissionRequestProcedures = []; - await model.makeAdmissionRequest(); - if(model.state == ViewState.ErrorLocal){ - DrAppToastMsg.showErrorToast( - model.error); - } - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); - } - }, - ), + model.admissionRequestData.estimatedCost = + int.parse(_estimatedCostController.text); + model.admissionRequestData.elementsForImprovement = + _postPlansEstimatedCostController.text; + + model.admissionRequestData.expectedDays = + int.parse(_expectedDaysController.text); + model.admissionRequestData.admissionDate = + _expectedAdmissionDate.toIso8601String(); + model.admissionRequestData + .otherDepartmentInterventions = + _otherDepartmentsInterventionsController.text; + model.admissionRequestData.admissionLocationID = + _selectedFloor['floorID']; + model.admissionRequestData.wardID = + _selectedWard != null + ? _selectedWard['nursingStationID'] + : 0; + model.admissionRequestData.roomCategoryID = + _selectedRoomCategory['categoryID']; + + model.admissionRequestData.admissionRequestProcedures = + []; + Navigator.of(context) + .pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: { + 'patient': patient, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, ), - ], - ) - : Container(), - ), + ), + ], + ), + )), ); } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 11b5fa7f..98e0cb19 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1092,8 +1092,16 @@ class TranslationBase { String get patientName => localizedValues['patient-name'][locale.languageCode]; - String get appointmentNumber => - localizedValues['appointmentNumber'][locale.languageCode]; + String get appointmentNumber => localizedValues['appointmentNumber'][locale.languageCode]; + String get sickLeaveComments => localizedValues['sickLeaveComments'][locale.languageCode]; + String get pastMedicalHistory => localizedValues['pastMedicalHistory'][locale.languageCode]; + String get pastSurgicalHistory => localizedValues['pastSurgicalHistory'][locale.languageCode]; + String get complications => localizedValues['complications'][locale.languageCode]; + String get floor => localizedValues['floor'][locale.languageCode]; + String get roomCategory => localizedValues['roomCategory'][locale.languageCode]; + String get otherDepartmentsInterventions => localizedValues['otherDepartmentsInterventions'][locale.languageCode]; + String get otherProcedure => localizedValues['otherProcedure'][locale.languageCode]; + String get admissionRequestSuccessMsg => localizedValues['admissionRequestSuccessMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 87f67ea2e8e0c9fa9def58594f5fca6ea195b8fb Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 8 Feb 2021 12:13:24 +0200 Subject: [PATCH 06/10] DA-273 solve --- .../profile/referral/refer-patient-screen.dart | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 3903b46a..b2a71f4b 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -91,20 +91,20 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? ReferralForm(model, screenSize) : PatientReferralItemWidget( - "${model.patientReferral[0].patientID}", - patientName: model.patientReferral[0].patientName, + "${model.patientReferral[model.patientReferral.length -1].patientID}", + patientName: model.patientReferral[model.patientReferral.length -1].patientName, referralStatus: - "${model.patientReferral[0].referralStatus}", + "${model.patientReferral[model.patientReferral.length -1].referralStatus}", isReferredTo: true, isSameBranch: model - .patientReferral[0].isReferralDoctorSameBranch, + .patientReferral[model.patientReferral.length -1].isReferralDoctorSameBranch, referralDoctorName: - model.patientReferral[0].referredByDoctorInfo, + model.patientReferral[model.patientReferral.length -1].referredByDoctorInfo, clinicDescription: null, - remark: model.patientReferral[0].remarksFromSource, - referredOn: model.patientReferral[0].referredOn, + remark: model.patientReferral[model.patientReferral.length -1].remarksFromSource, + referredOn: model.patientReferral[model.patientReferral.length -1].referredOn, answerFromTarget: - model.patientReferral[0].answerFromTarget, + model.patientReferral[model.patientReferral.length -1].answerFromTarget, ), ], ), From 400f8e25f6fc770132f854bed16f4f55dba056e7 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 9 Feb 2021 21:21:00 +0300 Subject: [PATCH 07/10] bug xis --- lib/config/shared_pref_kay.dart | 1 + lib/screens/dashboard_screen.dart | 9 ++++----- lib/widgets/auth/verification_methods.dart | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 376c8dab..eea2ce76 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -13,3 +13,4 @@ final DASHBOARD_DATA = 'dashboard-data'; final OTP_TYPE = 'otp-type'; final LAST_LOGIN_USER = 'last-login-user'; final PASSWORD = 'password'; +final CLINIC_NAME = 'clinic-name'; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 717dbaa6..30dc2700 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -58,6 +58,7 @@ class _DashboardScreenState extends State { DoctorProfileModel profile; bool isExpanded = false; String isInpatient = ""; + var clinicName = []; void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { @@ -72,7 +73,8 @@ class _DashboardScreenState extends State { .listen((IosNotificationSettings settings) { print("Settings registered: $settings"); }); - + clinicName = await sharedPref.getObj(CLINIC_NAME); + print(clinicName); _firebaseMessaging.getToken().then((String token) async { if (token != '') { DEVICE_TOKEN = token; @@ -721,10 +723,7 @@ class _DashboardScreenState extends State { child: Column( children: [ AppText( - model.dashboardItemsList.length > 0 - ? getPatientCount( - model.dashboardItemsList[6]) - : "", + clinicName.length.toString(), fontSize: SizeConfig.textMultiplier * 6, color: Colors.white, ), diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index b5111704..04a82a80 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -486,7 +486,11 @@ class _VerificationMethodsState extends State { case 3: return InkWell( onTap: () => { - authenticateUser(3, BiometricType.fingerprint.index, authProv) + if (checkIfBiometricAvailable(BiometricType.fingerprint)) + { + authenticateUser( + 3, BiometricType.fingerprint.index, authProv) + } }, child: RoundedContainer( backgroundColor: @@ -518,8 +522,11 @@ class _VerificationMethodsState extends State { break; case 4: return InkWell( - onTap: () => - {authenticateUser(4, BiometricType.face.index, authProv)}, + onTap: () { + if (checkIfBiometricAvailable(BiometricType.face)) { + authenticateUser(4, BiometricType.face.index, authProv); + } + }, child: RoundedContainer( backgroundColor: checkIfBiometricAvailable(BiometricType.face) ? Colors.white @@ -739,7 +746,9 @@ class _VerificationMethodsState extends State { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) { loginProcessCompleted(res['List_DoctorProfile'][0], authProv); + sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); } else { + sharedPref.setObj(CLINIC_NAME, res['List_DoctorsClinic']); ClinicModel clinic = ClinicModel.fromJson(res['List_DoctorsClinic'][0]); getDocProfiles(clinic, authProv); From 498c6c00af3c62a818ef69c899432137c3af97f0 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 10 Feb 2021 15:13:14 +0200 Subject: [PATCH 08/10] fix minor issue bugs (DA-273, DA-361, DA-362, DA-363) --- lib/core/service/patient-doctor-referral-service.dart | 6 +++--- lib/core/service/patient-ucaf-service.dart | 4 ++-- lib/models/patient/patiant_info_model.dart | 6 +++++- .../profile/referral/my-referral-detail-screen.dart | 2 ++ .../patients/profile/PatientHeaderWidgetNoAvatar.dart | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index 77af017c..813fef35 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -198,9 +198,9 @@ class PatientReferralService extends LookupService { Map body = Map(); body['PatientMRN'] = pendingReferral.patientID; - body['AppointmentNo'] = pendingReferral.sourceAppointmentNo; - body['SetupID'] = pendingReferral.sourceSetupID; - body['ProjectID'] = pendingReferral.sourceProjectId; + body['AppointmentNo'] = pendingReferral.targetAppointmentNo; + body['SetupID'] = pendingReferral.targetSetupID; + body['ProjectID'] = pendingReferral.targetProjectId; body['IsAccepted'] = isAccepted; body['PatientName'] = pendingReferral.patientName; body['ReferralResponse'] = pendingReferral.remarksFromSource; diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart index 429e78a9..90a45ee2 100644 --- a/lib/core/service/patient-ucaf-service.dart +++ b/lib/core/service/patient-ucaf-service.dart @@ -106,8 +106,8 @@ class UcafService extends LookupService { hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; - // body['AppointmentNo'] = patient.appointmentNo; - // body['EpisodeID'] = patient.episodeNo; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; await baseAppClient.post (GET_ORDER_PROCEDURE, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 3547a73d..ceb84175 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -54,6 +54,7 @@ class PatiantInformtion { String genderDescription; String nursingStationName; String startTime; + String visitType; PatiantInformtion({ this.list, @@ -105,7 +106,9 @@ class PatiantInformtion { this.genderInt, this.isSigned, this.medicationOrders, - this.nationality,this.patientMRN + this.nationality, + this.patientMRN, + this.visitType, }); factory PatiantInformtion.fromJson(Map json) => @@ -159,6 +162,7 @@ class PatiantInformtion { medicationOrders :json['medicationOrders'], nationality :json['nationality']??json['NationalityNameN'], patientMRN :json['patientMRN'] ?? json['PatientMRN'], + visitType :json['visitType'] ?? json['visitType'], ); } diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index f1f3c918..8a919709 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -157,6 +157,7 @@ class MyReferralDetailScreen extends StatelessWidget { } else { DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); Navigator.pop(context); + Navigator.pop(context); } }, ), @@ -180,6 +181,7 @@ class MyReferralDetailScreen extends StatelessWidget { } else { DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); Navigator.pop(context); + Navigator.pop(context); } }, ), diff --git a/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart index 1f1c4079..aef7a161 100644 --- a/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart +++ b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart @@ -43,7 +43,7 @@ class PatientHeaderWidgetNoAvatar extends StatelessWidget { ], ), AppText( - "NEW VISIT", + patient.visitType ?? "", fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.0, ), From c8e5a7eeef7551d873627f11c25e8cd5c058a321 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 10 Feb 2021 17:00:50 +0200 Subject: [PATCH 09/10] fix PatientCard --- ios/Podfile.lock | 4 +- .../ClingoVideoCallViewController.swift | 446 +++++++++++++++ lib/screens/patients/patients_screen.dart | 527 +++--------------- lib/widgets/patients/PatientCard.dart | 244 ++++++++ 4 files changed, 774 insertions(+), 447 deletions(-) create mode 100644 ios/Runner/ClingoVideoCallViewController.swift create mode 100644 lib/widgets/patients/PatientCard.dart diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fb65ae25..9c86879d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -18,7 +18,7 @@ PODS: - Firebase/Messaging (6.33.0): - Firebase/CoreOnly - FirebaseMessaging (~> 4.7.0) - - firebase_core (0.5.2): + - firebase_core (0.5.3): - Firebase/CoreOnly (~> 6.33.0) - Flutter - firebase_core_web (0.1.0): @@ -250,7 +250,7 @@ SPEC CHECKSUMS: connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_core: 350ba329d1641211bc6183a3236893cafdacfea7 + firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd diff --git a/ios/Runner/ClingoVideoCallViewController.swift b/ios/Runner/ClingoVideoCallViewController.swift new file mode 100644 index 00000000..b1bacdae --- /dev/null +++ b/ios/Runner/ClingoVideoCallViewController.swift @@ -0,0 +1,446 @@ +// +// ViewController.swift +// Lets-Build-OTPublisher +// +// Created by Roberto Perez Cubero on 11/08/16. +// Copyright © 2016 tokbox. All rights reserved. +// + +import UIKit +import OpenTok + +// The converted code is limited to 2 KB. +// Refill your credit or upgrade your plan to remove this limitation. +// +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +// +// ClingoVideoCallViewController.m +// Runner +// +// Created by Mohammad Aljammal & Elham on 23/6/20. +// Copyright © 2020 The Chromium Authors. All rights reserved. +// + + + + +import AVFoundation + +var dateFormatter: DateFormatter? + + +class ClingoVideoCallViewController : UIViewController, OTSessionDelegate, OTSubscriberDelegate, OTPublisherDelegate{ + + var kApiKey: String? + var kSessionId: String? + var kToken: String? + var session: OTSession? + var publisher: OTPublisher? + var subscriber: OTSubscriber? + var callDuration: String? + var warningDuration: String? + var appLang: String? + + + + @IBOutlet weak var localVideo: UIView! + @IBOutlet weak var remoteVideo: UIView! + @IBOutlet weak var controlButtons: UIView! + @IBOutlet weak var remoteVideoMutedIndicator: UIImageView! + @IBOutlet weak var localVideoMutedBg: UIImageView! + @IBOutlet weak var localVideoMutedIndicator: UIImageView! + @IBOutlet weak var remainingTimeLBL: UILabel! + @IBOutlet weak var pgView: UIProgressView! + var timer: Timer? + + + + + func viewDidLoad() { + super.viewDidLoad() + dateFormatter = DateFormatter() + + setupButtons() + askForMicrophonePermission() + requestCameraPermissionsIfNeeded() + hideVideoMuted() + setupSession() + // Do any additional setup after loading the view. + } + + func viewDidDisappear(_ animated: Bool) { + sessionDisconnect() + timer.invalidate() + timer = nil + PgView.hidden = true + remainingTimeLBL.hidden = true + } + +// MARK: -Microphone Camera and Permission Request + func askForMicrophonePermission() { + switch AVAudioSession.sharedInstance().recordPermission { + case AVAudioSessionRecordPermissionGranted: + break + case AVAudioSessionRecordPermissionDenied: + break + case AVAudioSessionRecordPermissionUndetermined: + // This is the initial state before a user has made any choice + // You can use this spot to request permission here if you want + AVAudioSession.sharedInstance().requestRecordPermission({ granted in + // Check for granted + }) + default: + break + } + } + + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +func requestCameraPermissionsIfNeeded() { + + // check camera authorization status + let authStatus: AVAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: .video) + switch authStatus { + case .authorized: break + // camera authorized + // do camera intensive stuff + case .notDetermined: + // request authorization + + AVCaptureDevice.requestAccess(for: .video, completionHandler: { granted in + DispatchQueue.main.async(execute: { + + if granted { + // do camera intensive stuff + } else { + self.notifyUserOfCameraAccessDenial() + } + }) + }) + case .restricted, .denied: + DispatchQueue.main.async(execute: { + self.notifyUserOfCameraAccessDenial() + }) + default: + break + } +} + +func notifyUserOfCameraAccessDenial() { + // display a useful message asking the user to grant permissions from within Settings > Privacy > Camera +} + +// MARK: - OpenTok methods +func showAlert(_ string: String?) { + // show alertview on main UI + DispatchQueue.main.async(execute: { + let alertVC = UIAlertController( + title: "OTError", + message: string, + preferredStyle: .alert) + self.present(alertVC, animated: true) + }) +} + +// MARK: - OpenTok methods +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +/// Asynchronously begins the session connect process. Some time later, we will +/// expect a delegate method to call us back with the results of this action. +func setupSession() { + //setup one time session + if session { + session = nil + } + session = OTSession( + apiKey: kApiKey, + sessionId: kSessionId, + delegate: self) + do { + try session.connect(withToken: kToken) + } catch { + } + +} + +/// Sets up an instance of OTPublisher to use with this session. OTPubilsher +/// binds to the device camera and microphone, and will provide A/V streams +/// to the OpenTok session. +func setupPublisher() { + let settings = OTPublisherSettings() + settings.name = UIDevice.current.name + publisher = OTPublisher(delegate: self, settings: settings) + + var error: OTError? = nil + session.publish(publisher, error: &error) + if error != nil { + showAlert(error?.localizedDescription()) + } + localVideo.addSubview(publisher.view) + publisher.view.frame = CGRect(x: localVideo.bounds.origin.x, y: localVideo.bounds.origin.y, width: localVideo.bounds.size.width, height: localVideo.bounds.size.height) + +} + +/// Cleans up the publisher and its view. At this point, the publisher should not +/// be attached to the session any more. +func cleanupPublisher() { + publisher?.view.removeFromSuperview() + publisher = nil + // this is a good place to notify the end-user that publishing has stopped. +} + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +/// Instantiates a subscriber for the given stream and asynchronously begins the +/// process to begin receiving A/V content for this stream. Unlike doPublish, +/// this method does not add the subscriber to the view hierarchy. Instead, we +/// add the subscriber only after it has connected and begins receiving data. +func setupSubscribe(_ stream: OTStream?) { + subscriber = OTSubscriber(stream: stream, delegate: self) + + var error: OTError? = nil + session.subscribe(subscriber, error: &error) + if error != nil { + showAlert(error?.localizedDescription()) + } +} + +/// Cleans the subscriber from the view hierarchy, if any. +/// NB: You do *not* have to call unsubscribe in your controller in response to +/// a streamDestroyed event. Any subscribers (or the publisher) for a stream will +/// be automatically removed from the session during cleanup of the stream. +func cleanupSubscriber() { + subscriber.view.removeFromSuperview() + subscriber = nil +} + + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +// MARK: - OTSession delegate callbacks +func sessionDidConnect(_ session: OTSession?) { + if let sessionId = session?.sessionId { + print("sessionDidConnect (\(sessionId))") + } + + // Step 2: We have successfully connected, now instantiate a publisher and + // begin pushing A/V streams into OpenTok. + setupPublisher() +} + +func sessionDidDisconnect(_ session: OTSession?) { + var alertMessage: String? = nil + if let sessionId = session?.sessionId { + alertMessage = "Session disconnected: (\(sessionId))" + } + print("sessionDidDisconnect (\(alertMessage ?? ""))") +} + +func session( + _ mySession: OTSession?, + streamCreated stream: OTStream? +) { + if let streamId = stream?.streamId { + print("session streamCreated (\(streamId))") + } + + if nil == subscriber { + setupSubscribe(stream) + } +} + + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +func session( + _ session: OTSession?, + streamDestroyed stream: OTStream? +) { + if let streamId = stream?.streamId { + print("session streamDestroyed (\(streamId))") + } + + if subscriber.stream.streamId == stream?.streamId { + cleanupSubscriber() + } +} + +func session( + _ session: OTSession?, + connectionCreated connection: OTConnection? +) { + startTimer(callDuration, warningDuration) + if let connectionId = connection?.connectionId { + print("session connectionCreated (\(connectionId))") + } +} + +func session( + _ session: OTSession?, + connectionDestroyed connection: OTConnection? +) { + if let connectionId = connection?.connectionId { + print("session connectionDestroyed (\(connectionId))") + } + if subscriber.stream.connection.connectionId == connection?.connectionId { + cleanupSubscriber() + } + sessionDisconnect() +} + + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +func session( + _ session: ARSession, + didFailWithError error: Error +) { + print("didFailWithError: (\(error))") +} + +func session(_ session: OTSession, receivedSignalType type: String?, from connection: OTConnection?, with string: String?) { + print("\(session)") +} + +func sessionDisconnect() { + if session && session.sessionConnectionStatus == OTSessionConnectionStatusConnected { + print("disconnecting....") + session.disconnect(nil) + dismiss(animated: true) + return + } + dismiss(animated: true) +} + + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +//do { +// print( +// "subscriberDidConnectToStream (\(subscriber.stream.connection.connectionId))") +// assert(subscriber == subscriber) +// remoteVideo.addSubview(subscriber.view) +// subscriber.view.frame = remoteVideo.bounds +// // self.remoteVideo=_publisher.view; +//} + +- +do { + print( + "subscriber \(subscriber.stream.streamId) didFailWithError \(error)") +} + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +// MARK: - OTPublisher delegate callbacks +func publisher( + _ publisher: OTPublisherKit?, + streamCreated stream: OTStream? +) { + print("Publishing") +} + +func publisher( + _ publisher: OTPublisherKit?, + streamDestroyed stream: OTStream? +) { + if subscriber.stream.streamId == stream?.streamId { + cleanupSubscriber() + } + + cleanupPublisher() +} + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +func publisher( + _ publisher: OTPublisherKit?, + didFailWithError error: OTError? +) { + if let error = error { + print("publisher didFailWithError \(error)") + } + cleanupPublisher() +} + +// MARK: - Ui Handel +func hideVideoMuted() { + remoteVideoMutedIndicator.hidden = true + localVideoMutedBg.hidden = true + localVideoMutedIndicator.hidden = true +} + +func setupButtons() { + perform(#selector(hideControlButtons), with: nil, afterDelay: 3) + let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(remoteVideoTapped(_:))) + view.addGestureRecognizer(tapGestureRecognizer) + view.isUserInteractionEnabled = true +} + + // Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +@objc func hideControlButtons() { + controlButtons.hidden = true +} + +func remoteVideoTapped(_ recognizer: UITapGestureRecognizer?) { + if controlButtons.hidden { + controlButtons.hidden = false + perform(#selector(hideControlButtons), with: nil, afterDelay: 3) + } +} + +func resetHideButtonsTimer() { + ClingoVideoCallViewController.cancelPreviousPerformRequests(withTarget: self) + perform(#selector(hideControlButtons), with: nil, afterDelay: 3) +} + + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +@IBAction func didClickMuteButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + publisher.publishAudio = !sender.isSelected + resetHideButtonsTimer() +} + +@IBAction func didClickSpeakerButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + subscriber.subscribeToAudio = !sender.isSelected + resetHideButtonsTimer() +} + +@IBAction func didClickVideoMuteButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + if publisher.publishVideo { + publisher.publishVideo = false + } else { + publisher.publishVideo = true + } + localVideo.hidden = sender.isSelected + localVideoMutedBg.hidden = !sender.isSelected + localVideoMutedIndicator.hidden = !sender.isSelected + resetHideButtonsTimer() +} + + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +@IBAction func didClickSwitchCameraButton(_ sender: UIButton) { + sender.isSelected = !sender.isSelected + if sender.isSelected { + publisher.cameraPosition = RPCameraPosition(rawValue: AVCaptureDevice.Position.back.rawValue) + } else { + publisher.cameraPosition = RPCameraPosition(rawValue: AVCaptureDevice.Position.front.rawValue) + } + resetHideButtonsTimer() +} + +@IBAction func hangUp(_ sender: UIButton) { + sessionDisconnect() +} + +// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ +func startTimer(_ callDuration: String?, _ warningTime: String?) { +} + + func -currentTime as? Date! +do { + let startCallTime = Date() + dateFormatter.dateFormat = "yyyyMMddHHmmss" + let resultString = dateFormatter.string(from: startCallTime) + let date = dateFormatter.date(from: resultString) + return date +} + + +} diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 50b89148..733a1b9c 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,12 +1,3 @@ -/* - *@author: Amjad Amireh Merge to Elham rababah - *@Date:27/4/2020 - *@param: - *@return:PatientsScreen - - *@desc: - */ - import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; @@ -19,6 +10,7 @@ import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; @@ -93,14 +85,6 @@ class _PatientsScreenState extends State { } } -/* - *@author: Amjad Amireh - *@Date:5/5/2020 - *@param: - *@return:Convert time from Milesecond to date with time - - *@desc: - */ convertDate(String str) { String timeConvert; const start = "/Date("; @@ -129,14 +113,6 @@ class _PatientsScreenState extends State { return newDateformat.toString(); } -/* - *@author: Amjad Amireh - *@Date:5/5/2020 - *@param: - *@return:Convert time from Milesecond to date - - *@desc: - */ convertDateFormat(String str) { String timeConvert; const start = "/Date("; @@ -156,24 +132,6 @@ class _PatientsScreenState extends State { return newDate.toString(); } - convertDateFormat2(String str) { - String timeConvert; - const start = "/Date("; - const end = "+0300)"; - - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - String newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); - - return newDate.toString(); - } filterBooking(String str) { this.responseModelList = this.responseModelList2; @@ -228,14 +186,6 @@ class _PatientsScreenState extends State { return TranslationBase.of(context).all; } -/* - *@author: Amjad Amireh Modified New design - *@Date:21/5/2020 - *@param: - *@return:PatientsScreen - - *@desc: - */ @override Widget build(BuildContext context) { _locations = [ @@ -401,322 +351,19 @@ class _PatientsScreenState extends State { children: responseModelList .map((PatiantInformtion item) { - return Container( - decoration: - myBoxDecoration(), - child: InkWell( - child: Row( - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: < - Widget>[ - Padding( - padding: EdgeInsets - .only( - left: - 12.0), - child: - Container( - decoration: - BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color.fromRGBO( - 0, - 0, - 0, - 0.08), - offset: Offset(0.0, - 5.0), - blurRadius: - 16.0) - ], - borderRadius: - BorderRadius.all( - Radius.circular(35.0)), - color: Color( - 0xffCCCCCC), - ), - width: 70, - height: 70, - child: Icon( - item.genderDescription == - "Male" - ? DoctorApp - .male - : DoctorApp - .female_icon, - size: 70, - color: Colors - .white, - ), - ), - ), - ], - ), - - SizedBox( - width: 10, - ), - - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Column( - children: [ - SizedBox( - height: - 10.0, - ), - AppText( - item.firstName + - " " + - item.lastName, - fontSize: - 2.0 * SizeConfig.textMultiplier, - fontWeight: - FontWeight.bold, - backGroundcolor: - Colors.white, - ), - SizedBox( - height: - 5, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: < - Widget>[ - Wrap( - children: [ - AppText( - TranslationBase.of(context).fileNo, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.patientId.toString(), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - SizedBox( - width: 10, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - Container( - child: - AppText( - TranslationBase.of(context).nationality + " : " + (item.nationalityName ?? item.nationality), - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - margin: - EdgeInsets.only(right: projectsProvider.isArabic ? 0 : 10, left: projectsProvider.isArabic ? 10 : 0), - ), - SizedBox( - width: - 10, - ), - SizedBox( - height: - 15.5, - ), - SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 0.5, - ) - ], - ) - : SizedBox( - height: 5, - ), - ], - ), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - // mainAxisAlignment: - // MainAxisAlignment - // .spaceBetween, - children: < - Widget>[ - SizedBox( - height: - 0.5, - ), - SizedBox( - height: - 0, - ), - Wrap( - children: [ - AppText( - TranslationBase - .of( - context) - .age2, - fontSize: 1.8 * - SizeConfig - .textMultiplier, - fontWeight: FontWeight - .bold, - backGroundcolor: Colors - .white, - ), - AppText( - " ${DateUtils.getAgeByBirthday(item.dateofBirth, context)}", - - fontSize: 1.8 * - SizeConfig - .textMultiplier, - fontWeight: FontWeight - .w300, - backGroundcolor: Colors - .white, - ), - SizedBox( - width: 10, - ), - ], - ), - SizedBox( - height: - 2.5, - ), - - Wrap( - children: [ - AppText( - TranslationBase.of(context).gender2, - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - backGroundcolor: Colors.white, - ), - AppText( - item.gender.toString() == '1' ? 'Male' : 'Female', - fontSize: 1.8 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - backGroundcolor: Colors.white, - ), - ], - ), - SizedBox( - height: - 8, - ), - SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" - ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - height: 15, - width: 60, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(25), - color: HexColor("#20A169"), - ), - child: AppText( - item.startTime, - color: Colors.white, - fontSize: 1.5 * SizeConfig.textMultiplier, - textAlign: TextAlign.center, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - width: 3.5, - ), - Container( - child: AppText( - convertDateFormat2(item.appointmentDate.toString()), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - ), - SizedBox( - height: 25.5, - ), - ], - ) - : SizedBox( - height: 15, - ), - ], - ), - ), - ], - ), - ], - ), - ), - // Divider(color: Colors.grey) - ], - ), - onTap: () { - Navigator.of(context) - .pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": item, - "patientType":patientType, - "from" : patient.getFrom, - "to" : patient.getTo, - }); - }, - ), - ); + return PatientCard(patientInfo: item, + patientType: patientType, + onTap: () { + Navigator.of(context) + .pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": item, + "patientType":patientType, + "from" : patient.getFrom, + "to" : patient.getTo, + }); + },); }).toList(), ) : Center( @@ -754,88 +401,78 @@ class _PatientsScreenState extends State { } Widget _locationBar(BuildContext _context) { - return Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.0619, - width: SizeConfig.screenWidth * 0.94, - decoration: BoxDecoration( - color: Color(0Xffffffff), - borderRadius: BorderRadius.circular(12.5), - border: Border.all( - width: 0.5, - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _locations.map((item) { - bool _isActive = _locations[_activeLocation] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Center( - child: Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.058, - width: SizeConfig.screenWidth * 0.2334, - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(12.5), - topRight: Radius.circular(12.5), - topLeft: Radius.circular(9.5), - bottomLeft: Radius.circular(9.5)), - color: - _isActive ? HexColor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - - fontWeight: FontWeight.normal, - ), - ), - )), - ), - ), - onTap: () { - filterBooking(item.toString()); - - setState(() { - _activeLocation = _locations.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10), - topRight: Radius.circular(10)), - color: Colors.white), - alignment: Alignment.center, - height: 1, - width: SizeConfig.screenWidth * 0.23, - ) - : Container() - ]); - }).toList(), + return Container( + height: MediaQuery.of(context).size.height * 0.0619, + width: SizeConfig.screenWidth * 0.94, + decoration: BoxDecoration( + color: Color(0Xffffffff), + borderRadius: BorderRadius.circular(12.5), + border: Border.all( + width: 0.5, ), ), - ); - } + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: _locations.map((item) { + bool _isActive = _locations[_activeLocation] == item ? true : false; + return Column(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.058, + width: SizeConfig.screenWidth * 0.2334, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(12.5), + topRight: Radius.circular(12.5), + topLeft: Radius.circular(9.5), + bottomLeft: Radius.circular(9.5)), + color: + _isActive ? HexColor("#B8382B") : Colors.white, + ), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + + fontWeight: FontWeight.normal, + ), + ), + )), + ), + onTap: () { + filterBooking(item.toString()); - myBoxDecoration() { - return BoxDecoration( - border: Border( - bottom: BorderSide( - color: Color(0xffCCCCCC), - width: 0.5, - ), + setState(() { + _activeLocation = _locations.indexOf(item); + }); + }), + _isActive + ? Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10), + topRight: Radius.circular(10)), + color: Colors.white), + alignment: Alignment.center, + height: 1, + width: SizeConfig.screenWidth * 0.23, + ) + : Container() + ]); + }).toList(), ), ); } + + } + + + diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart new file mode 100644 index 00000000..5ccae18f --- /dev/null +++ b/lib/widgets/patients/PatientCard.dart @@ -0,0 +1,244 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class PatientCard extends StatelessWidget { + final PatiantInformtion patientInfo; + final Function onTap; + final String patientType; + const PatientCard({Key key, this.patientInfo, this.onTap, this.patientType}) : super(key: key); + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(10), + decoration: myBoxDecoration(), + margin: EdgeInsets.only(bottom: 12), + child: InkWell( + child: Row( + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: < + Widget>[ + Padding( + padding: EdgeInsets + .only( + left: + 12.0), + child: + Container( + decoration: + BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color.fromRGBO( + 0, + 0, + 0, + 0.08), + offset: Offset(0.0, + 5.0), + blurRadius: + 16.0) + ], + borderRadius: + BorderRadius.all( + Radius.circular(35.0)), + color: Color( + 0xffCCCCCC), + ), + width: 70, + height: 70, + child: Icon( + patientInfo.genderDescription == + "Male" + ? DoctorApp + .male + : DoctorApp + .female_icon, + size: 70, + color: Colors + .white, + ), + ), + ), + ], + ), + + SizedBox( + width: 10, + ), + Expanded( + child: Column( + crossAxisAlignment:CrossAxisAlignment.start, + children: [ + AppText( + patientInfo.firstName + + " " + + patientInfo.lastName, + fontSize: + 2.0 * SizeConfig.textMultiplier, + fontWeight: + FontWeight.bold, + backGroundcolor: + Colors.white, + ), + SizedBox(height: 12,), + Table( + border: TableBorder.symmetric( + // inside: BorderSide(width: 2.0, color: Colors.white), + ), + // defaultVerticalAlignment:TableCellVerticalAlignment.middle , + children: [ + TableRow(children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).fileNo, + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 2.2 * SizeConfig.textMultiplier)), + new TextSpan(text: patientInfo.patientId.toString()), + ],),), + ), + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).age+ " : ", + style: TextStyle(fontWeight: FontWeight.w700, )), + new TextSpan(text: "${DateUtils.getAgeByBirthday(patientInfo.dateofBirth, context)}"), + ],),), + ), + ] + ), + TableRow(children: [ + SizedBox(height: 5,), + SizedBox(height: 5,) + ]), + TableRow(children: [ + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).nationality + " : ", + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 2.2 * SizeConfig.textMultiplier)), + new TextSpan(text: (patientInfo.nationalityName ?? patientInfo.nationality)), + ],),), + ), + + + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black), + children: [ + new TextSpan( + text: TranslationBase.of(context).gender + " : ", + style: TextStyle(fontWeight: FontWeight.w700, )), + new TextSpan(text: patientInfo.gender.toString() == '1' ? 'Male' : 'Female'), + ],),), + ), + ] + ), + + ], + ), + if(SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient") + Container( + + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + height: 15, + width: 60, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), + color: HexColor("#20A169"), + ), + child: AppText( + patientInfo.startTime, + color: Colors.white, + fontSize: 1.5 * SizeConfig.textMultiplier, + textAlign: TextAlign.center, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + width: 3.5, + ), + Container( + child: AppText( + convertDateFormat2(patientInfo.appointmentDate.toString()), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 0.5, + ) + ], + ), + margin: EdgeInsets.only(top: 8,), + ) + ], + ), + ), + + // Divider(color: Colors.grey) + ], + ), + onTap: onTap, + ), + ); + } + + convertDateFormat2(String str) { + String timeConvert; + const start = "/Date("; + const end = "+0300)"; + + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + + return newDate.toString(); + } + + myBoxDecoration() { + return BoxDecoration( + border: Border( + bottom: BorderSide( + color: Color(0xffCCCCCC), + width: 0.5, + ), + ), + ); + } +} \ No newline at end of file From dcac240ae4e44c76309e57ad9ec388bbe300a030 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 10 Feb 2021 17:15:05 +0200 Subject: [PATCH 10/10] remove files --- .../ClingoVideoCallViewController.swift | 446 ------------------ 1 file changed, 446 deletions(-) delete mode 100644 ios/Runner/ClingoVideoCallViewController.swift diff --git a/ios/Runner/ClingoVideoCallViewController.swift b/ios/Runner/ClingoVideoCallViewController.swift deleted file mode 100644 index b1bacdae..00000000 --- a/ios/Runner/ClingoVideoCallViewController.swift +++ /dev/null @@ -1,446 +0,0 @@ -// -// ViewController.swift -// Lets-Build-OTPublisher -// -// Created by Roberto Perez Cubero on 11/08/16. -// Copyright © 2016 tokbox. All rights reserved. -// - -import UIKit -import OpenTok - -// The converted code is limited to 2 KB. -// Refill your credit or upgrade your plan to remove this limitation. -// -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -// -// ClingoVideoCallViewController.m -// Runner -// -// Created by Mohammad Aljammal & Elham on 23/6/20. -// Copyright © 2020 The Chromium Authors. All rights reserved. -// - - - - -import AVFoundation - -var dateFormatter: DateFormatter? - - -class ClingoVideoCallViewController : UIViewController, OTSessionDelegate, OTSubscriberDelegate, OTPublisherDelegate{ - - var kApiKey: String? - var kSessionId: String? - var kToken: String? - var session: OTSession? - var publisher: OTPublisher? - var subscriber: OTSubscriber? - var callDuration: String? - var warningDuration: String? - var appLang: String? - - - - @IBOutlet weak var localVideo: UIView! - @IBOutlet weak var remoteVideo: UIView! - @IBOutlet weak var controlButtons: UIView! - @IBOutlet weak var remoteVideoMutedIndicator: UIImageView! - @IBOutlet weak var localVideoMutedBg: UIImageView! - @IBOutlet weak var localVideoMutedIndicator: UIImageView! - @IBOutlet weak var remainingTimeLBL: UILabel! - @IBOutlet weak var pgView: UIProgressView! - var timer: Timer? - - - - - func viewDidLoad() { - super.viewDidLoad() - dateFormatter = DateFormatter() - - setupButtons() - askForMicrophonePermission() - requestCameraPermissionsIfNeeded() - hideVideoMuted() - setupSession() - // Do any additional setup after loading the view. - } - - func viewDidDisappear(_ animated: Bool) { - sessionDisconnect() - timer.invalidate() - timer = nil - PgView.hidden = true - remainingTimeLBL.hidden = true - } - -// MARK: -Microphone Camera and Permission Request - func askForMicrophonePermission() { - switch AVAudioSession.sharedInstance().recordPermission { - case AVAudioSessionRecordPermissionGranted: - break - case AVAudioSessionRecordPermissionDenied: - break - case AVAudioSessionRecordPermissionUndetermined: - // This is the initial state before a user has made any choice - // You can use this spot to request permission here if you want - AVAudioSession.sharedInstance().requestRecordPermission({ granted in - // Check for granted - }) - default: - break - } - } - - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -func requestCameraPermissionsIfNeeded() { - - // check camera authorization status - let authStatus: AVAuthorizationStatus = AVCaptureDevice.authorizationStatus(for: .video) - switch authStatus { - case .authorized: break - // camera authorized - // do camera intensive stuff - case .notDetermined: - // request authorization - - AVCaptureDevice.requestAccess(for: .video, completionHandler: { granted in - DispatchQueue.main.async(execute: { - - if granted { - // do camera intensive stuff - } else { - self.notifyUserOfCameraAccessDenial() - } - }) - }) - case .restricted, .denied: - DispatchQueue.main.async(execute: { - self.notifyUserOfCameraAccessDenial() - }) - default: - break - } -} - -func notifyUserOfCameraAccessDenial() { - // display a useful message asking the user to grant permissions from within Settings > Privacy > Camera -} - -// MARK: - OpenTok methods -func showAlert(_ string: String?) { - // show alertview on main UI - DispatchQueue.main.async(execute: { - let alertVC = UIAlertController( - title: "OTError", - message: string, - preferredStyle: .alert) - self.present(alertVC, animated: true) - }) -} - -// MARK: - OpenTok methods -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -/// Asynchronously begins the session connect process. Some time later, we will -/// expect a delegate method to call us back with the results of this action. -func setupSession() { - //setup one time session - if session { - session = nil - } - session = OTSession( - apiKey: kApiKey, - sessionId: kSessionId, - delegate: self) - do { - try session.connect(withToken: kToken) - } catch { - } - -} - -/// Sets up an instance of OTPublisher to use with this session. OTPubilsher -/// binds to the device camera and microphone, and will provide A/V streams -/// to the OpenTok session. -func setupPublisher() { - let settings = OTPublisherSettings() - settings.name = UIDevice.current.name - publisher = OTPublisher(delegate: self, settings: settings) - - var error: OTError? = nil - session.publish(publisher, error: &error) - if error != nil { - showAlert(error?.localizedDescription()) - } - localVideo.addSubview(publisher.view) - publisher.view.frame = CGRect(x: localVideo.bounds.origin.x, y: localVideo.bounds.origin.y, width: localVideo.bounds.size.width, height: localVideo.bounds.size.height) - -} - -/// Cleans up the publisher and its view. At this point, the publisher should not -/// be attached to the session any more. -func cleanupPublisher() { - publisher?.view.removeFromSuperview() - publisher = nil - // this is a good place to notify the end-user that publishing has stopped. -} - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -/// Instantiates a subscriber for the given stream and asynchronously begins the -/// process to begin receiving A/V content for this stream. Unlike doPublish, -/// this method does not add the subscriber to the view hierarchy. Instead, we -/// add the subscriber only after it has connected and begins receiving data. -func setupSubscribe(_ stream: OTStream?) { - subscriber = OTSubscriber(stream: stream, delegate: self) - - var error: OTError? = nil - session.subscribe(subscriber, error: &error) - if error != nil { - showAlert(error?.localizedDescription()) - } -} - -/// Cleans the subscriber from the view hierarchy, if any. -/// NB: You do *not* have to call unsubscribe in your controller in response to -/// a streamDestroyed event. Any subscribers (or the publisher) for a stream will -/// be automatically removed from the session during cleanup of the stream. -func cleanupSubscriber() { - subscriber.view.removeFromSuperview() - subscriber = nil -} - - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -// MARK: - OTSession delegate callbacks -func sessionDidConnect(_ session: OTSession?) { - if let sessionId = session?.sessionId { - print("sessionDidConnect (\(sessionId))") - } - - // Step 2: We have successfully connected, now instantiate a publisher and - // begin pushing A/V streams into OpenTok. - setupPublisher() -} - -func sessionDidDisconnect(_ session: OTSession?) { - var alertMessage: String? = nil - if let sessionId = session?.sessionId { - alertMessage = "Session disconnected: (\(sessionId))" - } - print("sessionDidDisconnect (\(alertMessage ?? ""))") -} - -func session( - _ mySession: OTSession?, - streamCreated stream: OTStream? -) { - if let streamId = stream?.streamId { - print("session streamCreated (\(streamId))") - } - - if nil == subscriber { - setupSubscribe(stream) - } -} - - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -func session( - _ session: OTSession?, - streamDestroyed stream: OTStream? -) { - if let streamId = stream?.streamId { - print("session streamDestroyed (\(streamId))") - } - - if subscriber.stream.streamId == stream?.streamId { - cleanupSubscriber() - } -} - -func session( - _ session: OTSession?, - connectionCreated connection: OTConnection? -) { - startTimer(callDuration, warningDuration) - if let connectionId = connection?.connectionId { - print("session connectionCreated (\(connectionId))") - } -} - -func session( - _ session: OTSession?, - connectionDestroyed connection: OTConnection? -) { - if let connectionId = connection?.connectionId { - print("session connectionDestroyed (\(connectionId))") - } - if subscriber.stream.connection.connectionId == connection?.connectionId { - cleanupSubscriber() - } - sessionDisconnect() -} - - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -func session( - _ session: ARSession, - didFailWithError error: Error -) { - print("didFailWithError: (\(error))") -} - -func session(_ session: OTSession, receivedSignalType type: String?, from connection: OTConnection?, with string: String?) { - print("\(session)") -} - -func sessionDisconnect() { - if session && session.sessionConnectionStatus == OTSessionConnectionStatusConnected { - print("disconnecting....") - session.disconnect(nil) - dismiss(animated: true) - return - } - dismiss(animated: true) -} - - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -//do { -// print( -// "subscriberDidConnectToStream (\(subscriber.stream.connection.connectionId))") -// assert(subscriber == subscriber) -// remoteVideo.addSubview(subscriber.view) -// subscriber.view.frame = remoteVideo.bounds -// // self.remoteVideo=_publisher.view; -//} - -- -do { - print( - "subscriber \(subscriber.stream.streamId) didFailWithError \(error)") -} - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -// MARK: - OTPublisher delegate callbacks -func publisher( - _ publisher: OTPublisherKit?, - streamCreated stream: OTStream? -) { - print("Publishing") -} - -func publisher( - _ publisher: OTPublisherKit?, - streamDestroyed stream: OTStream? -) { - if subscriber.stream.streamId == stream?.streamId { - cleanupSubscriber() - } - - cleanupPublisher() -} - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -func publisher( - _ publisher: OTPublisherKit?, - didFailWithError error: OTError? -) { - if let error = error { - print("publisher didFailWithError \(error)") - } - cleanupPublisher() -} - -// MARK: - Ui Handel -func hideVideoMuted() { - remoteVideoMutedIndicator.hidden = true - localVideoMutedBg.hidden = true - localVideoMutedIndicator.hidden = true -} - -func setupButtons() { - perform(#selector(hideControlButtons), with: nil, afterDelay: 3) - let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(remoteVideoTapped(_:))) - view.addGestureRecognizer(tapGestureRecognizer) - view.isUserInteractionEnabled = true -} - - // Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -@objc func hideControlButtons() { - controlButtons.hidden = true -} - -func remoteVideoTapped(_ recognizer: UITapGestureRecognizer?) { - if controlButtons.hidden { - controlButtons.hidden = false - perform(#selector(hideControlButtons), with: nil, afterDelay: 3) - } -} - -func resetHideButtonsTimer() { - ClingoVideoCallViewController.cancelPreviousPerformRequests(withTarget: self) - perform(#selector(hideControlButtons), with: nil, afterDelay: 3) -} - - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -@IBAction func didClickMuteButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - publisher.publishAudio = !sender.isSelected - resetHideButtonsTimer() -} - -@IBAction func didClickSpeakerButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - subscriber.subscribeToAudio = !sender.isSelected - resetHideButtonsTimer() -} - -@IBAction func didClickVideoMuteButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - if publisher.publishVideo { - publisher.publishVideo = false - } else { - publisher.publishVideo = true - } - localVideo.hidden = sender.isSelected - localVideoMutedBg.hidden = !sender.isSelected - localVideoMutedIndicator.hidden = !sender.isSelected - resetHideButtonsTimer() -} - - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -@IBAction func didClickSwitchCameraButton(_ sender: UIButton) { - sender.isSelected = !sender.isSelected - if sender.isSelected { - publisher.cameraPosition = RPCameraPosition(rawValue: AVCaptureDevice.Position.back.rawValue) - } else { - publisher.cameraPosition = RPCameraPosition(rawValue: AVCaptureDevice.Position.front.rawValue) - } - resetHideButtonsTimer() -} - -@IBAction func hangUp(_ sender: UIButton) { - sessionDisconnect() -} - -// Converted to Swift 5.2 by Swiftify v5.2.26743 - https://swiftify.com/ -func startTimer(_ callDuration: String?, _ warningTime: String?) { -} - - func -currentTime as? Date! -do { - let startCallTime = Date() - dateFormatter.dateFormat = "yyyyMMddHHmmss" - let resultString = dateFormatter.string(from: startCallTime) - let date = dateFormatter.date(from: resultString) - return date -} - - -}