diff --git a/android/app/build.gradle b/android/app/build.gradle index c7b2631e..ab88f580 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -110,5 +110,6 @@ dependencies { implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0' + 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/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 34a225b2..e6560790 100644 --- a/android/google-services.json +++ b/android/google-services.json @@ -1,34 +1,77 @@ { "project_info": { - "project_number": "1095694324958", - "project_id": "mobapp-bb272", - "storage_bucket": "mobapp-bb272.appspot.com" + "project_number": "934365232760", + "project_id": "hmg-dr-app", + "storage_bucket": "hmg-dr-app.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:1095694324958:android:70a42e30fcc98ea33fde4f", + "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": "1095694324958-5psabq8tpbti0uqo8bt46atjtbas9uhr.apps.googleusercontent.com", + "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyCuPtf1hTikWXrp5OQIVfqO-TJWubI-Vd8" + "current_key": "AIzaSyCpYwrmuntOBdZv6GV6KEnLj8nQRvEnZ6I" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "1095694324958-5psabq8tpbti0uqo8bt46atjtbas9uhr.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" + } } ] } @@ -36,4 +79,4 @@ } ], "configuration_version": "1" -} +} \ No newline at end of file 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/client/base_app_client.dart b/lib/client/base_app_client.dart index de6f59a1..a93444c2 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -64,7 +64,7 @@ class BaseAppClient { else body['LanguageID'] = 2; - body['stamp'] = STAMP; + body['stamp'] = DateTime.now().toIso8601String(); // if(!body.containsKey("IPAdress")) body['IPAdress'] = IP_ADDRESS; body['VersionID'] = VERSION_ID; diff --git a/lib/config/config.dart b/lib/config/config.dart index d193bfac..7c950565 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; @@ -279,14 +279,14 @@ var SERVICES_PATIANT_HEADER_AR = [ "المريض الواصل" ]; -var DEVICE_TOKEN = ""; + const PRIMARY_COLOR = 0xff515B5D; 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.2; +const VERSION_ID = 6.3; 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/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index eea2ce76..784c8fff 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -12,5 +12,4 @@ final LOGGED_IN_USER = 'loggedUser'; final DASHBOARD_DATA = 'dashboard-data'; final OTP_TYPE = 'otp-type'; final LAST_LOGIN_USER = 'last-login-user'; -final PASSWORD = 'password'; final CLINIC_NAME = 'clinic-name'; diff --git a/lib/core/model/auth/activation_Code_req_model.dart b/lib/core/model/auth/activation_Code_req_model.dart index 1a9510e8..73c97242 100644 --- a/lib/core/model/auth/activation_Code_req_model.dart +++ b/lib/core/model/auth/activation_Code_req_model.dart @@ -1,34 +1,26 @@ class ActivationCodeModel { - String mobileNumber; - String zipCode; int channel; int languageID; double versionID; int memberID; - String password; int facilityId; String generalid; String otpSendType; + ActivationCodeModel( - {this.mobileNumber, - this.zipCode, - this.channel, + {this.channel, this.languageID, this.versionID, this.memberID, - this.password, this.facilityId, this.otpSendType, this.generalid}); ActivationCodeModel.fromJson(Map json) { - mobileNumber = json['MobileNumber']; - zipCode = json['ZipCode']; channel = json['Channel']; languageID = json['LanguageID']; versionID = json['VersionID']; memberID = json['MemberID']; - password = json['Password']; facilityId = json['facilityId']; otpSendType = json['OTP_SendType']; generalid = json['generalid']; @@ -36,13 +28,10 @@ class ActivationCodeModel { Map toJson() { final Map data = new Map(); - data['MobileNumber'] = this.mobileNumber; - data['ZipCode'] = this.zipCode; data['Channel'] = this.channel; data['LanguageID'] = this.languageID; data['VersionID'] = this.versionID; data['MemberID'] = this.memberID; - data['Password'] = this.password; data['facilityId'] = this.facilityId; data['OTP_SendType'] = otpSendType; data['generalid'] = this.generalid; diff --git a/lib/core/model/auth/activation_code_for_verification_screen_model.dart b/lib/core/model/auth/activation_code_for_verification_screen_model.dart index 28cc58db..a261ce46 100644 --- a/lib/core/model/auth/activation_code_for_verification_screen_model.dart +++ b/lib/core/model/auth/activation_code_for_verification_screen_model.dart @@ -55,8 +55,6 @@ class ActivationCodeForVerificationScreenModel { data['facilityId'] = this.facilityId; data['generalid'] = this.generalid; data['IsMobileFingerPrint'] = this.isMobileFingerPrint; - data['VidaAuthTokenID'] = this.vidaAuthTokenID; - data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; data['IMEI'] = this.iMEI; return data; } diff --git a/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart index c5ff29e6..e39518e6 100644 --- a/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart +++ b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart @@ -5,11 +5,16 @@ class CheckActivationCodeForDoctorAppResponseModel { List listDoctorsClinic; List listDoctorProfile; MemberInformation memberInformation; + String vidaAuthTokenID; + String vidaRefreshTokenID; CheckActivationCodeForDoctorAppResponseModel( {this.authenticationTokenID, this.listDoctorsClinic, - this.memberInformation}); + this.memberInformation, + this.listDoctorProfile, + this.vidaAuthTokenID, + this.vidaRefreshTokenID}); CheckActivationCodeForDoctorAppResponseModel.fromJson( Map json) { @@ -27,6 +32,8 @@ class CheckActivationCodeForDoctorAppResponseModel { listDoctorProfile.add(new DoctorProfileModel.fromJson(v)); }); } + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; memberInformation = json['memberInformation'] != null ? new MemberInformation.fromJson(json['memberInformation']) @@ -60,12 +67,13 @@ class ListDoctorsClinic { bool isActive; String clinicName; - ListDoctorsClinic({this.setupID, - this.projectID, - this.doctorID, - this.clinicID, - this.isActive, - this.clinicName}); + ListDoctorsClinic( + {this.setupID, + this.projectID, + this.doctorID, + this.clinicID, + this.isActive, + this.clinicName}); ListDoctorsClinic.fromJson(Map json) { setupID = json['SetupID']; @@ -99,15 +107,16 @@ class MemberInformation { String preferredLanguage; List roles; - MemberInformation({this.clinics, - this.doctorId, - this.email, - this.employeeId, - this.memberId, - this.memberName, - this.memberNameArabic, - this.preferredLanguage, - this.roles}); + MemberInformation( + {this.clinics, + this.doctorId, + this.email, + this.employeeId, + this.memberId, + this.memberName, + this.memberNameArabic, + this.preferredLanguage, + this.roles}); MemberInformation.fromJson(Map json) { if (json['clinics'] != null) { diff --git a/lib/core/model/auth/check_activation_code_request_model.dart b/lib/core/model/auth/check_activation_code_request_model.dart index 9bb3d4f6..c247a4fc 100644 --- a/lib/core/model/auth/check_activation_code_request_model.dart +++ b/lib/core/model/auth/check_activation_code_request_model.dart @@ -2,6 +2,9 @@ class CheckActivationCodeRequestModel { String mobileNumber; String zipCode; int doctorID; + int memberID; + String password; + String facilityId; String iPAdress; int channel; int languageID; @@ -12,6 +15,8 @@ class CheckActivationCodeRequestModel { String activationCode; String vidaAuthTokenID; String vidaRefreshTokenID; + String iMEI; + bool isForSilentLogin; int oTPSendType; CheckActivationCodeRequestModel( {this.mobileNumber, @@ -27,7 +32,7 @@ class CheckActivationCodeRequestModel { this.activationCode, this.vidaAuthTokenID, this.vidaRefreshTokenID, - this.oTPSendType}); + this.oTPSendType,this.password,this.facilityId,this.memberID,this.isForSilentLogin=false,this.iMEI}); CheckActivationCodeRequestModel.fromJson(Map json) { mobileNumber = json['MobileNumber']; @@ -62,6 +67,11 @@ class CheckActivationCodeRequestModel { data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; data['OTP_SendType'] = this.oTPSendType; + data['facilityId'] = this.facilityId; + data['MemberID'] = this.memberID; + data['Password'] = this.password; + data['IMEI'] = this.iMEI; + data['IsForSilentLogin'] = this.isForSilentLogin; return data; } } diff --git a/lib/core/service/AnalyticsService.dart b/lib/core/service/AnalyticsService.dart index 660267d5..0ad669ab 100644 --- a/lib/core/service/AnalyticsService.dart +++ b/lib/core/service/AnalyticsService.dart @@ -1,22 +1,16 @@ import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_analytics/observer.dart'; +import 'package:flutter/cupertino.dart'; class AnalyticsService { final FirebaseAnalytics _analytics = FirebaseAnalytics(); - FirebaseAnalyticsObserver getAnalyticsObserver() => - FirebaseAnalyticsObserver(analytics: _analytics); + FirebaseAnalyticsObserver getAnalyticsObserver() => FirebaseAnalyticsObserver(analytics: _analytics); - Future logEvent( - {String eventCategory, - String eventLabel, - String eventAction, - String eventValue}) async { + Future logEvent({@required String eventCategory, @required String eventAction}) async { await _analytics.logEvent(name: 'event', parameters: { "eventCategory": eventCategory, - "eventLabel": eventLabel, "eventAction": eventAction, - "eventValue": eventValue }); } } diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 5ef5bf70..56bf519e 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -70,35 +70,25 @@ class AuthenticationViewModel extends BaseViewModel { bool isLogin = false; bool unverified = false; bool isFromLogin = false; - APP_STATUS app_status = APP_STATUS.LOADING; - + APP_STATUS appStatus = APP_STATUS.LOADING; + String localToken =""; AuthenticationViewModel({bool checkDeviceInfo = false}) { getDeviceInfoFromFirebase(); getDoctorProfile(); } - /// select Device IMEI - Future selectDeviceImei(imei) async { - setState(ViewState.Busy); - await _authService.selectDeviceImei(imei); - if (_authService.hasError) { - error = _authService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); - } /// Insert Device IMEI - Future insertDeviceImei() async { + Future insertDeviceImei(token) async { var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); - var user = await sharedPref.getObj(LAST_LOGIN_USER); - if (user != null) { - user = GetIMEIDetailsModel.fromJson(user); + var data = await sharedPref.getObj(LAST_LOGIN_USER); + if (data != null) { + user = GetIMEIDetailsModel.fromJson(data); } var profileInfo = await sharedPref.getObj(DOCTOR_PROFILE); - profileInfo['IMEI'] = DEVICE_TOKEN; + profileInfo['IMEI'] = token; profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); profileInfo['BioMetricEnabled'] = true; profileInfo['MobileNo'] = @@ -115,9 +105,8 @@ class AuthenticationViewModel extends BaseViewModel { : user.doctorID; insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); - insertIMEIDetailsModel.vidaRefreshTokenID = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); - insertIMEIDetailsModel.password = await sharedPref.getString(PASSWORD); + insertIMEIDetailsModel.vidaRefreshTokenID =await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + insertIMEIDetailsModel.password = userInfo.password; await _authService.insertDeviceImei(insertIMEIDetailsModel); if (_authService.hasError) { @@ -174,21 +163,22 @@ class AuthenticationViewModel extends BaseViewModel { ActivationCodeModel activationCodeModel = ActivationCodeModel( facilityId: projectID, memberID: loggedUser.listMemberInformation[0].memberID, - zipCode: loggedUser.zipCode, - mobileNumber: loggedUser.mobileNumber, otpSendType: authMethodType.getTypeIdService().toString(), - password: password); + ); await _authService.sendActivationCodeForDoctorApp(activationCodeModel); if (_authService.hasError) { error = _authService.error; setState(ViewState.ErrorLocal); - } else + } else { + await sharedPref.setString(LOGIN_TOKEN_ID, + _authService.activationCodeForDoctorAppRes.logInTokenID); setState(ViewState.Idle); + } } /// check activation code for sms and whats app - Future checkActivationCodeForDoctorApp({String activationCode}) async { + Future checkActivationCodeForDoctorApp({String activationCode,bool isSilentLogin = false}) async { setState(ViewState.BusyLocal); CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( @@ -201,13 +191,19 @@ class AuthenticationViewModel extends BaseViewModel { : user.projectID, logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), activationCode: activationCode ?? '0000', + memberID:userInfo.userID!=null? int.parse(userInfo.userID):user.doctorID , + password: userInfo.password, + facilityId:userInfo.projectID!=null? userInfo.projectID.toString():user.projectID.toString(), oTPSendType: await sharedPref.getInt(OTP_TYPE), + iMEI: localToken, + isForSilentLogin:isSilentLogin, generalid: "Cs2020@2016\$2958"); await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); if (_authService.hasError) { error = _authService.error; setState(ViewState.ErrorLocal); } else { + await setDataAfterSendActivationSuccess(checkActivationCodeForDoctorAppRes); setState(ViewState.Idle); } } @@ -253,15 +249,14 @@ class AuthenticationViewModel extends BaseViewModel { } /// add  token to shared preferences in case of send activation code is success - setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) { - print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); - // DrAppToastMsg.showSuccesToast("mosa_VerificationCode_ : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); - sharedPref.setString(VIDA_AUTH_TOKEN_ID, + setDataAfterSendActivationSuccess(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel)async { + // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); + await sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); - sharedPref.setString(VIDA_REFRESH_TOKEN_ID, + await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID); - sharedPref.setString(LOGIN_TOKEN_ID, - sendActivationCodeForDoctorAppResponseModel.logInTokenID); + await sharedPref.setString(LOGIN_TOKEN_ID, + sendActivationCodeForDoctorAppResponseModel.authenticationTokenID); } saveObjToString(String key, value) async { @@ -312,7 +307,7 @@ class AuthenticationViewModel extends BaseViewModel { } /// add some logic in case of check activation code is success - onCheckActivationCodeSuccess() async { + onCheckActivationCodeSuccess({bool isSilentLogin = false}) async { sharedPref.setString( TOKEN, checkActivationCodeForDoctorAppRes.authenticationTokenID); @@ -359,17 +354,12 @@ class AuthenticationViewModel extends BaseViewModel { if (Platform.isIOS) { _firebaseMessaging.requestNotificationPermissions(); } - - try { setState(ViewState.Busy); - } catch (e) { - Helpers.showErrorToast("fdfdfdfdf"+e.toString()); - } var token = await _firebaseMessaging.getToken(); - if (DEVICE_TOKEN == "") { - DEVICE_TOKEN = token; + if (localToken == "") { + localToken = token; - await _authService.selectDeviceImei(DEVICE_TOKEN); + await _authService.selectDeviceImei(localToken); if (_authService.hasError) { error = _authService.error; setState(ViewState.ErrorLocal); @@ -378,6 +368,10 @@ class AuthenticationViewModel extends BaseViewModel { user =_authService.dashboardItemsList[0]; sharedPref.setObj( LAST_LOGIN_USER, _authService.dashboardItemsList[0]); + await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, + user.vidaRefreshTokenID); + await sharedPref.setString(VIDA_AUTH_TOKEN_ID, + user.vidaAuthTokenID); this.unverified = true; } setState(ViewState.Idle); @@ -390,22 +384,22 @@ class AuthenticationViewModel extends BaseViewModel { /// determine the status of the app APP_STATUS get status { if (state == ViewState.Busy) { - app_status = APP_STATUS.LOADING; + appStatus = APP_STATUS.LOADING; } else { if(this.doctorProfile !=null) - app_status = APP_STATUS.AUTHENTICATED; + appStatus = APP_STATUS.AUTHENTICATED; else if (this.unverified) { - app_status = APP_STATUS.UNVERIFIED; + appStatus = APP_STATUS.UNVERIFIED; } else if (this.isLogin) { - app_status = APP_STATUS.AUTHENTICATED; + appStatus = APP_STATUS.AUTHENTICATED; } else { - app_status = APP_STATUS.UNAUTHENTICATED; + appStatus = APP_STATUS.UNAUTHENTICATED; } } - return app_status; + return appStatus; } setAppStatus(APP_STATUS status){ - this.app_status = status; + this.appStatus = status; notifyListeners(); } @@ -419,7 +413,7 @@ class AuthenticationViewModel extends BaseViewModel { logout({bool isFromLogin = false}) async { - DEVICE_TOKEN = ""; + localToken = ""; String lang = await sharedPref.getString(APP_Language); await Helpers.clearSharedPref(); doctorProfile = null; @@ -427,7 +421,7 @@ class AuthenticationViewModel extends BaseViewModel { deleteUser(); await getDeviceInfoFromFirebase(); this.isFromLogin = isFromLogin; - app_status = APP_STATUS.UNAUTHENTICATED; + appStatus = APP_STATUS.UNAUTHENTICATED; setState(ViewState.Idle); } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index f35a4a2a..7df01bf9 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -44,8 +44,8 @@ class DashboardViewModel extends BaseViewModel { _firebaseMessaging.getToken().then((String token) async { if (token != '') { - DEVICE_TOKEN = token; - authProvider.insertDeviceImei(); + // DEVICE_TOKEN = token; + authProvider.insertDeviceImei(token); } }); } diff --git a/lib/main.dart b/lib/main.dart index bf319a84..6bfd624a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,8 +35,7 @@ class MyApp extends StatelessWidget { SizeConfig().init(constraints, orientation); return MultiProvider( providers: [ - ChangeNotifierProvider( - create: (context) => AuthenticationViewModel()), + ChangeNotifierProvider(create: (context) => AuthenticationViewModel()), ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), @@ -71,7 +70,7 @@ class MyApp extends StatelessWidget { backgroundColor: Color.fromRGBO(255, 255, 255, 1), ), navigatorKey: locator().navigatorKey, - navigatorObservers:[ + navigatorObservers: [ locator().getAnalyticsObserver(), ], initialRoute: INIT_ROUTE, 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 c4587014..a765ee70 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -432,8 +432,7 @@ class _VerificationMethodsScreenState extends State { Helpers.showErrorToast(authenticationViewModel.error); GifLoaderDialogUtils.hideDialog(context); } else { - authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeForDoctorAppRes); - sharedPref.setString(PASSWORD, authenticationViewModel.userInfo.password); + GifLoaderDialogUtils.hideDialog(context); this.startSMSService(authMethodType); } @@ -454,13 +453,14 @@ class _VerificationMethodsScreenState extends State { GifLoaderDialogUtils.hideDialog(context); Helpers.showErrorToast(authenticationViewModel.error); } else { - authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeVerificationScreenRes); + await sharedPref.setString(LOGIN_TOKEN_ID, + authenticationViewModel.activationCodeVerificationScreenRes.logInTokenID); if (authMethodType == AuthMethodTypes.SMS || authMethodType == AuthMethodTypes.WhatsApp) { GifLoaderDialogUtils.hideDialog(context); this.startSMSService(authMethodType); } else { - checkActivationCode(); + checkActivationCode(isSilentLogin: true); } } } @@ -541,8 +541,8 @@ class _VerificationMethodsScreenState extends State { } } - checkActivationCode({String value}) async { - await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value); + checkActivationCode({String value,bool isSilentLogin = false}) async { + await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value,isSilentLogin: isSilentLogin); if (authenticationViewModel.state == ViewState.ErrorLocal) { Navigator.pop(context); Helpers.showErrorToast(authenticationViewModel.error); 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 c48fb789..81d3fc89 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -406,7 +406,8 @@ class _HomeScreenState extends State { from: date, to: date, doctorID: - authenticationViewModel.doctorProfile.doctorID)), + authenticationViewModel.doctorProfile.doctorID),), + settings: RouteSettings(name: 'OutPatientsScreen'), )); }, )); @@ -423,6 +424,7 @@ class _HomeScreenState extends State { context, MaterialPageRoute( builder: (context) => PatientReferralScreen(), + settings: RouteSettings(name: 'PatientReferralScreen'), ), ); }, @@ -440,6 +442,7 @@ class _HomeScreenState extends State { context, MaterialPageRoute( builder: (context) => PatientSearchScreen(), + settings: RouteSettings(name: 'PatientSearchScreen'), )); }, )); @@ -456,6 +459,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/medical-file/health_summary_page.dart b/lib/screens/medical-file/health_summary_page.dart index 6b4b066c..b1ee901b 100644 --- a/lib/screens/medical-file/health_summary_page.dart +++ b/lib/screens/medical-file/health_summary_page.dart @@ -1,4 +1,6 @@ +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/medical_file_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart'; @@ -27,9 +29,7 @@ class _HealthSummaryPageState extends State { bool isInpatient = routeArgs['isInpatient']; return BaseView( onModelReady: (model) => model.getMedicalFile(mrn: patient.patientId), - builder: - (BuildContext context, MedicalFileViewModel model, Widget child) => - AppScaffold( + builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold( appBar: PatientProfileAppBar( patient, isInpatient: isInpatient, @@ -43,8 +43,7 @@ class _HealthSummaryPageState extends State { child: Column( children: [ Padding( - padding: - EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), child: Container( child: Padding( padding: const EdgeInsets.all(8.0), @@ -74,112 +73,68 @@ class _HealthSummaryPageState extends State { ), ), ), - (model.medicalFileList != null && - model.medicalFileList.length != 0) + (model.medicalFileList != null && model.medicalFileList.length != 0) ? ListView.builder( //physics: , physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model.medicalFileList[0].entityList[0] - .timelines.length, + itemCount: model.medicalFileList[0].entityList[0].timelines.length, itemBuilder: (BuildContext ctxt, int index) { return InkWell( - onTap: () { - if (model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .length != + onTap: () async { + if (model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0] + .consulations.length != 0) - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MedicalFileDetails( - age: patient.age is String - ? patient.age ?? "" - : "${patient.age}", - firstName: patient.firstName, - lastName: patient.lastName, - gender: patient.genderDescription, - encounterNumber: index, - pp: patient.patientId, - patient: patient, - doctorName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorName - : "", - clinicName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .clinicName - : "", - doctorImage: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorImage - : "", - 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())), + await locator().logEvent( + eventCategory: "Health Summary Page", + eventAction: "Health Summary Details", ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicalFileDetails( + age: patient.age is String ? patient.age ?? "" : "${patient.age}", + firstName: patient.firstName, + lastName: patient.lastName, + gender: patient.genderDescription, + encounterNumber: index, + pp: patient.patientId, + patient: patient, + doctorName: model.medicalFileList[0].entityList[0].timelines[index] + .timeLineEvents[0].consulations.isNotEmpty + ? model.medicalFileList[0].entityList[0].timelines[index].doctorName + : "", + clinicName: model.medicalFileList[0].entityList[0].timelines[index] + .timeLineEvents[0].consulations.isNotEmpty + ? model.medicalFileList[0].entityList[0].timelines[index].clinicName + : "", + doctorImage: model.medicalFileList[0].entityList[0].timelines[index] + .timeLineEvents[0].consulations.isNotEmpty + ? model.medicalFileList[0].entityList[0].timelines[index].doctorImage + : "", + 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()), + settings: RouteSettings(name: 'MedicalFileDetails'), + ), + ); }, child: DoctorCard( - doctorName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorName, - clinic: model.medicalFileList[0].entityList[0] - .timelines[index].clinicName, - branch: model.medicalFileList[0].entityList[0] - .timelines[index].projectName, - profileUrl: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorImage, - appointmentDate: - AppDateUtils.getDateTimeFromServerFormat( - model.medicalFileList[0].entityList[0] - .timelines[index].date, + doctorName: model.medicalFileList[0].entityList[0].timelines[index].doctorName, + clinic: model.medicalFileList[0].entityList[0].timelines[index].clinicName, + branch: model.medicalFileList[0].entityList[0].timelines[index].projectName, + profileUrl: model.medicalFileList[0].entityList[0].timelines[index].doctorImage, + appointmentDate: AppDateUtils.getDateTimeFromServerFormat( + model.medicalFileList[0].entityList[0].timelines[index].date, ), isPrescriptions: true, - isShowEye: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .length != + isShowEye: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0] + .consulations.length != 0 ? true : false), @@ -195,8 +150,7 @@ class _HealthSummaryPageState extends State { Image.asset('assets/images/no-data.png'), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context) - .noMedicalFileFound), + child: AppText(TranslationBase.of(context).noMedicalFileFound), ) ], ), 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..2c89425e 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/InsuranceViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -92,11 +94,13 @@ class _InsuranceApprovalScreenNewState extends State Navigator.push( context, MaterialPageRoute( - builder: (context) => InsuranceApprovalsDetails( - patient: patient, - indexInsurance: index, - patientType: patientType, - )), + builder: (context) => InsuranceApprovalsDetails( + patient: patient, + indexInsurance: index, + patientType: patientType, + ), + settings: RouteSettings(name: 'InsuranceApprovalsDetails'), + ), ); }, child: DoctorCardInsurance( @@ -175,15 +179,21 @@ class _InsuranceApprovalScreenNewState extends State model.insuranceApproval.length, (index) => Container( child: InkWell( - onTap: () { + onTap: () async { + await locator().logEvent( + eventCategory: "Insurance Approval Screen New", + eventAction: "Insurance Approval Details", + ); Navigator.push( context, MaterialPageRoute( - builder: (context) => InsuranceApprovalsDetails( - patient: patient, - indexInsurance: index, - patientType: patientType, - )), + builder: (context) => InsuranceApprovalsDetails( + 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/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart index f0ccaece..9fa78cef 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -23,12 +25,10 @@ import '../../../../routes.dart'; class AdmissionRequestFirstScreen extends StatefulWidget { @override - _AdmissionRequestThirdScreenState createState() => - _AdmissionRequestThirdScreenState(); + _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState(); } -class _AdmissionRequestThirdScreenState - extends State { +class _AdmissionRequestThirdScreenState extends State { final _dietTypeRemarksController = TextEditingController(); final _sickLeaveCommentsController = TextEditingController(); final _postMedicalHistoryController = TextEditingController(); @@ -61,8 +61,7 @@ class _AdmissionRequestThirdScreenState builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), + appBar: PatientProfileAppBar(patient), appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -100,14 +99,12 @@ class _AdmissionRequestThirdScreenState ), ), Container( - margin: - EdgeInsets.symmetric(vertical: 0, horizontal: 16), + margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .specialityAndDoctorDetail, + TranslationBase.of(context).specialityAndDoctorDetail, color: Color(0xFF2E303A), fontSize: SizeConfig.textMultiplier * 1.8, fontWeight: FontWeight.w700, @@ -121,14 +118,15 @@ class _AdmissionRequestThirdScreenState isTextFieldHasSuffix: true, validationError: clinicError, dropDownText: _selectedClinic != null - ? projectViewModel.isArabic? _selectedClinic['clinicNameArabic'] : _selectedClinic['clinicNameEnglish'] + ? projectViewModel.isArabic + ? _selectedClinic['clinicNameArabic'] + : _selectedClinic['clinicNameEnglish'] : null, enabled: false, - onClick: model.clinicList != null && - model.clinicList.length > 0 + onClick: model.clinicList != null && model.clinicList.length > 0 ? () { openListDialogField( - projectViewModel.isArabic? 'clinicNameArabic' : 'clinicNameEnglish', + projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish', 'clinicID', model.clinicList, (selectedValue) { setState(() { @@ -137,28 +135,21 @@ class _AdmissionRequestThirdScreenState }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getClinics().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.clinicList.length > 0) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getClinics().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.clinicList.length > 0) { openListDialogField( - projectViewModel.isArabic? 'clinicNameArabic' : 'clinicNameEnglish', + projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish', 'clinicID', model.clinicList, (selectedValue) { setState(() { _selectedClinic = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -169,17 +160,13 @@ class _AdmissionRequestThirdScreenState height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, isTextFieldHasSuffix: true, - dropDownText: _selectedDoctor != null - ? _selectedDoctor['DoctorName'] - : null, + dropDownText: _selectedDoctor != null ? _selectedDoctor['DoctorName'] : null, enabled: false, validationError: doctorError, onClick: _selectedClinic != null - ? model.doctorsList != null && - model.doctorsList.length > 0 + ? model.doctorsList != null && model.doctorsList.length > 0 ? () { - openListDialogField('DoctorName', - 'DoctorID', model.doctorsList, + openListDialogField('DoctorName', 'DoctorID', model.doctorsList, (selectedValue) { setState(() { _selectedDoctor = selectedValue; @@ -187,29 +174,21 @@ class _AdmissionRequestThirdScreenState }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model - .getClinicDoctors( - _selectedClinic['clinicID']) - .then((_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.doctorsList.length > 0) { - openListDialogField('DoctorName', - 'DoctorID', model.doctorsList, + .getClinicDoctors(_selectedClinic['clinicID']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.doctorsList.length > 0) { + openListDialogField('DoctorName', 'DoctorID', model.doctorsList, (selectedValue) { setState(() { _selectedDoctor = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } } : null, @@ -226,7 +205,7 @@ class _AdmissionRequestThirdScreenState SizedBox( height: 10, ), - if(patient.gender != 1) + if (patient.gender != 1) CheckboxListTile( title: AppText( TranslationBase.of(context).patientPregnant, @@ -262,8 +241,7 @@ class _AdmissionRequestThirdScreenState contentPadding: EdgeInsets.all(0), ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).sickLeaveComments, + hintText: TranslationBase.of(context).sickLeaveComments, controller: _sickLeaveCommentsController, minLines: 2, maxLines: 4, @@ -278,43 +256,31 @@ class _AdmissionRequestThirdScreenState hintText: TranslationBase.of(context).dietType, isTextFieldHasSuffix: true, validationError: dietTypeError, - dropDownText: _selectedDietType != null - ? _selectedDietType['nameEn'] - : null, + dropDownText: _selectedDietType != null ? _selectedDietType['nameEn'] : null, enabled: false, - onClick: model.dietTypesList != null && - model.dietTypesList.length > 0 + onClick: model.dietTypesList != null && model.dietTypesList.length > 0 ? () { - openListDialogField( - 'nameEn', 'id', model.dietTypesList, - (selectedValue) { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { setState(() { _selectedDietType = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getDietTypes(patient.patientId).then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.dietTypesList.length > 0) { - openListDialogField( - 'nameEn', 'id', model.dietTypesList, - (selectedValue) { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getDietTypes(patient.patientId) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.dietTypesList.length > 0) { + openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) { setState(() { _selectedDietType = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -322,8 +288,7 @@ class _AdmissionRequestThirdScreenState height: 10, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).dietTypeRemarks, + hintText: TranslationBase.of(context).dietTypeRemarks, controller: _dietTypeRemarksController, minLines: 4, maxLines: 6, @@ -363,82 +328,71 @@ class _AdmissionRequestThirdScreenState child: AppButton( title: TranslationBase.of(context).next, color: HexColor("#D02127"), - onPressed: () { + onPressed: () async { + await locator().logEvent( + eventCategory: "Admission Request First Screen", + eventAction: "Go To Admission Request Two", + ); model.admissionRequestData = AdmissionRequest(); if (_selectedClinic != null && _selectedDoctor != null && _sickLeaveCommentsController.text != "" && _postMedicalHistoryController.text != "" && _postSurgicalHistoryController.text != "") { - model.admissionRequestData.patientMRN = - patient.patientMRN; - model.admissionRequestData.appointmentNo = - patient.appointmentNo; + model.admissionRequestData.patientMRN = patient.patientMRN; + model.admissionRequestData.appointmentNo = patient.appointmentNo; model.admissionRequestData.episodeID = patient.episodeNo; model.admissionRequestData.admissionRequestNo = 0; - model.admissionRequestData.admitToClinic = - _selectedClinic['clinicID']; - model.admissionRequestData.mrpDoctorID = - _selectedDoctor['DoctorID']; + model.admissionRequestData.admitToClinic = _selectedClinic['clinicID']; + model.admissionRequestData.mrpDoctorID = _selectedDoctor['DoctorID']; model.admissionRequestData.isPregnant = _patientPregnant; - model.admissionRequestData.isSickLeaveRequired = - _isSickLeaveRequired; - model.admissionRequestData.sickLeaveComments = - _sickLeaveCommentsController.text; - model.admissionRequestData.isDietType = - _selectedDietType != null ? true : false; - model.admissionRequestData.dietType = - _selectedDietType != null - ? _selectedDietType['id'] - : 0; - model.admissionRequestData.dietRemarks = - _dietTypeRemarksController.text; - model.admissionRequestData.pastMedicalHistory = - _postMedicalHistoryController.text; - model.admissionRequestData.pastSurgicalHistory = - _postSurgicalHistoryController.text; - Navigator.of(context) - .pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: { + model.admissionRequestData.isSickLeaveRequired = _isSickLeaveRequired; + model.admissionRequestData.sickLeaveComments = _sickLeaveCommentsController.text; + model.admissionRequestData.isDietType = _selectedDietType != null ? true : false; + model.admissionRequestData.dietType = _selectedDietType != null ? _selectedDietType['id'] : 0; + model.admissionRequestData.dietRemarks = _dietTypeRemarksController.text; + model.admissionRequestData.pastMedicalHistory = _postMedicalHistoryController.text; + model.admissionRequestData.pastSurgicalHistory = _postSurgicalHistoryController.text; + Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: { 'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType, 'admission-data': model.admissionRequestData }); } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill); setState(() { - if(_selectedClinic == null){ + if (_selectedClinic == null) { clinicError = TranslationBase.of(context).fieldRequired; - }else { + } else { clinicError = null; } - if(_selectedDoctor == null){ + if (_selectedDoctor == null) { doctorError = TranslationBase.of(context).fieldRequired; - }else { + } else { doctorError = null; } - if(_sickLeaveCommentsController.text == ""){ + if (_sickLeaveCommentsController.text == "") { sickLeaveCommentError = TranslationBase.of(context).fieldRequired; - }else { + } else { sickLeaveCommentError = null; } - if(_selectedDietType == null){ + if (_selectedDietType == null) { dietTypeError = TranslationBase.of(context).fieldRequired; - }else { + } else { dietTypeError = null; } - if(_postMedicalHistoryController.text == ""){ + if (_postMedicalHistoryController.text == "") { medicalHistoryError = TranslationBase.of(context).fieldRequired; - }else { + } else { medicalHistoryError = null; } - if(_postSurgicalHistoryController.text == ""){ + if (_postSurgicalHistoryController.text == "") { surgicalHistoryError = TranslationBase.of(context).fieldRequired; - }else { + } else { surgicalHistoryError = null; } }); @@ -453,8 +407,8 @@ class _AdmissionRequestThirdScreenState ); } - void openListDialogField(String attributeName, String attributeValueId, - List list, Function(dynamic selectedValue) okFunction) { + void openListDialogField( + String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( list: list, attributeName: attributeName, diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index 563b4827..99097777 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -2,8 +2,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -23,12 +25,10 @@ import '../../../../routes.dart'; class AdmissionRequestThirdScreen extends StatefulWidget { @override - _AdmissionRequestThirdScreenState createState() => - _AdmissionRequestThirdScreenState(); + _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState(); } -class _AdmissionRequestThirdScreenState - extends State { +class _AdmissionRequestThirdScreenState extends State { dynamic _selectedDiagnosis; dynamic _selectedIcd; dynamic _selectedDiagnosisType; @@ -52,8 +52,7 @@ class _AdmissionRequestThirdScreenState builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), + appBar: PatientProfileAppBar(patient), appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -106,18 +105,13 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).diagnosis, - dropDownText: _selectedDiagnosis != null - ? _selectedDiagnosis['nameEn'] - : null, + dropDownText: _selectedDiagnosis != null ? _selectedDiagnosis['nameEn'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: diagnosisError, - onClick: model.diagnosisTypesList != null && - model.diagnosisTypesList.length > 0 + onClick: model.diagnosisTypesList != null && model.diagnosisTypesList.length > 0 ? () { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, - (selectedValue) { + openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) { setState(() { _selectedDiagnosis = selectedValue; }); @@ -125,24 +119,17 @@ class _AdmissionRequestThirdScreenState } : () async { GifLoaderDialogUtils.showMyDialog(context); - await model.getDiagnosis().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.diagnosisTypesList.length > 0) { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, - (selectedValue) { + await model.getDiagnosis().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.diagnosisTypesList.length > 0) { + openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) { setState(() { _selectedDiagnosis = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { + } else if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -152,18 +139,13 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).icd, - dropDownText: _selectedIcd != null - ? _selectedIcd['description'] - : null, + dropDownText: _selectedIcd != null ? _selectedIcd['description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: icdError, - onClick: model.icdCodes != null && - model.icdCodes.length > 0 + onClick: model.icdCodes != null && model.icdCodes.length > 0 ? () { - openListDialogField( - 'description', 'code', model.icdCodes, - (selectedValue) { + openListDialogField('description', 'code', model.icdCodes, (selectedValue) { setState(() { _selectedIcd = selectedValue; }); @@ -173,24 +155,17 @@ class _AdmissionRequestThirdScreenState GifLoaderDialogUtils.showMyDialog(context); await model .getICDCodes(patient.patientMRN) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.icdCodes.length > 0) { - openListDialogField( - 'description', 'code', model.icdCodes, - (selectedValue) { + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.icdCodes.length > 0) { + openListDialogField('description', 'code', model.icdCodes, (selectedValue) { setState(() { _selectedIcd = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { + } else if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -200,19 +175,14 @@ class _AdmissionRequestThirdScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).diagnoseType, - dropDownText: _selectedDiagnosisType != null - ? _selectedDiagnosisType['description'] - : null, + dropDownText: _selectedDiagnosisType != null ? _selectedDiagnosisType['description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: diagnosisTypeError, - onClick: model.listOfDiagnosisSelectionTypes != - null && - model.listOfDiagnosisSelectionTypes.length > - 0 + onClick: model.listOfDiagnosisSelectionTypes != null && + model.listOfDiagnosisSelectionTypes.length > 0 ? () { - openListDialogField('description', 'code', - model.listOfDiagnosisSelectionTypes, + openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes, (selectedValue) { setState(() { _selectedDiagnosisType = selectedValue; @@ -222,29 +192,20 @@ class _AdmissionRequestThirdScreenState : () async { GifLoaderDialogUtils.showMyDialog(context); await model - .getMasterLookup(MasterKeysService - .DiagnosisSelectionType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); + .getMasterLookup(MasterKeysService.DiagnosisSelectionType) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.Idle && - model.listOfDiagnosisSelectionTypes - .length > - 0) { - openListDialogField('description', 'code', - model.listOfDiagnosisSelectionTypes, + model.listOfDiagnosisSelectionTypes.length > 0) { + openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes, (selectedValue) { setState(() { - _selectedDiagnosisType = - selectedValue; + _selectedDiagnosisType = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { + } else if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -279,58 +240,52 @@ class _AdmissionRequestThirdScreenState title: TranslationBase.of(context).submit, color: HexColor("#359846"), onPressed: () async { - if (_selectedDiagnosis != null && - _selectedIcd != null && - _selectedDiagnosisType != null) { + await locator().logEvent( + eventCategory: "Admission Request Third Screen", + eventAction: "Submit Admission Request", + ); + if (_selectedDiagnosis != null && _selectedIcd != null && _selectedDiagnosisType != null) { model.admissionRequestData = admissionRequest; dynamic admissionRequestDiagnoses = [ { - 'diagnosisDescription': - _selectedDiagnosis['nameEn'], + 'diagnosisDescription': _selectedDiagnosis['nameEn'], 'diagnosisType': _selectedDiagnosis['id'], 'icdCode': _selectedIcd['code'], - 'icdCodeDescription': - _selectedIcd['description'], + 'icdCodeDescription': _selectedIcd['description'], 'type': _selectedDiagnosisType['code'], 'remarks': "", 'isActive': true, } ]; - model.admissionRequestData - .admissionRequestDiagnoses = - admissionRequestDiagnoses; + model.admissionRequestData.admissionRequestDiagnoses = admissionRequestDiagnoses; await model.makeAdmissionRequest(); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .admissionRequestSuccessMsg); - Navigator.popUntil(context, - ModalRoute.withName(PATIENTS_PROFILE)); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).admissionRequestSuccessMsg); + Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); } } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill); setState(() { - if(_selectedDiagnosis == null){ + if (_selectedDiagnosis == null) { diagnosisError = TranslationBase.of(context).fieldRequired; - }else { + } else { diagnosisError = null; } - if(_selectedIcd == null){ + if (_selectedIcd == null) { icdError = TranslationBase.of(context).fieldRequired; - }else { + } else { icdError = null; } - if(_selectedDiagnosisType == null){ + if (_selectedDiagnosisType == null) { diagnosisTypeError = TranslationBase.of(context).fieldRequired; - }else { + } else { diagnosisTypeError = null; } }); @@ -348,8 +303,8 @@ class _AdmissionRequestThirdScreenState ); } - void openListDialogField(String attributeName, String attributeValueId, - List list, Function(dynamic selectedValue) okFunction) { + void openListDialogField( + String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( list: list, attributeName: attributeName, diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index dc79b2be..0258d26f 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -3,8 +3,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -26,12 +28,10 @@ import '../../../../routes.dart'; class AdmissionRequestSecondScreen extends StatefulWidget { @override - _AdmissionRequestSecondScreenState createState() => - _AdmissionRequestSecondScreenState(); + _AdmissionRequestSecondScreenState createState() => _AdmissionRequestSecondScreenState(); } -class _AdmissionRequestSecondScreenState - extends State { +class _AdmissionRequestSecondScreenState extends State { final _postPlansEstimatedCostController = TextEditingController(); final _estimatedCostController = TextEditingController(); final _expectedDaysController = TextEditingController(); @@ -74,8 +74,7 @@ class _AdmissionRequestSecondScreenState builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), + appBar: PatientProfileAppBar(patient), appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -112,14 +111,12 @@ class _AdmissionRequestSecondScreenState ), ), Container( - margin: - EdgeInsets.symmetric(vertical: 0, horizontal: 16), + margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .postPlansEstimatedCost, + TranslationBase.of(context).postPlansEstimatedCost, color: Color(0xFF2E303A), fontSize: SizeConfig.textMultiplier * 1.8, fontWeight: FontWeight.w700, @@ -129,15 +126,11 @@ class _AdmissionRequestSecondScreenState ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).estimatedCost, + hintText: TranslationBase.of(context).estimatedCost, controller: _estimatedCostController, validationError: costError, inputType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], ), SizedBox( height: 10, @@ -154,10 +147,8 @@ class _AdmissionRequestSecondScreenState height: 10, ), AppTextFieldCustom( - hintText: TranslationBase.of(context) - .otherDepartmentsInterventions, - controller: - _otherDepartmentsInterventionsController, + hintText: TranslationBase.of(context).otherDepartmentsInterventions, + controller: _otherDepartmentsInterventionsController, inputType: TextInputType.multiline, validationError: otherInterventionsError, minLines: 2, @@ -177,23 +168,18 @@ class _AdmissionRequestSecondScreenState ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).expectedDays, + hintText: TranslationBase.of(context).expectedDays, controller: _expectedDaysController, validationError: expectedDaysError, inputType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], ), SizedBox( height: 10, ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: TranslationBase.of(context) - .expectedAdmissionDate, + hintText: TranslationBase.of(context).expectedAdmissionDate, dropDownText: _expectedAdmissionDate != null ? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" : null, @@ -209,8 +195,7 @@ class _AdmissionRequestSecondScreenState if (_expectedAdmissionDate == null) { _expectedAdmissionDate = DateTime.now(); } - _selectDate(context, _expectedAdmissionDate, - (picked) { + _selectDate(context, _expectedAdmissionDate, (picked) { setState(() { _expectedAdmissionDate = picked; }); @@ -223,47 +208,32 @@ class _AdmissionRequestSecondScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).floor, - dropDownText: _selectedFloor != null - ? _selectedFloor['description'] - : null, + dropDownText: _selectedFloor != null ? _selectedFloor['description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: floorError, - onClick: model.floorList != null && - model.floorList.length > 0 + onClick: model.floorList != null && model.floorList.length > 0 ? () { - openListDialogField( - 'description', - 'floorID', - model.floorList, (selectedValue) { + openListDialogField('description', 'floorID', model.floorList, (selectedValue) { setState(() { _selectedFloor = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getFloors().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.floorList.length > 0) { - openListDialogField( - 'description', - 'floorID', - model.floorList, (selectedValue) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getFloors().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.floorList.length > 0) { + openListDialogField('description', 'floorID', model.floorList, + (selectedValue) { setState(() { _selectedFloor = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -273,46 +243,32 @@ class _AdmissionRequestSecondScreenState AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).ward, - dropDownText: _selectedWard != null - ? _selectedWard['description'] - : null, + dropDownText: _selectedWard != null ? _selectedWard['description'] : null, enabled: false, isTextFieldHasSuffix: true, - onClick: model.wardList != null && - model.wardList.length > 0 + onClick: model.wardList != null && model.wardList.length > 0 ? () { - openListDialogField( - 'description', - 'nursingStationID', - model.wardList, (selectedValue) { + openListDialogField('description', 'nursingStationID', model.wardList, + (selectedValue) { setState(() { _selectedWard = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getWards().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.wardList.length > 0) { - openListDialogField( - 'description', - 'nursingStationID', - model.wardList, (selectedValue) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getWards().then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.wardList.length > 0) { + openListDialogField('description', 'nursingStationID', model.wardList, + (selectedValue) { setState(() { _selectedWard = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -321,54 +277,37 @@ class _AdmissionRequestSecondScreenState ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).roomCategory, - dropDownText: _selectedRoomCategory != null - ? _selectedRoomCategory['description'] - : null, + hintText: TranslationBase.of(context).roomCategory, + dropDownText: + _selectedRoomCategory != null ? _selectedRoomCategory['description'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: roomError, - onClick: model.roomCategoryList != null && - model.roomCategoryList.length > 0 + onClick: model.roomCategoryList != null && model.roomCategoryList.length > 0 ? () { - openListDialogField( - 'description', - 'categoryID', - model.roomCategoryList, + openListDialogField('description', 'categoryID', model.roomCategoryList, (selectedValue) { setState(() { - _selectedRoomCategory = - selectedValue; + _selectedRoomCategory = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getRoomCategories().then( - (_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.roomCategoryList.length > 0) { - openListDialogField( - 'description', - 'categoryID', - model.roomCategoryList, + GifLoaderDialogUtils.showMyDialog(context); + await model + .getRoomCategories() + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.roomCategoryList.length > 0) { + openListDialogField('description', 'categoryID', model.roomCategoryList, (selectedValue) { setState(() { - _selectedRoomCategory = - selectedValue; + _selectedRoomCategory = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -376,8 +315,7 @@ class _AdmissionRequestSecondScreenState height: 10, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).treatmentLine, + hintText: TranslationBase.of(context).treatmentLine, controller: _treatmentLineController, inputType: TextInputType.multiline, validationError: treatmentsError, @@ -388,8 +326,7 @@ class _AdmissionRequestSecondScreenState height: 10, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).complications, + hintText: TranslationBase.of(context).complications, controller: _complicationsController, inputType: TextInputType.multiline, validationError: complicationsError, @@ -400,8 +337,7 @@ class _AdmissionRequestSecondScreenState height: 10, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).otherProcedure, + hintText: TranslationBase.of(context).otherProcedure, controller: _otherProceduresController, inputType: TextInputType.multiline, validationError: proceduresError, @@ -413,53 +349,34 @@ class _AdmissionRequestSecondScreenState ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: - TranslationBase.of(context).admissionType, - dropDownText: _selectedAdmissionType != null - ? _selectedAdmissionType['nameEn'] - : null, + hintText: TranslationBase.of(context).admissionType, + dropDownText: _selectedAdmissionType != null ? _selectedAdmissionType['nameEn'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: admissionTypeError, - onClick: model.admissionTypeList != null && - model.admissionTypeList.length > 0 + onClick: model.admissionTypeList != null && model.admissionTypeList.length > 0 ? () { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { + openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) { setState(() { - _selectedAdmissionType = - selectedValue; + _selectedAdmissionType = selectedValue; }); }); } : () async { - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); await model - .getMasterLookup(MasterKeysService - .AdmissionRequestType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.admissionTypeList.length > - 0) { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { + .getMasterLookup(MasterKeysService.AdmissionRequestType) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.Idle && model.admissionTypeList.length > 0) { + openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) { setState(() { - _selectedAdmissionType = - selectedValue; + _selectedAdmissionType = selectedValue; }); }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + } else if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showErrorToast( - "Empty List"); + DrAppToastMsg.showErrorToast("Empty List"); } }, ), @@ -492,144 +409,115 @@ class _AdmissionRequestSecondScreenState title: TranslationBase.of(context).next, color: HexColor("#D02127"), onPressed: () async { + await locator().logEvent( + eventCategory: "Admission Request Second Screen", + eventAction: "Go To Admission Request Three", + ); if (_estimatedCostController.text != "" && _postPlansEstimatedCostController.text != "" && _expectedDaysController.text != "" && _expectedAdmissionDate != null && - _otherDepartmentsInterventionsController.text != - "" && + _otherDepartmentsInterventionsController.text != "" && _selectedFloor != null && - _selectedRoomCategory != - null /*_selectedWard is not required*/ && + _selectedRoomCategory != null /*_selectedWard is not required*/ && _treatmentLineController.text != "" && _complicationsController.text != "" && _otherProceduresController.text != "" && _selectedAdmissionType != null) { model.admissionRequestData = admissionRequest; - model.admissionRequestData.estimatedCost = - int.parse(_estimatedCostController.text); - model.admissionRequestData - .elementsForImprovement = + model.admissionRequestData.estimatedCost = int.parse(_estimatedCostController.text); + model.admissionRequestData.elementsForImprovement = _postPlansEstimatedCostController.text; - model.admissionRequestData.expectedDays = - int.parse(_expectedDaysController.text); - model.admissionRequestData.admissionDate = - _expectedAdmissionDate.toIso8601String(); - model.admissionRequestData - .otherDepartmentInterventions = + model.admissionRequestData.expectedDays = int.parse(_expectedDaysController.text); + model.admissionRequestData.admissionDate = _expectedAdmissionDate.toIso8601String(); + model.admissionRequestData.otherDepartmentInterventions = _otherDepartmentsInterventionsController.text; - model.admissionRequestData.admissionLocationID = - _selectedFloor['floorID']; + model.admissionRequestData.admissionLocationID = _selectedFloor['floorID']; model.admissionRequestData.wardID = - _selectedWard != null - ? _selectedWard['nursingStationID'] - : 0; - model.admissionRequestData.roomCategoryID = - _selectedRoomCategory['categoryID']; + _selectedWard != null ? _selectedWard['nursingStationID'] : 0; + model.admissionRequestData.roomCategoryID = _selectedRoomCategory['categoryID']; - model.admissionRequestData - .admissionRequestProcedures = []; + model.admissionRequestData.admissionRequestProcedures = []; - model.admissionRequestData.mainLineOfTreatment = - _treatmentLineController.text; - model.admissionRequestData.complications = - _complicationsController.text; - model.admissionRequestData.otherProcedures = - _otherProceduresController.text; - model.admissionRequestData.admissionType = - _selectedAdmissionType['id']; + model.admissionRequestData.mainLineOfTreatment = _treatmentLineController.text; + model.admissionRequestData.complications = _complicationsController.text; + model.admissionRequestData.otherProcedures = _otherProceduresController.text; + model.admissionRequestData.admissionType = _selectedAdmissionType['id']; - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_3, - arguments: { - 'patient': patient, - 'patientType': patientType, - 'arrivalType': arrivalType, - 'admission-data': model.admissionRequestData - }); + Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'admission-data': model.admissionRequestData + }); } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill); setState(() { if (_estimatedCostController.text == "") { - costError = - TranslationBase.of(context).fieldRequired; + costError = TranslationBase.of(context).fieldRequired; } else { costError = null; } - if (_postPlansEstimatedCostController.text == - "") { - plansError = - TranslationBase.of(context).fieldRequired; + if (_postPlansEstimatedCostController.text == "") { + plansError = TranslationBase.of(context).fieldRequired; } else { plansError = null; } if (_expectedDaysController.text == "") { - expectedDaysError = - TranslationBase.of(context).fieldRequired; + expectedDaysError = TranslationBase.of(context).fieldRequired; } else { expectedDaysError = null; } if (_expectedAdmissionDate == null) { - expectedDatesError = - TranslationBase.of(context).fieldRequired; + expectedDatesError = TranslationBase.of(context).fieldRequired; } else { expectedDatesError = null; } - if (_otherDepartmentsInterventionsController - .text == - "") { - otherInterventionsError = - TranslationBase.of(context).fieldRequired; + if (_otherDepartmentsInterventionsController.text == "") { + otherInterventionsError = TranslationBase.of(context).fieldRequired; } else { otherInterventionsError = null; } if (_selectedFloor == null) { - floorError = - TranslationBase.of(context).fieldRequired; + floorError = TranslationBase.of(context).fieldRequired; } else { floorError = null; } if (_selectedRoomCategory == null) { - roomError = - TranslationBase.of(context).fieldRequired; + roomError = TranslationBase.of(context).fieldRequired; } else { roomError = null; } if (_treatmentLineController.text == "") { - treatmentsError = - TranslationBase.of(context).fieldRequired; + treatmentsError = TranslationBase.of(context).fieldRequired; } else { treatmentsError = null; } if (_complicationsController.text == "") { - complicationsError = - TranslationBase.of(context).fieldRequired; + complicationsError = TranslationBase.of(context).fieldRequired; } else { complicationsError = null; } if (_otherProceduresController.text == "") { - proceduresError = - TranslationBase.of(context).fieldRequired; + proceduresError = TranslationBase.of(context).fieldRequired; } else { proceduresError = null; } if (_selectedAdmissionType == null) { - admissionTypeError = - TranslationBase.of(context).fieldRequired; + admissionTypeError = TranslationBase.of(context).fieldRequired; } else { admissionTypeError = null; } @@ -647,8 +535,7 @@ class _AdmissionRequestSecondScreenState ); } - Future _selectDate(BuildContext context, DateTime dateTime, - Function(DateTime picked) updateDate) async { + Future _selectDate(BuildContext context, DateTime dateTime, Function(DateTime picked) updateDate) async { final DateTime picked = await showDatePicker( context: context, initialDate: dateTime, @@ -661,8 +548,8 @@ class _AdmissionRequestSecondScreenState } } - void openListDialogField(String attributeName, String attributeValueId, - List list, Function(dynamic selectedValue) okFunction) { + void openListDialogField( + String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( list: list, attributeName: attributeName, 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/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index a5c367de..a25d03b4 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -75,163 +77,168 @@ class _MedicalReportPageState extends State { ), ), AddNewOrder( - onTap: () { + onTap: () async { // if (model.hasOnHold()) { // Helpers.showErrorToast("Please Verified the on hold report to be able to add new one"); // } else - + await locator().logEvent( + eventCategory: "Medical Report Page", + eventAction: "Add New Medical Report", + ); Navigator.push( context, MaterialPageRoute( - builder: (context) => AddVerifyMedicalReport( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - model: model, - status: MedicalReportStatus.ADD, - )), + builder: (context) => AddVerifyMedicalReport( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + model: model, + status: MedicalReportStatus.ADD, + ), + settings: RouteSettings(name: 'AddVerifyMedicalReport'), + ), ); - }, label: TranslationBase.of(context).createNewMedicalReport, ), - // if (model.state != ViewState.ErrorLocal)ß - ...List.generate( - model.medicalReportList.length, - (index) => InkWell( - onTap: () { - if (model.medicalReportList[index].status == 1) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddVerifyMedicalReport( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - medicalReport: model.medicalReportList[index], - model: model, - medicalNote: model.medicalReportList[index].reportDataHtml, - )), - ); - } else { - Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { - 'patient': patient, - 'patientType': patientType, - 'arrivalType': arrivalType, - 'type': MedicalReportStatus.ADD, - 'medicalReport': model.medicalReportList[index], - 'model': model, - }); - } - }, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 8), - child: CardWithBgWidget( - hasBorder: false, - bgColor: model.medicalReportList[index].status == 1 ? Color(0xFFCC9B14) : Colors.green[700], - widget: Column( - children: [ - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - model.medicalReportList[index].status == 1 - ? TranslationBase.of(context).onHold - : TranslationBase.of(context).verified, - color: model.medicalReportList[index].status == 1 - ? Color(0xFFCC9B14) - : Colors.green[700], - fontSize: 1.4 * SizeConfig.textMultiplier, - bold: true, - ), - AppText( - projectViewModel.isArabic - ? model.medicalReportList[index].doctorNameN ?? "" - : model.medicalReportList[index].doctorName ?? "", - fontSize: 1.9 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w700, - color: Color(0xFF2E303A), - ), - ], - )), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - AppText( - '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "dd MMM yyyy")}', - color: Color(0xFF2E303A), - fontWeight: FontWeight.w600, - fontSize: 1.6 * SizeConfig.textMultiplier, - ), - AppText( - '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "hh:mm a")}', - color: Color(0xFF2E303A), - fontWeight: FontWeight.w600, - fontSize: 1.5 * SizeConfig.textMultiplier, - ), - ], + // if (model.state != ViewState.ErrorLocal)ß + ...List.generate( + model.medicalReportList.length, + (index) => InkWell( + onTap: () { + if (model.medicalReportList[index].status == 1) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddVerifyMedicalReport( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + medicalReport: model.medicalReportList[index], + model: model, + medicalNote: model.medicalReportList[index].reportDataHtml, ), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(left: 0, top: 4, right: 8, bottom: 0), - child: LargeAvatar( - name: projectViewModel.isArabic - ? model.medicalReportList[index].doctorNameN - : model.medicalReportList[index].doctorName, - url: model.medicalReportList[index].doctorImageURL, + settings: RouteSettings(name: 'AddVerifyMedicalReport')), + ); + } else { + Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'type': MedicalReportStatus.ADD, + 'medicalReport': model.medicalReportList[index], + 'model': model, + }); + } + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: CardWithBgWidget( + hasBorder: false, + bgColor: model.medicalReportList[index].status == 1 ? Color(0xFFCC9B14) : Colors.green[700], + widget: Column( + children: [ + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + model.medicalReportList[index].status == 1 + ? TranslationBase.of(context).onHold + : TranslationBase.of(context).verified, + color: model.medicalReportList[index].status == 1 + ? Color(0xFFCC9B14) + : Colors.green[700], + fontSize: 1.4 * SizeConfig.textMultiplier, + bold: true, ), - width: 50, - height: 50, - ), - Expanded( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - projectViewModel.isArabic - ? model.medicalReportList[index].projectNameN - : model.medicalReportList[index].projectName, - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Color(0xFF2E303A), - ), - AppText( - projectViewModel.isArabic - ? model.medicalReportList[index].clinicNameN - : model.medicalReportList[index].clinicName, - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Color(0xFF2E303A), - ), - ], - ), + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index].doctorNameN ?? "" + : model.medicalReportList[index].doctorName ?? "", + fontSize: 1.9 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w700, + color: Color(0xFF2E303A), ), + ], + )), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + AppText( + '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "dd MMM yyyy")}', + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + fontSize: 1.6 * SizeConfig.textMultiplier, + ), + AppText( + '${AppDateUtils.convertDateFromServerFormat(model.medicalReportList[index].editedOn ?? model.medicalReportList[index].createdOn, "hh:mm a")}', + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + fontSize: 1.5 * SizeConfig.textMultiplier, + ), + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 0, top: 4, right: 8, bottom: 0), + child: LargeAvatar( + name: projectViewModel.isArabic + ? model.medicalReportList[index].doctorNameN + : model.medicalReportList[index].doctorName, + url: model.medicalReportList[index].doctorImageURL, ), - Container( - height: 50, + width: 50, + height: 50, + ), + Expanded( + child: Container( child: Column( - mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - model.medicalReportList[index].status == 1 ? DoctorApp.edit_1 : EvaIcons.eye, + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index].projectNameN + : model.medicalReportList[index].projectName, + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), + ), + AppText( + projectViewModel.isArabic + ? model.medicalReportList[index].clinicNameN + : model.medicalReportList[index].clinicName, + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Color(0xFF2E303A), ), ], ), - ) - ], - ), - ], - ), + ), + ), + Container( + height: 50, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Icon( + model.medicalReportList[index].status == 1 ? DoctorApp.edit_1 : EvaIcons.eye, + ), + ], + ), + ) + ], + ), + ], ), ), ), ), + ), SizedBox( height: 15, ) diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index 723ee75f..d4a6f3b1 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -1,9 +1,11 @@ import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.dart'; @@ -43,8 +45,7 @@ class _ProgressNoteState extends State { AuthenticationViewModel authenticationViewModel; ProjectViewModel projectViewModel; - getProgressNoteList(BuildContext context, PatientViewModel model, - {bool isLocalBusy = false}) async { + getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String token = await sharedPref.getString(TOKEN); @@ -59,10 +60,7 @@ class _ProgressNoteState extends State { tokenID: token, patientTypeID: patient.patientType, languageID: 2); - model - .getPatientProgressNote(progressNoteRequest.toJson(), - isLocalBusy: isLocalBusy) - .then((c) { + model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) { notesList = model.patientProgressNoteList; }); } @@ -71,170 +69,113 @@ class _ProgressNoteState extends State { Widget build(BuildContext context) { authenticationViewModel = Provider.of(context); projectViewModel = Provider.of(context); - final routeArgs = ModalRoute - .of(context) - .settings - .arguments as Map; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; String arrivalType = routeArgs['arrivalType']; - if (routeArgs.containsKey('isDischargedPatient')) - isDischargedPatient = routeArgs['isDischargedPatient']; + if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient']; return BaseView( onModelReady: (model) => getProgressNoteList(context, model), - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - backgroundColor: Theme - .of(context) - .scaffoldBackgroundColor, - // appBarTitle: TranslationBase.of(context).progressNote, - appBar: PatientProfileAppBar( - patient, - isInpatient: true, - ), - body: model.patientProgressNoteList == null || - model.patientProgressNoteList.length == 0 - ? DrAppEmbeddedError( - error: TranslationBase - .of(context) - .errorNoProgressNote) - : Container( - color: Colors.grey[200], - child: Column( - children: [ - if (!isDischargedPatient) - AddNewOrder( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - UpdateNoteOrder( - patientModel: model, - patient: patient, - visitType: widget.visitType, - isUpdate: false, - )), - ); - }, - label: widget.visitType == 3 - ? TranslationBase - .of(context) - .addNewOrderSheet - : TranslationBase - .of(context) - .addProgressNote, - ), - Expanded( - child: Container( - child: ListView.builder( - itemCount: model.patientProgressNoteList.length, - itemBuilder: (BuildContext ctxt, int index) { - return FractionallySizedBox( - widthFactor: 0.95, - child: CardWithBgWidget( - hasBorder: false, - bgColor: model.patientProgressNoteList[index] - .status == - 1 && - authenticationViewModel.doctorProfile.doctorID != - model - .patientProgressNoteList[ - index] - .createdBy - ? Color(0xFFCC9B14) - : model.patientProgressNoteList[index] - .status == - 4 - ? Colors.red.shade700 - : model.patientProgressNoteList[index] - .status == - 2 - ? Colors.green[600] - : Color(0xFFCC9B14), - widget: Column( - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (model - .patientProgressNoteList[ - index] - .status == - 1 && - authenticationViewModel - .doctorProfile.doctorID != - model - .patientProgressNoteList[ - index] - .createdBy) - AppText( - TranslationBase - .of(context) - .notePending, - fontWeight: FontWeight.bold, - color: Color(0xFFCC9B14), - fontSize: 12, - ), - if (model - .patientProgressNoteList[ - index] - .status == - 4) + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + // appBarTitle: TranslationBase.of(context).progressNote, + appBar: PatientProfileAppBar( + patient, + isInpatient: true, + ), + body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0 + ? DrAppEmbeddedError(error: TranslationBase.of(context).errorNoProgressNote) + : Container( + color: Colors.grey[200], + child: Column( + children: [ + if (!isDischargedPatient) + AddNewOrder( + onTap: () async { + await locator().logEvent( + eventCategory: "Progress Note Screen", + eventAction: "Update Progress Note", + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => UpdateNoteOrder( + patientModel: model, + patient: patient, + visitType: widget.visitType, + isUpdate: false, + ), + settings: RouteSettings(name: 'UpdateNoteOrder'), + ), + ); + }, + label: widget.visitType == 3 + ? TranslationBase.of(context).addNewOrderSheet + : TranslationBase.of(context).addProgressNote, + ), + Expanded( + child: Container( + child: ListView.builder( + itemCount: model.patientProgressNoteList.length, + itemBuilder: (BuildContext ctxt, int index) { + return FractionallySizedBox( + widthFactor: 0.95, + child: CardWithBgWidget( + hasBorder: false, + bgColor: model.patientProgressNoteList[index].status == 1 && + authenticationViewModel.doctorProfile.doctorID != + model.patientProgressNoteList[index].createdBy + ? Color(0xFFCC9B14) + : model.patientProgressNoteList[index].status == 4 + ? Colors.red.shade700 + : model.patientProgressNoteList[index].status == 2 + ? Colors.green[600] + : Color(0xFFCC9B14), + widget: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (model.patientProgressNoteList[index].status == 1 && + authenticationViewModel.doctorProfile.doctorID != + model.patientProgressNoteList[index].createdBy) + AppText( + TranslationBase.of(context).notePending, + fontWeight: FontWeight.bold, + color: Color(0xFFCC9B14), + fontSize: 12, + ), + if (model.patientProgressNoteList[index].status == 4) AppText( - TranslationBase - .of(context) - .noteCanceled, + TranslationBase.of(context).noteCanceled, fontWeight: FontWeight.bold, color: Colors.red.shade700, fontSize: 12, ), - if (model - .patientProgressNoteList[ - index] - .status == - 2) + if (model.patientProgressNoteList[index].status == 2) AppText( - TranslationBase - .of(context) - .noteVerified, + TranslationBase.of(context).noteVerified, fontWeight: FontWeight.bold, color: Colors.green[600], fontSize: 12, ), if (model.patientProgressNoteList[index].status != 2 && - model - .patientProgressNoteList[ - index] - .status != - 4 && - authenticationViewModel - .doctorProfile.doctorID == - model - .patientProgressNoteList[ - index] - .createdBy) + model.patientProgressNoteList[index].status != 4 && + authenticationViewModel.doctorProfile.doctorID == + model.patientProgressNoteList[index].createdBy) Row( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => - UpdateNoteOrder( - note: model - .patientProgressNoteList[ - index], - patientModel: - model, - patient: - patient, - visitType: widget - .visitType, + builder: (context) => UpdateNoteOrder( + note: model.patientProgressNoteList[index], + patientModel: model, + patient: patient, + visitType: widget.visitType, isUpdate: true, )), ); @@ -242,9 +183,7 @@ class _ProgressNoteState extends State { child: Container( decoration: BoxDecoration( color: Colors.grey[600], - borderRadius: - BorderRadius.circular( - 10), + borderRadius: BorderRadius.circular(10), ), // color:Colors.red[600], @@ -259,10 +198,7 @@ class _ProgressNoteState extends State { width: 2, ), AppText( - TranslationBase - .of( - context) - .update, + TranslationBase.of(context).update, fontSize: 10, color: Colors.white, ), @@ -280,61 +216,33 @@ class _ProgressNoteState extends State { context: context, actionName: "verify", confirmFun: () async { - GifLoaderDialogUtils - .showMyDialog( - context); - UpdateNoteReqModel - reqModel = - UpdateNoteReqModel( - admissionNo: int - .parse(patient - .admissionNo), - cancelledNote: - false, - lineItemNo: model - .patientProgressNoteList[ - index] - .lineItemNo, - createdBy: model - .patientProgressNoteList[ - index] - .createdBy, - notes: model - .patientProgressNoteList[ - index] - .notes, + GifLoaderDialogUtils.showMyDialog(context); + UpdateNoteReqModel reqModel = UpdateNoteReqModel( + admissionNo: int.parse(patient.admissionNo), + cancelledNote: false, + lineItemNo: model.patientProgressNoteList[index].lineItemNo, + createdBy: model.patientProgressNoteList[index].createdBy, + notes: model.patientProgressNoteList[index].notes, verifiedNote: true, - patientTypeID: - patient - .patientType, + patientTypeID: patient.patientType, patientOutSA: false, ); - await model - .updatePatientProgressNote( - reqModel); - await getProgressNoteList( - context, model, - isLocalBusy: - true); - GifLoaderDialogUtils - .hideDialog( - context); + await model.updatePatientProgressNote(reqModel); + await getProgressNoteList(context, model, isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); }); }, child: Container( decoration: BoxDecoration( color: Colors.green[600], - borderRadius: - BorderRadius.circular( - 10), + borderRadius: BorderRadius.circular(10), ), // color:Colors.red[600], child: Row( children: [ Icon( - FontAwesomeIcons - .check, + FontAwesomeIcons.check, size: 12, color: Colors.white, ), @@ -342,10 +250,7 @@ class _ProgressNoteState extends State { width: 2, ), AppText( - TranslationBase - .of( - context) - .noteVerify, + TranslationBase.of(context).noteVerify, fontSize: 10, color: Colors.white, ), @@ -361,67 +266,37 @@ class _ProgressNoteState extends State { onTap: () async { showMyDialog( context: context, - actionName: - TranslationBase - .of( - context) - .cancel, + actionName: TranslationBase.of(context).cancel, confirmFun: () async { - GifLoaderDialogUtils - .showMyDialog( + GifLoaderDialogUtils.showMyDialog( context, ); - UpdateNoteReqModel - reqModel = - UpdateNoteReqModel( - admissionNo: int - .parse(patient - .admissionNo), + UpdateNoteReqModel reqModel = UpdateNoteReqModel( + admissionNo: int.parse(patient.admissionNo), cancelledNote: true, - lineItemNo: model - .patientProgressNoteList[ - index] - .lineItemNo, - createdBy: model - .patientProgressNoteList[ - index] - .createdBy, - notes: model - .patientProgressNoteList[ - index] - .notes, + lineItemNo: model.patientProgressNoteList[index].lineItemNo, + createdBy: model.patientProgressNoteList[index].createdBy, + notes: model.patientProgressNoteList[index].notes, verifiedNote: false, - patientTypeID: - patient - .patientType, + patientTypeID: patient.patientType, patientOutSA: false, ); - await model - .updatePatientProgressNote( - reqModel); - await getProgressNoteList( - context, model, - isLocalBusy: - true); - GifLoaderDialogUtils - .hideDialog( - context); + await model.updatePatientProgressNote(reqModel); + await getProgressNoteList(context, model, isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); }); }, child: Container( decoration: BoxDecoration( color: Colors.red[600], - borderRadius: - BorderRadius.circular( - 10), + borderRadius: BorderRadius.circular(10), ), // color:Colors.red[600], child: Row( children: [ Icon( - FontAwesomeIcons - .trash, + FontAwesomeIcons.trash, size: 12, color: Colors.white, ), @@ -447,41 +322,25 @@ class _ProgressNoteState extends State { height: 10, ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width: MediaQuery.of(context) - .size - .width * - 0.60, + width: MediaQuery.of(context).size.width * 0.60, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase - .of( - context) - .createdBy, + TranslationBase.of(context).createdBy, fontSize: 10, ), Expanded( child: AppText( - model - .patientProgressNoteList[ - index] - .doctorName ?? - '', - fontWeight: - FontWeight.w600, + model.patientProgressNoteList[index].doctorName ?? '', + fontWeight: FontWeight.w600, fontSize: 12, ), ), @@ -493,85 +352,55 @@ class _ProgressNoteState extends State { Column( children: [ AppText( - model - .patientProgressNoteList[ - index] - .createdOn != - null + model.patientProgressNoteList[index].createdOn != null ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils - .getDateTimeFromServerFormat( - model - .patientProgressNoteList[ - index] - .createdOn), - isArabic: - projectViewModel - .isArabic) - : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now(), - isArabic: - projectViewModel - .isArabic), + AppDateUtils.getDateTimeFromServerFormat( + model.patientProgressNoteList[index].createdOn), + isArabic: projectViewModel.isArabic) + : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(), + isArabic: projectViewModel.isArabic), fontWeight: FontWeight.w600, fontSize: 14, ), AppText( - model - .patientProgressNoteList[ - index] - .createdOn != - null - ? AppDateUtils.getHour(AppDateUtils - .getDateTimeFromServerFormat( - model - .patientProgressNoteList[ - index] - .createdOn)) - : AppDateUtils.getHour( - DateTime.now()), + model.patientProgressNoteList[index].createdOn != null + ? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat( + model.patientProgressNoteList[index].createdOn)) + : AppDateUtils.getHour(DateTime.now()), fontWeight: FontWeight.w600, fontSize: 14, ), ], - crossAxisAlignment: - CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, ) ], ), SizedBox( height: 8, ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - child: AppText( - model - .patientProgressNoteList[ - index] - .notes, - fontSize: 10, - ), - ), - ]) - ], - ), - SizedBox( - height: 20, - ), - ], + Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + Expanded( + child: AppText( + model.patientProgressNoteList[index].notes, + fontSize: 10, + ), + ), + ]) + ], + ), + SizedBox( + height: 20, + ), + ], + ), ), - ), - ); - }), + ); + }), + ), ), - ), - ], + ], + ), ), - ), ), ); } @@ -580,100 +409,92 @@ class _ProgressNoteState extends State { showDialog( context: context, builder: (ctx) => Center( - child: Container( - width: MediaQuery - .of(context) - .size - .width * 0.8, - height: 200, - child: AppScaffold( - isShowAppBar: false, - body: Container( - color: Colors.white, - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // SizedBox(height: 20,), - SizedBox( - height: 10, - ), - Row( + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + height: 200, + child: AppScaffold( + isShowAppBar: false, + body: Container( + color: Colors.white, + child: Center( + child: Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - AppText( - TranslationBase - .of(context) - .noteConfirm, - fontWeight: FontWeight.w600, - color: Colors.black, - fontSize: 16, + // SizedBox(height: 20,), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).noteConfirm, + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), + ], + ), + SizedBox( + height: 10, + ), + DividerWithSpacesAround(), + SizedBox( + height: 12, ), - ], - ), - SizedBox( - height: 10, - ), - DividerWithSpacesAround(), - SizedBox( - height: 12, - ), - Container( - padding: EdgeInsets.all(20), - color: Colors.white, - child: AppText( - projectViewModel.isArabic?"هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟":'Are you sure you want $actionName this order?', - fontSize: 15, - textAlign: TextAlign.center, - ), - ), + Container( + padding: EdgeInsets.all(20), + color: Colors.white, + child: AppText( + projectViewModel.isArabic + ? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟" + : 'Are you sure you want $actionName this order?', + fontSize: 15, + textAlign: TextAlign.center, + ), + ), - SizedBox( - height: 8, + SizedBox( + height: 8, + ), + DividerWithSpacesAround(), + FractionallySizedBox( + widthFactor: 0.75, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + FlatButton( + child: AppText( + TranslationBase.of(context).cancel, + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), //Text("Cancel"), + onPressed: () { + Navigator.of(context).pop(); + }), + FlatButton( + child: AppText( + TranslationBase.of(context).noteConfirm, + fontWeight: FontWeight.w600, + color: Colors.red.shade700, + fontSize: 16, + ), //Text("Confirm", ), + onPressed: () async { + await confirmFun(); + Navigator.of(context).pop(); + }) + ], + ), + ) + ], ), - DividerWithSpacesAround(), - FractionallySizedBox( - widthFactor: 0.75, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - FlatButton( - child: AppText( - TranslationBase - .of(context) - .cancel, - fontWeight: FontWeight.w600, - color: Colors.black, - fontSize: 16, - ), //Text("Cancel"), - onPressed: () { - Navigator.of(context).pop(); - }), - FlatButton( - child: AppText( - TranslationBase - .of(context) - .noteConfirm, - fontWeight: FontWeight.w600, - color: Colors.red.shade700, - fontSize: 16, - ), //Text("Confirm", ), - onPressed: () async { - await confirmFun(); - Navigator.of(context).pop(); - }) - ], - ), - ) - ], + ), ), ), ), - ), - ), - ) - ); + )); } } 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 364e47f6..0fefb8ea 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/service/VideoCallService.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; @@ -232,6 +233,10 @@ class _PatientProfileScreenState extends State with Single onPressed: () async { if ((isFromLiveCare && patient.appointmentNo != null) || patient.patientStatusType == 43) { + await locator().logEvent( + eventCategory: "Patient Profile", + eventAction: "Create Episode", + ); PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( appointmentNo: int.parse(patient.appointmentNo.toString()), patientMRN: patient.patientMRN); @@ -264,7 +269,11 @@ class _PatientProfileScreenState extends State with Single color: Colors.white, height: 30, ), - onPressed: () { + onPressed: () async { + await locator().logEvent( + eventCategory: "Patient Profile ", + eventAction: "Update Episode", + ); if ((isFromLiveCare && patient.appointmentNo != null && patient.appointmentNo != 0) || @@ -324,7 +333,7 @@ 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); diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index 48bef68a..93613275 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -11,6 +12,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; +import '../../../../locator.dart'; + class RadiologyDetailsPage extends StatelessWidget { final FinalRadiology finalRadiology; final PatiantInformtion patient; @@ -19,12 +22,7 @@ class RadiologyDetailsPage extends StatelessWidget { final bool isInpatient; RadiologyDetailsPage( - {Key key, - this.finalRadiology, - this.patient, - this.patientType, - this.arrivalType, - this.isInpatient = false}); + {Key key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false}); @override Widget build(BuildContext context) { @@ -36,7 +34,7 @@ class RadiologyDetailsPage extends StatelessWidget { invoiceNo: finalRadiology.invoiceNo), builder: (_, model, widget) => AppScaffold( appBar: PatientProfileAppBar( - patient, + patient, appointmentDate: finalRadiology.orderDate, doctorName: finalRadiology.doctorName, clinic: finalRadiology.clinicDescription, @@ -44,7 +42,6 @@ class RadiologyDetailsPage extends StatelessWidget { profileUrl: finalRadiology.doctorImageURL, invoiceNO: finalRadiology.invoiceNo.toString(), isAppointmentHeader: true, - ), isShowAppBar: true, baseViewModel: model, @@ -68,9 +65,11 @@ class RadiologyDetailsPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: AppText(TranslationBase.of(context).generalResult,color: Color(0xff2E303A),), + child: AppText( + TranslationBase.of(context).generalResult, + color: Color(0xff2E303A), + ), ), - Padding( padding: const EdgeInsets.all(8.0), child: AppText( @@ -94,13 +93,16 @@ class RadiologyDetailsPage extends StatelessWidget { height: 80, width: double.maxFinite, child: Container( - margin: - EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12), + margin: EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12), child: SecondaryButton( color: Color(0xffD02127), disabled: finalRadiology.dIAPACSURL == "", textColor: Color(0xffFFFFFF), - onTap: () { + onTap: () async { + await locator().logEvent( + eventCategory: "RadiologyDetailsPage", + eventAction: "Open Radiology Image", + ); launch(model.radImageURL); }, label: TranslationBase.of(context).openRad, 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/referral/AddReplayOnReferralPatient.dart b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart index e4b8700c..251a91fa 100644 --- a/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart +++ b/lib/screens/patients/profile/referral/AddReplayOnReferralPatient.dart @@ -3,8 +3,10 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; import 'package:doctor_app_flutter/core/model/referral/add_referred_remarks_request.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -138,6 +140,10 @@ class _AddReplayOnReferralPatientState extends State Expanded( child: AppButton( onPressed: () async { + await locator().logEvent( + eventCategory: "Add Replay On Referral Patient", + eventAction: "Add Replay on Referral", + ); if (replayOnReferralController.text.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); await widget.patientReferralViewModel.replayReferred( diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index 4cc5effd..8bf89d87 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -18,8 +18,7 @@ import 'package:flutter/material.dart'; class MyReferralDetailScreen extends StatelessWidget { final MyReferralPatientModel referralPatient; - const MyReferralDetailScreen({Key key, this.referralPatient}) - : super(key: key); + const MyReferralDetailScreen({Key key, this.referralPatient}) : super(key: key); @override Widget build(BuildContext context) { @@ -54,8 +53,7 @@ class MyReferralDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Helpers.capitalize(referralPatient.firstName + " "+ - referralPatient.lastName)), + (Helpers.capitalize(referralPatient.firstName + " " + referralPatient.lastName)), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -95,62 +93,48 @@ class MyReferralDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( referralPatient.referralStatus != null - ? model.getReferralStatusNameByCode( - referralPatient.referralStatus, - context) + ? model.getReferralStatusNameByCode(referralPatient.referralStatus, context) : "", fontFamily: 'Poppins', fontSize: 1.9 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700, color: referralPatient.referralStatus == 1 ? Color(0xffc4aa54) - : referralPatient.referralStatus == - 46 || - referralPatient - .referralStatus == - 2 + : referralPatient.referralStatus == 46 || referralPatient.referralStatus == 2 ? Colors.green[700] : Colors.red[700], ), AppText( - AppDateUtils.getDayMonthYearDateFormatted( - referralPatient.referralDate), + AppDateUtils.getDayMonthYearDateFormatted(referralPatient.referralDate), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 2.0 * SizeConfig.textMultiplier, + fontSize: 2.0 * SizeConfig.textMultiplier, color: Color(0XFF28353E), ) ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .fileNumber, + TranslationBase.of(context).fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( "${referralPatient.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -159,75 +143,56 @@ class MyReferralDetailScreen extends StatelessWidget { AppDateUtils.getTimeHHMMA(referralPatient.referralDate), fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: - 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF575757), ) ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .referredFrom, + TranslationBase.of(context).referredFrom, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( - referralPatient.targetProjectId ==referralPatient.sourceProjectId - ? TranslationBase.of( - context) - .sameBranch - : TranslationBase.of( - context) - .otherBranch, + referralPatient.targetProjectId == referralPatient.sourceProjectId + ? TranslationBase.of(context).sameBranch + : TranslationBase.of(context).otherBranch, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig - .textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], ), Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context) - .remarks + - " : ", + TranslationBase.of(context).remarks + " : ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), Expanded( child: AppText( - referralPatient.referringDoctorRemarks?? - '', + referralPatient.referringDoctorRemarks ?? '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * - SizeConfig.textMultiplier, + fontSize: 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ), @@ -239,29 +204,22 @@ class MyReferralDetailScreen extends StatelessWidget { Row( children: [ AppText( - referralPatient.nationalityName != - null + referralPatient.nationalityName != null ? referralPatient.nationalityName : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), - fontSize: - 1.4 * SizeConfig.textMultiplier, + fontSize: 1.4 * SizeConfig.textMultiplier, ), - referralPatient.nationalityFlagURL != - null + referralPatient.nationalityFlagURL != null ? ClipRRect( - borderRadius: - BorderRadius.circular(20.0), + borderRadius: BorderRadius.circular(20.0), child: Image.network( - referralPatient - .nationalityFlagURL, + referralPatient.nationalityFlagURL, height: 25, width: 30, - errorBuilder: (BuildContext - context, - Object exception, - StackTrace stackTrace) { + errorBuilder: + (BuildContext context, Object exception, StackTrace stackTrace) { return Text('No Image'); }, )) @@ -274,8 +232,7 @@ class MyReferralDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: - EdgeInsets.only(left: 10, right: 0), + margin: EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_up.png', height: 50, @@ -283,20 +240,14 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only( - left: 0, - top: 25, - right: 0, - bottom: 0), - padding: EdgeInsets.only( - left: 4.0, right: 4.0), + margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0), + padding: EdgeInsets.only(left: 4.0, right: 4.0), child: Container( width: 40, height: 40, child: CircleAvatar( radius: 25.0, - backgroundImage: NetworkImage( - referralPatient.doctorImageURL), + backgroundImage: NetworkImage(referralPatient.doctorImageURL), backgroundColor: Colors.transparent, ), ), @@ -304,19 +255,14 @@ class MyReferralDetailScreen extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only( - left: 10, - top: 25, - right: 10, - bottom: 0), + margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0), child: Column( children: [ AppText( referralPatient.doctorName, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.7 * - SizeConfig.textMultiplier, + fontSize: 1.7 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -347,8 +293,7 @@ class MyReferralDetailScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16), child: SizedBox( child: ProfileMedicalInfoWidgetSearch( - patient: model - .getPatientFromReferralO(referralPatient), + patient: model.getPatientFromReferralO(referralPatient), patientType: "7", isInpatient: false, from: null, @@ -380,9 +325,7 @@ class MyReferralDetailScreen extends StatelessWidget { if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgAccept); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); @@ -407,9 +350,7 @@ class MyReferralDetailScreen extends StatelessWidget { if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .referralSuccessMsgReject); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 407a6815..6010a422 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -21,8 +23,7 @@ import 'package:hexcolor/hexcolor.dart'; class PatientMakeReferralScreen extends StatefulWidget { // previous design page is: ReferPatientScreen @override - _PatientMakeReferralScreenState createState() => - _PatientMakeReferralScreenState(); + _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState(); } class _PatientMakeReferralScreenState extends State { @@ -55,14 +56,8 @@ class _PatientMakeReferralScreenState extends State { String arrivalType = routeArgs['arrivalType']; referToList = List(); - dynamic sameBranch = { - "id": 1, - "name": TranslationBase.of(context).sameBranch - }; - dynamic otherBranch = { - "id": 2, - "name": TranslationBase.of(context).otherBranch - }; + dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch}; + dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch}; referToList.add(sameBranch); referToList.add(otherBranch); @@ -74,8 +69,7 @@ class _PatientMakeReferralScreenState extends State { baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), + appBar: PatientProfileAppBar(patient), body: SingleChildScrollView( child: Container( child: Column( @@ -109,57 +103,25 @@ class _PatientMakeReferralScreenState extends State { model.patientReferral.length == 0 ? referralForm(model, screenSize) : PatientReferralItemWidget( - referralStatus: model - .patientReferral[ - model.patientReferral.length - 1] - .referralStatus, - patientName: model - .patientReferral[ - model.patientReferral.length - 1] - .patientName, - patientGender: model - .patientReferral[ - model.patientReferral.length - 1] - .patientDetails - .gender, - referredDate: model - .patientReferral[ - model.patientReferral.length - 1] - .referredOn - .split(" ")[0], - referredTime: model - .patientReferral[ - model.patientReferral.length - 1] - .referredOn - .split(" ")[1], - patientID: - "${model.patientReferral[model.patientReferral.length - 1].patientID}", - isSameBranch: model - .patientReferral[ - model.patientReferral.length - 1] - .isReferralDoctorSameBranch, + referralStatus: model.patientReferral[model.patientReferral.length - 1].referralStatus, + patientName: model.patientReferral[model.patientReferral.length - 1].patientName, + patientGender: + model.patientReferral[model.patientReferral.length - 1].patientDetails.gender, + referredDate: + model.patientReferral[model.patientReferral.length - 1].referredOn.split(" ")[0], + referredTime: + model.patientReferral[model.patientReferral.length - 1].referredOn.split(" ")[1], + patientID: "${model.patientReferral[model.patientReferral.length - 1].patientID}", + isSameBranch: + model.patientReferral[model.patientReferral.length - 1].isReferralDoctorSameBranch, isReferral: true, - remark: model - .patientReferral[ - model.patientReferral.length - 1] - .remarksFromSource, - nationality: model - .patientReferral[ - model.patientReferral.length - 1] - .patientDetails - .nationalityName, - nationalityFlag: model - .patientReferral[ - model.patientReferral.length - 1] - .nationalityFlagUrl, - doctorAvatar: model - .patientReferral[ - model.patientReferral.length - 1] - .doctorImageUrl, - referralDoctorName: model - .patientReferral[ - model.patientReferral.length - 1] - .referredByDoctorInfo, + remark: model.patientReferral[model.patientReferral.length - 1].remarksFromSource, + nationality: + model.patientReferral[model.patientReferral.length - 1].patientDetails.nationalityName, + nationalityFlag: model.patientReferral[model.patientReferral.length - 1].nationalityFlagUrl, + doctorAvatar: model.patientReferral[model.patientReferral.length - 1].doctorImageUrl, + referralDoctorName: + model.patientReferral[model.patientReferral.length - 1].referredByDoctorInfo, clinicDescription: null, ), ], @@ -171,29 +133,29 @@ class _PatientMakeReferralScreenState extends State { title: TranslationBase.of(context).refer, fontWeight: FontWeight.w700, color: HexColor("#359846"), - onPressed: () { - setState(() { + onPressed: () async { + setState(() async { + await locator().logEvent( + eventCategory: "Refer Patient", + eventAction: "Submit Refer", + ); if (_referTo == null) { - branchError = - TranslationBase.of(context).fieldRequired; + branchError = TranslationBase.of(context).fieldRequired; } else { branchError = null; } if (_selectedBranch == null) { - hospitalError = - TranslationBase.of(context).fieldRequired; + hospitalError = TranslationBase.of(context).fieldRequired; } else { hospitalError = null; } if (_selectedClinic == null) { - clinicError = - TranslationBase.of(context).fieldRequired; + clinicError = TranslationBase.of(context).fieldRequired; } else { clinicError = null; } if (_selectedDoctor == null) { - doctorError = - TranslationBase.of(context).fieldRequired; + doctorError = TranslationBase.of(context).fieldRequired; } else { doctorError = null; } @@ -204,16 +166,10 @@ class _PatientMakeReferralScreenState extends State { _selectedDoctor == null || _remarksController.text == null) return; model - .makeReferral( - patient, - appointmentDate.toIso8601String(), - _selectedBranch['facilityId'], - _selectedClinic['ClinicID'], - _selectedDoctor['DoctorID'], - _remarksController.text) + .makeReferral(patient, appointmentDate.toIso8601String(), _selectedBranch['facilityId'], + _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text) .then((_) { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).referralSuccessMsg); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); Navigator.pop(context); }); }, @@ -259,8 +215,7 @@ class _PatientMakeReferralScreenState extends State { GifLoaderDialogUtils.showMyDialog(context); await model .getClinics(_selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog(context)); + .then((_) => GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } @@ -287,47 +242,42 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).hospital, - dropDownText: _selectedBranch != null - ? _selectedBranch['facilityName'] - : null, + dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: hospitalError, - onClick: model.branchesList != null && - model.branchesList.length > 0 && - _referTo != null && - _referTo['id'] == 2 - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: model.branchesList, - attributeName: 'facilityName', - attributeValueId: 'facilityId', - okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() async { - _selectedBranch = selectedValue; - _selectedClinic = null; - _selectedDoctor = null; - GifLoaderDialogUtils.showMyDialog(context); - await model - .getClinics(_selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog(context)); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, + onClick: + model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.branchesList, + attributeName: 'facilityName', + attributeValueId: 'facilityId', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() async { + _selectedBranch = selectedValue; + _selectedClinic = null; + _selectedDoctor = null; + GifLoaderDialogUtils.showMyDialog(context); + await model + .getClinics(_selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, ), SizedBox( height: 10, @@ -335,15 +285,11 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).clinic, - dropDownText: _selectedClinic != null - ? _selectedClinic['ClinicDescription'] - : null, + dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: clinicError, - onClick: _selectedBranch != null && - model.clinicsList != null && - model.clinicsList.length > 0 + onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( list: model.clinicsList, @@ -358,12 +304,8 @@ class _PatientMakeReferralScreenState extends State { _selectedClinic = selectedValue; GifLoaderDialogUtils.showMyDialog(context); await model - .getClinicDoctors( - patient, - _selectedClinic['ClinicID'], - _selectedBranch['facilityId']) - .then((_) => - GifLoaderDialogUtils.hideDialog(context)); + .getClinicDoctors(patient, _selectedClinic['ClinicID'], _selectedBranch['facilityId']) + .then((_) => GifLoaderDialogUtils.hideDialog(context)); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } @@ -386,14 +328,11 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).doctor, - dropDownText: - _selectedDoctor != null ? _selectedDoctor['Name'] : null, + dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null, enabled: false, isTextFieldHasSuffix: true, validationError: doctorError, - onClick: _selectedClinic != null && - model.doctorsList != null && - model.doctorsList.length > 0 + onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0 ? () { ListSelectDialog dialog = ListSelectDialog( list: model.doctorsList, @@ -418,12 +357,9 @@ class _PatientMakeReferralScreenState extends State { } : () { if (_selectedClinic == null) { - DrAppToastMsg.showErrorToast( - "You need to select a clinic first"); - } else if (model.doctorsList == null || - model.doctorsList.length == 0) { - DrAppToastMsg.showErrorToast( - "There is no doctors for this clinic"); + DrAppToastMsg.showErrorToast("You need to select a clinic first"); + } else if (model.doctorsList == null || model.doctorsList.length == 0) { + DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); } }, ), @@ -433,9 +369,8 @@ class _PatientMakeReferralScreenState extends State { AppTextFieldCustom( height: screenSize.height * 0.075, hintText: TranslationBase.of(context).date, - dropDownText: appointmentDate != null - ? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" - : null, + dropDownText: + appointmentDate != null ? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" : null, enabled: false, isTextFieldHasSuffix: true, suffixIcon: IconButton( diff --git a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart index 50bd0a9e..d9b9aae9 100644 --- a/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart +++ b/lib/screens/patients/profile/referral/referral_patient_detail_in-paint.dart @@ -1,7 +1,9 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/referral/MyReferralPatientModel.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -433,7 +435,8 @@ class ReferralPatientDetailScreen extends StatelessWidget { ], ), ), - if (referredPatient.referredDoctorRemarks!= null && referredPatient.referredDoctorRemarks.isNotEmpty) + if (referredPatient.referredDoctorRemarks != null && + referredPatient.referredDoctorRemarks.isNotEmpty) Container( width: double.infinity, margin: EdgeInsets.symmetric(horizontal: 16, vertical: 0), @@ -486,13 +489,18 @@ class ReferralPatientDetailScreen extends StatelessWidget { hPadding: 8, vPadding: 12, onPressed: () async { + await locator().logEvent( + eventCategory: "Referral Patient Detail", + eventAction: "Replay To Patient", + ); Navigator.push( context, SlideUpPageRoute( widget: AddReplayOnReferralPatient( patientReferralViewModel: patientReferralViewModel, myReferralInPatientModel: referredPatient, - isEdited: referredPatient.referredDoctorRemarks!=null && referredPatient.referredDoctorRemarks.isNotEmpty, + isEdited: referredPatient.referredDoctorRemarks != null && + referredPatient.referredDoctorRemarks.isNotEmpty, ), ), ); 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/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index 23266095..09694ad6 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/lookups/patient_lookup.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -18,8 +20,7 @@ class VitalSignDetailsScreen extends StatelessWidget { int projectID; bool isNotOneAppointment; - VitalSignDetailsScreen( - {this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); + VitalSignDetailsScreen({this.appointmentNo, this.projectID, this.isNotOneAppointment = true}); @override Widget build(BuildContext context) { @@ -34,14 +35,12 @@ class VitalSignDetailsScreen extends StatelessWidget { String assetBasePath = "${imageBasePath}patient/vital_signs/"; return BaseView( - onModelReady: (model) => - model.getPatientVitalSignHistory(patient, from, to, isInpatient), + onModelReady: (model) => model.getPatientVitalSignHistory(patient, from, to, isInpatient), builder: (_, mode, widget) => AppScaffold( baseViewModel: mode, isShowAppBar: true, backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: PatientProfileAppBar( - patient), + appBar: PatientProfileAppBar(patient), appBarTitle: TranslationBase.of(context).vitalSign, body: mode.patientVitalSignsHistory.length > 0 ? Column( @@ -57,7 +56,7 @@ class VitalSignDetailsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - "${patient.firstName ?? patient?.patientDetails?.firstName?? patient.fullName?? ''}'s", + "${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s", fontSize: SizeConfig.textMultiplier * 1.6, fontWeight: FontWeight.w700, color: Color(0xFF2E303A), @@ -75,8 +74,7 @@ class VitalSignDetailsScreen extends StatelessWidget { height: MediaQuery.of(context).size.height * 0.23, width: double.infinity, padding: EdgeInsets.all(12.0), - margin: EdgeInsets.symmetric( - horizontal: 16.0, vertical: 8.0), + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), decoration: BoxDecoration( shape: BoxShape.rectangle, color: Colors.white, @@ -100,17 +98,13 @@ class VitalSignDetailsScreen extends StatelessWidget { children: [ Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 1 ? '${assetBasePath}underweight_BMI.png' : '${assetBasePath}underweight_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -118,38 +112,28 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiUnderWeight}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, - color: mode.getBMIStatus() == 1 - ? Color(0XFFD02127) - : null, + fontSize: SizeConfig.textMultiplier * 1.15, + color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : null, fontWeight: FontWeight.w700, ), AppText( "(<18.5)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, - color: mode.getBMIStatus() == 1 - ? Color(0XFFD02127) - : null, + fontSize: SizeConfig.textMultiplier * 1.15, + color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : null, fontWeight: FontWeight.w700, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 2 ? '${assetBasePath}health_BMI.png' : '${assetBasePath}health_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -158,40 +142,29 @@ class VitalSignDetailsScreen extends StatelessWidget { child: AppText( "${TranslationBase.of(context).normal}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * - 1.15, + fontSize: SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 2 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : null, ), ), AppText( "(18.5-24.9)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 2 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : null, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 3 ? '${assetBasePath}ovrweight_BMI.png' : '${assetBasePath}ovrweight_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -199,38 +172,28 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiOverWeight}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.155, + fontSize: SizeConfig.textMultiplier * 1.155, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 3 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : null, ), AppText( "(25-29.9)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.155, + fontSize: SizeConfig.textMultiplier * 1.155, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 3 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : null, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 4 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -238,38 +201,28 @@ class VitalSignDetailsScreen extends StatelessWidget { AppText( "${TranslationBase.of(context).bmiObese}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 4 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : null, ), AppText( "(30-34.9)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 4 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : null, ), ], )), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( mode.getBMIStatus() != 5 ? '${assetBasePath}Obese_BMI.png' : '${assetBasePath}Obese_BMI-r.png', - height: MediaQuery.of(context) - .size - .height * - 0.10, + height: MediaQuery.of(context).size.height * 0.10, ), const SizedBox( height: 4, @@ -279,24 +232,17 @@ class VitalSignDetailsScreen extends StatelessWidget { child: AppText( "${TranslationBase.of(context).bmiObeseExtreme}", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * - 1.15, + fontSize: SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 5 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : null, ), ), AppText( "(35<)", fontFamily: 'Poppins', - fontSize: - SizeConfig.textMultiplier * 1.15, + fontSize: SizeConfig.textMultiplier * 1.15, fontWeight: FontWeight.w700, - color: mode.getBMIStatus() == 5 - ? Color(0XFFD02127) - : null, + color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : null, ), ], )), @@ -308,11 +254,9 @@ class VitalSignDetailsScreen extends StatelessWidget { Expanded( child: SingleChildScrollView( child: Container( - margin: EdgeInsets.symmetric( - horizontal: 16.0, vertical: 16), + margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ GridView.count( shrinkWrap: true, @@ -326,16 +270,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Height, - pageTitle: - TranslationBase.of( - context) - .height, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Height, + pageTitle: TranslationBase.of(context).height, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -345,63 +283,51 @@ class VitalSignDetailsScreen extends StatelessWidget { : null, child: Container( child: VitalSignItem( - des: TranslationBase.of(context) - .height, - imagePath: - "${assetBasePath}height.png", + des: TranslationBase.of(context).height, + imagePath: "${assetBasePath}height.png", lastVal: mode.heightCm, - unit: TranslationBase.of(context) - .cm, + unit: TranslationBase.of(context).cm, ), ), ), - InkWell( - onTap: () => isNotOneAppointment - ? Navigator.push( - context, - FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Weight, - pageTitle: - TranslationBase.of( - context) - .weight, - vitalList: mode - .patientVitalSignsHistory, - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - ), + if (isNotOneAppointment) + InkWell( + onTap: () async { + await locator().logEvent( + eventCategory: "Vital Sign Details Screen", + eventAction: "Vital Sign Details", + ); + + Navigator.push( + context, + FadePage( + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Weight, + pageTitle: TranslationBase.of(context).weight, + vitalList: mode.patientVitalSignsHistory, + patient: patient, + patientType: patientType, + arrivalType: arrivalType, ), - ) - : null, - child: VitalSignItem( - des: TranslationBase.of(context) - .weight, - imagePath: - "${assetBasePath}weight.png", - unit: - TranslationBase.of(context).kg, - lastVal: mode.weightKg, + ), + ); + }, + child: VitalSignItem( + des: TranslationBase.of(context).weight, + imagePath: "${assetBasePath}weight.png", + unit: TranslationBase.of(context).kg, + lastVal: mode.weightKg, + ), ), - ), InkWell( onTap: () => isNotOneAppointment ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Temperature, - pageTitle: - TranslationBase.of( - context) - .temperature, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Temperature, + pageTitle: TranslationBase.of(context).temperature, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -411,13 +337,10 @@ class VitalSignDetailsScreen extends StatelessWidget { : null, child: Container( child: VitalSignItem( - des: TranslationBase.of(context) - .temperature, - imagePath: - "${assetBasePath}temperature.png", + des: TranslationBase.of(context).temperature, + imagePath: "${assetBasePath}temperature.png", lastVal: mode.temperatureCelcius, - unit: TranslationBase.of(context) - .tempC, + unit: TranslationBase.of(context).tempC, ), ), ), @@ -426,16 +349,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .heart, - pageTitle: - TranslationBase.of( - context) - .heart, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.heart, + pageTitle: TranslationBase.of(context).heart, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -444,13 +361,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .heart, - imagePath: - "${assetBasePath}heart_rate.png", + des: TranslationBase.of(context).heart, + imagePath: "${assetBasePath}heart_rate.png", lastVal: mode.hartRat, - unit: - TranslationBase.of(context).bpm, + unit: TranslationBase.of(context).bpm, ), ), InkWell( @@ -458,16 +372,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Respiration, - pageTitle: - TranslationBase.of( - context) - .respirationRate, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Respiration, + pageTitle: TranslationBase.of(context).respirationRate, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -476,14 +384,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .respirationRate, - imagePath: - "${assetBasePath}respiration_rate.png", - lastVal: - mode.respirationBeatPerMinute, - unit: TranslationBase.of(context) - .respirationSigns, + des: TranslationBase.of(context).respirationRate, + imagePath: "${assetBasePath}respiration_rate.png", + lastVal: mode.respirationBeatPerMinute, + unit: TranslationBase.of(context).respirationSigns, ), ), InkWell( @@ -491,16 +395,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .BloodPressure, - pageTitle: - TranslationBase.of( - context) - .bloodPressure, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.BloodPressure, + pageTitle: TranslationBase.of(context).bloodPressure, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -509,13 +407,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .bloodPressure, - imagePath: - "${assetBasePath}blood_pressure.png", + des: TranslationBase.of(context).bloodPressure, + imagePath: "${assetBasePath}blood_pressure.png", lastVal: mode.bloodPressure, - unit: TranslationBase.of(context) - .sysDias, + unit: TranslationBase.of(context).sysDias, ), ), InkWell( @@ -523,16 +418,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .Oxygenation, - pageTitle: - TranslationBase.of( - context) - .oxygenation, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.Oxygenation, + pageTitle: TranslationBase.of(context).oxygenation, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -541,10 +430,8 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .oxygenation, - imagePath: - "${assetBasePath}oxg.png", + des: TranslationBase.of(context).oxygenation, + imagePath: "${assetBasePath}oxg.png", lastVal: "${mode.oxygenation}%", unit: "", ), @@ -554,16 +441,10 @@ class VitalSignDetailsScreen extends StatelessWidget { ? Navigator.push( context, FadePage( - page: - VitalSignItemDetailsScreen( - pageKey: vitalSignDetails - .PainScale, - pageTitle: - TranslationBase.of( - context) - .painScale, - vitalList: mode - .patientVitalSignsHistory, + page: VitalSignItemDetailsScreen( + pageKey: vitalSignDetails.PainScale, + pageTitle: TranslationBase.of(context).painScale, + vitalList: mode.patientVitalSignsHistory, patient: patient, patientType: patientType, arrivalType: arrivalType, @@ -572,10 +453,8 @@ class VitalSignDetailsScreen extends StatelessWidget { ) : null, child: VitalSignItem( - des: TranslationBase.of(context) - .painScale, - imagePath: - "${assetBasePath}painScale.png", + des: TranslationBase.of(context).painScale, + imagePath: "${assetBasePath}painScale.png", lastVal: mode.painScore, unit: TranslationBase.of(context).severe, ), @@ -588,19 +467,17 @@ class VitalSignDetailsScreen extends StatelessWidget { ), ), ], - ), - ), - ), - ], - ) + ), + ), + ), + ], + ) : Container( - color: Theme - .of(context) - .scaffoldBackgroundColor, - child: ErrorMessage(error: TranslationBase - .of(context) - .vitalSignEmptyMsg,)), + color: Theme.of(context).scaffoldBackgroundColor, + child: ErrorMessage( + error: TranslationBase.of(context).vitalSignEmptyMsg, + )), ), ); } -} \ No newline at end of file +} diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 477e5359..6d1609be 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -6,10 +6,12 @@ import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -638,6 +640,10 @@ class _PrescriptionFormWidgetState extends State { title: TranslationBase.of(context).addMedication, fontWeight: FontWeight.w600, onPressed: () async { + await locator().logEvent( + eventCategory: "Add Prescription Form", + eventAction: "Add Prescription", + ); if (route != null && duration != null && doseTime != null && 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_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart index 4c054fc5..a2afdba6 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -1,7 +1,9 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/add-procedure-page.dart'; @@ -21,11 +23,10 @@ class ProcedureCheckOutScreen extends StatefulWidget { final String toolbarTitle; ProcedureCheckOutScreen( - {this.items, this.model, this.patient,@required this.addButtonTitle,@required this.toolbarTitle}); + {this.items, this.model, this.patient, @required this.addButtonTitle, @required this.toolbarTitle}); @override - _ProcedureCheckOutScreenState createState() => - _ProcedureCheckOutScreenState(); + _ProcedureCheckOutScreenState createState() => _ProcedureCheckOutScreenState(); } class _ProcedureCheckOutScreenState extends State { @@ -36,8 +37,7 @@ class _ProcedureCheckOutScreenState extends State { @override Widget build(BuildContext context) { return BaseView( - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( + builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), isShowAppBar: false, body: SingleChildScrollView( @@ -82,10 +82,8 @@ class _ProcedureCheckOutScreenState extends State { widget.items.length, (index) => Container( margin: EdgeInsets.only(bottom: 15.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.all(Radius.circular(10.0))), + decoration: + BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(10.0))), child: ExpansionTile( initiallyExpanded: true, title: Row( @@ -98,9 +96,7 @@ class _ProcedureCheckOutScreenState extends State { SizedBox( width: 6.0, ), - Expanded( - child: AppText( - widget.items[index].procedureName)), + Expanded(child: AppText(widget.items[index].procedureName)), ], ), children: [ @@ -113,11 +109,9 @@ class _ProcedureCheckOutScreenState extends State { Row( children: [ Padding( - padding: const EdgeInsets.symmetric( - horizontal: 11), + padding: const EdgeInsets.symmetric(horizontal: 11), child: AppText( - TranslationBase.of(context) - .orderType, + TranslationBase.of(context).orderType, fontWeight: FontWeight.w700, color: Color(0xff2B353E), ), @@ -129,14 +123,11 @@ class _ProcedureCheckOutScreenState extends State { Radio( activeColor: Color(0xFFD02127), value: 0, - groupValue: - widget.items[index].selectedType, + groupValue: widget.items[index].selectedType, onChanged: (value) { - widget.items[index].selectedType = - 0; + widget.items[index].selectedType = 0; setState(() { - widget.items[index].type = - value.toString(); + widget.items[index].type = value.toString(); }); }, ), @@ -147,15 +138,12 @@ class _ProcedureCheckOutScreenState extends State { ), Radio( activeColor: Color(0xFFD02127), - groupValue: - widget.items[index].selectedType, + groupValue: widget.items[index].selectedType, value: 1, onChanged: (value) { - widget.items[index].selectedType = - 1; + widget.items[index].selectedType = 1; setState(() { - widget.items[index].type = - value.toString(); + widget.items[index].type = value.toString(); }); }, ), @@ -174,8 +162,7 @@ class _ProcedureCheckOutScreenState extends State { height: 2.0, ), Padding( - padding: EdgeInsets.symmetric( - horizontal: 12, vertical: 15.0), + padding: EdgeInsets.symmetric(horizontal: 12, vertical: 15.0), child: TextFields( hintText: TranslationBase.of(context).remarks, controller: remarksController, @@ -222,11 +209,13 @@ class _ProcedureCheckOutScreenState extends State { ), ); }); + await locator().logEvent( + eventCategory: "Procedure Checkout Screen", + eventAction: "Add New Procedure", + ); Navigator.pop(context); await model.preparePostProcedure( - entityList: entityList, - patient: widget.patient, - remarks: remarksController.text); + entityList: entityList, patient: widget.patient, remarks: remarksController.text); Navigator.pop(context); Navigator.pop(context); }, 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/qr_reader/QR_reader_screen.dart b/lib/screens/qr_reader/QR_reader_screen.dart index c6d07bb9..c06a8722 100644 --- a/lib/screens/qr_reader/QR_reader_screen.dart +++ b/lib/screens/qr_reader/QR_reader_screen.dart @@ -2,8 +2,10 @@ import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -61,7 +63,11 @@ class _QrReaderScreenState extends State { ), AppButton( title: TranslationBase.of(context).scanQr, - onPressed: () { + onPressed: () async { + await locator().logEvent( + eventCategory: "QrReaderScreen", + eventAction: "Scan QR", + ); _scanQrAndGetPatient(context, model); }, icon: Image.asset('assets/images/qr_code_white.png'), @@ -82,10 +88,7 @@ class _QrReaderScreenState extends State { int patientID = 0; if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]); PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel( - patientID: patientID,clinicID: 0, - doctorID: 0, - projectID: int.parse(listOfParams[0]) - ); + patientID: patientID, clinicID: 0, doctorID: 0, projectID: int.parse(listOfParams[0])); await model.getInPatientList(patientSearchRequestModel, isMyInpatient: false).then((d) { if (model.state != ViewState.ErrorLocal) { diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index 2e0a284f..43d4ae68 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -1,6 +1,8 @@ +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; @@ -20,23 +22,29 @@ class AddRescheduleLeavScreen extends StatelessWidget { Widget build(BuildContext context) { projectsProvider = Provider.of(context); return BaseView( - onModelReady: (model) => - {model.getRescheduleLeave(), model.getCoveringDoctors()}, + onModelReady: (model) => {model.getRescheduleLeave(), model.getCoveringDoctors()}, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, appBarTitle: TranslationBase.of(context).rescheduleLeaves, body: SingleChildScrollView( child: Column(children: [ - AddNewOrder( onTap: () { - openLeave( - context, - false, - ); - },label: TranslationBase.of(context).applyForReschedule,), + AddNewOrder( + onTap: () async { + await locator().logEvent( + eventCategory: "Add Reschedule" + "Leave Screen", + eventAction: "apply For Reschedule", + ); + openLeave( + context, + false, + ); + }, + label: TranslationBase.of(context).applyForReschedule, + ), Column( - children: model.getReschduleLeave - .map((GetRescheduleLeavesResponse item) { + children: model.getReschduleLeave.map((GetRescheduleLeavesResponse item) { return RoundedContainer( child: Column( children: [ @@ -62,71 +70,55 @@ class AddRescheduleLeavScreen extends StatelessWidget { child: Wrap( children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.all(3), - margin: - EdgeInsets.only(top: 10), - child: AppText( - item.statusDescription, - fontWeight: FontWeight.bold, - color: item.status == 10 - ? Colors.red[800] - : item.status == 2 - ? HexColor('#CC9B14') - : item.status == 9 - ? Colors.green - : Colors.red, - fontSize: 14, - ), - ), - Padding( - padding: - EdgeInsets.only(top: 10), - child: AppText( - AppDateUtils - .convertStringToDateFormat( - item.createdOn, - 'yyyy-MM-dd HH:mm'), - fontWeight: FontWeight.bold, - )) - ]), + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Container( + padding: EdgeInsets.all(3), + margin: EdgeInsets.only(top: 10), + child: AppText( + item.statusDescription, + fontWeight: FontWeight.bold, + color: item.status == 10 + ? Colors.red[800] + : item.status == 2 + ? HexColor('#CC9B14') + : item.status == 9 + ? Colors.green + : Colors.red, + fontSize: 14, + ), + ), + Padding( + padding: EdgeInsets.only(top: 10), + child: AppText( + AppDateUtils.convertStringToDateFormat( + item.createdOn, 'yyyy-MM-dd HH:mm'), + fontWeight: FontWeight.bold, + )) + ]), SizedBox( height: 5, ), Container( child: AppText( item.requisitionType == 1 - ? TranslationBase.of(context) - .offTime + ? TranslationBase.of(context).offTime : item.requisitionType == 2 - ? TranslationBase.of(context) - .holiday + ? TranslationBase.of(context).holiday : item.requisitionType == 3 - ? TranslationBase.of( - context) - .changeOfSchedule - : TranslationBase.of( - context) - .newSchedule, + ? TranslationBase.of(context).changeOfSchedule + : TranslationBase.of(context).newSchedule, fontWeight: FontWeight.bold, )), SizedBox( height: 5, ), Row(children: [ - AppText(TranslationBase.of(context) - .startDate), + AppText(TranslationBase.of(context).startDate), AppText( AppDateUtils.convertStringToDateFormat( - item.dateTimeFrom, - 'yyyy-MM-dd HH:mm'), + item.dateTimeFrom, 'yyyy-MM-dd HH:mm'), fontWeight: FontWeight.bold, ) @@ -142,13 +134,10 @@ class AddRescheduleLeavScreen extends StatelessWidget { ), Row( children: [ - AppText(TranslationBase.of(context) - .endDate), + AppText(TranslationBase.of(context).endDate), AppText( - AppDateUtils - .convertStringToDateFormat( - item.dateTimeTo, - 'yyyy-MM-dd HH:mm'), + AppDateUtils.convertStringToDateFormat( + item.dateTimeTo, 'yyyy-MM-dd HH:mm'), fontWeight: FontWeight.bold, ) ], @@ -160,13 +149,10 @@ class AddRescheduleLeavScreen extends StatelessWidget { model.coveringDoctors.length > 0 ? Row(children: [ AppText( - TranslationBase.of(context) - .coveringDoctor, + TranslationBase.of(context).coveringDoctor, ), AppText( - getDoctor( - model.coveringDoctors, - item.coveringDoctorId), + getDoctor(model.coveringDoctors, item.coveringDoctorId), fontWeight: FontWeight.bold, ) ]) @@ -176,28 +162,18 @@ class AddRescheduleLeavScreen extends StatelessWidget { // .reasons, // fontWeight: FontWeight.bold, // ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.only( - bottom: 5), - child: AppText(getReasons( - model.allReasons, - item.reasonId))), - (item.status == 2) - ? IconButton( - icon: Image.asset( - 'assets/images/edit.png'), - // color: Colors.green, //Colors.black, - onPressed: () => { - openLeave(context, true, - extendedData: item) - }, - ) - : SizedBox(), - ]), + Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ + Padding( + padding: EdgeInsets.only(bottom: 5), + child: AppText(getReasons(model.allReasons, item.reasonId))), + (item.status == 2) + ? IconButton( + icon: Image.asset('assets/images/edit.png'), + // color: Colors.green, //Colors.black, + onPressed: () => {openLeave(context, true, extendedData: item)}, + ) + : SizedBox(), + ]), ], ), SizedBox( 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 61c81957..d7dffd8d 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -1,8 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -64,7 +66,12 @@ class AddSickLeavScreen extends StatelessWidget { ], )), InkWell( - onTap: () { + onTap: () async { + await locator().logEvent( + eventCategory: "Add Sick Leave Screen" + "Leave Screen", + eventAction: "apply For Sick Leave", + ); openSickLeave( context, false, 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/patient-profile-header-new-design-app-bar.dart b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart index f2a32e63..08cc26c5 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -11,8 +13,7 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; import 'package:url_launcher/url_launcher.dart'; -class PatientProfileHeaderNewDesignAppBar extends StatelessWidget - with PreferredSizeWidget { +class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with PreferredSizeWidget { final PatiantInformtion patient; final String patientType; final String arrivalType; @@ -23,8 +24,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget final Stream videoCallDurationStream; - PatientProfileHeaderNewDesignAppBar( - this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false, this.isFromLiveCare = false, this.videoCallDurationStream}); + PatientProfileHeaderNewDesignAppBar(this.patient, this.patientType, this.arrivalType, + {this.height = 0.0, + this.isInpatient = false, + this.isDischargedPatient = false, + this.isFromLiveCare = false, + this.videoCallDurationStream}); @override Widget build(BuildContext context) { @@ -43,7 +48,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget decoration: BoxDecoration( color: Colors.white, ), - height: height == 0 ? isInpatient? 215:200 : height, + height: height == 0 + ? isInpatient + ? 215 + : 200 + : height, child: Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), margin: EdgeInsets.only(top: 50), @@ -60,10 +69,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget Expanded( child: AppText( patient.firstName != null - ? (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize(patient.lastName)) - : Helpers.capitalize(patient.fullName??patient.patientDetails.fullName), + ? (Helpers.capitalize(patient.firstName) + " " + Helpers.capitalize(patient.lastName)) + : Helpers.capitalize(patient.fullName ?? patient.patientDetails.fullName), fontSize: SizeConfig.textMultiplier * 1.8, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -81,7 +88,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget Container( margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( - onTap: () { + onTap: () async { + await locator().logEvent( + eventCategory: "Patient Profile Header", + eventAction: "Call Patient", + ); launch("tel://" + patient.mobileNumber); }, child: Icon( @@ -93,14 +104,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget StreamBuilder( stream: videoCallDurationStream, builder: (BuildContext context, AsyncSnapshot snapshot) { - if(snapshot.hasData && snapshot.data != null) + if (snapshot.hasData && snapshot.data != null) return InkWell( - onTap: (){ - }, + onTap: () {}, child: Container( decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)), padding: EdgeInsets.symmetric(vertical: 2, horizontal: 10), - child: Text(snapshot.data, style: TextStyle(color: Colors.white),), + child: Text( + snapshot.data, + style: TextStyle(color: Colors.white), + ), ), ); else @@ -116,9 +129,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget width: 60, height: 60, child: Image.asset( - gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', + gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, ), ), @@ -130,8 +141,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SERVICES_PATIANT2[int.parse(patientType)] == - "patientArrivalList" + SERVICES_PATIANT2[int.parse(patientType)] == "patientArrivalList" ? Container( child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -151,19 +161,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget fontFamily: 'Poppins', fontSize: 12, ), - arrivalType == '1'|| patient.arrivedOn == null + arrivalType == '1' || patient.arrivedOn == null ? AppText( - patient.startTime != null - ? patient.startTime - : '', + patient.startTime != null ? patient.startTime : '', fontFamily: 'Poppins', fontWeight: FontWeight.w600, ) : AppText( patient.arrivedOn != null ? AppDateUtils.convertStringToDateFormat( - patient.arrivedOn, - 'MM-dd-yyyy HH:mm') + patient.arrivedOn, 'MM-dd-yyyy HH:mm') : '', fontFamily: 'Poppins', fontWeight: FontWeight.w600, @@ -171,15 +178,13 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget ], )) : SizedBox(), - if (SERVICES_PATIANT2[int.parse(patientType)] == - "List_MyOutPatient" && !isFromLiveCare) + if (SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" && !isFromLiveCare) Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).appointmentDate + - " : ", + TranslationBase.of(context).appointmentDate + " : ", fontSize: 14, ), patient.startTime != null @@ -191,7 +196,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget color: HexColor("#20A169"), ), child: AppText( - patient.startTime??"", + patient.startTime ?? "", color: Colors.white, fontSize: 1.5 * SizeConfig.textMultiplier, textAlign: TextAlign.center, @@ -202,14 +207,13 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget SizedBox( width: 3.5, ), - Container( - child: AppText( - convertDateFormat2( - patient.appointmentDate ?? ''), - fontSize: 1.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), + Container( + child: AppText( + convertDateFormat2(patient.appointmentDate ?? ''), + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), + ), SizedBox( height: 0.5, ) @@ -224,27 +228,21 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget children: [ RichText( text: TextSpan( - style: TextStyle( - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Colors.black), + style: TextStyle(fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black), children: [ new TextSpan( text: TranslationBase.of(context).fileNumber, - style: TextStyle( - fontSize: 12, fontFamily: 'Poppins')), + style: TextStyle(fontSize: 12, fontFamily: 'Poppins')), new TextSpan( text: patient.patientId.toString(), - style: TextStyle( - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - fontSize: 14)), + style: TextStyle(fontWeight: FontWeight.w700, fontFamily: 'Poppins', fontSize: 14)), ], ), ), Row( children: [ AppText( - patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', + patient.nationalityName ?? patient.nationality ?? patient.nationalityId ?? '', fontWeight: FontWeight.bold, fontSize: 12, ), @@ -255,9 +253,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget patient.nationalityFlagURL, height: 25, width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { + errorBuilder: (BuildContext context, Object exception, StackTrace stackTrace) { return Text('No Image'); }, )) @@ -275,19 +271,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget fontFamily: 'Poppins', ), children: [ - new TextSpan( - text: TranslationBase.of(context).age+ " : ", - style: TextStyle(fontSize: 14)), + new TextSpan(text: TranslationBase.of(context).age + " : ", style: TextStyle(fontSize: 14)), new TextSpan( text: - "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context,isServerFormat: !isFromLiveCare)}", - style: TextStyle( - fontWeight: FontWeight.w700, fontSize: 14)), + "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ?? "" : patient.dateofBirth ?? "", context, isServerFormat: !isFromLiveCare)}", + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 14)), ], ), ), ), - if(isInpatient) + if (isInpatient) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -295,27 +288,22 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget child: RichText( text: new TextSpan( style: new TextStyle( - fontSize: - 2.0 * SizeConfig.textMultiplier, + fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black, fontFamily: 'Poppins', ), children: [ - new TextSpan( - text: patient.admissionDate == null - ? "" - : TranslationBase.of(context) - .admissionDate + - " : ", - style: TextStyle(fontSize: 14)), - new TextSpan( - text: patient.admissionDate == null - ? "" - : "${AppDateUtils.convertDateFromServerFormat(patient.admissionDate.toString(), 'yyyy-MM-dd')}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 15)), - ]))), + new TextSpan( + text: patient.admissionDate == null + ? "" + : TranslationBase.of(context).admissionDate + " : ", + style: TextStyle(fontSize: 14)), + new TextSpan( + text: patient.admissionDate == null + ? "" + : "${AppDateUtils.convertDateFromServerFormat(patient.admissionDate.toString(), 'yyyy-MM-dd')}", + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 15)), + ]))), if (patient.admissionDate != null) Row( children: [ @@ -323,11 +311,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget "${TranslationBase.of(context).numOfDays}: ", fontSize: 15, ), - if(isDischargedPatient && patient.dischargeDate!=null) - AppText( - "${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", - fontSize: 15, - fontWeight: FontWeight.w700) + if (isDischargedPatient && patient.dischargeDate != null) + AppText( + "${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", + fontSize: 15, + fontWeight: FontWeight.w700) else AppText( "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", @@ -356,8 +344,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget final startIndex = str.indexOf(start); final endIndex = str.indexOf(end, startIndex + start.length); - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); + var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex))); newDate = date.year.toString() + "/" + date.month.toString().padLeft(2, '0') + @@ -365,13 +352,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget date.day.toString().padLeft(2, '0'); } - return newDate??''; + return newDate ?? ''; } isToday(date) { DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); - return DateFormat("yyyy-MM-dd").format(tempDate) == - DateFormat("yyyy-MM-dd").format(DateTime.now()); + return DateFormat("yyyy-MM-dd").format(tempDate) == DateFormat("yyyy-MM-dd").format(DateTime.now()); } myBoxDecoration() { 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/patients/profile/profile_status_info_widget.dart b/lib/widgets/patients/profile/profile_status_info_widget.dart deleted file mode 100644 index d616c36f..00000000 --- a/lib/widgets/patients/profile/profile_status_info_widget.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; - -import '../../../config/size_config.dart'; -import '../../shared/app_texts_widget.dart'; -import '../../shared/rounded_container_widget.dart'; - - -/* - *@author: Elham Rababah - *@Date:13/4/2020 - *@param: - *@return: ProfileStatusInfoWidget - *@desc: Profile Status Info Widget - */ -class ProfileStatusInfoWidget extends StatelessWidget { - const ProfileStatusInfoWidget({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return RoundedContainer( - child: ListView( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 14), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Insurance approval', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.w700, - color: HexColor('#58434F'), - ), - AppText( - 'Approved', - color: HexColor('#707070'), - fontSize: SizeConfig.textMultiplier * 2.5, - ) - ], - ), - ), - ], - ), - width: SizeConfig.screenWidth * 0.70, - height: SizeConfig.screenHeight * 0.12, - ); - } -} 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,