diff --git a/android/app/build.gradle b/android/app/build.gradle index 2e124398..e19addc9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -108,6 +108,6 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.6.2' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' - + implementation 'com.google.firebase:firebase-analytics:17.4.1' } apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json index db548786..e6560790 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,34 +1,77 @@ { "project_info": { - "project_number": "157373154094", - "project_id": "hmg-doctor-app-1553688619744", - "storage_bucket": "hmg-doctor-app-1553688619744.appspot.com" + "project_number": "934365232760", + "project_id": "hmg-dr-app", + "storage_bucket": "hmg-dr-app.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:157373154094:android:daeea3a4e1f4462a1bf0bf", + "mobilesdk_app_id": "1:934365232760:android:024b3569972f1c09f9778d", + "android_client_info": { + "package_name": "COM.HMG.HMGDR" + } + }, + "oauth_client": [ + { + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCpYwrmuntOBdZv6GV6KEnLj8nQRvEnZ6I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "934365232760-57v2ld1qqulc4nt4o5pgjfbpc47fj3qf.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "COM.HMG.HMGDR" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:934365232760:android:e0e185e68c0d7690f9778d", "android_client_info": { "package_name": "com.hmg.hmgDr" } }, "oauth_client": [ { - "client_id": "157373154094-egrhbfr861l7k722g3v2gd4a0opi3r1u.apps.googleusercontent.com", + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyDX8RPwu00MyrpqC-T2zXtrUQvTQGRv1mM" + "current_key": "AIzaSyCpYwrmuntOBdZv6GV6KEnLj8nQRvEnZ6I" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "157373154094-egrhbfr861l7k722g3v2gd4a0opi3r1u.apps.googleusercontent.com", + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", "client_type": 3 + }, + { + "client_id": "934365232760-57v2ld1qqulc4nt4o5pgjfbpc47fj3qf.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "COM.HMG.HMGDR" + } } ] } diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java index 2b099551..c26f8df4 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallContract.java @@ -13,6 +13,7 @@ public interface VideoCallContract { void onCallChangeCallStatusSuccessful(SessionStatusModel sessionStatusModel); void onFailure(); + } interface VideoCallPresenter { diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java index ea2128ba..4613c231 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/VideoCallPresenterImpl.java @@ -59,7 +59,6 @@ public class VideoCallPresenterImpl implements VideoCallContract.VideoCallPresen public void onResponse(@NotNull Call call, @NotNull Response response) { if (!response.isSuccessful()) view.onFailure(); - } @Override diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt index abe6225e..cba99ab9 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt @@ -416,6 +416,20 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session mSession = Session.Builder(context, apiKey, sessionId).build() mSession!!.setSessionListener(this) mSession!!.connect(token) + + mSession!!.setReconnectionListener(object :Session.ReconnectionListener{ + override fun onReconnecting(p0: Session?) { + + } + + override fun onReconnected(session: Session?) { + session?.connect(token) + } + + + }) + + } catch (e: Exception) { e.printStackTrace() } @@ -453,10 +467,10 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session override fun onDisconnected(session: Session) { Log.d(TAG, "onDisconnected: disconnected from session " + session.sessionId) - mSession = null - cmTimer.stop() - disconnectSession() - videoCallResponseListener?.minimizeVideoEvent(false) +// mSession = null +// cmTimer.stop() +// disconnectSession() +// videoCallResponseListener?.minimizeVideoEvent(false) } override fun onError(session: Session, opentokError: OpentokError) { @@ -503,7 +517,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session mSubscriber!!.destroy() mSubscriber = null } - disconnectSession() + //disconnectSession() } override fun onStreamCreated(publisherKit: PublisherKit?, stream: Stream) { @@ -628,6 +642,16 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session sessionStatusModel!!.vcid ) ) +// if(isDismiss) +// dialog?.dismiss() +// else + onCallChangeCallStatusSuccessful() + } + + fun onCallChangeCallStatusSuccessful(){ + val returnIntent = Intent() + returnIntent.putExtra("CallEnd", sessionStatusModel) + videoCallResponseListener?.onCallFinished(Activity.RESULT_CANCELED, returnIntent) dialog?.dismiss() } diff --git a/android/build.gradle b/android/build.gradle index badc1b18..bf0f679d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.2' + classpath 'com.google.gms:google-services:4.3.3' } } diff --git a/android/google-services.json b/android/google-services.json index db548786..e6560790 100644 --- a/android/google-services.json +++ b/android/google-services.json @@ -1,34 +1,77 @@ { "project_info": { - "project_number": "157373154094", - "project_id": "hmg-doctor-app-1553688619744", - "storage_bucket": "hmg-doctor-app-1553688619744.appspot.com" + "project_number": "934365232760", + "project_id": "hmg-dr-app", + "storage_bucket": "hmg-dr-app.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:157373154094:android:daeea3a4e1f4462a1bf0bf", + "mobilesdk_app_id": "1:934365232760:android:024b3569972f1c09f9778d", + "android_client_info": { + "package_name": "COM.HMG.HMGDR" + } + }, + "oauth_client": [ + { + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCpYwrmuntOBdZv6GV6KEnLj8nQRvEnZ6I" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "934365232760-57v2ld1qqulc4nt4o5pgjfbpc47fj3qf.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "COM.HMG.HMGDR" + } + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:934365232760:android:e0e185e68c0d7690f9778d", "android_client_info": { "package_name": "com.hmg.hmgDr" } }, "oauth_client": [ { - "client_id": "157373154094-egrhbfr861l7k722g3v2gd4a0opi3r1u.apps.googleusercontent.com", + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyDX8RPwu00MyrpqC-T2zXtrUQvTQGRv1mM" + "current_key": "AIzaSyCpYwrmuntOBdZv6GV6KEnLj8nQRvEnZ6I" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "157373154094-egrhbfr861l7k722g3v2gd4a0opi3r1u.apps.googleusercontent.com", + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", "client_type": 3 + }, + { + "client_id": "934365232760-57v2ld1qqulc4nt4o5pgjfbpc47fj3qf.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "COM.HMG.HMGDR" + } } ] } diff --git a/ios/GoogleService-Info .plist b/ios/GoogleService-Info .plist index 81c3af44..a29eac6d 100644 --- a/ios/GoogleService-Info .plist +++ b/ios/GoogleService-Info .plist @@ -3,21 +3,21 @@ CLIENT_ID - 1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com + 934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre + com.googleusercontent.apps.934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5 API_KEY - AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo + AIzaSyBtA8-oCZ5T4gkuTG7CucGr_d_7lakp4MM GCM_SENDER_ID - 1097451043303 + 934365232760 PLIST_VERSION 1 BUNDLE_ID - com.hmg.doctorApp + com.hmg.hmgDr PROJECT_ID - doctor-app-35ddc + hmg-dr-app STORAGE_BUCKET - doctor-app-35ddc.appspot.com + hmg-dr-app.appspot.com IS_ADS_ENABLED IS_ANALYTICS_ENABLED @@ -29,6 +29,6 @@ IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:1097451043303:ios:0e9b87e77dcf397d866542 + 1:934365232760:ios:61e01db91b41502bf9778d \ No newline at end of file diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist index 81c3af44..a29eac6d 100644 --- a/ios/Runner/GoogleService-Info.plist +++ b/ios/Runner/GoogleService-Info.plist @@ -3,21 +3,21 @@ CLIENT_ID - 1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com + 934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre + com.googleusercontent.apps.934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5 API_KEY - AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo + AIzaSyBtA8-oCZ5T4gkuTG7CucGr_d_7lakp4MM GCM_SENDER_ID - 1097451043303 + 934365232760 PLIST_VERSION 1 BUNDLE_ID - com.hmg.doctorApp + com.hmg.hmgDr PROJECT_ID - doctor-app-35ddc + hmg-dr-app STORAGE_BUCKET - doctor-app-35ddc.appspot.com + hmg-dr-app.appspot.com IS_ADS_ENABLED IS_ANALYTICS_ENABLED @@ -29,6 +29,6 @@ IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:1097451043303:ios:0e9b87e77dcf397d866542 + 1:934365232760:ios:61e01db91b41502bf9778d \ No newline at end of file diff --git a/lib/config/config.dart b/lib/config/config.dart index d6836827..d193bfac 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -231,6 +231,9 @@ const GET_SPECIAL_CLINICAL_CARE_MAPPING_LIST = "Services/DoctorApplication.svc/R const INSERT_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_InsertMedicalReport_New"; const UPDATE_MEDICAL_REPORT = "Services/Patients.svc/REST/DAPP_UpdateMedicalReport"; +const GET_SICK_LEAVE_DOCTOR_APP = "Services/DoctorApplication.svc/REST/GetAllSickLeaves"; +const ADD_PATIENT_TO_DOCTOR = "LiveCareApi/DoctorApp/AssignPatientToDoctor"; +const REMOVE_PATIENT_FROM_DOCTOR = "LiveCareApi/DoctorApp/BackPatientToQueue"; var selectedPatientType = 1; @@ -283,7 +286,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 6.1; +const VERSION_ID = 6.2; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 089ff3b5..0a094b9b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -703,4 +703,5 @@ const Map> localizedValues = { "addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"}, "edit": {"en": "Edit", "ar": "تعديل"}, "summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"}, + "finish": {"en": "Finish", "ar": "انهاء"}, }; diff --git a/lib/core/model/live_care/add_patient_to_doctor_list_request_model.dart b/lib/core/model/live_care/add_patient_to_doctor_list_request_model.dart new file mode 100644 index 00000000..1d63e885 --- /dev/null +++ b/lib/core/model/live_care/add_patient_to_doctor_list_request_model.dart @@ -0,0 +1,27 @@ +class AddPatientToDoctorListRequestModel { + int vCID; + String tokenID; + String generalid; + int doctorId; + bool isOutKsa; + + AddPatientToDoctorListRequestModel({this.vCID, this.tokenID, this.generalid, this.doctorId, this.isOutKsa}); + + AddPatientToDoctorListRequestModel.fromJson(Map json) { + vCID = json['VC_ID']; + tokenID = json['TokenID']; + generalid = json['generalid']; + doctorId = json['DoctorId']; + isOutKsa = json['IsOutKsa']; + } + + Map toJson() { + final Map data = new Map(); + data['VC_ID'] = this.vCID; + data['TokenID'] = this.tokenID; + data['generalid'] = this.generalid; + data['DoctorId'] = this.doctorId; + data['IsOutKsa'] = this.isOutKsa; + return data; + } +} diff --git a/lib/core/model/sick_leave/sick_leave_doctor_request_model.dart b/lib/core/model/sick_leave/sick_leave_doctor_request_model.dart new file mode 100644 index 00000000..26bb76bd --- /dev/null +++ b/lib/core/model/sick_leave/sick_leave_doctor_request_model.dart @@ -0,0 +1,28 @@ +class GetSickLeaveDoctorRequestModel { + int patientMRN; + String appointmentNo; + int status; + String vidaAuthTokenID; + String vidaRefreshTokenID; + + GetSickLeaveDoctorRequestModel( + {this.patientMRN, this.appointmentNo, this.status, this.vidaAuthTokenID, this.vidaRefreshTokenID}); + + GetSickLeaveDoctorRequestModel.fromJson(Map json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + status = json['status']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['status'] = this.status; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + return data; + } +} diff --git a/lib/core/model/sick_leave/sick_leave_patient_model.dart b/lib/core/model/sick_leave/sick_leave_patient_model.dart index 3c78f1ff..43dbdb05 100644 --- a/lib/core/model/sick_leave/sick_leave_patient_model.dart +++ b/lib/core/model/sick_leave/sick_leave_patient_model.dart @@ -36,6 +36,11 @@ class SickLeavePatientModel { String strRequestDate; String startDate; String endDate; + dynamic isExtendedLeave; + dynamic noOfDays; + dynamic patientMRN; + dynamic remarks; + dynamic status; SickLeavePatientModel( {this.setupID, @@ -72,10 +77,19 @@ class SickLeavePatientModel { // this.speciality, this.strRequestDate, this.startDate, - this.endDate}); + this.endDate, + this.isExtendedLeave, + this.noOfDays, + this.patientMRN, + this.remarks, + this.status}); SickLeavePatientModel.fromJson(Map json) { setupID = json['SetupID']; + isExtendedLeave = json['isExtendedLeave']; + noOfDays = json['noOfDays']; + patientMRN = json['patientMRN']; + status = json['status']; projectID = json['ProjectID']; patientID = json['PatientID']; @@ -109,13 +123,17 @@ class SickLeavePatientModel { qR = json['QR']; // speciality = json['Speciality'].cast(); strRequestDate = json['StrRequestDate']; - startDate = json['StartDate']; + startDate = json['StartDate'] ?? json['startDate']; endDate = json['EndDate']; } Map toJson() { final Map data = new Map(); data['SetupID'] = this.setupID; + data['status'] = this.status; + data['isExtendedLeave'] = this.isExtendedLeave; + data['noOfDays'] = this.noOfDays; + data['patientMRN'] = this.patientMRN; data['ProjectID'] = this.projectID; data['PatientID'] = this.patientID; diff --git a/lib/core/model/sick_leave/sick_leave_patient_request_model.dart b/lib/core/model/sick_leave/sick_leave_patient_request_model.dart index ec588316..69b18f41 100644 --- a/lib/core/model/sick_leave/sick_leave_patient_request_model.dart +++ b/lib/core/model/sick_leave/sick_leave_patient_request_model.dart @@ -10,6 +10,7 @@ class SickLeavePatientRequestModel { int patientTypeID; String tokenID; int patientID; + int patientMRN; String sessionID; SickLeavePatientRequestModel( @@ -24,10 +25,12 @@ class SickLeavePatientRequestModel { this.patientTypeID, this.tokenID, this.patientID, - this.sessionID}); + this.sessionID, + this.patientMRN}); SickLeavePatientRequestModel.fromJson(Map json) { versionID = json['VersionID']; + patientMRN = json['PatientMRN']; channel = json['Channel']; languageID = json['LanguageID']; iPAdress = json['IPAdress']; @@ -44,6 +47,7 @@ class SickLeavePatientRequestModel { Map toJson() { final Map data = new Map(); data['VersionID'] = this.versionID; + data['PatientMRN'] = this.patientMRN; data['Channel'] = this.channel; data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; diff --git a/lib/core/service/AnalyticsService.dart b/lib/core/service/AnalyticsService.dart new file mode 100644 index 00000000..660267d5 --- /dev/null +++ b/lib/core/service/AnalyticsService.dart @@ -0,0 +1,22 @@ +import 'package:firebase_analytics/firebase_analytics.dart'; +import 'package:firebase_analytics/observer.dart'; + +class AnalyticsService { + final FirebaseAnalytics _analytics = FirebaseAnalytics(); + + FirebaseAnalyticsObserver getAnalyticsObserver() => + FirebaseAnalyticsObserver(analytics: _analytics); + + Future logEvent( + {String eventCategory, + String eventLabel, + String eventAction, + String eventValue}) async { + await _analytics.logEvent(name: 'event', parameters: { + "eventCategory": eventCategory, + "eventLabel": eventLabel, + "eventAction": eventAction, + "eventValue": eventValue + }); + } +} diff --git a/lib/core/service/VideoCallService.dart b/lib/core/service/VideoCallService.dart index dcc31b71..50a507e6 100644 --- a/lib/core/service/VideoCallService.dart +++ b/lib/core/service/VideoCallService.dart @@ -32,8 +32,8 @@ class VideoCallService extends BaseService { kToken: startCallRes.openTokenID, kSessionId: startCallRes.openSessionID, kApiKey:'46209962', - // kToken: "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==", - // kSessionId: "1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg", + // kToken: "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGUyZjgxMjFlYTFkNzU5NjcxNDY2ZTM2ZjM3YTVhNTI2NGY0NTI2NzpzZXNzaW9uX2lkPTJfTVg0ME56STBOemsxTkg1LU1UWXlOVGN5TmpnMk5qZzNOMzQ1YUhCcGRtcDFXbVpDTDFkNE1qbDRkWFY2TTA4cmIySi1mZyZjcmVhdGVfdGltZT0xNjI1NzI2ODg5Jm5vbmNlPTAuNjc2Nzc4OTQxNjA1MTMxNSZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNjI4MzE4ODg4JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9", + // kSessionId: "2_MX40NzI0Nzk1NH5-MTYyNTcyNjg2Njg3N345aHBpdmp1WmZCL1d4Mjl4dXV6M08rb2J-fg", // kApiKey:'47247954', vcId: patient.vcId, isRecording: isRecording, diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index fff803d8..10af0ea2 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -1,7 +1,7 @@ - import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart'; import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; +import 'package:doctor_app_flutter/core/model/live_care/add_patient_to_doctor_list_request_model.dart'; import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/livecare/end_call_req.dart'; @@ -35,14 +35,12 @@ class LiveCarePatientServices extends BaseService { StartCallRes get startCallRes => _startCallRes; Future getPendingPatientERForDoctorApp( - PendingPatientERForDoctorAppRequestModel - pendingPatientERForDoctorAppRequestModel) async { + PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async { hasError = false; await baseAppClient.post( GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, onSuccess: (dynamic response, int statusCode) { - - List localPatientList= []; + List localPatientList = []; response['List_PendingPatientList'].forEach((v) { localPatientList.add(PatiantInformtion.fromJson(v)); @@ -50,22 +48,19 @@ class LiveCarePatientServices extends BaseService { /// add new items. localPatientList.forEach((element) { - if ((_patientList.singleWhere((it) => it.patientId == element.patientId, - orElse: () => null)) == null) { + if ((_patientList.singleWhere((it) => it.patientId == element.patientId, orElse: () => null)) == null) { _patientList.add(element); } }); /// remove items. - List removedPatientList= []; + List removedPatientList = []; _patientList.forEach((element) { - if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, - orElse: () => null)) == null) { + if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, orElse: () => null)) == null) { removedPatientList.add(element); } }); - removedPatientList.forEach((element) { _patientList.remove(element); }); @@ -105,11 +100,7 @@ class LiveCarePatientServices extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: { - "VC_ID": vcID, - "AltServiceList": altServiceList, - "generalid":GENERAL_ID - }, isLiveCare: _isLive); + }, body: {"VC_ID": vcID, "AltServiceList": altServiceList, "generalid": GENERAL_ID}, isLiveCare: _isLive); } Future transferToAdmin(int vcID, String notes) async { @@ -128,20 +119,17 @@ class LiveCarePatientServices extends BaseService { Future sendSMSInstruction(int vcID) async { hasError = false; - await baseAppClient.post(SEND_SMS_INSTRUCTIONS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(SEND_SMS_INSTRUCTIONS, onSuccess: (dynamic response, int statusCode) { transferToAdminResponse = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: { - "VC_ID": vcID, "generalid": GENERAL_ID - }, isLiveCare: _isLive); + }, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive); } Future isLogin({LiveCareUserLoginRequestModel isLoginRequestModel, int loginStatus}) async { hasError = false; - await getDoctorProfile( ); + await getDoctorProfile(); isLoginRequestModel.doctorId = super.doctorProfile.doctorID; await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async { isLoginResponse = response; @@ -155,17 +143,48 @@ class LiveCarePatientServices extends BaseService { hasError = false; alternativeServicesList.clear(); - await baseAppClient.post(GET_ALTERNATIVE_SERVICE, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALTERNATIVE_SERVICE, onSuccess: (dynamic response, int statusCode) { response['AlternativeServicesList'].forEach((v) { alternativeServicesList.add(AlternativeService.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: { - "VC_ID": vcID, - "generalid": GENERAL_ID - }, isLiveCare: _isLive); + }, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive); + } + + Future addPatientToDoctorList({int vcID}) async { + hasError = false; + await getDoctorProfile(); + AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); + + addPatientToDoctorListRequestModel.doctorId = super.doctorProfile.doctorID; + addPatientToDoctorListRequestModel.vCID = vcID; + addPatientToDoctorListRequestModel.isOutKsa = false; + addPatientToDoctorListRequestModel.generalid = GENERAL_ID; + + await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, onSuccess: (response, statusCode) async { + isLoginResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: addPatientToDoctorListRequestModel.toJson(), isLiveCare: _isLive); + } + + Future removePatientFromDoctorList({int vcID}) async { + hasError = false; + AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel(); + await getDoctorProfile(); + addPatientToDoctorListRequestModel.doctorId = super.doctorProfile.doctorID; + addPatientToDoctorListRequestModel.vCID = vcID; + addPatientToDoctorListRequestModel.isOutKsa = false; + addPatientToDoctorListRequestModel.generalid = GENERAL_ID; + + await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, onSuccess: (response, statusCode) async { + isLoginResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: addPatientToDoctorListRequestModel.toJson(), isLiveCare: _isLive); } } diff --git a/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart b/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart index 8113c9a7..e1fca881 100644 --- a/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart +++ b/lib/core/service/patient_medical_file/sick_leave/sickleave_service.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_doctor_request_model.dart'; import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart'; import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; @@ -21,8 +22,7 @@ class SickLeaveService extends BaseService { List get coveringDoctorsList => _coveringDoctors; List _coveringDoctors = []; - List get getAllRescheduleLeave => - _getReScheduleLeave; + List get getAllRescheduleLeave => _getReScheduleLeave; List _getReScheduleLeave = []; dynamic get postReschedule => _postReschedule; dynamic _postReschedule; @@ -31,9 +31,11 @@ class SickLeaveService extends BaseService { dynamic _sickLeaveResponse; List getAllSickLeavePatient = List(); + List getAllSickLeaveDoctor = List(); + //getAllSickLeavePatient.addAll(getAllSickLeaveDoctor); - SickLeavePatientRequestModel _sickLeavePatientRequestModel = - SickLeavePatientRequestModel(); + SickLeavePatientRequestModel _sickLeavePatientRequestModel = SickLeavePatientRequestModel(); + GetSickLeaveDoctorRequestModel _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel(); Future getStatistics(appoNo, patientMRN) async { hasError = false; @@ -56,6 +58,7 @@ class SickLeaveService extends BaseService { // addSickLeaveRequest.appointmentNo = '2016054661'; // addSickLeaveRequest.patientMRN = '3120746'; hasError = false; + _sickLeaveResponse.clear(); await baseAppClient.post( ADD_SICK_LEAVE, onSuccess: (dynamic response, int statusCode) { @@ -73,8 +76,7 @@ class SickLeaveService extends BaseService { Future extendSickLeave(GetAllSickLeaveResponse request) async { var extendSickLeaveRequest = ExtendSickLeaveRequest(); - extendSickLeaveRequest.patientMRN = - request.patientMRN.toString(); //'3120746'; + extendSickLeaveRequest.patientMRN = request.patientMRN.toString(); //'3120746'; extendSickLeaveRequest.previousRequestNo = request.requestNo.toString(); extendSickLeaveRequest.noOfDays = request.noOfDays.toString(); extendSickLeaveRequest.remarks = request.remarks; @@ -114,8 +116,8 @@ class SickLeaveService extends BaseService { } Future getSickLeavePatient(patientMRN) async { - _sickLeavePatientRequestModel = SickLeavePatientRequestModel( - patientID: patientMRN, patientTypeID: 2, patientType: 1); + _sickLeavePatientRequestModel = + SickLeavePatientRequestModel(patientID: patientMRN, patientTypeID: 2, patientType: 1); hasError = false; getAllSickLeavePatient = []; getAllSickLeavePatient.clear(); @@ -136,6 +138,28 @@ class SickLeaveService extends BaseService { ); } + Future getSickLeaveDoctor(patientMRN) async { + _sickLeaveDoctorRequestModel = GetSickLeaveDoctorRequestModel(patientMRN: patientMRN); + hasError = false; + getAllSickLeaveDoctor = []; + getAllSickLeaveDoctor.clear(); + await baseAppClient.post( + GET_SICK_LEAVE_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + getAllSickLeaveDoctor.clear(); + response['SickLeavesList']['entityList'].forEach((v) { + getAllSickLeaveDoctor.add(SickLeavePatientModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _sickLeaveDoctorRequestModel.toJson(), + ); + } + Future getRescheduleLeave() async { hasError = false; await baseAppClient.post( diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index 03cb0a7b..53feedd1 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -20,8 +20,7 @@ class LiveCarePatientViewModel extends BaseViewModel { StartCallRes get startCallRes => _liveCarePatientServices.startCallRes; - List get alternativeServicesList => - _liveCarePatientServices.alternativeServicesList; + List get alternativeServicesList => _liveCarePatientServices.alternativeServicesList; DashboardService _dashboardService = locator(); @@ -106,8 +105,7 @@ class LiveCarePatientViewModel extends BaseViewModel { selectedServices = getSelectedAlternativeServices(); } - await _liveCarePatientServices.endCallWithCharge( - vcID, selectedServices); + await _liveCarePatientServices.endCallWithCharge(vcID, selectedServices); if (_liveCarePatientServices.hasError) { error = _liveCarePatientServices.error; setState(ViewState.ErrorLocal); @@ -209,8 +207,7 @@ class LiveCarePatientViewModel extends BaseViewModel { AlternativeService(serviceID: 2, serviceName: "LABORATORY"), ); alternativeServicesList.add( - AlternativeService( - serviceID: 3, serviceName: "RADIOLOGY(ULTRASOUND) For pregnant only"), + AlternativeService(serviceID: 3, serviceName: "RADIOLOGY(ULTRASOUND) For pregnant only"), ); alternativeServicesList.add( AlternativeService(serviceID: 4, serviceName: "VACCINATIONS"), @@ -231,25 +228,46 @@ class LiveCarePatientViewModel extends BaseViewModel { AlternativeService(serviceID: 9, serviceName: "FAMILY MEDICIN DR"), ); alternativeServicesList.add( - AlternativeService( - serviceID: 10, serviceName: "FOLYS CATHETER INSERTION"), + AlternativeService(serviceID: 10, serviceName: "FOLYS CATHETER INSERTION"), ); alternativeServicesList.add( AlternativeService(serviceID: 11, serviceName: "GASTRIC TUBE CHANGE"), ); } - updateInCallPatient({PatiantInformtion patient, appointmentNo}){ - - _liveCarePatientServices.patientList.forEach((e) { - if(e.patientId == patient.patientId) { - e.episodeNo = 0 ; + updateInCallPatient({PatiantInformtion patient, appointmentNo}) { + _liveCarePatientServices.patientList.forEach((e) { + if (e.patientId == patient.patientId) { + e.episodeNo = 0; e.appointmentNo = appointmentNo; return; } }); setState(ViewState.Idle); + } + + Future addPatientToDoctorList(int vcID) async { + await getDoctorProfile(isGetProfile: true); + setState(ViewState.BusyLocal); + await _liveCarePatientServices.addPatientToDoctorList(vcID: vcID); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + Future removePatientFromDoctorList(int vcID) async { + await getDoctorProfile(isGetProfile: true); + setState(ViewState.BusyLocal); + await _liveCarePatientServices.removePatientFromDoctorList(vcID: vcID); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index b768cc9d..e80318f6 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -10,13 +10,17 @@ class SickLeaveViewModel extends BaseViewModel { SickLeaveService _sickLeaveService = locator(); get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; get getAllSIckLeave => _sickLeaveService.getAllSickLeave; - get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient; + //get getAllSIckLeavePatient => _sickLeaveService.getAllSickLeavePatient; + get sickleaveResponse => _sickLeaveService.sickLeaveResponse; + List get allOffTime => _sickLeaveService.getOffTimeList; List get allReasons => _sickLeaveService.getReasons; List get coveringDoctors => _sickLeaveService.coveringDoctorsList; + List get sickLeaveDoctor => _sickLeaveService.getAllSickLeaveDoctor; get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; get postSechedule => _sickLeaveService.postReschedule; - get sickleaveResponse => _sickLeaveService.sickLeaveResponse; + get getAllSIckLeavePatient => + [..._sickLeaveService.getAllSickLeavePatient, ..._sickLeaveService.getAllSickLeaveDoctor]; Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { setState(ViewState.Busy); await _sickLeaveService.addSickLeave(addSickLeaveRequest); @@ -67,6 +71,16 @@ class SickLeaveViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getSickLeaveDoctor(patientMRN) async { + setState(ViewState.Busy); + await _sickLeaveService.getSickLeaveDoctor(patientMRN); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + Future getRescheduleLeave() async { setState(ViewState.Busy); await _sickLeaveService.getRescheduleLeave(); diff --git a/lib/locator.dart b/lib/locator.dart index d74fad8b..aa259758 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:get_it/get_it.dart'; +import 'core/service/AnalyticsService.dart'; import 'core/service/NavigationService.dart'; import 'core/service/VideoCallService.dart'; import 'core/service/home/dasboard_service.dart'; @@ -98,6 +99,7 @@ void setupLocator() { locator.registerLazySingleton(() => ScanQrService()); locator.registerLazySingleton(() => SpecialClinicsService()); locator.registerLazySingleton(() => VideoCallService()); + locator.registerLazySingleton(() => AnalyticsService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); diff --git a/lib/main.dart b/lib/main.dart index c29429b0..bf319a84 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,8 @@ import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:firebase_analytics/firebase_analytics.dart'; +import 'package:firebase_analytics/observer.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -11,6 +13,7 @@ import 'package:provider/provider.dart'; import './config/size_config.dart'; import './routes.dart'; import 'config/config.dart'; +import 'core/service/AnalyticsService.dart'; import 'core/service/NavigationService.dart'; import 'core/viewModel/authentication_view_model.dart'; import 'locator.dart'; @@ -67,7 +70,10 @@ class MyApp extends StatelessWidget { dividerColor: Colors.grey[350], backgroundColor: Color.fromRGBO(255, 255, 255, 1), ), - navigatorKey: locator().navigatorKey, + navigatorKey: locator().navigatorKey, + navigatorObservers:[ + locator().getAnalyticsObserver(), + ], initialRoute: INIT_ROUTE, routes: routes, debugShowCheckedModeBanner: false, diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart index c4e52af7..90031230 100644 --- a/lib/models/SOAP/my_selected_allergy.dart +++ b/lib/models/SOAP/my_selected_allergy.dart @@ -6,15 +6,19 @@ class MySelectedAllergy { String remark; bool isChecked; bool isExpanded; + bool isLocal; int createdBy; + bool hasValidationError; MySelectedAllergy( {this.selectedAllergySeverity, this.selectedAllergy, this.remark, this.isChecked, - this.isExpanded = true, - this.createdBy}); + this.isExpanded = true, + this.isLocal = true, + this.createdBy, + this.hasValidationError = false}); MySelectedAllergy.fromJson(Map json) { selectedAllergySeverity = json['selectedAllergySeverity'] != null @@ -26,7 +30,9 @@ class MySelectedAllergy { remark = json['remark']; isChecked = json['isChecked']; isExpanded = json['isExpanded']; + isLocal = json['isLocal']; createdBy = json['createdBy']; + hasValidationError = json['hasValidationError']; } Map toJson() { @@ -41,6 +47,8 @@ class MySelectedAllergy { data['isChecked'] = this.isChecked; data['isExpanded'] = this.isExpanded; data['createdBy'] = this.createdBy; + data['isLocal'] = this.isLocal; + data['hasValidationError'] = this.hasValidationError; return data; } } diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart index 393af944..6a3ecf99 100644 --- a/lib/models/SOAP/my_selected_examination.dart +++ b/lib/models/SOAP/my_selected_examination.dart @@ -1,22 +1,29 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class MySelectedExamination { - MasterKeyModel selectedExamination; + MasterKeyModel selectedExamination; String remark; bool isNormal; bool isAbnormal; bool notExamined; bool isNew; + bool isLocal; int createdBy; + String createdOn; + String editedOn; - MySelectedExamination( - {this.selectedExamination, - this.remark, - this.isNormal = false, - this.isAbnormal = false, - this.notExamined = true, - this.isNew = true, - this.createdBy}); + MySelectedExamination({ + this.selectedExamination, + this.remark, + this.isNormal = false, + this.isAbnormal = false, + this.notExamined = true, + this.isNew = true, + this.isLocal = true, + this.createdBy, + this.createdOn, + this.editedOn, + }); MySelectedExamination.fromJson(Map json) { selectedExamination = json['selectedExamination'] != null @@ -28,6 +35,9 @@ class MySelectedExamination { notExamined = json['notExamined']; isNew = json['isNew']; createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedOn = json['editedOn']; + isLocal = json['isLocal']; } Map toJson() { @@ -42,6 +52,10 @@ class MySelectedExamination { data['notExamined'] = this.notExamined; data['isNew'] = this.isNew; data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedOn'] = this.editedOn; + data['isLocal'] = this.isLocal; + return data; } } diff --git a/lib/models/SOAP/my_selected_history.dart b/lib/models/SOAP/my_selected_history.dart index 11e366c2..91f66910 100644 --- a/lib/models/SOAP/my_selected_history.dart +++ b/lib/models/SOAP/my_selected_history.dart @@ -4,9 +4,10 @@ class MySelectedHistory { MasterKeyModel selectedHistory; String remark; bool isChecked; + bool isLocal; MySelectedHistory( - { this.selectedHistory, this.remark, this.isChecked}); + { this.selectedHistory, this.remark, this.isChecked, this.isLocal = true}); MySelectedHistory.fromJson(Map json) { @@ -15,6 +16,7 @@ class MySelectedHistory { : null; remark = json['remark']; remark = json['isChecked']; + isLocal = json['isLocal']; } Map toJson() { @@ -25,6 +27,7 @@ class MySelectedHistory { } data['remark'] = this.remark; data['isChecked'] = this.remark; + data['isLocal'] = this.isLocal; return data; } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 69d4a47a..c4587014 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -45,7 +45,7 @@ class VerificationMethodsScreen extends StatefulWidget { } class _VerificationMethodsScreenState extends State { - + ProjectViewModel projectsProvider; bool isMoreOption = false; bool onlySMSBox = false; @@ -409,13 +409,6 @@ class _VerificationMethodsScreenState extends State { onTap: () { authenticationViewModel.deleteUser(); authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); - // Navigator.pushAndRemoveUntil( - // AppGlobal.CONTEX, - // FadePage( - // page: RootPage(), - // ), - // (r) => false); - // Navigator.of(context).pushNamed(LOGIN); }, ), @@ -548,13 +541,14 @@ class _VerificationMethodsScreenState extends State { } } - checkActivationCode({value}) async { + checkActivationCode({String value}) async { await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value); if (authenticationViewModel.state == ViewState.ErrorLocal) { Navigator.pop(context); Helpers.showErrorToast(authenticationViewModel.error); } else { await authenticationViewModel.onCheckActivationCodeSuccess(); + if(value !=null) Navigator.pop(context); Navigator.pop(context); navigateToLandingPage(); @@ -569,6 +563,4 @@ class _VerificationMethodsScreenState extends State { } } - - } diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index f522561f..b318f6a4 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -56,7 +56,7 @@ class DoctorReplyScreen extends StatelessWidget { DoctorReplayChat( reply: reply, previousModel: model, - ))); + ), settings: RouteSettings(name: 'DoctorReplayChat'),)); }, child: DoctorReplyWidget(reply: reply), ); diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 568ad60f..3efd0243 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -405,7 +405,8 @@ class _HomeScreenState extends State { from: date, to: date, doctorID: - authenticationViewModel.doctorProfile.doctorID)), + authenticationViewModel.doctorProfile.doctorID),), + settings: RouteSettings(name: 'OutPatientsScreen'), )); }, )); @@ -422,6 +423,7 @@ class _HomeScreenState extends State { context, MaterialPageRoute( builder: (context) => PatientReferralScreen(), + settings: RouteSettings(name: 'PatientReferralScreen'), ), ); }, @@ -439,6 +441,7 @@ class _HomeScreenState extends State { context, MaterialPageRoute( builder: (context) => PatientSearchScreen(), + settings: RouteSettings(name: 'PatientSearchScreen'), )); }, )); @@ -455,6 +458,7 @@ class _HomeScreenState extends State { context, MaterialPageRoute( builder: (context) => MedicineSearchScreen(), + settings: RouteSettings(name: 'MedicineSearchScreen'), )); }, )); diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index 0e65182b..62b97f2d 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -184,7 +184,8 @@ class _EndCallScreenState extends State { context, MaterialPageRoute( builder: (BuildContext context) => - LivaCareTransferToAdmin(patient: patient))); + LivaCareTransferToAdmin(patient: patient), + settings: RouteSettings(name: 'LivaCareTransferToAdmin'),),); }, isInPatient: isInpatient, isDartIcon: true, diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index 12c8caff..f0f5e232 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -194,10 +194,7 @@ class _LiveCarePatientScreenState extends State { ); } - callConnected(){ + callConnected() {} - } - - callDisconnected(){ - } + callDisconnected() {} } diff --git a/lib/screens/medical-file/health_summary_page.dart b/lib/screens/medical-file/health_summary_page.dart index 6b4b066c..45b95de0 100644 --- a/lib/screens/medical-file/health_summary_page.dart +++ b/lib/screens/medical-file/health_summary_page.dart @@ -149,7 +149,8 @@ class _HealthSummaryPageState extends State { episode: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty ? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString() : "", - vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString())), + vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString()), + settings: RouteSettings(name: 'MedicalFileDetails'),), ); }, child: DoctorCard( diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index eeea51c5..c0289605 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -226,7 +226,7 @@ class _MedicineSearchState extends State { ["ItemID"], url: model.pharmacyItemsList[index] ["ImageSRCUrl"]), - ), + settings: RouteSettings(name: 'PharmaciesListScreen'),), ); }, ); diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart index b9d3f57e..0cc5d5c3 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -96,7 +96,7 @@ class _InsuranceApprovalScreenNewState extends State patient: patient, indexInsurance: index, patientType: patientType, - )), + ),settings: RouteSettings(name: 'InsuranceApprovalsDetails'),), ); }, child: DoctorCardInsurance( @@ -183,7 +183,7 @@ class _InsuranceApprovalScreenNewState extends State patient: patient, indexInsurance: index, patientType: patientType, - )), + ),settings: RouteSettings(name: 'InsuranceApprovalsDetails'),), ); }, child: DoctorCardInsurance( diff --git a/lib/screens/patients/out_patient/out_patient_screen.dart b/lib/screens/patients/out_patient/out_patient_screen.dart index 0037634d..fa96a191 100644 --- a/lib/screens/patients/out_patient/out_patient_screen.dart +++ b/lib/screens/patients/out_patient/out_patient_screen.dart @@ -223,7 +223,7 @@ class _OutPatientsScreenState extends State { builder: (BuildContext context) => FilterDatePage( outPatientFilterType: outPatientFilterType, patientSearchViewModel: model, - ))); + ),settings: RouteSettings(name: 'FilterOutPatentDateScreen'),)); }, ), onChanged: (String str) { diff --git a/lib/screens/patients/patient_search/patient_search_screen.dart b/lib/screens/patients/patient_search/patient_search_screen.dart index 2275cc09..2479910f 100644 --- a/lib/screens/patients/patient_search/patient_search_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_screen.dart @@ -208,6 +208,7 @@ class _PatientSearchScreenState extends State { searchKey: patientFileInfoController.text, isInpatient: false, ), + settings: RouteSettings(name: 'PatientsSearchResultScreen'), ), ); } diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index 7da55967..dfc1a1e8 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -121,6 +121,7 @@ class _LabsHomePageState extends State { model: model, procedureType: ProcedureType.LAB_RESULT, ), + settings: RouteSettings(name: 'AddProcedureTabPage'), ), ); }, diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index b3714edd..72ee1311 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -43,7 +43,9 @@ class _AddVerifyMedicalReportState extends State { String txtOfMedicalReport; return BaseView( - onModelReady: (model) async {}, + onModelReady: (model) async { + model.getMedicalReportTemplate(); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index a5c367de..4ebfdbf6 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -89,7 +89,9 @@ class _MedicalReportPageState extends State { arrivalType: arrivalType, model: model, status: MedicalReportStatus.ADD, - )), + ), + settings: RouteSettings(name: 'AddVerifyMedicalReport'), + ), ); }, @@ -111,7 +113,8 @@ class _MedicalReportPageState extends State { medicalReport: model.medicalReportList[index], model: model, medicalNote: model.medicalReportList[index].reportDataHtml, - )), + ), + settings: RouteSettings(name: 'AddVerifyMedicalReport')), ); } else { Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index 723ee75f..6b6e7c24 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -114,7 +114,7 @@ class _ProgressNoteState extends State { patient: patient, visitType: widget.visitType, isUpdate: false, - )), + ),settings: RouteSettings(name: 'UpdateNoteOrder'),), ); }, label: widget.visitType == 3 @@ -236,7 +236,7 @@ class _ProgressNoteState extends State { visitType: widget .visitType, isUpdate: true, - )), + ),settings: RouteSettings(name: 'UpdateNoteOrder'),), ); }, child: Container( diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index a1da7882..412cf986 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -32,6 +32,7 @@ class PatientProfileScreen extends StatefulWidget { class _PatientProfileScreenState extends State with SingleTickerProviderStateMixin { PatiantInformtion patient; + LiveCarePatientViewModel _liveCareViewModel = LiveCarePatientViewModel(); bool isFromSearch = false; bool isFromLiveCare = false; @@ -63,6 +64,9 @@ class _PatientProfileScreenState extends State with Single void dispose() { _tabController.dispose(); super.dispose(); + if (isFromLiveCare) { + _liveCareViewModel.removePatientFromDoctorList(patient.vcId); + } } @override @@ -123,6 +127,9 @@ class _PatientProfileScreenState extends State with Single Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; return BaseView( + onModelReady: (model) async { + if (isFromLiveCare && patient.patientStatus == 1) await model.addPatientToDoctorList(patient.vcId); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).patientProfile, @@ -316,43 +323,35 @@ class _PatientProfileScreenState extends State with Single Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => - EndCallScreen(patient: patient))); + builder: (BuildContext context) => EndCallScreen(patient: patient),settings: RouteSettings(name: 'EndCallScreen'),),); } else { GifLoaderDialogUtils.showMyDialog(context); - await model.startCall( - isReCall: false, vCID: patient.vcId); + await model.startCall(isReCall: false, vCID: patient.vcId); if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); Helpers.showErrorToast(model.error); } else { await model.getDoctorProfile(); - patient.appointmentNo = int.parse(model - .startCallRes.appointmentNo - .toString()); + patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); patient.episodeNo = 0; model.updateInCallPatient( patient: patient, - appointmentNo: int.parse(model - .startCallRes.appointmentNo - .toString())); + appointmentNo: int.parse(model.startCallRes.appointmentNo.toString())); setState(() { isCallStarted = true; }); GifLoaderDialogUtils.hideDialog(context); - AppPermissionsUtils - .requestVideoCallPermission( - context: context, - onTapGrant: () { - locator() - .openVideo( - model.startCallRes, - patient, - model.startCallRes != null ? model.startCallRes.isRecording : true - , callConnected, - callDisconnected); - }); + AppPermissionsUtils.requestVideoCallPermission( + context: context, + onTapGrant: () { + locator().openVideo( + model.startCallRes, + patient, + model.startCallRes != null ? model.startCallRes.isRecording : true, + callConnected, + callDisconnected); + }); } } }, diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 3d8d527c..46b5ad28 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -117,7 +117,7 @@ class _RadiologyHomePageState extends State { patient: patient, model: model, procedureType: ProcedureType.RADIOLOGY, - ), + ), settings: RouteSettings(name: 'AddProcedureTabPage') ), ); }, diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index a30842f8..e14eb6f2 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -18,6 +18,7 @@ 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/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; @@ -32,6 +33,7 @@ class AddAssessmentDetails extends StatefulWidget { addSelectedAssessment; final PatiantInformtion patientInfo; final bool isUpdate; + AddAssessmentDetails( {Key key, this.mySelectedAssessment, @@ -129,14 +131,14 @@ class _AddAssessmentDetailsState extends State { }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: false, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: TranslationBase.of(context).addAssessmentDetails), backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( child: Center( child: Column( children: [ - BottomSheetTitle( - title: TranslationBase.of(context).addAssessmentDetails), FractionallySizedBox( widthFactor: 0.9, child: Container( @@ -253,6 +255,8 @@ class _AddAssessmentDetailsState extends State { MasterKeyDailog dialog = MasterKeyDailog( list: model.listOfDiagnosisCondition, okText: TranslationBase.of(context).ok, + selectedValue: widget.mySelectedAssessment.selectedDiagnosisCondition, + okFunction: (MasterKeyModel selectedValue) { setState(() { @@ -305,6 +309,7 @@ class _AddAssessmentDetailsState extends State { MasterKeyDailog dialog = MasterKeyDailog( list: model.listOfDiagnosisType, okText: TranslationBase.of(context).ok, + selectedValue: widget.mySelectedAssessment.selectedDiagnosisType, okFunction: (MasterKeyModel selectedValue) { setState(() { @@ -367,7 +372,7 @@ class _AddAssessmentDetailsState extends State { ), ), ), - bottomSheet: Container( + bottomSheet: model.state == ViewState.Busy?Container(height: 0,):Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( @@ -434,6 +439,7 @@ class _AddAssessmentDetailsState extends State { {SOAPViewModel model, MySelectedAssessment mySelectedAssessment, bool isUpdate = false}) async { + GifLoaderDialogUtils.showMyDialog(context); if (isUpdate) { PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -464,8 +470,9 @@ class _AddAssessmentDetailsState extends State { await model.postAssessment(postAssessmentRequestModel); } - + GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); @@ -473,10 +480,7 @@ class _AddAssessmentDetailsState extends State { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; mySelectedAssessment.doctorName = doctorProfile.doctorName; - - if (!isUpdate) { - widget.addSelectedAssessment(mySelectedAssessment, isUpdate); - } + widget.addSelectedAssessment(mySelectedAssessment, isUpdate); Navigator.of(context).pop(); } } diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index fab69c44..f8da93f5 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -26,14 +26,12 @@ import 'add_assessment_details.dart'; // ignore: must_be_immutable class UpdateAssessmentPage extends StatefulWidget { final Function changePageViewIndex; - List mySelectedAssessmentList; final PatiantInformtion patientInfo; final Function changeLoadingState; final int currentIndex; UpdateAssessmentPage( {Key key, this.changePageViewIndex, - this.mySelectedAssessmentList, this.patientInfo, this.changeLoadingState, this.currentIndex}); @@ -43,19 +41,20 @@ class UpdateAssessmentPage extends StatefulWidget { class _UpdateAssessmentPageState extends State { bool isAssessmentExpand = false; + List mySelectedAssessmentList = List(); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) async { - widget.mySelectedAssessmentList.clear(); + mySelectedAssessmentList.clear(); GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', - appointmentNo: int.parse(widget.patientInfo.appointmentNo)); + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); await model.getPatientAssessment(getAssessmentReqModel); if (model.patientAssessmentList.isNotEmpty) { if (model.listOfDiagnosisCondition.length == 0) { @@ -96,7 +95,7 @@ class _UpdateAssessmentPageState extends State { createdOn: element.createdOn, icdCode10ID: element.icdCode10ID); - widget.mySelectedAssessmentList.add(temMySelectedAssessment); + mySelectedAssessmentList.add(temMySelectedAssessment); } }); } @@ -147,7 +146,7 @@ class _UpdateAssessmentPageState extends State { height: 20, ), Column( - children: widget.mySelectedAssessmentList + children: mySelectedAssessmentList .map((assessment) { return Container( margin: EdgeInsets.only( @@ -348,7 +347,7 @@ class _UpdateAssessmentPageState extends State { height: 6, ), AppText( - (assessment.remark != null || + (assessment.remark != null && assessment.remark != '') ? TranslationBase.of( @@ -501,14 +500,15 @@ class _UpdateAssessmentPageState extends State { color: Colors.red[700], disabled: model.state == ViewState.BusyLocal, onPressed: () async { - if (widget.mySelectedAssessmentList.isEmpty) { + if (mySelectedAssessmentList.isEmpty) { Helpers.showErrorToast( TranslationBase .of(context) .assessmentErrorMsg); } else { - widget.changePageViewIndex(3); widget.changeLoadingState(true); + widget.changePageViewIndex(3); + } }, ), @@ -542,11 +542,12 @@ class _UpdateAssessmentPageState extends State { mySelectedAssessment: assessment, patientInfo: widget.patientInfo, isUpdate: isUpdate, - mySelectedAssessmentList: widget.mySelectedAssessmentList, + mySelectedAssessmentList: mySelectedAssessmentList, addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, bool isUpdate) async { setState(() { - widget.mySelectedAssessmentList.add(mySelectedAssessment); + if(!isUpdate) + mySelectedAssessmentList.add(mySelectedAssessment); }); }); }); diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index d98e17be..87af6ec2 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -31,79 +32,55 @@ class _AddExaminationPageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup(MasterKeysService.PhysicalExamination); - } - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - backgroundColor: Color.fromRGBO(248, 248, 248, 1), - body: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - padding: - EdgeInsets.only(left: 16, top: 70, right: 16, bottom: 16), - color: Colors.white, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup(MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: "${TranslationBase.of(context).addExamination}", + ), + backgroundColor: Color.fromRGBO(248, 248, 248, 1), + body: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( - child: AppText( - "${TranslationBase.of(context).addExamination}", - fontSize: SizeConfig.textMultiplier * 3.3, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - ), - InkWell( - onTap: () { - Navigator.of(context).pop(); - }, - child: Icon( - Icons.clear, - size: 40, - ), - ) - ], - ), - ), - Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - Container( - margin: EdgeInsets.all(16.0), - padding: EdgeInsets.all(0.0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.circular(12), - border: Border.fromBorderSide(BorderSide( - color: Colors.grey.shade400, - width: 0.4, - )), - ), + child: SingleChildScrollView( child: Column( children: [ - ExaminationsListSearchWidget( - masterList: model.physicalExaminationList, - isServiceSelected: (master) => - isServiceSelected(master), - removeHistory: (history) { - setState(() { - widget.removeExamination(history); - }); - }, - addHistory: (selectedExamination) { - setState(() { - widget.mySelectedExamination - .add(selectedExamination); + Container( + margin: EdgeInsets.all(16.0), + padding: EdgeInsets.all(0.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), + ), + child: Column( + children: [ + ExaminationsListSearchWidget( + mySelectedExamination: + widget.mySelectedExamination, + masterList: model.physicalExaminationList, + isServiceSelected: (master) => + isServiceSelected(master), + removeExamination: (history) { + setState(() { + widget.removeExamination(history); }); }, + addHistory: (selectedExamination) { + widget.mySelectedExamination + .add(selectedExamination); + // setState(() {}); + }, ), ], ), diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index e990be79..f0dc25cf 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -14,19 +14,21 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class AddExaminationWidget extends StatefulWidget { MasterKeyModel item; - final Function(MasterKeyModel) removeHistory; - final Function(MySelectedExamination) addHistory; + final Function(MasterKeyModel) removeExamination; + final Function(MySelectedExamination) addExamination; final bool Function(MasterKeyModel) isServiceSelected; bool isExpand; final Function expandClick; + final List mySelectedExamination; AddExaminationWidget({ this.item, - this.removeHistory, - this.addHistory, + this.removeExamination, + this.addExamination, this.isServiceSelected, this.isExpand, this.expandClick, + this.mySelectedExamination, }); @override @@ -40,7 +42,17 @@ class _AddExaminationWidgetState extends State { @override void initState() { - examination.selectedExamination = widget.item; + if (getSelectedExam(widget.item) != null) { + examination = getSelectedExam(widget.item); + status = examination.isNormal + ? 1 + : examination.isAbnormal + ? 2 + : 3; + remarksController.text = examination.remark; + } else { + examination.selectedExamination = widget.item; + } super.initState(); } @@ -70,14 +82,15 @@ class _AddExaminationWidgetState extends State { onChanged: (newValue) { setState(() { if (widget.isServiceSelected(widget.item)) { - widget.removeHistory(widget.item); + if (examination.isLocal) + widget.removeExamination(widget.item); widget.expandClick(); } else { examination.isNormal = status == 1; examination.isAbnormal = status == 2; examination.notExamined = status == 3; examination.remark = remarksController.text; - widget.addHistory(examination); + widget.addExamination(examination); widget.expandClick(); } }); @@ -113,18 +126,18 @@ class _AddExaminationWidgetState extends State { Row( children: [ Expanded( - child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - status = 1; - }); - examination.isNormal = true; - examination.isAbnormal = false; - examination.notExamined = false; - }, - child: Container( + child: InkWell( + onTap: () { + setState(() { + status = 1; + }); + examination.isNormal = true; + examination.isAbnormal = false; + examination.notExamined = false; + }, + child: Row( + children: [ + Container( padding: EdgeInsets.all(2.0), margin: EdgeInsets.symmetric(horizontal: 6), width: 20, @@ -143,28 +156,28 @@ class _AddExaminationWidgetState extends State { ), ), ), - ), - AppText( - TranslationBase.of(context).normal, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - ), - ], + AppText( + TranslationBase.of(context).normal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ], + ), )), Expanded( - child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - status = 2; - }); - examination.isNormal = false; - examination.isAbnormal = true; - examination.notExamined = false; - }, - child: Container( + child: InkWell( + onTap: () { + setState(() { + status = 2; + }); + examination.isNormal = false; + examination.isAbnormal = true; + examination.notExamined = false; + }, + child: Row( + children: [ + Container( padding: EdgeInsets.all(2.0), margin: EdgeInsets.symmetric(horizontal: 6), width: 20, @@ -183,57 +196,58 @@ class _AddExaminationWidgetState extends State { ), ), ), - ), - AppText( - TranslationBase.of(context).abnormal, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - ), - ], + AppText( + TranslationBase.of(context).abnormal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ], + ), )), - Expanded( + if (!examination.isLocal) + Expanded( + child: InkWell( + onTap: () { + setState(() { + status = 3; + }); + examination.isNormal = false; + examination.isAbnormal = false; + examination.notExamined = true; + }, child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - status = 3; - }); - examination.isNormal = false; - examination.isAbnormal = false; - examination.notExamined = true; - }, - child: Container( - padding: EdgeInsets.all(2.0), - margin: EdgeInsets.symmetric(horizontal: 6), - width: 20, - height: 20, - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - border: Border.all(color: Colors.grey, width: 1), - ), - child: Container( + children: [ + Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, decoration: BoxDecoration( - color: status == 3 - ? HexColor("#D02127") - : Colors.white, + color: Colors.white, shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 3 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), ), ), - ), - ), - Expanded( - child: AppText( - TranslationBase.of(context).notExamined, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - ), + Expanded( + child: AppText( + TranslationBase.of(context).notExamined, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ), + ], ), - ], - )), + )), ], ), Container( @@ -256,4 +270,15 @@ class _AddExaminationWidgetState extends State { ), ); } + + MySelectedExamination getSelectedExam(MasterKeyModel masterKey) { + Iterable exam = widget.mySelectedExamination.where( + (element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { + return exam.first; + } + return null; + } } diff --git a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart index d40faea5..84a4c740 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination_item_card.dart @@ -40,25 +40,6 @@ class ExaminationItemCard extends StatelessWidget { fontSize: SizeConfig.textMultiplier * 1.8, ), )), - Row( - children: [ - AppText( - TranslationBase.of(context).remove, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - color: Colors.red.shade800, - fontSize: SizeConfig.textMultiplier * 1.8, - ), - InkWell( - onTap: removeExamination, - child: Icon( - Icons.clear, - size: 20, - color: Colors.red.shade800, - ), - ) - ], - ), ], ), AppText( @@ -79,6 +60,7 @@ class ExaminationItemCard extends StatelessWidget { SizedBox( height: 4, ), + if(examination.remark.isNotEmpty) AppText( examination.remark, fontWeight: FontWeight.normal, diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index 36b65d4c..c67102ee 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -8,16 +8,17 @@ import 'package:flutter/material.dart'; import 'add_examination_widget.dart'; class ExaminationsListSearchWidget extends StatefulWidget { - final Function(MasterKeyModel) removeHistory; + final Function(MasterKeyModel) removeExamination; final Function(MySelectedExamination) addHistory; final bool Function(MasterKeyModel) isServiceSelected; final List masterList; + final List mySelectedExamination; ExaminationsListSearchWidget( - {this.removeHistory, + {this.removeExamination, this.addHistory, this.isServiceSelected, - this.masterList}); + this.masterList, this.mySelectedExamination}); @override _ExaminationsListSearchWidgetState createState() => @@ -61,8 +62,9 @@ class _ExaminationsListSearchWidgetState ...items.mapIndexed((index, item) { return AddExaminationWidget( item: item, - addHistory: widget.addHistory, - removeHistory: widget.removeHistory, + addExamination: widget.addHistory, + removeExamination: widget.removeExamination, + mySelectedExamination: widget.mySelectedExamination, isServiceSelected: widget.isServiceSelected, isExpand: index == expandedIndex, expandClick: () { diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index 4d36f49f..dbd3b080 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -28,13 +28,11 @@ class UpdateObjectivePage extends StatefulWidget { final Function changePageViewIndex; final Function changeLoadingState; final int currentIndex; - final List mySelectedExamination; final PatiantInformtion patientInfo; UpdateObjectivePage( {Key key, this.changePageViewIndex, - this.mySelectedExamination, this.patientInfo, this.changeLoadingState, this.currentIndex}); @@ -45,8 +43,10 @@ class UpdateObjectivePage extends StatefulWidget { class _UpdateObjectivePageState extends State { bool isSysExaminationExpand = false; + List mySelectedExamination = List(); - BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -62,11 +62,13 @@ class _UpdateObjectivePageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - widget.mySelectedExamination.clear(); - GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); + mySelectedExamination.clear(); + GetPhysicalExamReqModel getPhysicalExamReqModel = + GetPhysicalExamReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString())); await model.getPatientPhysicalExam(getPhysicalExamReqModel); if (model.patientPhysicalExamList.isNotEmpty) { @@ -79,14 +81,18 @@ class _UpdateObjectivePageState extends State { id: element.examId, ); MySelectedExamination tempEam = MySelectedExamination( - selectedExamination: examMaster, - remark: element.remarks, - isNormal: element.isNormal, - createdBy: element.createdBy, - notExamined: element.notExamined, - isNew: element.isNew, - isAbnormal: element.isAbnormal); - widget.mySelectedExamination.add(tempEam); + selectedExamination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + createdBy: element.createdBy, + createdOn: element.createdOn, + editedOn: element.editedOn, + notExamined: element.notExamined, + isNew: element.isNew, + isLocal: false, + isAbnormal: element.isAbnormal, + ); + mySelectedExamination.add(tempEam); }); } @@ -102,9 +108,12 @@ class _UpdateObjectivePageState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex), ExpandableSOAPWidget( - headerTitle: TranslationBase.of(context).physicalSystemExamination, + headerTitle: + TranslationBase.of(context).physicalSystemExamination, onTap: () { setState(() { isSysExaminationExpand = !isSysExaminationExpand; @@ -113,15 +122,17 @@ class _UpdateObjectivePageState extends State { child: Column( children: [ SOAPOpenItems( - label: "${TranslationBase.of(context).addExamination}", + label: + "${TranslationBase.of(context).addExamination}", onTap: () { openExaminationList(context); }, ), Column( - children: widget.mySelectedExamination.map((examination) { + children: mySelectedExamination.map((examination) { return ExaminationItemCard(examination, () { - removeExamination(examination.selectedExamination); + removeExamination( + examination.selectedExamination); }); }).toList(), ) @@ -198,40 +209,45 @@ class _UpdateObjectivePageState extends State { } submitUpdateObjectivePage(SOAPViewModel model) async { - if (widget.mySelectedExamination.isNotEmpty) { + if (mySelectedExamination.isNotEmpty) { + widget.changeLoadingState(true); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); - widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; + PostPhysicalExamRequestModel postPhysicalExamRequestModel = + new PostPhysicalExamRequestModel(); + mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = + []; - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: exam.remark ?? '', - createdBy: exam.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - notExamined: exam.notExamined, - examinationType: exam.isNormal - ? 1 - : exam.isAbnormal - ? 2 - : 3, - examinationTypeName: exam.isNormal - ? "Normal" - : exam.isAbnormal - ? 'AbNormal' - : "Not Examined", - isNew: exam.isNew)); + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM + .add(ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: exam.createdBy ?? doctorProfile.doctorID, + createdOn: exam.createdOn ?? DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + 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) { @@ -241,10 +257,10 @@ class _UpdateObjectivePageState extends State { } if (model.state == ViewState.ErrorLocal) { + widget.changeLoadingState(false); Helpers.showErrorToast(model.error); } else { widget.changeLoadingState(true); - widget.changePageViewIndex(2); } } else { @@ -253,12 +269,14 @@ class _UpdateObjectivePageState extends State { } removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.mySelectedExamination.where((element) => - masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); + Iterable history = mySelectedExamination.where( + (element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); if (history.length > 0) setState(() { - widget.mySelectedExamination.remove(history.first); + mySelectedExamination.remove(history.first); }); } @@ -267,7 +285,7 @@ class _UpdateObjectivePageState extends State { context, FadePage( page: AddExaminationPage( - mySelectedExamination: widget.mySelectedExamination, + mySelectedExamination: mySelectedExamination, addSelectedExamination: () { setState(() { Navigator.of(context).pop(); @@ -276,21 +294,6 @@ class _UpdateObjectivePageState extends State { removeExamination: (masterKey) => removeExamination(masterKey)), ), ); - /*showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddExaminationDailog( - mySelectedExamination: widget.mySelectedExamination, - addSelectedExamination: () { - setState(() { - Navigator.of(context).pop(); - }); - }, - removeExamination: (masterKey) => removeExamination(masterKey), - ); - });*/ } } @@ -299,7 +302,11 @@ class AddExaminationDailog extends StatefulWidget { final Function addSelectedExamination; final Function(MasterKeyModel) removeExamination; - const AddExaminationDailog({Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) + const AddExaminationDailog( + {Key key, + this.mySelectedExamination, + this.addSelectedExamination, + this.removeExamination}) : super(key: key); @override @@ -314,7 +321,8 @@ class _AddExaminationDailogState extends State { child: BaseView( onModelReady: (model) async { if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup(MasterKeysService.PhysicalExamination); + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); } }, builder: (_, model, w) => AppScaffold( @@ -324,19 +332,21 @@ class _AddExaminationDailogState extends State { child: Container( child: FractionallySizedBox( widthFactor: 0.9, - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - ]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).physicalSystemExamination, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + ]), ))), )), ); diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index 1960ef72..4622bc94 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -27,14 +27,12 @@ class UpdatePlanPage extends StatefulWidget { final Function changeLoadingState; final int currentIndex; - GetPatientProgressNoteResModel patientProgressNote; UpdatePlanPage( {Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, - this.patientProgressNote, this.currentIndex}); @override @@ -44,10 +42,14 @@ class UpdatePlanPage extends StatefulWidget { class _UpdatePlanPageState extends State { bool isAddProgress = true; bool isProgressExpanded = true; + GetPatientProgressNoteResModel patientProgressNote = + GetPatientProgressNoteResModel(); - TextEditingController progressNoteController = TextEditingController(text: null); + TextEditingController progressNoteController = + TextEditingController(text: null); - BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -62,32 +64,74 @@ class _UpdatePlanPageState extends State { @override void initState() { super.initState(); - if (widget.patientProgressNote.planNote != null) { + if (patientProgressNote.planNote != null) { setState(() { isAddProgress = false; }); } } + + getPatientProgressNote(model, {bool isAddProgress = false}) async { + GetGetProgressNoteReqModel getGetProgressNoteReqModel = + GetGetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await model.getPatientProgressNote(getGetProgressNoteReqModel); + + if (model.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = Helpers.parseHtmlString( + model.patientProgressNoteList[0].planNote); + patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = + model.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + model.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + model.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + model.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + model.patientProgressNoteList[0].appointmentNo; + setState(() { + isAddProgress = isAddProgress; + }); + } + } + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( - appointmentNo: int.parse(widget.patientInfo.appointmentNo), - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - editedBy: '', - doctorID: ''); + GetGetProgressNoteReqModel getGetProgressNoteReqModel = + GetGetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); await model.getPatientProgressNote(getGetProgressNoteReqModel); if (model.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote); - widget.patientProgressNote.planNote = progressNoteController.text; - widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; - widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; - widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; - widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; + progressNoteController.text = Helpers.parseHtmlString( + model.patientProgressNoteList[0].planNote); + patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = + model.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + model.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + model.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + model.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + model.patientProgressNoteList[0].appointmentNo; + setState(() { isAddProgress = false; }); @@ -104,7 +148,9 @@ class _UpdatePlanPageState extends State { widthFactor: 0.90, child: Column( children: [ - SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), + SOAPStepHeader( + currentIndex: widget.currentIndex, + changePageViewIndex: widget.changePageViewIndex), SizedBox( height: 10, ), @@ -123,33 +169,41 @@ class _UpdatePlanPageState extends State { children: [ if (isAddProgress) Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), child: AppTextFieldCustom( - hintText: TranslationBase.of(context).progressNote, + hintText: TranslationBase.of(context) + .progressNote, controller: progressNoteController, minLines: 2, maxLines: 4, inputType: TextInputType.multiline, onChanged: (value) { - widget.patientProgressNote.planNote = value; + setState(() { + patientProgressNote.planNote = value; + }); }, ), ), SizedBox( height: 9, ), - if (widget.patientProgressNote.planNote != null && !isAddProgress) + if (patientProgressNote.planNote != null && + !isAddProgress) Container( margin: EdgeInsets.only( left: 5, right: 5, ), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( children: [ @@ -158,40 +212,61 @@ class _UpdatePlanPageState extends State { fontSize: 12, ), AppText( - widget.patientProgressNote.appointmentNo ?? '', + patientProgressNote + .appointmentNo != + null + ? patientProgressNote + .appointmentNo + .toString() + : '', fontWeight: FontWeight.w600, + fontSize: 14, ), ], ), AppText( - widget.patientProgressNote.createdOn != null - ? AppDateUtils.getDayMonthYearDateFormatted( - DateTime.parse(widget.patientProgressNote.createdOn)) - : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), + patientProgressNote.createdOn != + null + ? AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.parse( + patientProgressNote + .createdOn)) + : AppDateUtils + .getDayMonthYearDateFormatted( + DateTime.now()), fontWeight: FontWeight.w600, fontSize: 14, ) ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - 'Condition: ', - fontSize: 12, - ), - AppText(widget.patientProgressNote.mName ?? '', - fontWeight: FontWeight.w600), - ], - ), + // Row( + // children: [ + // AppText( + // 'Condition: ', + // fontSize: 12, + // ), + // AppText( + // patientProgressNote.mName ?? + // '', + // fontWeight: FontWeight.w600), + // ], + // ), AppText( - widget.patientProgressNote.createdOn != null + patientProgressNote.createdOn != + null ? AppDateUtils.getHour( - DateTime.parse(widget.patientProgressNote.createdOn)) - : AppDateUtils.getHour(DateTime.now()), + DateTime.parse( + patientProgressNote + .createdOn)) + : AppDateUtils.getHour( + DateTime.now()), fontWeight: FontWeight.w600, fontSize: 14, ) @@ -201,7 +276,8 @@ class _UpdatePlanPageState extends State { height: 8, ), Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ Expanded( child: AppText( @@ -213,7 +289,6 @@ class _UpdatePlanPageState extends State { onTap: () { setState(() { isAddProgress = true; - widget.changePageViewIndex(3, isChangeState: false); }); }, child: Icon( @@ -274,30 +349,23 @@ class _UpdatePlanPageState extends State { ), Expanded( child: AppButton( - title: TranslationBase.of(context).next, + title: isAddProgress + ? TranslationBase.of(context).next + : TranslationBase.of(context).finish, fontWeight: FontWeight.w600, color: Colors.red[700], - loading: model.state == ViewState.BusyLocal, disabled: progressNoteController.text.isEmpty, onPressed: () async { if (progressNoteController.text.isNotEmpty) { if (isAddProgress) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - setState(() { - widget.patientProgressNote.createdByName = - widget.patientProgressNote.createdByName ?? doctorProfile.doctorName; - widget.patientProgressNote.editedByName = doctorProfile.doctorName; - widget.patientProgressNote.createdOn = DateTime.now().toString(); - widget.patientProgressNote.planNote = progressNoteController.text; - isAddProgress = !isAddProgress; - }); submitPlan(model); } else { Navigator.of(context).pop(); } } else { - Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); + Helpers.showErrorToast( + TranslationBase.of(context) + .progressNoteErrorMsg); } }, ), @@ -318,19 +386,20 @@ class _UpdatePlanPageState extends State { submitPlan(SOAPViewModel model) async { if (progressNoteController.text.isNotEmpty) { - PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - planNote: widget.patientProgressNote.planNote, - doctorID: '', - editedBy: ''); + widget.changeLoadingState(true); + PostProgressNoteRequestModel postProgressNoteRequestModel = + new PostProgressNoteRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + planNote: patientProgressNote.planNote, + doctorID: '', + editedBy: ''); if (model.patientProgressNoteList.isEmpty) { await model.postProgressNote(postProgressNoteRequestModel); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; await model.patchProgressNote(postProgressNoteRequestModel); @@ -339,8 +408,37 @@ class _UpdatePlanPageState extends State { if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); } else { - widget.changePageViewIndex(4, isChangeState: false); + + GetGetProgressNoteReqModel getGetProgressNoteReqModel = + GetGetProgressNoteReqModel( + appointmentNo: + int.parse(widget.patientInfo.appointmentNo.toString()), + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await model.getPatientProgressNote(getGetProgressNoteReqModel); + if (model.patientProgressNoteList.isNotEmpty) { + progressNoteController.text = Helpers.parseHtmlString( + model.patientProgressNoteList[0].planNote); + patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = + model.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = + model.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = + model.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = + model.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = + model.patientProgressNoteList[0].appointmentNo; + + setState(() { + isAddProgress = false; + }); + } } + widget.changeLoadingState(false); } else { Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); } diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart index 8f5ecf93..d8110844 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:flutter/material.dart'; -class BottomSheetTitle extends StatelessWidget { +class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { const BottomSheetTitle({ Key key, this.title, }) : super(key: key); @@ -57,4 +57,7 @@ class BottomSheetTitle extends StatelessWidget { ), ); } + + @override + Size get preferredSize => Size(double.maxFinite,115); } diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart index c5c2e8ca..e79c24a7 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart @@ -247,6 +247,8 @@ class StepsWidget extends StatelessWidget { "Plan", fontWeight: FontWeight.bold, fontSize: 12, + textAlign: TextAlign.end, + marginLeft: 25, ), StatusLabel( selectedStepId: index, @@ -530,20 +532,22 @@ class StatusLabel extends StatelessWidget { ), border: Border.all(color: HexColor('#707070'), width: 0.30), ), - child: AppText( - stepId == selectedStepId - ? "inProgress" - : stepId < selectedStepId - ? "Completed" - : " Locked ", - fontWeight: FontWeight.bold, - textAlign: TextAlign.center, - fontSize: 10, - color: stepId == selectedStepId - ? Color(0xFFCC9B14) - : stepId < selectedStepId - ? Color(0xFF359846) - : Color(0xFF969696), + child: Center( + child: AppText( + stepId == selectedStepId + ? "inProgress" + : stepId < selectedStepId + ? "Completed" + : "Locked", + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + fontSize: 10, + color: stepId == selectedStepId + ? Color(0xFFCC9B14) + : stepId < selectedStepId + ? Color(0xFF359846) + : Color(0xFF969696), + ), ), ); } diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index fc7329e5..4cf20318 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -1,5 +1,6 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; @@ -8,12 +9,12 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_allergies_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart'; +import 'master_key_checkbox_search_allergies_widget.dart'; class AddAllergies extends StatefulWidget { final Function addAllergiesFun; @@ -83,95 +84,107 @@ class _AddAllergiesState extends State { } }, builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BottomSheetTitle( - title: TranslationBase.of(context).addAllergies, + baseViewModel: model, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: TranslationBase.of(context).addAllergies, + ), + body: Center( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + SizedBox( + height: 16, + ), + Expanded( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Center( + child: NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchAllergiesWidget( + model: model, + masterList: model.allergiesList, + removeAllergy: (master) { + setState(() { + removeAllergyFromLocalList(master); + }); + }, + addAllergy: + (MySelectedAllergy mySelectedAllergy) { + addAllergyLocally(mySelectedAllergy); + }, + addSelectedAllergy: () { + + setState(() { + widget + .addAllergiesFun(myAllergiesListLocal); + }); + }, + isServiceSelected: (master) => + isServiceSelected(master), + getServiceSelectedAllergy: (master) => + getSelectedAllergy(master), + ), + ), + ), + ), ), + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.11, + ), + ]), + ), + ), + bottomSheet: model.state == ViewState.Busy + ? Container( + height: 0, + ) + : Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ SizedBox( height: 10, ), - SizedBox( - height: 16, - ), - Expanded( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Center( - child: NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchAllergiesWidget( - model: model, - masterList: model.allergiesList, - removeAllergy: (master) { - setState(() { - removeAllergyFromLocalList(master); - }); - }, - addAllergy: - (MySelectedAllergy mySelectedAllergy) { - addAllergyLocally(mySelectedAllergy); - }, - addSelectedAllergy: () => widget - .addAllergiesFun(myAllergiesListLocal), - isServiceSelected: (master) => - isServiceSelected(master), - getServiceSelectedAllergy: (master) => - getSelectedAllergy(master), - ), - ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + title: TranslationBase.of(context).addAllergies, + padding: 10, + color: Color(0xFF359846), + onPressed: () { + setState(() { + widget.addAllergiesFun(myAllergiesListLocal); + }); + }, ), ), ), ), SizedBox( - height: MediaQuery.of(context).size.height * 0.11, + height: 5, ), - ]), - ), - ),bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: - TranslationBase.of(context).addAllergies, - padding: 10, - color: Color(0xFF359846), - onPressed: () { - widget.addAllergiesFun(myAllergiesListLocal); - }, - ), + ], ), ), - ), - SizedBox( - height: 5, - ), - ], - ), - ),), + ), ), ); } @@ -207,17 +220,15 @@ class _AddAllergiesState extends State { addAllergyLocally(MySelectedAllergy mySelectedAllergy) { if (mySelectedAllergy.selectedAllergy == null) { - Helpers.showErrorToast(TranslationBase - .of(context) - .requiredMsg); + Helpers.showErrorToast(TranslationBase.of(context).requiredMsg); } else { setState(() { List allergy = - // ignore: missing_return - myAllergiesListLocal - .where((element) => - mySelectedAllergy.selectedAllergy.id == - element.selectedAllergy.id) + // ignore: missing_return + myAllergiesListLocal + .where((element) => + mySelectedAllergy.selectedAllergy.id == + element.selectedAllergy.id) .toList(); if (allergy.isEmpty) { diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart new file mode 100644 index 00000000..55e36342 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart @@ -0,0 +1,197 @@ +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class AddAllergiesItem extends StatefulWidget { + final SOAPViewModel model; + final Function(MasterKeyModel) removeAllergy; + final Function(MySelectedAllergy mySelectedAllergy) addAllergy; + final bool Function(MasterKeyModel) isServiceSelected; + final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; + + final MasterKeyModel item; + + const AddAllergiesItem( + {Key key, + this.model, + this.removeAllergy, + this.addAllergy, + this.isServiceSelected, + this.getServiceSelectedAllergy, + this.item}) + : super(key: key); + + @override + _AddAllergiesItemState createState() => _AddAllergiesItemState(); +} + +class _AddAllergiesItemState extends State { + MasterKeyModel _selectedAllergySeverity; + bool isSubmitted = false; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + bool isSelected = widget.isServiceSelected(widget.item); + MySelectedAllergy mySelectedAllergy; + if (isSelected) { + mySelectedAllergy = widget.getServiceSelectedAllergy(widget.item); + } + TextEditingController remarkController = TextEditingController( + text: isSelected ? mySelectedAllergy.remark : null); + TextEditingController severityController = TextEditingController( + text: isSelected + ? mySelectedAllergy.selectedAllergySeverity != null + ? projectViewModel.isArabic + ? mySelectedAllergy.selectedAllergySeverity.nameAr + : mySelectedAllergy.selectedAllergySeverity.nameEn + : null + : null); + return HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Checkbox( + value: widget.isServiceSelected(widget.item), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + onTapItem(); + }), + InkWell( + onTap:onTapItem, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: Container( + child: AppText( + projectViewModel.isArabic + ? widget.item.nameAr != "" + ? widget.item.nameAr + : widget.item.nameEn + : widget.item.nameEn, + color: Color(0xFF575757), + fontSize: 16, + fontWeight: FontWeight.w600, + ), + width: MediaQuery.of(context).size.width * 0.55, + ), + ), + ), + ], + ), + InkWell( + onTap: () { + if (mySelectedAllergy != null) { + setState(() { + mySelectedAllergy.isExpanded = + mySelectedAllergy.isExpanded ? false : true; + }); + } + }, + child: Icon((mySelectedAllergy != null + ? mySelectedAllergy.isExpanded + : false) + ? EvaIcons.arrowIosUpwardOutline + : EvaIcons.arrowIosDownwardOutline)) + ], + ), + bodyWidget: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Center( + child: Column( + children: [ + AppTextFieldCustom( + onClick: widget.model.allergySeverityList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: widget.model.allergySeverityList, + selectedValue: + mySelectedAllergy.selectedAllergySeverity, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + mySelectedAllergy.selectedAllergySeverity = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + isTextFieldHasSuffix: true, + hintText: TranslationBase.of(context).selectSeverity, + enabled: false, + maxLines: 2, + minLines: 2, + validationError: mySelectedAllergy != null && + mySelectedAllergy.selectedAllergySeverity == null && + mySelectedAllergy.hasValidationError + ? TranslationBase.of(context).emptyMessage + : null, + controller: severityController, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarkController, + maxLines: 25, + minLines: 3, + hasBorder: true, + onChanged: (value){ + mySelectedAllergy.remark = value; + }, + inputType: TextInputType.multiline, + + ), + SizedBox( + height: 10, + ), + ], + ), + ), + ), + ), + isExpand: + mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false, + ); + } + + onTapItem(){ + setState(() { + if (widget.isServiceSelected(widget.item)) { + widget.removeAllergy(widget.item); + } else { + MySelectedAllergy mySelectedAllergy = + new MySelectedAllergy( + selectedAllergy: widget.item, + selectedAllergySeverity: _selectedAllergySeverity, + remark: null, + isChecked: true, + isExpanded: true); + widget.addAllergy(mySelectedAllergy); + } + }); + } +} diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart new file mode 100644 index 00000000..8644c9a9 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -0,0 +1,148 @@ +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'allergies_item.dart'; + + +class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { + final SOAPViewModel model; + final Function() addSelectedAllergy; + final Function(MasterKeyModel) removeAllergy; + final Function(MySelectedAllergy mySelectedAllergy) addAllergy; + final bool Function(MasterKeyModel) isServiceSelected; + final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; + + final List masterList; + final String buttonName; + final String hintSearchText; + + MasterKeyCheckboxSearchAllergiesWidget( + {Key key, + this.model, + this.addSelectedAllergy, + this.removeAllergy, + this.masterList, + this.addAllergy, + this.isServiceSelected, + this.buttonName, + this.hintSearchText, + this.getServiceSelectedAllergy}) + : super(key: key); + + @override + _MasterKeyCheckboxSearchAllergiesWidgetState createState() => + _MasterKeyCheckboxSearchAllergiesWidgetState(); +} + +class _MasterKeyCheckboxSearchAllergiesWidgetState + extends State { + List items = List(); + + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Expanded( + child: Container( + height: MediaQuery.of(context).size.height * 0.70, + child: Center( + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + children: [ + AppTextFieldCustom( + // height: + // MediaQuery.of(context).size.height * 0.070, + hintText: + TranslationBase.of(context).selectAllergy, + isTextFieldHasSuffix: true, + hasBorder: false, + // controller: filteredSearchController, + onChanged: (value) { + filterSearchResults(value); + }, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.black, + )), + ), + DividerWithSpacesAround(), + SizedBox( + height: 10, + ), + Expanded( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Container( + height: + MediaQuery.of(context).size.height * 0.60, + child: ListView.builder( + itemCount: items.length, + itemBuilder: (context, index) { + + return AddAllergiesItem( + item:items[index], + model: widget.model, + removeAllergy: widget.removeAllergy, + addAllergy:widget.addAllergy, + isServiceSelected: widget.isServiceSelected, + getServiceSelectedAllergy: widget.getServiceSelectedAllergy, + ); + }, + ), + ), + ), + ), + ], + ))), + ), + ), + SizedBox( + height: 10, + ), + ], + ), + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((items) { + if (items.nameAr.toLowerCase().contains(query.toLowerCase()) || + items.nameEn.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(items); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index 6f7439e6..4be953a7 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -34,10 +34,8 @@ class _UpdateAllergiesWidgetState extends State { return Column( children: [ - - SOAPOpenItems(label: "${TranslationBase.of(context).addAllergies}",onTap: () { - openAllergiesList(context, changeAllState); + openAllergiesList(context, changeAllState, removeAllergy); },), SizedBox( height: 20, @@ -153,16 +151,18 @@ class _UpdateAllergiesWidgetState extends State { ).toList(); if (allergy.length > 0) { + if(allergy.first.isLocal) { + setState(() { + widget.myAllergiesList.remove(allergy.first); + }); + } setState(() { allergy[0].isChecked = false; }); } - - - print(allergy); } - openAllergiesList(BuildContext context, Function changeParentState) { + openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) { showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, @@ -175,15 +175,29 @@ class _UpdateAllergiesWidgetState extends State { bool isAllDataFilled = true; mySelectedAllergy.forEach((element) { if (element.selectedAllergySeverity == null) { + element.hasValidationError = true; isAllDataFilled = false; } }); if (isAllDataFilled) { mySelectedAllergy.forEach((element) { - if (!widget.myAllergiesList.contains(element.selectedAllergySeverity.id)) { + if ((widget.myAllergiesList.singleWhere((it) => it.selectedAllergy.id == element.selectedAllergy.id, + orElse: () => null)) == null) { widget.myAllergiesList.add(element); } }); + + /// remove items. + List removedList= []; + widget.myAllergiesList.forEach((element) { + if ((mySelectedAllergy.singleWhere((it) => it.selectedAllergy.id == element.selectedAllergy.id, + orElse: () => null)) == null) { + removedList.add(element); + }}); + + removedList.forEach((element) { + removeAllergy(element); + }); changeParentState(); Navigator.of(context).pop(); } else { diff --git a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index 1da8db17..bd2f8502 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; @@ -19,10 +20,15 @@ class AddHistoryDialog extends StatefulWidget { final PageController controller; final List myHistoryList; final Function addSelectedHistories; - final Function (MasterKeyModel) removeHistory; + final Function(MasterKeyModel) removeHistory; const AddHistoryDialog( - {Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory}) + {Key key, + this.changePageViewIndex, + this.controller, + this.myHistoryList, + this.addSelectedHistories, + this.removeHistory}) : super(key: key); @override @@ -51,96 +57,96 @@ class _AddHistoryDialogState extends State { }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: false, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: TranslationBase.of(context).addHistory), body: Center( child: Container( child: Column( - children: [ - BottomSheetTitle(title:TranslationBase.of(context).addHistory), - SizedBox( - height: 10, - ), - PriorityBar(onTap: (activePriority) async { - widget.changePageViewIndex(activePriority); - }), - SizedBox( - height: 20, - ), - Expanded( - child: FractionallySizedBox( - widthFactor: 0.9, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: widget.controller, - onPageChanged: (index) { - setState(() { - }); - }, - scrollDirection: Axis.horizontal, - children: [ - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.historyFamilyList, - removeHistory: (history){ - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history){ - setState(() { - createAndAddHistory( - history); - }); - }, - addSelectedHistories: (){ - widget.addSelectedHistories(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - ), - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.mergeHistorySurgicalWithHistorySportList, - removeHistory: (history){ - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history){ - setState(() { - createAndAddHistory( - history); - }); - }, - addSelectedHistories: (){ - widget.addSelectedHistories(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - ), - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.historyMedicalList, - removeHistory: (history){ - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history){ - setState(() { - createAndAddHistory( - history); - }); - }, - addSelectedHistories: (){ - widget.addSelectedHistories(); - }, + children: [ + SizedBox( + height: 10, + ), + PriorityBar(onTap: (activePriority) async { + widget.changePageViewIndex(activePriority); + }), + SizedBox( + height: 20, + ), + Expanded( + child: FractionallySizedBox( + widthFactor: 0.9, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: widget.controller, + onPageChanged: (index) { + setState(() {}); + }, + scrollDirection: Axis.horizontal, + children: [ + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyFamilyList, + removeHistory: (history) { + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history) { + setState(() { + createAndAddHistory(history); + }); + }, + addSelectedHistories: () { + widget.addSelectedHistories(); + }, + isServiceSelected: (master) => + isServiceSelected(master), + ), + ), + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model + .mergeHistorySurgicalWithHistorySportList, + removeHistory: (history) { + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history) { + setState(() { + createAndAddHistory(history); + }); + }, + addSelectedHistories: () { + widget.addSelectedHistories(); + }, + isServiceSelected: (master) => + isServiceSelected(master), + ), + ), + NetworkBaseView( + baseViewModel: model, + child: MasterKeyCheckboxSearchWidget( + model: model, + masterList: model.historyMedicalList, + removeHistory: (history) { + setState(() { + widget.removeHistory(history); + }); + }, + addHistory: (history) { + setState(() { + createAndAddHistory(history); + }); + }, + addSelectedHistories: () { + widget.addSelectedHistories(); + }, isServiceSelected: (master) => isServiceSelected(master), ), @@ -149,59 +155,63 @@ class _AddHistoryDialogState extends State { ), ), ), - SizedBox(height:MediaQuery.of(context).size.height * 0.11 ,) + SizedBox( + height: MediaQuery.of(context).size.height * 0.11, + ) ], - ) - ), + )), ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: - TranslationBase.of(context).addSelectedHistories, - padding: 10, - color: Color(0xFF359846), - onPressed: () { - widget.addSelectedHistories(); - }, - ), + bottomSheet: model.state == ViewState.Busy + ? Container( + height: 0, + ) + : Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + title: TranslationBase.of(context) + .addSelectedHistories, + padding: 10, + color: Color(0xFF359846), + onPressed: () { + widget.addSelectedHistories(); + }, + ), + ), + ), + ), + SizedBox( + height: 5, + ), + ], ), ), - SizedBox( - height: 5, - ), - ], - ), - ), ), )); } createAndAddHistory(MasterKeyModel history) { - List myhistory = widget.myHistoryList.where((element) => - history.id == - element.selectedHistory.id && - history.typeId == - element.selectedHistory.typeId - ).toList(); + List myhistory = widget.myHistoryList + .where((element) => + history.id == element.selectedHistory.id && + history.typeId == element.selectedHistory.typeId) + .toList(); if (myhistory.isEmpty) { setState(() { @@ -217,18 +227,14 @@ class _AddHistoryDialogState extends State { } isServiceSelected(MasterKeyModel masterKey) { - Iterable history = - widget - .myHistoryList - .where((element) => - masterKey.id == element.selectedHistory.id && - masterKey.typeId == element.selectedHistory.typeId && - element.isChecked); + Iterable history = widget.myHistoryList.where( + (element) => + masterKey.id == element.selectedHistory.id && + masterKey.typeId == element.selectedHistory.typeId && + element.isChecked); if (history.length > 0) { return true; } return false; } - } - diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index f114702d..3b431a69 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -123,10 +123,19 @@ class _UpdateHistoryWidgetState extends State ).toList(); - if (history.length > 0) - setState(() { - history[0].isChecked = false; - }); + if (history.length > 0) { + if(history.first.isLocal) { + setState(() { + widget.myHistoryList.remove(history.first); + }); + } else { + setState(() { + history[0].isChecked = false; + }); + } + + } + } openHistoryList(BuildContext context) { diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index 69475926..11e4fa72 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -1,6 +1,7 @@ // ignore: must_be_immutable import 'package:autocomplete_textfield/autocomplete_textfield.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/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; @@ -74,15 +75,15 @@ class _AddMedicationState extends State { }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: false, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: TranslationBase.of(context).addMedication, + ), body: Center( child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - BottomSheetTitle( - title: TranslationBase.of(context).addMedication, - ), SizedBox( height: 10, ), @@ -187,6 +188,7 @@ class _AddMedicationState extends State { list: model.medicationDoseTimeList, okText: TranslationBase.of(context).ok, + selectedValue: _selectedMedicationDose, okFunction: (selectedValue) { setState(() { _selectedMedicationDose = @@ -235,6 +237,7 @@ class _AddMedicationState extends State { list: model.medicationStrengthList, okText: TranslationBase.of(context).ok, + selectedValue: _selectedMedicationStrength, okFunction: (selectedValue) { setState(() { _selectedMedicationStrength = @@ -283,6 +286,7 @@ class _AddMedicationState extends State { MasterKeyDailog dialog = MasterKeyDailog( list: model.medicationRouteList, + selectedValue: _selectedMedicationRoute, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { @@ -332,6 +336,7 @@ class _AddMedicationState extends State { list: model.medicationFrequencyList, okText: TranslationBase.of(context).ok, + selectedValue: _selectedMedicationFrequency, okFunction: (selectedValue) { setState(() { _selectedMedicationFrequency = @@ -381,7 +386,7 @@ class _AddMedicationState extends State { ]), ), ), - bottomSheet: Container( + bottomSheet:model.state == ViewState.Busy?Container(height: 0,): Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all( diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 1b6cd274..7a48a786 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -30,16 +30,12 @@ import 'history/update_history_widget.dart'; class UpdateSubjectivePage extends StatefulWidget { final Function changePageViewIndex; final Function changeLoadingState; - final List myAllergiesList; - final List myHistoryList; final PatiantInformtion patientInfo; final int currentIndex; UpdateSubjectivePage( {Key key, this.changePageViewIndex, - this.myAllergiesList, - this.myHistoryList, this.patientInfo, this.changeLoadingState, this.currentIndex}); @@ -59,6 +55,8 @@ class _UpdateSubjectivePageState extends State { String medicationControllerError = ''; String illnessControllerError = ''; final formKey = GlobalKey(); + List myAllergiesList=List(); + List myHistoryList=List(); getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); @@ -93,9 +91,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { @@ -105,9 +103,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { @@ -117,9 +115,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { @@ -129,9 +127,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } }); @@ -169,8 +167,9 @@ class _UpdateSubjectivePageState extends State { isChecked: element.isChecked, createdBy: element.createdBy, remark: element.remarks, + isLocal : false, selectedAllergySeverity: selectedAllergySeverity); - if (selectedAllergy != null && selectedAllergySeverity != null) widget.myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); }); } } @@ -179,8 +178,8 @@ class _UpdateSubjectivePageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - widget.myAllergiesList.clear(); - widget.myHistoryList.clear(); + myAllergiesList.clear(); + myHistoryList.clear(); GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -246,7 +245,7 @@ class _UpdateSubjectivePageState extends State { }); }, child: Column( - children: [UpdateHistoryWidget(myHistoryList: widget.myHistoryList)], + children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], ), isExpanded: isHistoryExpand, ), @@ -264,7 +263,7 @@ class _UpdateSubjectivePageState extends State { child: Column( children: [ UpdateAllergiesWidget( - myAllergiesList: widget.myAllergiesList, + myAllergiesList: myAllergiesList, ), SizedBox( height: 30, @@ -304,10 +303,10 @@ class _UpdateSubjectivePageState extends State { title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, color: Colors.red[700], - loading: model.state == ViewState.BusyLocal, + // loading: model.state == ViewState.BusyLocal, onPressed: () async { addSubjectiveInfo( - model: model, myAllergiesList: widget.myAllergiesList, myHistoryList: widget.myHistoryList); + model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); }, ), ), @@ -325,6 +324,9 @@ class _UpdateSubjectivePageState extends State { addSubjectiveInfo( {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { + if(FocusScope.of(context).hasFocus) + FocusScope.of(context).unfocus(); + widget.changeLoadingState(true); formKey.currentState.save(); formKey.currentState.validate(); @@ -338,7 +340,6 @@ class _UpdateSubjectivePageState extends State { if (model.state == ViewState.ErrorLocal) { Helpers.showErrorToast(model.error); } - if (myHistoryList.length != 0) { await postHistories(model: model, myHistoryList: myHistoryList); if (model.state == ViewState.ErrorLocal) { @@ -370,6 +371,8 @@ class _UpdateSubjectivePageState extends State { medicationControllerError = TranslationBase.of(context).emptyMessage; } }); + + widget.changeLoadingState(false); Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); } } @@ -380,7 +383,7 @@ class _UpdateSubjectivePageState extends State { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - widget.myAllergiesList.forEach((allergy) { + myAllergiesList.forEach((allergy) { if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM( @@ -404,6 +407,9 @@ class _UpdateSubjectivePageState extends State { await model.patchAllergy(postAllergyRequestModel); } + if (model.state == ViewState.ErrorLocal) { + Helpers.showErrorToast(model.error); + } GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -419,7 +425,7 @@ class _UpdateSubjectivePageState extends State { postHistories({List myHistoryList, SOAPViewModel model}) async { PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); - widget.myHistoryList.forEach((history) { + myHistoryList.forEach((history) { if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( patientMRN: widget.patientInfo.patientMRN, diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index 60597b11..e9d6d16d 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -31,11 +31,7 @@ class _UpdateSoapIndexState extends State int _currentIndex = 0; List myAllergiesList = List(); List myHistoryList = List(); - List mySelectedExamination = List(); - List mySelectedAssessment = List(); - GetPatientProgressNoteResModel patientProgressNote = - GetPatientProgressNoteResModel(); changePageViewIndex(pageIndex,{isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) @@ -65,12 +61,11 @@ class _UpdateSoapIndexState extends State Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - return BaseView( - builder: (_, model, w) => AppScaffold( - isLoading: _isLoading, - isShowAppBar: false, - body: SingleChildScrollView( - child: SingleChildScrollView( + return AppScaffold( + isLoading: _isLoading, + isShowAppBar: false, + body: SingleChildScrollView( + child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -105,27 +100,22 @@ class _UpdateSoapIndexState extends State UpdateSubjectivePage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, - myAllergiesList: myAllergiesList, - myHistoryList: myHistoryList, patientInfo: patient, changeLoadingState: changeLoadingState), UpdateObjectivePage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, - mySelectedExamination: mySelectedExamination, patientInfo: patient, changeLoadingState: changeLoadingState), UpdateAssessmentPage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, - mySelectedAssessmentList: mySelectedAssessment, patientInfo: patient, changeLoadingState: changeLoadingState), UpdatePlanPage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, patientInfo: patient, - patientProgressNote: patientProgressNote, changeLoadingState: changeLoadingState) ], ), @@ -137,6 +127,6 @@ class _UpdateSoapIndexState extends State ), ), ), - )); + ); } } diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index 1a99299b..4c9d986e 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -104,7 +104,7 @@ class PrescriptionsPage extends StatelessWidget { prescriptionModel: model, procedureType: ProcedureType.PRESCRIPTION, - )), + ),settings: RouteSettings(name: 'AddProcedureTabPage')), ); }, label: TranslationBase.of(context) diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 978fc2c5..236ec5e2 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -108,7 +108,7 @@ class _AddFavouriteProcedureState extends State { patient: widget.patient, model: widget.prescriptionModel, groupProcedures: groupProcedures, - ), + ), settings: RouteSettings(name: 'PrescriptionCheckOutScreen') ), ); } else { @@ -128,7 +128,7 @@ class _AddFavouriteProcedureState extends State { patient: widget.patient, addButtonTitle: widget.procedureType.getAddButtonTitle(context), toolbarTitle: widget.procedureType.getToolbarLabel(context), - ), + ), settings: RouteSettings(name: 'ProcedureCheckOutScreen') ), ); } diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 79371459..3ca6d25d 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -110,7 +110,7 @@ class ProcedureScreen extends StatelessWidget { patient: patient, model: model, procedureType: ProcedureType.PROCEDURE, - ), + ), settings: RouteSettings(name: 'AddProcedureTabPage') ), ); }, diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index dc3d0adf..98e9f9ec 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -982,6 +982,7 @@ class _RescheduleLeaveScreen extends State { context, MaterialPageRoute( builder: (context) => AddRescheduleLeavScreen(), + settings: RouteSettings(name: 'AddRescheduleLeaveScreen') // MyReferredPatient(), ), ); @@ -1045,7 +1046,7 @@ class _RescheduleLeaveScreen extends State { context, MaterialPageRoute( builder: (context) => AddRescheduleLeavScreen(), - // MyReferredPatient(), + settings: RouteSettings(name: 'AddRescheduleLeaveScreen') ), ); } diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 7b065321..61c81957 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -28,8 +28,10 @@ class AddSickLeavScreen extends StatelessWidget { patient = routeArgs['patient']; bool isInpatient = routeArgs['isInpatient']; return BaseView( - onModelReady: (model) => - model.getSickLeavePatient(patient.patientMRN ?? patient.patientId), + onModelReady: (model) async { + await model.getSickLeavePatient(patient.patientMRN ?? patient.patientId); + await model.getSickLeaveDoctor(patient.patientMRN ?? patient.patientId); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, @@ -61,56 +63,59 @@ class AddSickLeavScreen extends StatelessWidget { ), ], )), - Container( - width: SizeConfig.screenWidth, - margin: EdgeInsets.only( - left: 20, right: 20, top: 10, bottom: 10), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: HexColor('#EAEAEA')), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - child: Container( - decoration: BoxDecoration( - color: Colors.grey, - borderRadius: BorderRadius.circular(10)), - padding: EdgeInsets.all(3), - child: IconButton( + InkWell( + onTap: () { + openSickLeave( + context, + false, + ); + }, + child: Container( + width: SizeConfig.screenWidth, + margin: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10), + padding: EdgeInsets.all(20), + decoration: + BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor('#EAEAEA')), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + child: Container( + decoration: + BoxDecoration(color: Colors.grey, borderRadius: BorderRadius.circular(10)), + padding: EdgeInsets.all(3), + child: IconButton( icon: Icon( Icons.add, size: 35, color: Colors.white, ), - onPressed: () { - openSickLeave( - context, - false, - ); - }), - )), - Padding( - child: AppText( - TranslationBase.of(context) - .noSickLeaveApplied, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: 16, - textAlign: TextAlign.center, - color: HexColor('#7E7E7E')), - padding: EdgeInsets.all(10), - ), - ], - )), + // onPressed: () { + // openSickLeave( + // context, + // false, + // ); + // }, + ), + )), + Padding( + child: AppText(TranslationBase.of(context).noSickLeaveApplied, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: 16, + textAlign: TextAlign.center, + color: HexColor('#7E7E7E')), + padding: EdgeInsets.all(10), + ), + ], + )), + ), ], ) : SizedBox(), model.getAllSIckLeavePatient.length > 0 ? Column( - children: model.getAllSIckLeavePatient - .map((SickLeavePatientModel item) { + children: model.getAllSIckLeavePatient.map((SickLeavePatientModel item) { return RoundedContainer( margin: EdgeInsets.all(10), child: Column( @@ -129,8 +134,7 @@ class AddSickLeavScreen extends StatelessWidget { // ))), padding: EdgeInsets.all(10), child: Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( flex: 4, @@ -139,13 +143,12 @@ class AddSickLeavScreen extends StatelessWidget { // MainAxisAlignment.start, children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.all(3), child: AppText( - item.doctorName, + item.doctorName ?? "", // item.status == 1 // ? TranslationBase.of( // context) @@ -158,8 +161,7 @@ class AddSickLeavScreen extends StatelessWidget { // : TranslationBase // .of(context) // .all, - fontWeight: - FontWeight.bold, + fontWeight: FontWeight.bold, // color: item.status == 1 // ? Colors.yellow[800] // : item.status == 2 @@ -170,34 +172,25 @@ class AddSickLeavScreen extends StatelessWidget { ), Row( children: [ - AppText(TranslationBase - .of(context) - .daysSickleave + - ": "), + AppText(TranslationBase.of(context).daysSickleave + ": "), AppText( - item.sickLeaveDays - .toString(), - fontWeight: - FontWeight.bold, + item.sickLeaveDays ?? item.noOfDays.toString(), + fontWeight: FontWeight.bold, ), ], ), Row( children: [ AppText( - TranslationBase.of( - context) - .startDate + - ' ', + TranslationBase.of(context).startDate + ' ' ?? "", ), Flexible( child: AppText( AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .convertStringToDate( - item.startDate)), - fontWeight: - FontWeight.bold, + item.startDate.contains("/Date(") + ? AppDateUtils.convertStringToDate(item.startDate) + : DateTime.parse(item.startDate)), + fontWeight: FontWeight.bold, ), ) ], @@ -205,42 +198,21 @@ class AddSickLeavScreen extends StatelessWidget { Row( children: [ AppText( - TranslationBase.of(context) - .endDate + - ' ', + TranslationBase.of(context).endDate + ' ' ?? "", ), Flexible( child: AppText( - AppDateUtils - .getDayMonthYearDateFormatted( - AppDateUtils - .convertStringToDate( - item.endDate, - )), - fontWeight: - FontWeight.bold, + AppDateUtils.getDayMonthYearDateFormatted( + item.startDate.contains("/Date(") + ? AppDateUtils.convertStringToDate(item.endDate) + .add(Duration(days: item.noOfDays)) + : DateTime.parse(item.startDate) + .add(Duration(days: item.noOfDays))), + fontWeight: FontWeight.bold, ), ) ], ), - Row(children: [ - AppText(TranslationBase.of( - context) - .branch + - ": "), - AppText( - item.projectName ?? "", - ), - ]), - Row(children: [ - AppText(TranslationBase.of( - context) - .clinic + - ": "), - AppText( - item.clinicName ?? "", - ), - ]), ], ), SizedBox( @@ -266,8 +238,7 @@ class AddSickLeavScreen extends StatelessWidget { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText( - TranslationBase.of(context).noSickLeave), + child: AppText(TranslationBase.of(context).noSickLeave), ) ], ), @@ -276,8 +247,7 @@ class AddSickLeavScreen extends StatelessWidget { ])))); } - openSickLeave(BuildContext context, isExtend, - {GetAllSickLeaveResponse extendedData}) { + openSickLeave(BuildContext context, isExtend, {GetAllSickLeaveResponse extendedData}) { // showModalBottomSheet( // context: context, // builder: (context) { @@ -287,12 +257,9 @@ class AddSickLeavScreen extends StatelessWidget { context, FadePage( page: SickLeaveScreen( - appointmentNo: isExtend == true - ? extendedData.appointmentNo - : patient.appointmentNo, //extendedData.appointmentNo, - patientMRN: isExtend == true - ? extendedData.patientMRN - : patient.patientMRN, + appointmentNo: + isExtend == true ? extendedData.appointmentNo : patient.appointmentNo, //extendedData.appointmentNo, + patientMRN: isExtend == true ? extendedData.patientMRN : patient.patientMRN, isExtended: isExtend, extendedData: extendedData, patient: patient))); diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 199a7c82..be8e38f1 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -1,12 +1,14 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.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/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -28,12 +30,7 @@ class SickLeaveScreen extends StatefulWidget { final appointmentNo; final patientMRN; final patient; - SickLeaveScreen( - {this.appointmentNo, - this.patientMRN, - this.isExtended = false, - this.extendedData, - this.patient}); + SickLeaveScreen({this.appointmentNo, this.patientMRN, this.isExtended = false, this.extendedData, this.patient}); @override _SickLeaveScreenState createState() => _SickLeaveScreenState(); } @@ -76,8 +73,7 @@ class _SickLeaveScreenState extends State { return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( - onModelReady: (model2) => model2.preSickLeaveStatistics( - widget.appointmentNo, widget.patientMRN), + onModelReady: (model2) => model2.preSickLeaveStatistics(widget.appointmentNo, widget.patientMRN), builder: (_, model2, w) => GestureDetector( onTap: () { FocusScope.of(context).requestFocus(new FocusNode()); @@ -108,46 +104,35 @@ class _SickLeaveScreenState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), + borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all( width: 1.0, color: HexColor("#CCCCCC"), ), color: Colors.white), padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - top: 5, left: 10, right: 10), - child: AppText( - TranslationBase.of(context) - .sickLeave + - ' ' + - TranslationBase.of(context) - .days)), - AppTextFormField( - borderColor: Colors.white, - onChanged: (value) { - addSickLeave.noOfDays = value; - if (widget.extendedData != null) { - widget.extendedData.noOfDays = - int.parse(value); - } - }, - hintText: widget.extendedData != null - ? widget.extendedData.noOfDays - .toString() - : '', - // validator: (value) { - // return TextValidator().validateName(value); - // }, - textInputType:TextInputType.number, - inputFormatter: ONLY_NUMBERS) - ]), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Padding( + padding: EdgeInsets.only(top: 5, left: 10, right: 10), + child: AppText(TranslationBase.of(context).sickLeave + + ' ' + + TranslationBase.of(context).days)), + AppTextFormField( + borderColor: Colors.white, + onChanged: (value) { + addSickLeave.noOfDays = value; + if (widget.extendedData != null) { + widget.extendedData.noOfDays = int.parse(value); + } + }, + hintText: + widget.extendedData != null ? widget.extendedData.noOfDays.toString() : '', + // validator: (value) { + // return TextValidator().validateName(value); + // }, + textInputType: TextInputType.number, + inputFormatter: ONLY_NUMBERS) + ]), ), SizedBox( height: 10, @@ -155,146 +140,107 @@ class _SickLeaveScreenState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC")), color: Colors.white, ), padding: EdgeInsets.all(5), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only( - top: 5, left: 10, right: 10), + padding: EdgeInsets.only(top: 5, left: 10, right: 10), child: AppText( - TranslationBase.of(context) - .sickLeaveDate, + TranslationBase.of(context).sickLeaveDate, )), AppTextFormField( - hintText: widget.extendedData != null - ? widget.extendedData.startDate - : '', + hintText: widget.extendedData != null ? widget.extendedData.startDate : '', borderColor: Colors.white, - prefix: IconButton( - icon: Icon(Icons.calendar_today)), + prefix: IconButton(icon: Icon(Icons.calendar_today)), textInputType: TextInputType.number, controller: _toDateController, onTap: () { - _presentDatePicker( - '_selectedToDate'); + _presentDatePicker('_selectedToDate'); }, inputFormatter: ONLY_DATE, onChanged: (value) { addSickLeave.startDate = value; if (widget.extendedData != null) { - widget.extendedData.startDate = - value; + widget.extendedData.startDate = value; } }), ], )), Container( - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC")), color: Colors.white, ), width: double.infinity, child: Padding( padding: EdgeInsets.only( top: SizeConfig.widthMultiplier * 0.9, - bottom: - SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, right: SizeConfig.widthMultiplier * 3, left: SizeConfig.widthMultiplier * 3), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.only(top: 5), child: AppText( - TranslationBase.of(context) - .clinicName, + TranslationBase.of(context).clinicName, )), Row( mainAxisSize: MainAxisSize.max, children: [ Expanded( // add Expanded to have your dropdown button fill remaining space - child: - DropdownButtonHideUnderline( - child: new IgnorePointer( - ignoring: true, - child: DropdownButton( - isExpanded: true, - value: getClinicName( - model) ?? - "", - iconSize: 0, - elevation: 16, - selectedItemBuilder: - (BuildContext - context) { - return model - .getClinicNameList() - .map((item) { - return Row( - mainAxisSize: - MainAxisSize - .max, - children: < - Widget>[ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - color: Colors - .grey, - ), - ], - ); - }).toList(); - }, - onChanged: - (newValue) => - {}, - items: model - .getClinicNameList() - .map((item) { - return DropdownMenuItem( - value: item - .toString(), - child: Text( + child: DropdownButtonHideUnderline( + child: new IgnorePointer( + ignoring: true, + child: DropdownButton( + isExpanded: true, + value: getClinicName(model) ?? "", + iconSize: 0, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return model.getClinicNameList().map((item) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + AppText( item, - textAlign: - TextAlign - .end, + fontSize: SizeConfig.textMultiplier * 2.1, + color: Colors.grey, ), - ); - }).toList(), - ))), + ], + ); + }).toList(); + }, + onChanged: (newValue) => {}, + items: model.getClinicNameList().map((item) { + return DropdownMenuItem( + value: item.toString(), + child: Text( + item, + textAlign: TextAlign.end, + ), + ); + }).toList(), + ))), ), ], ) ], ), )), - model2.sickLeaveStatistics[ - 'recommendedSickLeaveDays'] != - null + model2.sickLeaveStatistics['recommendedSickLeaveDays'] != null ? Padding( child: AppText( - model2.sickLeaveStatistics[ - 'recommendedSickLeaveDays'], + model2.sickLeaveStatistics['recommendedSickLeaveDays'], fontWeight: FontWeight.bold, textAlign: TextAlign.start, ), @@ -306,10 +252,8 @@ class _SickLeaveScreenState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC")), color: Colors.white, ), padding: EdgeInsets.all(5), @@ -317,11 +261,9 @@ class _SickLeaveScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only( - top: 5, left: 10, right: 10), + padding: EdgeInsets.only(top: 5, left: 10, right: 10), child: AppText( - TranslationBase.of(context) - .doctorName, + TranslationBase.of(context).doctorName, )), new IgnorePointer( ignoring: true, @@ -343,10 +285,8 @@ class _SickLeaveScreenState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10), decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC")), + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all(width: 1.0, color: HexColor("#CCCCCC")), color: Colors.white, ), padding: EdgeInsets.all(5), @@ -354,8 +294,7 @@ class _SickLeaveScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only( - top: 5, left: 10, right: 10), + padding: EdgeInsets.only(top: 5, left: 10, right: 10), child: AppText( TranslationBase.of(context).remarks, )), @@ -364,9 +303,7 @@ class _SickLeaveScreenState extends State { decoration: InputDecoration( contentPadding: EdgeInsets.all(20.0), border: InputBorder.none, - hintText: widget.extendedData != null - ? widget.extendedData.remarks - : ''), + hintText: widget.extendedData != null ? widget.extendedData.remarks : ''), onChanged: (value) { addSickLeave.remarks = value; if (widget.extendedData != null) { @@ -378,40 +315,60 @@ class _SickLeaveScreenState extends State { ), ), Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Wrap( alignment: WrapAlignment.center, children: [ AppButton( title: widget.isExtended == true ? TranslationBase.of(context).extend - : TranslationBase.of(context) - .addSickLeaverequest, + : TranslationBase.of(context).addSickLeaverequest, color: Colors.green, onPressed: () async { if (widget.isExtended) { - await model2.extendSickLeave( - widget.extendedData); + await model2.extendSickLeave(widget.extendedData); DrAppToastMsg.showSuccesToast( - model2.sickleaveResponse[ - 'ListSickLeavesToExtent'] - ['success']); - Navigator.of(context) - .popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; + model2.sickleaveResponse['ListSickLeavesToExtent']['success']); + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; }); - Navigator.of(context).pushNamed( - ADD_SICKLEAVE, - arguments: { - 'patient': widget.patient - }); + Navigator.of(context) + .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient}); //print(value); //}); } else { - _validateInputs(model2); + try { + if (addSickLeave.noOfDays == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterNoOfDays); + } else if (addSickLeave.remarks == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterRemarks); + } else if (addSickLeave.startDate == null) { + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate); + } else { + addSickLeave.patientMRN = widget.patient.patientMRN.toString(); + addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); + await model2.addSickLeave(addSickLeave); + + if (model2.sickleaveResponse['SickLeavesList']['success'] != null) + DrAppToastMsg.showSuccesToast( + model2.sickleaveResponse['SickLeavesList']['success']); + } + // Navigator.push( + // context, + // MaterialPageRoute(builder: (context) => AddSickLeavScreen()), + // ); + + // Navigator.of(context).popUntil((route) { + // return route.settings.name == PATIENTS_PROFILE; + // }); + // Navigator.of(context) + // .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient}); + } catch (err) { + print(err); + } } }, ), @@ -437,26 +394,21 @@ class _SickLeaveScreenState extends State { void _validateInputs(model2) async { try { if (addSickLeave.noOfDays == null) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseEnterNoOfDays); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterNoOfDays); } else if (addSickLeave.remarks == null) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseEnterRemarks); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterRemarks); } else if (addSickLeave.startDate == null) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseEnterDate); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseEnterDate); } else { addSickLeave.patientMRN = widget.patient.patientMRN.toString(); addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); await model2.addSickLeave(addSickLeave).then((value) => print(value)); - DrAppToastMsg.showSuccesToast( - model2.sickleaveResponse['ListSickLeavesToExtent']['success']); + DrAppToastMsg.showSuccesToast(model2.sickleaveResponse['ListSickLeavesToExtent']['success']); Navigator.of(context).popUntil((route) { return route.settings.name == PATIENTS_PROFILE; }); - Navigator.of(context) - .pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient}); + Navigator.of(context).pushNamed(ADD_SICKLEAVE, arguments: {'patient': widget.patient}); } } catch (err) { print(err); @@ -471,9 +423,7 @@ class _SickLeaveScreenState extends State { } getClinicName(model) { - var clinicInfo = model.clinicsList - .where((i) => i['ClinicID'] == this.profile['ClinicID']) - .toList(); + var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == this.profile['ClinicID']).toList(); return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 165a9bb5..e30a006a 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -562,6 +562,7 @@ class TranslationBase { localizedValues['no-priscription-listed'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; + String get finish => localizedValues['finish'][locale.languageCode]; String get previous => localizedValues['previous'][locale.languageCode]; diff --git a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart index bd40c3ca..50afbdcf 100644 --- a/lib/widgets/patients/profile/prescription_out_patinets_widget.dart +++ b/lib/widgets/patients/profile/prescription_out_patinets_widget.dart @@ -71,6 +71,7 @@ class PrescriptionOutPatientWidget extends StatelessWidget { prescriptionResModel: patientPrescriptionsList[index], ), + settings: RouteSettings(name: 'OutPatientPrescriptionDetailsScreen') ), ); }, diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index b13a4f10..49f7d4e8 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -118,6 +118,7 @@ class _AppDrawerState extends State { context, MaterialPageRoute( builder: (context) => AddRescheduleLeavScreen(), + settings: RouteSettings(name: 'AddRescheduleLeaveScreen') // MyReferredPatient(), )); }, diff --git a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart deleted file mode 100644 index 7a1fc3f5..00000000 --- a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart +++ /dev/null @@ -1,421 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/new_text_Field.dart'; -import 'package:doctor_app_flutter/widgets/shared/user-guid/custom_validation_error.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -import 'app_texts_widget.dart'; -import 'dialogs/master_key_dailog.dart'; -import 'divider_with_spaces_around.dart'; -import 'expandable-widget-header-body.dart'; -import 'text_fields/app-textfield-custom.dart'; - -class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { - final SOAPViewModel model; - final Function() addSelectedAllergy; - final Function(MasterKeyModel) removeAllergy; - final Function(MySelectedAllergy mySelectedAllergy) addAllergy; - final bool Function(MasterKeyModel) isServiceSelected; - final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy; - - final List masterList; - final String buttonName; - final String hintSearchText; - - MasterKeyCheckboxSearchAllergiesWidget( - {Key key, - this.model, - this.addSelectedAllergy, - this.removeAllergy, - this.masterList, - this.addAllergy, - this.isServiceSelected, - this.buttonName, - this.hintSearchText, - this.getServiceSelectedAllergy}) - : super(key: key); - - @override - _MasterKeyCheckboxSearchAllergiesWidgetState createState() => - _MasterKeyCheckboxSearchAllergiesWidgetState(); -} - -class _MasterKeyCheckboxSearchAllergiesWidgetState - extends State { - List items = List(); - MasterKeyModel _selectedAllergySeverity; - bool isSubmitted = false; - - @override - void initState() { - items.addAll(widget.masterList); - super.initState(); - } - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return Container( - child: Column( - children: [ - Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.70, - child: Center( - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Column( - children: [ - AppTextFieldCustom( - // height: - // MediaQuery.of(context).size.height * 0.070, - hintText: - TranslationBase.of(context).selectAllergy, - isTextFieldHasSuffix: true, - hasBorder: false, - // controller: filteredSearchController, - onChanged: (value) { - filterSearchResults(value); - }, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - )), - ), - DividerWithSpacesAround(), - SizedBox( - height: 10, - ), - Expanded( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Container( - height: - MediaQuery.of(context).size.height * 0.60, - child: ListView.builder( - itemCount: items.length, - itemBuilder: (context, index) { - bool isSelected = widget - .isServiceSelected(items[index]); - MySelectedAllergy mySelectedAllergy; - if (isSelected) { - mySelectedAllergy = - widget.getServiceSelectedAllergy( - items[index]); - } - TextEditingController remarkController = - TextEditingController( - text: isSelected - ? mySelectedAllergy.remark - : null); - TextEditingController severityController = - TextEditingController( - text: isSelected - ? mySelectedAllergy - .selectedAllergySeverity != - null - ? projectViewModel - .isArabic - ? mySelectedAllergy - .selectedAllergySeverity - .nameAr - : mySelectedAllergy - .selectedAllergySeverity - .nameEn - : null - : null); - return HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Checkbox( - value: widget - .isServiceSelected( - items[index]), - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() { - if (widget - .isServiceSelected( - items[index])) { - widget.removeAllergy( - items[index]); - } else { - MySelectedAllergy - mySelectedAllergy = - new MySelectedAllergy( - selectedAllergy: - items[ - index], - selectedAllergySeverity: - _selectedAllergySeverity, - remark: null, - isChecked: - true, - isExpanded: - true); - widget.addAllergy( - mySelectedAllergy); - } - }); - }), - InkWell( - onTap: () { - setState(() { - if (widget - .isServiceSelected( - items[index])) { - widget.removeAllergy( - items[index]); - } else { - - MySelectedAllergy mySelectedAllergy = - new MySelectedAllergy( - selectedAllergy: - items[ - index], - selectedAllergySeverity: - _selectedAllergySeverity, - remark: null, - isChecked: true, - isExpanded: - true); - widget.addAllergy( - mySelectedAllergy); - } - }); - }, - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Container( - child: AppText( - projectViewModel - .isArabic - ? items[index] - .nameAr != - "" - ? items[index] - .nameAr - : items[index] - .nameEn - : items[index] - .nameEn, - color: - Color(0xFF575757), - fontSize: 16, - fontWeight: - FontWeight.w600, - ), - width: - MediaQuery.of(context) - .size - .width * - 0.55, - ), - ), - ), - ], - ), - InkWell( - onTap: () { - if (mySelectedAllergy != - null) { - setState(() { - mySelectedAllergy - .isExpanded = - mySelectedAllergy - .isExpanded - ? false - : true; - }); - } - }, - child: Icon((mySelectedAllergy != - null - ? mySelectedAllergy - .isExpanded - : false) - ? EvaIcons - .arrowIosUpwardOutline - : EvaIcons - .arrowIosDownwardOutline)) - ], - ), - bodyWidget: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Center( - child: Column( - children: [ - AppTextFieldCustom( - onClick: widget.model - .allergySeverityList != - null - ? () { - MasterKeyDailog - dialog = - MasterKeyDailog( - list: widget.model - .allergySeverityList, - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - mySelectedAllergy - .selectedAllergySeverity = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: - (BuildContext - context) { - return dialog; - }, - ); - } - : null, - isTextFieldHasSuffix: true, - hintText: - TranslationBase.of( - context) - .selectSeverity, - enabled: false, - maxLines: 2, - minLines: 2, - controller: - severityController, - ), - SizedBox( - height: 5, - ), - if (isSubmitted && - mySelectedAllergy != - null && - mySelectedAllergy - .selectedAllergySeverity == - null) - Row( - children: [ - CustomValidationError(), - ], - mainAxisAlignment: - MainAxisAlignment - .start, - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only( - left: 0, - right: 0, - top: 15), - child: NewTextFields( - hintText: - TranslationBase.of( - context) - .remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: - FontWeight.w600, - maxLines: 25, - minLines: 3, - initialValue: isSelected - ? mySelectedAllergy - .remark - : '', - // controller: remarkControlle - - onChanged: (value) { - if (isSelected) { - mySelectedAllergy - .remark = value; - } - }, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - ], - ), - ), - ), - ), - isExpand: mySelectedAllergy != null - ? mySelectedAllergy.isExpanded - : false, - ); - }, - ), - ), - ), - ), - ], - ))), - ), - ), - SizedBox( - height: 10, - ), - ], - ), - ); - } - - void filterSearchResults(String query) { - List dummySearchList = List(); - dummySearchList.addAll(widget.masterList); - if (query.isNotEmpty) { - List dummyListData = List(); - dummySearchList.forEach((items) { - if (items.nameAr.toLowerCase().contains(query.toLowerCase()) || - items.nameEn.toLowerCase().contains(query.toLowerCase())) { - dummyListData.add(items); - } - }); - setState(() { - items.clear(); - items.addAll(dummyListData); - }); - return; - } else { - setState(() { - items.clear(); - items.addAll(widget.masterList); - }); - } - } -} diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index fc7df189..05f139a2 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -27,6 +27,7 @@ class AppTextFieldCustom extends StatefulWidget { final String validationError; final bool isPrscription; final bool isSecure; + final bool focus; AppTextFieldCustom({ this.height = 0, @@ -47,6 +48,7 @@ class AppTextFieldCustom extends StatefulWidget { this.validationError, this.isPrscription = false, this.isSecure = false, + this.focus = false, }); @override @@ -54,6 +56,32 @@ class AppTextFieldCustom extends StatefulWidget { } class _AppTextFieldCustomState extends State { + final FocusNode _focusNode = FocusNode(); + bool focus = false; + bool view = false; + + @override + void initState() { + super.initState(); + _focusNode.addListener(() { + setState(() { + focus = _focusNode.hasFocus; + }); + }); + } + + @override + void didUpdateWidget(AppTextFieldCustom oldWidget) { + if (widget.focus) _focusNode.requestFocus(); + super.didUpdateWidget(oldWidget); + } + + @override + void dispose() { + _focusNode.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -104,10 +132,11 @@ class _AppTextFieldCustomState extends State { widget.height != 0 && widget.maxLines == 1 ? widget.height - 22 : null, - child: TextField( + child: TextFormField( textAlign: projectViewModel.isArabic ? TextAlign.right : TextAlign.left, + focusNode: _focusNode, decoration: TextFieldsUtils .textFieldSelectorDecoration( widget.hintText, null, true), @@ -129,7 +158,7 @@ class _AppTextFieldCustomState extends State { ? widget.inputFormatters : [], onChanged: (value) { - setState(() {}); + // setState(() {}); if (widget.onChanged != null) { widget.onChanged(value); } @@ -162,9 +191,10 @@ class _AppTextFieldCustomState extends State { ), ), ), - if (widget.validationError != null) + if (widget.validationError != null && widget.validationError.isNotEmpty) TextFieldsError(error: widget.validationError), ], ); } + } diff --git a/lib/widgets/shared/user-guid/custom_validation_error.dart b/lib/widgets/shared/user-guid/custom_validation_error.dart index a05d52a2..fd1f2125 100644 --- a/lib/widgets/shared/user-guid/custom_validation_error.dart +++ b/lib/widgets/shared/user-guid/custom_validation_error.dart @@ -13,9 +13,9 @@ class CustomValidationError extends StatelessWidget { @override Widget build(BuildContext context) { if(error == null ) - error = TranslationBase - .of(context) - .emptyMessage; + error = TranslationBase + .of(context) + .emptyMessage; return Column( children: [ SizedBox( diff --git a/lib/widgets/transitions/fade_page.dart b/lib/widgets/transitions/fade_page.dart index 97a37ce1..7cd3826c 100644 --- a/lib/widgets/transitions/fade_page.dart +++ b/lib/widgets/transitions/fade_page.dart @@ -7,6 +7,7 @@ class FadePage extends PageRouteBuilder { FadePage({this.page}) : super( opaque: false, + settings: RouteSettings(name: page.runtimeType.toString()), fullscreenDialog: true, barrierDismissible: true, barrierColor: Colors.black.withOpacity(0.8), diff --git a/lib/widgets/transitions/slide_up_page.dart b/lib/widgets/transitions/slide_up_page.dart index 2c138b9e..f534e2a3 100644 --- a/lib/widgets/transitions/slide_up_page.dart +++ b/lib/widgets/transitions/slide_up_page.dart @@ -24,6 +24,7 @@ class SlideUpPageRoute extends PageRouteBuilder { opaque: opaque, barrierColor: Color.fromRGBO(0, 0, 0, 0.5), barrierDismissible: true, + settings: RouteSettings(name: widget.runtimeType.toString()), transitionDuration: Duration(milliseconds: 800), transitionsBuilder: ((BuildContext context, Animation animation, diff --git a/pubspec.lock b/pubspec.lock index a408ffd5..c90d86d9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -351,6 +351,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.2.1" + firebase: + dependency: transitive + description: + name: firebase + url: "https://pub.dartlang.org" + source: hosted + version: "7.3.3" + firebase_analytics: + dependency: "direct main" + description: + name: firebase_analytics + url: "https://pub.dartlang.org" + source: hosted + version: "6.3.0" + firebase_analytics_platform_interface: + dependency: transitive + description: + name: firebase_analytics_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + firebase_analytics_web: + dependency: transitive + description: + name: firebase_analytics_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1" firebase_core: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1429bc3e..8582b9cb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -71,6 +71,7 @@ dependencies: # Firebase firebase_messaging: ^7.0.3 + firebase_analytics: 6.3.0 #GIF image flutter_gifimage: ^1.0.1