Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into video-stream-new

 Conflicts:
	android/app/build.gradle
	lib/core/viewModel/authentication_view_model.dart
merge-requests/779/head
mosazaid 5 years ago
commit e046928e3e

@ -110,5 +110,6 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0' 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' apply plugin: 'com.google.gms.google-services'

@ -1,34 +1,77 @@
{ {
"project_info": { "project_info": {
"project_number": "157373154094", "project_number": "934365232760",
"project_id": "hmg-doctor-app-1553688619744", "project_id": "hmg-dr-app",
"storage_bucket": "hmg-doctor-app-1553688619744.appspot.com" "storage_bucket": "hmg-dr-app.appspot.com"
}, },
"client": [ "client": [
{ {
"client_info": { "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": { "android_client_info": {
"package_name": "com.hmg.hmgDr" "package_name": "com.hmg.hmgDr"
} }
}, },
"oauth_client": [ "oauth_client": [
{ {
"client_id": "157373154094-egrhbfr861l7k722g3v2gd4a0opi3r1u.apps.googleusercontent.com", "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com",
"client_type": 3 "client_type": 3
} }
], ],
"api_key": [ "api_key": [
{ {
"current_key": "AIzaSyDX8RPwu00MyrpqC-T2zXtrUQvTQGRv1mM" "current_key": "AIzaSyCpYwrmuntOBdZv6GV6KEnLj8nQRvEnZ6I"
} }
], ],
"services": { "services": {
"appinvite_service": { "appinvite_service": {
"other_platform_oauth_client": [ "other_platform_oauth_client": [
{ {
"client_id": "157373154094-egrhbfr861l7k722g3v2gd4a0opi3r1u.apps.googleusercontent.com", "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com",
"client_type": 3 "client_type": 3
},
{
"client_id": "934365232760-57v2ld1qqulc4nt4o5pgjfbpc47fj3qf.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "COM.HMG.HMGDR"
}
} }
] ]
} }

@ -8,7 +8,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 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'
} }
} }

@ -1,34 +1,77 @@
{ {
"project_info": { "project_info": {
"project_number": "1095694324958", "project_number": "934365232760",
"project_id": "mobapp-bb272", "project_id": "hmg-dr-app",
"storage_bucket": "mobapp-bb272.appspot.com" "storage_bucket": "hmg-dr-app.appspot.com"
}, },
"client": [ "client": [
{ {
"client_info": { "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": { "android_client_info": {
"package_name": "com.hmg.hmgDr" "package_name": "com.hmg.hmgDr"
} }
}, },
"oauth_client": [ "oauth_client": [
{ {
"client_id": "1095694324958-5psabq8tpbti0uqo8bt46atjtbas9uhr.apps.googleusercontent.com", "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com",
"client_type": 3 "client_type": 3
} }
], ],
"api_key": [ "api_key": [
{ {
"current_key": "AIzaSyCuPtf1hTikWXrp5OQIVfqO-TJWubI-Vd8" "current_key": "AIzaSyCpYwrmuntOBdZv6GV6KEnLj8nQRvEnZ6I"
} }
], ],
"services": { "services": {
"appinvite_service": { "appinvite_service": {
"other_platform_oauth_client": [ "other_platform_oauth_client": [
{ {
"client_id": "1095694324958-5psabq8tpbti0uqo8bt46atjtbas9uhr.apps.googleusercontent.com", "client_id": "934365232760-bobv1r1sn222le020jeni6u1bdbjdu1v.apps.googleusercontent.com",
"client_type": 3 "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" "configuration_version": "1"
} }

@ -3,21 +3,21 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CLIENT_ID</key> <key>CLIENT_ID</key>
<string>1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com</string> <string>934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key> <key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre</string> <string>com.googleusercontent.apps.934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5</string>
<key>API_KEY</key> <key>API_KEY</key>
<string>AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo</string> <string>AIzaSyBtA8-oCZ5T4gkuTG7CucGr_d_7lakp4MM</string>
<key>GCM_SENDER_ID</key> <key>GCM_SENDER_ID</key>
<string>1097451043303</string> <string>934365232760</string>
<key>PLIST_VERSION</key> <key>PLIST_VERSION</key>
<string>1</string> <string>1</string>
<key>BUNDLE_ID</key> <key>BUNDLE_ID</key>
<string>com.hmg.doctorApp</string> <string>com.hmg.hmgDr</string>
<key>PROJECT_ID</key> <key>PROJECT_ID</key>
<string>doctor-app-35ddc</string> <string>hmg-dr-app</string>
<key>STORAGE_BUCKET</key> <key>STORAGE_BUCKET</key>
<string>doctor-app-35ddc.appspot.com</string> <string>hmg-dr-app.appspot.com</string>
<key>IS_ADS_ENABLED</key> <key>IS_ADS_ENABLED</key>
<false></false> <false></false>
<key>IS_ANALYTICS_ENABLED</key> <key>IS_ANALYTICS_ENABLED</key>
@ -29,6 +29,6 @@
<key>IS_SIGNIN_ENABLED</key> <key>IS_SIGNIN_ENABLED</key>
<true></true> <true></true>
<key>GOOGLE_APP_ID</key> <key>GOOGLE_APP_ID</key>
<string>1:1097451043303:ios:0e9b87e77dcf397d866542</string> <string>1:934365232760:ios:61e01db91b41502bf9778d</string>
</dict> </dict>
</plist> </plist>

@ -3,21 +3,21 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CLIENT_ID</key> <key>CLIENT_ID</key>
<string>1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com</string> <string>934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key> <key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre</string> <string>com.googleusercontent.apps.934365232760-en86g42ch3fgu7odnv5ka6kec8irg8d5</string>
<key>API_KEY</key> <key>API_KEY</key>
<string>AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo</string> <string>AIzaSyBtA8-oCZ5T4gkuTG7CucGr_d_7lakp4MM</string>
<key>GCM_SENDER_ID</key> <key>GCM_SENDER_ID</key>
<string>1097451043303</string> <string>934365232760</string>
<key>PLIST_VERSION</key> <key>PLIST_VERSION</key>
<string>1</string> <string>1</string>
<key>BUNDLE_ID</key> <key>BUNDLE_ID</key>
<string>com.hmg.doctorApp</string> <string>com.hmg.hmgDr</string>
<key>PROJECT_ID</key> <key>PROJECT_ID</key>
<string>doctor-app-35ddc</string> <string>hmg-dr-app</string>
<key>STORAGE_BUCKET</key> <key>STORAGE_BUCKET</key>
<string>doctor-app-35ddc.appspot.com</string> <string>hmg-dr-app.appspot.com</string>
<key>IS_ADS_ENABLED</key> <key>IS_ADS_ENABLED</key>
<false></false> <false></false>
<key>IS_ANALYTICS_ENABLED</key> <key>IS_ANALYTICS_ENABLED</key>
@ -29,6 +29,6 @@
<key>IS_SIGNIN_ENABLED</key> <key>IS_SIGNIN_ENABLED</key>
<true></true> <true></true>
<key>GOOGLE_APP_ID</key> <key>GOOGLE_APP_ID</key>
<string>1:1097451043303:ios:0e9b87e77dcf397d866542</string> <string>1:934365232760:ios:61e01db91b41502bf9778d</string>
</dict> </dict>
</plist> </plist>

@ -64,7 +64,7 @@ class BaseAppClient {
else else
body['LanguageID'] = 2; body['LanguageID'] = 2;
body['stamp'] = STAMP; body['stamp'] = DateTime.now().toIso8601String();
// if(!body.containsKey("IPAdress")) // if(!body.containsKey("IPAdress"))
body['IPAdress'] = IP_ADDRESS; body['IPAdress'] = IP_ADDRESS;
body['VersionID'] = VERSION_ID; body['VersionID'] = VERSION_ID;

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; 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 PRIMARY_COLOR = 0xff515B5D;
const TRANSACTION_NO = 0; const TRANSACTION_NO = 0;
const LANGUAGE_ID = 2; const LANGUAGE_ID = 2;
const STAMP = '2020-04-27T12:17:17.721Z'; const STAMP = '2020-04-27T12:17:17.721Z';
const IP_ADDRESS = '9.9.9.9'; const IP_ADDRESS = '9.9.9.9';
const VERSION_ID = 6.2; const VERSION_ID = 6.3;
const CHANNEL = 9; const CHANNEL = 9;
const SESSION_ID = 'BlUSkYymTt'; const SESSION_ID = 'BlUSkYymTt';
const IS_LOGIN_FOR_DOCTOR_APP = true; const IS_LOGIN_FOR_DOCTOR_APP = true;

@ -703,4 +703,5 @@ const Map<String, Map<String, String>> localizedValues = {
"addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"}, "addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"},
"edit": {"en": "Edit", "ar": "تعديل"}, "edit": {"en": "Edit", "ar": "تعديل"},
"summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"}, "summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"},
"finish": {"en": "Finish", "ar": "انهاء"},
}; };

@ -12,5 +12,4 @@ final LOGGED_IN_USER = 'loggedUser';
final DASHBOARD_DATA = 'dashboard-data'; final DASHBOARD_DATA = 'dashboard-data';
final OTP_TYPE = 'otp-type'; final OTP_TYPE = 'otp-type';
final LAST_LOGIN_USER = 'last-login-user'; final LAST_LOGIN_USER = 'last-login-user';
final PASSWORD = 'password';
final CLINIC_NAME = 'clinic-name'; final CLINIC_NAME = 'clinic-name';

@ -1,34 +1,26 @@
class ActivationCodeModel { class ActivationCodeModel {
String mobileNumber;
String zipCode;
int channel; int channel;
int languageID; int languageID;
double versionID; double versionID;
int memberID; int memberID;
String password;
int facilityId; int facilityId;
String generalid; String generalid;
String otpSendType; String otpSendType;
ActivationCodeModel( ActivationCodeModel(
{this.mobileNumber, {this.channel,
this.zipCode,
this.channel,
this.languageID, this.languageID,
this.versionID, this.versionID,
this.memberID, this.memberID,
this.password,
this.facilityId, this.facilityId,
this.otpSendType, this.otpSendType,
this.generalid}); this.generalid});
ActivationCodeModel.fromJson(Map<String, dynamic> json) { ActivationCodeModel.fromJson(Map<String, dynamic> json) {
mobileNumber = json['MobileNumber'];
zipCode = json['ZipCode'];
channel = json['Channel']; channel = json['Channel'];
languageID = json['LanguageID']; languageID = json['LanguageID'];
versionID = json['VersionID']; versionID = json['VersionID'];
memberID = json['MemberID']; memberID = json['MemberID'];
password = json['Password'];
facilityId = json['facilityId']; facilityId = json['facilityId'];
otpSendType = json['OTP_SendType']; otpSendType = json['OTP_SendType'];
generalid = json['generalid']; generalid = json['generalid'];
@ -36,13 +28,10 @@ class ActivationCodeModel {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['MobileNumber'] = this.mobileNumber;
data['ZipCode'] = this.zipCode;
data['Channel'] = this.channel; data['Channel'] = this.channel;
data['LanguageID'] = this.languageID; data['LanguageID'] = this.languageID;
data['VersionID'] = this.versionID; data['VersionID'] = this.versionID;
data['MemberID'] = this.memberID; data['MemberID'] = this.memberID;
data['Password'] = this.password;
data['facilityId'] = this.facilityId; data['facilityId'] = this.facilityId;
data['OTP_SendType'] = otpSendType; data['OTP_SendType'] = otpSendType;
data['generalid'] = this.generalid; data['generalid'] = this.generalid;

@ -55,8 +55,6 @@ class ActivationCodeForVerificationScreenModel {
data['facilityId'] = this.facilityId; data['facilityId'] = this.facilityId;
data['generalid'] = this.generalid; data['generalid'] = this.generalid;
data['IsMobileFingerPrint'] = this.isMobileFingerPrint; data['IsMobileFingerPrint'] = this.isMobileFingerPrint;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['IMEI'] = this.iMEI; data['IMEI'] = this.iMEI;
return data; return data;
} }

@ -5,11 +5,16 @@ class CheckActivationCodeForDoctorAppResponseModel {
List<ListDoctorsClinic> listDoctorsClinic; List<ListDoctorsClinic> listDoctorsClinic;
List<DoctorProfileModel> listDoctorProfile; List<DoctorProfileModel> listDoctorProfile;
MemberInformation memberInformation; MemberInformation memberInformation;
String vidaAuthTokenID;
String vidaRefreshTokenID;
CheckActivationCodeForDoctorAppResponseModel( CheckActivationCodeForDoctorAppResponseModel(
{this.authenticationTokenID, {this.authenticationTokenID,
this.listDoctorsClinic, this.listDoctorsClinic,
this.memberInformation}); this.memberInformation,
this.listDoctorProfile,
this.vidaAuthTokenID,
this.vidaRefreshTokenID});
CheckActivationCodeForDoctorAppResponseModel.fromJson( CheckActivationCodeForDoctorAppResponseModel.fromJson(
Map<String, dynamic> json) { Map<String, dynamic> json) {
@ -27,6 +32,8 @@ class CheckActivationCodeForDoctorAppResponseModel {
listDoctorProfile.add(new DoctorProfileModel.fromJson(v)); listDoctorProfile.add(new DoctorProfileModel.fromJson(v));
}); });
} }
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
memberInformation = json['memberInformation'] != null memberInformation = json['memberInformation'] != null
? new MemberInformation.fromJson(json['memberInformation']) ? new MemberInformation.fromJson(json['memberInformation'])
@ -60,12 +67,13 @@ class ListDoctorsClinic {
bool isActive; bool isActive;
String clinicName; String clinicName;
ListDoctorsClinic({this.setupID, ListDoctorsClinic(
this.projectID, {this.setupID,
this.doctorID, this.projectID,
this.clinicID, this.doctorID,
this.isActive, this.clinicID,
this.clinicName}); this.isActive,
this.clinicName});
ListDoctorsClinic.fromJson(Map<String, dynamic> json) { ListDoctorsClinic.fromJson(Map<String, dynamic> json) {
setupID = json['SetupID']; setupID = json['SetupID'];
@ -99,15 +107,16 @@ class MemberInformation {
String preferredLanguage; String preferredLanguage;
List<Roles> roles; List<Roles> roles;
MemberInformation({this.clinics, MemberInformation(
this.doctorId, {this.clinics,
this.email, this.doctorId,
this.employeeId, this.email,
this.memberId, this.employeeId,
this.memberName, this.memberId,
this.memberNameArabic, this.memberName,
this.preferredLanguage, this.memberNameArabic,
this.roles}); this.preferredLanguage,
this.roles});
MemberInformation.fromJson(Map<String, dynamic> json) { MemberInformation.fromJson(Map<String, dynamic> json) {
if (json['clinics'] != null) { if (json['clinics'] != null) {

@ -2,6 +2,9 @@ class CheckActivationCodeRequestModel {
String mobileNumber; String mobileNumber;
String zipCode; String zipCode;
int doctorID; int doctorID;
int memberID;
String password;
String facilityId;
String iPAdress; String iPAdress;
int channel; int channel;
int languageID; int languageID;
@ -12,6 +15,8 @@ class CheckActivationCodeRequestModel {
String activationCode; String activationCode;
String vidaAuthTokenID; String vidaAuthTokenID;
String vidaRefreshTokenID; String vidaRefreshTokenID;
String iMEI;
bool isForSilentLogin;
int oTPSendType; int oTPSendType;
CheckActivationCodeRequestModel( CheckActivationCodeRequestModel(
{this.mobileNumber, {this.mobileNumber,
@ -27,7 +32,7 @@ class CheckActivationCodeRequestModel {
this.activationCode, this.activationCode,
this.vidaAuthTokenID, this.vidaAuthTokenID,
this.vidaRefreshTokenID, this.vidaRefreshTokenID,
this.oTPSendType}); this.oTPSendType,this.password,this.facilityId,this.memberID,this.isForSilentLogin=false,this.iMEI});
CheckActivationCodeRequestModel.fromJson(Map<String, dynamic> json) { CheckActivationCodeRequestModel.fromJson(Map<String, dynamic> json) {
mobileNumber = json['MobileNumber']; mobileNumber = json['MobileNumber'];
@ -62,6 +67,11 @@ class CheckActivationCodeRequestModel {
data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['OTP_SendType'] = this.oTPSendType; 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; return data;
} }
} }

@ -1,22 +1,16 @@
import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart'; import 'package:firebase_analytics/observer.dart';
import 'package:flutter/cupertino.dart';
class AnalyticsService { class AnalyticsService {
final FirebaseAnalytics _analytics = FirebaseAnalytics(); final FirebaseAnalytics _analytics = FirebaseAnalytics();
FirebaseAnalyticsObserver getAnalyticsObserver() => FirebaseAnalyticsObserver getAnalyticsObserver() => FirebaseAnalyticsObserver(analytics: _analytics);
FirebaseAnalyticsObserver(analytics: _analytics);
Future logEvent( Future logEvent({@required String eventCategory, @required String eventAction}) async {
{String eventCategory,
String eventLabel,
String eventAction,
String eventValue}) async {
await _analytics.logEvent(name: 'event', parameters: { await _analytics.logEvent(name: 'event', parameters: {
"eventCategory": eventCategory, "eventCategory": eventCategory,
"eventLabel": eventLabel,
"eventAction": eventAction, "eventAction": eventAction,
"eventValue": eventValue
}); });
} }
} }

@ -70,35 +70,25 @@ class AuthenticationViewModel extends BaseViewModel {
bool isLogin = false; bool isLogin = false;
bool unverified = false; bool unverified = false;
bool isFromLogin = false; bool isFromLogin = false;
APP_STATUS app_status = APP_STATUS.LOADING; APP_STATUS appStatus = APP_STATUS.LOADING;
String localToken ="";
AuthenticationViewModel({bool checkDeviceInfo = false}) { AuthenticationViewModel({bool checkDeviceInfo = false}) {
getDeviceInfoFromFirebase(); getDeviceInfoFromFirebase();
getDoctorProfile(); 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 /// Insert Device IMEI
Future insertDeviceImei() async { Future insertDeviceImei(token) async {
var loggedIn = await sharedPref.getObj(LOGGED_IN_USER); var loggedIn = await sharedPref.getObj(LOGGED_IN_USER);
var user = await sharedPref.getObj(LAST_LOGIN_USER); var data = await sharedPref.getObj(LAST_LOGIN_USER);
if (user != null) { if (data != null) {
user = GetIMEIDetailsModel.fromJson(user); user = GetIMEIDetailsModel.fromJson(data);
} }
var profileInfo = await sharedPref.getObj(DOCTOR_PROFILE); var profileInfo = await sharedPref.getObj(DOCTOR_PROFILE);
profileInfo['IMEI'] = DEVICE_TOKEN; profileInfo['IMEI'] = token;
profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE); profileInfo['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE);
profileInfo['BioMetricEnabled'] = true; profileInfo['BioMetricEnabled'] = true;
profileInfo['MobileNo'] = profileInfo['MobileNo'] =
@ -115,9 +105,8 @@ class AuthenticationViewModel extends BaseViewModel {
: user.doctorID; : user.doctorID;
insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA;
insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
insertIMEIDetailsModel.vidaRefreshTokenID = insertIMEIDetailsModel.vidaRefreshTokenID =await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); insertIMEIDetailsModel.password = userInfo.password;
insertIMEIDetailsModel.password = await sharedPref.getString(PASSWORD);
await _authService.insertDeviceImei(insertIMEIDetailsModel); await _authService.insertDeviceImei(insertIMEIDetailsModel);
if (_authService.hasError) { if (_authService.hasError) {
@ -174,21 +163,22 @@ class AuthenticationViewModel extends BaseViewModel {
ActivationCodeModel activationCodeModel = ActivationCodeModel( ActivationCodeModel activationCodeModel = ActivationCodeModel(
facilityId: projectID, facilityId: projectID,
memberID: loggedUser.listMemberInformation[0].memberID, memberID: loggedUser.listMemberInformation[0].memberID,
zipCode: loggedUser.zipCode,
mobileNumber: loggedUser.mobileNumber,
otpSendType: authMethodType.getTypeIdService().toString(), otpSendType: authMethodType.getTypeIdService().toString(),
password: password); );
await _authService.sendActivationCodeForDoctorApp(activationCodeModel); await _authService.sendActivationCodeForDoctorApp(activationCodeModel);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else {
await sharedPref.setString(LOGIN_TOKEN_ID,
_authService.activationCodeForDoctorAppRes.logInTokenID);
setState(ViewState.Idle); setState(ViewState.Idle);
}
} }
/// check activation code for sms and whats app /// check activation code for sms and whats app
Future checkActivationCodeForDoctorApp({String activationCode}) async { Future checkActivationCodeForDoctorApp({String activationCode,bool isSilentLogin = false}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = CheckActivationCodeRequestModel checkActivationCodeForDoctorApp =
new CheckActivationCodeRequestModel( new CheckActivationCodeRequestModel(
@ -201,13 +191,19 @@ class AuthenticationViewModel extends BaseViewModel {
: user.projectID, : user.projectID,
logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID),
activationCode: activationCode ?? '0000', 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), oTPSendType: await sharedPref.getInt(OTP_TYPE),
iMEI: localToken,
isForSilentLogin:isSilentLogin,
generalid: "Cs2020@2016\$2958"); generalid: "Cs2020@2016\$2958");
await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
await setDataAfterSendActivationSuccess(checkActivationCodeForDoctorAppRes);
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
@ -253,15 +249,14 @@ class AuthenticationViewModel extends BaseViewModel {
} }
/// add  token to shared preferences in case of send activation code is success /// add  token to shared preferences in case of send activation code is success
setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) { setDataAfterSendActivationSuccess(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel)async {
print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode);
// DrAppToastMsg.showSuccesToast("mosa_VerificationCode_ : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); await sharedPref.setString(VIDA_AUTH_TOKEN_ID,
sharedPref.setString(VIDA_AUTH_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID);
sharedPref.setString(VIDA_REFRESH_TOKEN_ID, await sharedPref.setString(VIDA_REFRESH_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID); sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID);
sharedPref.setString(LOGIN_TOKEN_ID, await sharedPref.setString(LOGIN_TOKEN_ID,
sendActivationCodeForDoctorAppResponseModel.logInTokenID); sendActivationCodeForDoctorAppResponseModel.authenticationTokenID);
} }
saveObjToString(String key, value) async { saveObjToString(String key, value) async {
@ -312,7 +307,7 @@ class AuthenticationViewModel extends BaseViewModel {
} }
/// add some logic in case of check activation code is success /// add some logic in case of check activation code is success
onCheckActivationCodeSuccess() async { onCheckActivationCodeSuccess({bool isSilentLogin = false}) async {
sharedPref.setString( sharedPref.setString(
TOKEN, TOKEN,
checkActivationCodeForDoctorAppRes.authenticationTokenID); checkActivationCodeForDoctorAppRes.authenticationTokenID);
@ -359,17 +354,12 @@ class AuthenticationViewModel extends BaseViewModel {
if (Platform.isIOS) { if (Platform.isIOS) {
_firebaseMessaging.requestNotificationPermissions(); _firebaseMessaging.requestNotificationPermissions();
} }
try {
setState(ViewState.Busy); setState(ViewState.Busy);
} catch (e) {
Helpers.showErrorToast("fdfdfdfdf"+e.toString());
}
var token = await _firebaseMessaging.getToken(); var token = await _firebaseMessaging.getToken();
if (DEVICE_TOKEN == "") { if (localToken == "") {
DEVICE_TOKEN = token; localToken = token;
await _authService.selectDeviceImei(DEVICE_TOKEN); await _authService.selectDeviceImei(localToken);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -378,6 +368,10 @@ class AuthenticationViewModel extends BaseViewModel {
user =_authService.dashboardItemsList[0]; user =_authService.dashboardItemsList[0];
sharedPref.setObj( sharedPref.setObj(
LAST_LOGIN_USER, _authService.dashboardItemsList[0]); 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; this.unverified = true;
} }
setState(ViewState.Idle); setState(ViewState.Idle);
@ -390,22 +384,22 @@ class AuthenticationViewModel extends BaseViewModel {
/// determine the status of the app /// determine the status of the app
APP_STATUS get status { APP_STATUS get status {
if (state == ViewState.Busy) { if (state == ViewState.Busy) {
app_status = APP_STATUS.LOADING; appStatus = APP_STATUS.LOADING;
} else { } else {
if(this.doctorProfile !=null) if(this.doctorProfile !=null)
app_status = APP_STATUS.AUTHENTICATED; appStatus = APP_STATUS.AUTHENTICATED;
else if (this.unverified) { else if (this.unverified) {
app_status = APP_STATUS.UNVERIFIED; appStatus = APP_STATUS.UNVERIFIED;
} else if (this.isLogin) { } else if (this.isLogin) {
app_status = APP_STATUS.AUTHENTICATED; appStatus = APP_STATUS.AUTHENTICATED;
} else { } else {
app_status = APP_STATUS.UNAUTHENTICATED; appStatus = APP_STATUS.UNAUTHENTICATED;
} }
} }
return app_status; return appStatus;
} }
setAppStatus(APP_STATUS status){ setAppStatus(APP_STATUS status){
this.app_status = status; this.appStatus = status;
notifyListeners(); notifyListeners();
} }
@ -419,7 +413,7 @@ class AuthenticationViewModel extends BaseViewModel {
logout({bool isFromLogin = false}) async { logout({bool isFromLogin = false}) async {
DEVICE_TOKEN = ""; localToken = "";
String lang = await sharedPref.getString(APP_Language); String lang = await sharedPref.getString(APP_Language);
await Helpers.clearSharedPref(); await Helpers.clearSharedPref();
doctorProfile = null; doctorProfile = null;
@ -427,7 +421,7 @@ class AuthenticationViewModel extends BaseViewModel {
deleteUser(); deleteUser();
await getDeviceInfoFromFirebase(); await getDeviceInfoFromFirebase();
this.isFromLogin = isFromLogin; this.isFromLogin = isFromLogin;
app_status = APP_STATUS.UNAUTHENTICATED; appStatus = APP_STATUS.UNAUTHENTICATED;
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -44,8 +44,8 @@ class DashboardViewModel extends BaseViewModel {
_firebaseMessaging.getToken().then((String token) async { _firebaseMessaging.getToken().then((String token) async {
if (token != '') { if (token != '') {
DEVICE_TOKEN = token; // DEVICE_TOKEN = token;
authProvider.insertDeviceImei(); authProvider.insertDeviceImei(token);
} }
}); });
} }

@ -35,8 +35,7 @@ class MyApp extends StatelessWidget {
SizeConfig().init(constraints, orientation); SizeConfig().init(constraints, orientation);
return MultiProvider( return MultiProvider(
providers: [ providers: [
ChangeNotifierProvider<AuthenticationViewModel>( ChangeNotifierProvider<AuthenticationViewModel>(create: (context) => AuthenticationViewModel()),
create: (context) => AuthenticationViewModel()),
ChangeNotifierProvider<ProjectViewModel>( ChangeNotifierProvider<ProjectViewModel>(
create: (context) => ProjectViewModel(), create: (context) => ProjectViewModel(),
), ),
@ -71,7 +70,7 @@ class MyApp extends StatelessWidget {
backgroundColor: Color.fromRGBO(255, 255, 255, 1), backgroundColor: Color.fromRGBO(255, 255, 255, 1),
), ),
navigatorKey: locator<NavigationService>().navigatorKey, navigatorKey: locator<NavigationService>().navigatorKey,
navigatorObservers:[ navigatorObservers: [
locator<AnalyticsService>().getAnalyticsObserver(), locator<AnalyticsService>().getAnalyticsObserver(),
], ],
initialRoute: INIT_ROUTE, initialRoute: INIT_ROUTE,

@ -6,15 +6,19 @@ class MySelectedAllergy {
String remark; String remark;
bool isChecked; bool isChecked;
bool isExpanded; bool isExpanded;
bool isLocal;
int createdBy; int createdBy;
bool hasValidationError;
MySelectedAllergy( MySelectedAllergy(
{this.selectedAllergySeverity, {this.selectedAllergySeverity,
this.selectedAllergy, this.selectedAllergy,
this.remark, this.remark,
this.isChecked, this.isChecked,
this.isExpanded = true, this.isExpanded = true,
this.createdBy}); this.isLocal = true,
this.createdBy,
this.hasValidationError = false});
MySelectedAllergy.fromJson(Map<String, dynamic> json) { MySelectedAllergy.fromJson(Map<String, dynamic> json) {
selectedAllergySeverity = json['selectedAllergySeverity'] != null selectedAllergySeverity = json['selectedAllergySeverity'] != null
@ -26,7 +30,9 @@ class MySelectedAllergy {
remark = json['remark']; remark = json['remark'];
isChecked = json['isChecked']; isChecked = json['isChecked'];
isExpanded = json['isExpanded']; isExpanded = json['isExpanded'];
isLocal = json['isLocal'];
createdBy = json['createdBy']; createdBy = json['createdBy'];
hasValidationError = json['hasValidationError'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -41,6 +47,8 @@ class MySelectedAllergy {
data['isChecked'] = this.isChecked; data['isChecked'] = this.isChecked;
data['isExpanded'] = this.isExpanded; data['isExpanded'] = this.isExpanded;
data['createdBy'] = this.createdBy; data['createdBy'] = this.createdBy;
data['isLocal'] = this.isLocal;
data['hasValidationError'] = this.hasValidationError;
return data; return data;
} }
} }

@ -1,22 +1,29 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedExamination { class MySelectedExamination {
MasterKeyModel selectedExamination; MasterKeyModel selectedExamination;
String remark; String remark;
bool isNormal; bool isNormal;
bool isAbnormal; bool isAbnormal;
bool notExamined; bool notExamined;
bool isNew; bool isNew;
bool isLocal;
int createdBy; int createdBy;
String createdOn;
String editedOn;
MySelectedExamination( MySelectedExamination({
{this.selectedExamination, this.selectedExamination,
this.remark, this.remark,
this.isNormal = false, this.isNormal = false,
this.isAbnormal = false, this.isAbnormal = false,
this.notExamined = true, this.notExamined = true,
this.isNew = true, this.isNew = true,
this.createdBy}); this.isLocal = true,
this.createdBy,
this.createdOn,
this.editedOn,
});
MySelectedExamination.fromJson(Map<String, dynamic> json) { MySelectedExamination.fromJson(Map<String, dynamic> json) {
selectedExamination = json['selectedExamination'] != null selectedExamination = json['selectedExamination'] != null
@ -28,6 +35,9 @@ class MySelectedExamination {
notExamined = json['notExamined']; notExamined = json['notExamined'];
isNew = json['isNew']; isNew = json['isNew'];
createdBy = json['createdBy']; createdBy = json['createdBy'];
createdOn = json['createdOn'];
editedOn = json['editedOn'];
isLocal = json['isLocal'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -42,6 +52,10 @@ class MySelectedExamination {
data['notExamined'] = this.notExamined; data['notExamined'] = this.notExamined;
data['isNew'] = this.isNew; data['isNew'] = this.isNew;
data['createdBy'] = this.createdBy; data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['editedOn'] = this.editedOn;
data['isLocal'] = this.isLocal;
return data; return data;
} }
} }

@ -4,9 +4,10 @@ class MySelectedHistory {
MasterKeyModel selectedHistory; MasterKeyModel selectedHistory;
String remark; String remark;
bool isChecked; bool isChecked;
bool isLocal;
MySelectedHistory( MySelectedHistory(
{ this.selectedHistory, this.remark, this.isChecked}); { this.selectedHistory, this.remark, this.isChecked, this.isLocal = true});
MySelectedHistory.fromJson(Map<String, dynamic> json) { MySelectedHistory.fromJson(Map<String, dynamic> json) {
@ -15,6 +16,7 @@ class MySelectedHistory {
: null; : null;
remark = json['remark']; remark = json['remark'];
remark = json['isChecked']; remark = json['isChecked'];
isLocal = json['isLocal'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -25,6 +27,7 @@ class MySelectedHistory {
} }
data['remark'] = this.remark; data['remark'] = this.remark;
data['isChecked'] = this.remark; data['isChecked'] = this.remark;
data['isLocal'] = this.isLocal;
return data; return data;
} }
} }

@ -432,8 +432,7 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
Helpers.showErrorToast(authenticationViewModel.error); Helpers.showErrorToast(authenticationViewModel.error);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} else { } else {
authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeForDoctorAppRes);
sharedPref.setString(PASSWORD, authenticationViewModel.userInfo.password);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
this.startSMSService(authMethodType); this.startSMSService(authMethodType);
} }
@ -454,13 +453,14 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(authenticationViewModel.error); Helpers.showErrorToast(authenticationViewModel.error);
} else { } else {
authenticationViewModel.setDataAfterSendActivationSuccess(authenticationViewModel.activationCodeVerificationScreenRes); await sharedPref.setString(LOGIN_TOKEN_ID,
authenticationViewModel.activationCodeVerificationScreenRes.logInTokenID);
if (authMethodType == AuthMethodTypes.SMS || if (authMethodType == AuthMethodTypes.SMS ||
authMethodType == AuthMethodTypes.WhatsApp) { authMethodType == AuthMethodTypes.WhatsApp) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
this.startSMSService(authMethodType); this.startSMSService(authMethodType);
} else { } else {
checkActivationCode(); checkActivationCode(isSilentLogin: true);
} }
} }
} }
@ -541,8 +541,8 @@ class _VerificationMethodsScreenState extends State<VerificationMethodsScreen> {
} }
} }
checkActivationCode({String value}) async { checkActivationCode({String value,bool isSilentLogin = false}) async {
await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value); await authenticationViewModel.checkActivationCodeForDoctorApp(activationCode: value,isSilentLogin: isSilentLogin);
if (authenticationViewModel.state == ViewState.ErrorLocal) { if (authenticationViewModel.state == ViewState.ErrorLocal) {
Navigator.pop(context); Navigator.pop(context);
Helpers.showErrorToast(authenticationViewModel.error); Helpers.showErrorToast(authenticationViewModel.error);

@ -56,7 +56,7 @@ class DoctorReplyScreen extends StatelessWidget {
DoctorReplayChat( DoctorReplayChat(
reply: reply, reply: reply,
previousModel: model, previousModel: model,
))); ), settings: RouteSettings(name: 'DoctorReplayChat'),));
}, },
child: DoctorReplyWidget(reply: reply), child: DoctorReplyWidget(reply: reply),
); );

@ -406,7 +406,8 @@ class _HomeScreenState extends State<HomeScreen> {
from: date, from: date,
to: date, to: date,
doctorID: doctorID:
authenticationViewModel.doctorProfile.doctorID)), authenticationViewModel.doctorProfile.doctorID),),
settings: RouteSettings(name: 'OutPatientsScreen'),
)); ));
}, },
)); ));
@ -423,6 +424,7 @@ class _HomeScreenState extends State<HomeScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => PatientReferralScreen(), builder: (context) => PatientReferralScreen(),
settings: RouteSettings(name: 'PatientReferralScreen'),
), ),
); );
}, },
@ -440,6 +442,7 @@ class _HomeScreenState extends State<HomeScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => PatientSearchScreen(), builder: (context) => PatientSearchScreen(),
settings: RouteSettings(name: 'PatientSearchScreen'),
)); ));
}, },
)); ));
@ -456,6 +459,7 @@ class _HomeScreenState extends State<HomeScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => MedicineSearchScreen(), builder: (context) => MedicineSearchScreen(),
settings: RouteSettings(name: 'MedicineSearchScreen'),
)); ));
}, },
)); ));

@ -184,7 +184,8 @@ class _EndCallScreenState extends State<EndCallScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
LivaCareTransferToAdmin(patient: patient))); LivaCareTransferToAdmin(patient: patient),
settings: RouteSettings(name: 'LivaCareTransferToAdmin'),),);
}, },
isInPatient: isInpatient, isInPatient: isInpatient,
isDartIcon: true, isDartIcon: true,

@ -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/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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.dart';
@ -27,9 +29,7 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
return BaseView<MedicalFileViewModel>( return BaseView<MedicalFileViewModel>(
onModelReady: (model) => model.getMedicalFile(mrn: patient.patientId), onModelReady: (model) => model.getMedicalFile(mrn: patient.patientId),
builder: builder: (BuildContext context, MedicalFileViewModel model, Widget child) => AppScaffold(
(BuildContext context, MedicalFileViewModel model, Widget child) =>
AppScaffold(
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient,
isInpatient: isInpatient, isInpatient: isInpatient,
@ -43,8 +43,7 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0),
child: Container( child: Container(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
@ -74,112 +73,68 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
), ),
), ),
), ),
(model.medicalFileList != null && (model.medicalFileList != null && model.medicalFileList.length != 0)
model.medicalFileList.length != 0)
? ListView.builder( ? ListView.builder(
//physics: , //physics: ,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
itemCount: model.medicalFileList[0].entityList[0] itemCount: model.medicalFileList[0].entityList[0].timelines.length,
.timelines.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
return InkWell( return InkWell(
onTap: () { onTap: () async {
if (model if (model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0]
.medicalFileList[0] .consulations.length !=
.entityList[0]
.timelines[index]
.timeLineEvents[0]
.consulations
.length !=
0) 0)
Navigator.push( await locator<AnalyticsService>().logEvent(
context, eventCategory: "Health Summary Page",
MaterialPageRoute( eventAction: "Health Summary Details",
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())),
); );
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( child: DoctorCard(
doctorName: model doctorName: model.medicalFileList[0].entityList[0].timelines[index].doctorName,
.medicalFileList[0] clinic: model.medicalFileList[0].entityList[0].timelines[index].clinicName,
.entityList[0] branch: model.medicalFileList[0].entityList[0].timelines[index].projectName,
.timelines[index] profileUrl: model.medicalFileList[0].entityList[0].timelines[index].doctorImage,
.doctorName, appointmentDate: AppDateUtils.getDateTimeFromServerFormat(
clinic: model.medicalFileList[0].entityList[0] model.medicalFileList[0].entityList[0].timelines[index].date,
.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, isPrescriptions: true,
isShowEye: model isShowEye: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0]
.medicalFileList[0] .consulations.length !=
.entityList[0]
.timelines[index]
.timeLineEvents[0]
.consulations
.length !=
0 0
? true ? true
: false), : false),
@ -195,8 +150,7 @@ class _HealthSummaryPageState extends State<HealthSummaryPage> {
Image.asset('assets/images/no-data.png'), Image.asset('assets/images/no-data.png'),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText(TranslationBase.of(context) child: AppText(TranslationBase.of(context).noMedicalFileFound),
.noMedicalFileFound),
) )
], ],
), ),

@ -226,7 +226,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
["ItemID"], ["ItemID"],
url: model.pharmacyItemsList[index] url: model.pharmacyItemsList[index]
["ImageSRCUrl"]), ["ImageSRCUrl"]),
), settings: RouteSettings(name: 'PharmaciesListScreen'),),
); );
}, },
); );

@ -1,6 +1,8 @@
import 'package:doctor_app_flutter/config/size_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/core/viewModel/InsuranceViewModel.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/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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approvals_details.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -92,11 +94,13 @@ class _InsuranceApprovalScreenNewState extends State<InsuranceApprovalScreenNew>
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => InsuranceApprovalsDetails( builder: (context) => InsuranceApprovalsDetails(
patient: patient, patient: patient,
indexInsurance: index, indexInsurance: index,
patientType: patientType, patientType: patientType,
)), ),
settings: RouteSettings(name: 'InsuranceApprovalsDetails'),
),
); );
}, },
child: DoctorCardInsurance( child: DoctorCardInsurance(
@ -175,15 +179,21 @@ class _InsuranceApprovalScreenNewState extends State<InsuranceApprovalScreenNew>
model.insuranceApproval.length, model.insuranceApproval.length,
(index) => Container( (index) => Container(
child: InkWell( child: InkWell(
onTap: () { onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Insurance Approval Screen New",
eventAction: "Insurance Approval Details",
);
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => InsuranceApprovalsDetails( builder: (context) => InsuranceApprovalsDetails(
patient: patient, patient: patient,
indexInsurance: index, indexInsurance: index,
patientType: patientType, patientType: patientType,
)), ),
settings: RouteSettings(name: 'InsuranceApprovalsDetails'),
),
); );
}, },
child: DoctorCardInsurance( child: DoctorCardInsurance(

@ -223,7 +223,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
builder: (BuildContext context) => FilterDatePage( builder: (BuildContext context) => FilterDatePage(
outPatientFilterType: outPatientFilterType, outPatientFilterType: outPatientFilterType,
patientSearchViewModel: model, patientSearchViewModel: model,
))); ),settings: RouteSettings(name: 'FilterOutPatentDateScreen'),));
}, },
), ),
onChanged: (String str) { onChanged: (String str) {

@ -208,6 +208,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
searchKey: patientFileInfoController.text, searchKey: patientFileInfoController.text,
isInpatient: false, isInpatient: false,
), ),
settings: RouteSettings(name: 'PatientsSearchResultScreen'),
), ),
); );
} }

@ -1,8 +1,10 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.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/patient-admission-request-viewmodel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
@ -23,12 +25,10 @@ import '../../../../routes.dart';
class AdmissionRequestFirstScreen extends StatefulWidget { class AdmissionRequestFirstScreen extends StatefulWidget {
@override @override
_AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState();
_AdmissionRequestThirdScreenState();
} }
class _AdmissionRequestThirdScreenState class _AdmissionRequestThirdScreenState extends State<AdmissionRequestFirstScreen> {
extends State<AdmissionRequestFirstScreen> {
final _dietTypeRemarksController = TextEditingController(); final _dietTypeRemarksController = TextEditingController();
final _sickLeaveCommentsController = TextEditingController(); final _sickLeaveCommentsController = TextEditingController();
final _postMedicalHistoryController = TextEditingController(); final _postMedicalHistoryController = TextEditingController();
@ -61,8 +61,7 @@ class _AdmissionRequestThirdScreenState
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(patient),
patient),
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {
@ -100,14 +99,12 @@ class _AdmissionRequestThirdScreenState
), ),
), ),
Container( Container(
margin: margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
EdgeInsets.symmetric(vertical: 0, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).specialityAndDoctorDetail,
.specialityAndDoctorDetail,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -121,14 +118,15 @@ class _AdmissionRequestThirdScreenState
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: clinicError, validationError: clinicError,
dropDownText: _selectedClinic != null dropDownText: _selectedClinic != null
? projectViewModel.isArabic? _selectedClinic['clinicNameArabic'] : _selectedClinic['clinicNameEnglish'] ? projectViewModel.isArabic
? _selectedClinic['clinicNameArabic']
: _selectedClinic['clinicNameEnglish']
: null, : null,
enabled: false, enabled: false,
onClick: model.clinicList != null && onClick: model.clinicList != null && model.clinicList.length > 0
model.clinicList.length > 0
? () { ? () {
openListDialogField( openListDialogField(
projectViewModel.isArabic? 'clinicNameArabic' : 'clinicNameEnglish', projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish',
'clinicID', 'clinicID',
model.clinicList, (selectedValue) { model.clinicList, (selectedValue) {
setState(() { setState(() {
@ -137,28 +135,21 @@ class _AdmissionRequestThirdScreenState
}); });
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context); await model.getClinics().then((_) => GifLoaderDialogUtils.hideDialog(context));
await model.getClinics().then((_) => if (model.state == ViewState.Idle && model.clinicList.length > 0) {
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle &&
model.clinicList.length > 0) {
openListDialogField( openListDialogField(
projectViewModel.isArabic? 'clinicNameArabic' : 'clinicNameEnglish', projectViewModel.isArabic ? 'clinicNameArabic' : 'clinicNameEnglish',
'clinicID', 'clinicID',
model.clinicList, (selectedValue) { model.clinicList, (selectedValue) {
setState(() { setState(() {
_selectedClinic = selectedValue; _selectedClinic = selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error);
DrAppToastMsg.showErrorToast(
model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -169,17 +160,13 @@ class _AdmissionRequestThirdScreenState
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor, hintText: TranslationBase.of(context).doctor,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
dropDownText: _selectedDoctor != null dropDownText: _selectedDoctor != null ? _selectedDoctor['DoctorName'] : null,
? _selectedDoctor['DoctorName']
: null,
enabled: false, enabled: false,
validationError: doctorError, validationError: doctorError,
onClick: _selectedClinic != null onClick: _selectedClinic != null
? model.doctorsList != null && ? model.doctorsList != null && model.doctorsList.length > 0
model.doctorsList.length > 0
? () { ? () {
openListDialogField('DoctorName', openListDialogField('DoctorName', 'DoctorID', model.doctorsList,
'DoctorID', model.doctorsList,
(selectedValue) { (selectedValue) {
setState(() { setState(() {
_selectedDoctor = selectedValue; _selectedDoctor = selectedValue;
@ -187,29 +174,21 @@ class _AdmissionRequestThirdScreenState
}); });
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context);
await model await model
.getClinicDoctors( .getClinicDoctors(_selectedClinic['clinicID'])
_selectedClinic['clinicID']) .then((_) => GifLoaderDialogUtils.hideDialog(context));
.then((_) => GifLoaderDialogUtils if (model.state == ViewState.Idle && model.doctorsList.length > 0) {
.hideDialog(context)); openListDialogField('DoctorName', 'DoctorID', model.doctorsList,
if (model.state == ViewState.Idle &&
model.doctorsList.length > 0) {
openListDialogField('DoctorName',
'DoctorID', model.doctorsList,
(selectedValue) { (selectedValue) {
setState(() { setState(() {
_selectedDoctor = selectedValue; _selectedDoctor = selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error);
DrAppToastMsg.showErrorToast(
model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
} }
: null, : null,
@ -226,7 +205,7 @@ class _AdmissionRequestThirdScreenState
SizedBox( SizedBox(
height: 10, height: 10,
), ),
if(patient.gender != 1) if (patient.gender != 1)
CheckboxListTile( CheckboxListTile(
title: AppText( title: AppText(
TranslationBase.of(context).patientPregnant, TranslationBase.of(context).patientPregnant,
@ -262,8 +241,7 @@ class _AdmissionRequestThirdScreenState
contentPadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0),
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).sickLeaveComments,
TranslationBase.of(context).sickLeaveComments,
controller: _sickLeaveCommentsController, controller: _sickLeaveCommentsController,
minLines: 2, minLines: 2,
maxLines: 4, maxLines: 4,
@ -278,43 +256,31 @@ class _AdmissionRequestThirdScreenState
hintText: TranslationBase.of(context).dietType, hintText: TranslationBase.of(context).dietType,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: dietTypeError, validationError: dietTypeError,
dropDownText: _selectedDietType != null dropDownText: _selectedDietType != null ? _selectedDietType['nameEn'] : null,
? _selectedDietType['nameEn']
: null,
enabled: false, enabled: false,
onClick: model.dietTypesList != null && onClick: model.dietTypesList != null && model.dietTypesList.length > 0
model.dietTypesList.length > 0
? () { ? () {
openListDialogField( openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) {
'nameEn', 'id', model.dietTypesList,
(selectedValue) {
setState(() { setState(() {
_selectedDietType = selectedValue; _selectedDietType = selectedValue;
}); });
}); });
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context); await model
await model.getDietTypes(patient.patientId).then((_) => .getDietTypes(patient.patientId)
GifLoaderDialogUtils.hideDialog( .then((_) => GifLoaderDialogUtils.hideDialog(context));
context)); if (model.state == ViewState.Idle && model.dietTypesList.length > 0) {
if (model.state == ViewState.Idle && openListDialogField('nameEn', 'id', model.dietTypesList, (selectedValue) {
model.dietTypesList.length > 0) {
openListDialogField(
'nameEn', 'id', model.dietTypesList,
(selectedValue) {
setState(() { setState(() {
_selectedDietType = selectedValue; _selectedDietType = selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error);
DrAppToastMsg.showErrorToast(
model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -322,8 +288,7 @@ class _AdmissionRequestThirdScreenState
height: 10, height: 10,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).dietTypeRemarks,
TranslationBase.of(context).dietTypeRemarks,
controller: _dietTypeRemarksController, controller: _dietTypeRemarksController,
minLines: 4, minLines: 4,
maxLines: 6, maxLines: 6,
@ -363,82 +328,71 @@ class _AdmissionRequestThirdScreenState
child: AppButton( child: AppButton(
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
color: HexColor("#D02127"), color: HexColor("#D02127"),
onPressed: () { onPressed: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Admission Request First Screen",
eventAction: "Go To Admission Request Two",
);
model.admissionRequestData = AdmissionRequest(); model.admissionRequestData = AdmissionRequest();
if (_selectedClinic != null && if (_selectedClinic != null &&
_selectedDoctor != null && _selectedDoctor != null &&
_sickLeaveCommentsController.text != "" && _sickLeaveCommentsController.text != "" &&
_postMedicalHistoryController.text != "" && _postMedicalHistoryController.text != "" &&
_postSurgicalHistoryController.text != "") { _postSurgicalHistoryController.text != "") {
model.admissionRequestData.patientMRN = model.admissionRequestData.patientMRN = patient.patientMRN;
patient.patientMRN; model.admissionRequestData.appointmentNo = patient.appointmentNo;
model.admissionRequestData.appointmentNo =
patient.appointmentNo;
model.admissionRequestData.episodeID = patient.episodeNo; model.admissionRequestData.episodeID = patient.episodeNo;
model.admissionRequestData.admissionRequestNo = 0; model.admissionRequestData.admissionRequestNo = 0;
model.admissionRequestData.admitToClinic = model.admissionRequestData.admitToClinic = _selectedClinic['clinicID'];
_selectedClinic['clinicID']; model.admissionRequestData.mrpDoctorID = _selectedDoctor['DoctorID'];
model.admissionRequestData.mrpDoctorID =
_selectedDoctor['DoctorID'];
model.admissionRequestData.isPregnant = _patientPregnant; model.admissionRequestData.isPregnant = _patientPregnant;
model.admissionRequestData.isSickLeaveRequired = model.admissionRequestData.isSickLeaveRequired = _isSickLeaveRequired;
_isSickLeaveRequired; model.admissionRequestData.sickLeaveComments = _sickLeaveCommentsController.text;
model.admissionRequestData.sickLeaveComments = model.admissionRequestData.isDietType = _selectedDietType != null ? true : false;
_sickLeaveCommentsController.text; model.admissionRequestData.dietType = _selectedDietType != null ? _selectedDietType['id'] : 0;
model.admissionRequestData.isDietType = model.admissionRequestData.dietRemarks = _dietTypeRemarksController.text;
_selectedDietType != null ? true : false; model.admissionRequestData.pastMedicalHistory = _postMedicalHistoryController.text;
model.admissionRequestData.dietType = model.admissionRequestData.pastSurgicalHistory = _postSurgicalHistoryController.text;
_selectedDietType != null Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {
? _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, 'patient': patient,
'patientType': patientType, 'patientType': patientType,
'arrivalType': arrivalType, 'arrivalType': arrivalType,
'admission-data': model.admissionRequestData 'admission-data': model.admissionRequestData
}); });
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill);
TranslationBase.of(context).pleaseFill);
setState(() { setState(() {
if(_selectedClinic == null){ if (_selectedClinic == null) {
clinicError = TranslationBase.of(context).fieldRequired; clinicError = TranslationBase.of(context).fieldRequired;
}else { } else {
clinicError = null; clinicError = null;
} }
if(_selectedDoctor == null){ if (_selectedDoctor == null) {
doctorError = TranslationBase.of(context).fieldRequired; doctorError = TranslationBase.of(context).fieldRequired;
}else { } else {
doctorError = null; doctorError = null;
} }
if(_sickLeaveCommentsController.text == ""){ if (_sickLeaveCommentsController.text == "") {
sickLeaveCommentError = TranslationBase.of(context).fieldRequired; sickLeaveCommentError = TranslationBase.of(context).fieldRequired;
}else { } else {
sickLeaveCommentError = null; sickLeaveCommentError = null;
} }
if(_selectedDietType == null){ if (_selectedDietType == null) {
dietTypeError = TranslationBase.of(context).fieldRequired; dietTypeError = TranslationBase.of(context).fieldRequired;
}else { } else {
dietTypeError = null; dietTypeError = null;
} }
if(_postMedicalHistoryController.text == ""){ if (_postMedicalHistoryController.text == "") {
medicalHistoryError = TranslationBase.of(context).fieldRequired; medicalHistoryError = TranslationBase.of(context).fieldRequired;
}else { } else {
medicalHistoryError = null; medicalHistoryError = null;
} }
if(_postSurgicalHistoryController.text == ""){ if (_postSurgicalHistoryController.text == "") {
surgicalHistoryError = TranslationBase.of(context).fieldRequired; surgicalHistoryError = TranslationBase.of(context).fieldRequired;
}else { } else {
surgicalHistoryError = null; surgicalHistoryError = null;
} }
}); });
@ -453,8 +407,8 @@ class _AdmissionRequestThirdScreenState
); );
} }
void openListDialogField(String attributeName, String attributeValueId, void openListDialogField(
List<dynamic> list, Function(dynamic selectedValue) okFunction) { String attributeName, String attributeValueId, List<dynamic> list, Function(dynamic selectedValue) okFunction) {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: list, list: list,
attributeName: attributeName, attributeName: attributeName,

@ -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/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.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/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/patient-admission-request-viewmodel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
@ -23,12 +25,10 @@ import '../../../../routes.dart';
class AdmissionRequestThirdScreen extends StatefulWidget { class AdmissionRequestThirdScreen extends StatefulWidget {
@override @override
_AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState createState() => _AdmissionRequestThirdScreenState();
_AdmissionRequestThirdScreenState();
} }
class _AdmissionRequestThirdScreenState class _AdmissionRequestThirdScreenState extends State<AdmissionRequestThirdScreen> {
extends State<AdmissionRequestThirdScreen> {
dynamic _selectedDiagnosis; dynamic _selectedDiagnosis;
dynamic _selectedIcd; dynamic _selectedIcd;
dynamic _selectedDiagnosisType; dynamic _selectedDiagnosisType;
@ -52,8 +52,7 @@ class _AdmissionRequestThirdScreenState
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(patient),
patient),
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {
@ -106,18 +105,13 @@ class _AdmissionRequestThirdScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).diagnosis, hintText: TranslationBase.of(context).diagnosis,
dropDownText: _selectedDiagnosis != null dropDownText: _selectedDiagnosis != null ? _selectedDiagnosis['nameEn'] : null,
? _selectedDiagnosis['nameEn']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: diagnosisError, validationError: diagnosisError,
onClick: model.diagnosisTypesList != null && onClick: model.diagnosisTypesList != null && model.diagnosisTypesList.length > 0
model.diagnosisTypesList.length > 0
? () { ? () {
openListDialogField('nameEn', 'id', openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) {
model.diagnosisTypesList,
(selectedValue) {
setState(() { setState(() {
_selectedDiagnosis = selectedValue; _selectedDiagnosis = selectedValue;
}); });
@ -125,24 +119,17 @@ class _AdmissionRequestThirdScreenState
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.getDiagnosis().then((_) => await model.getDiagnosis().then((_) => GifLoaderDialogUtils.hideDialog(context));
GifLoaderDialogUtils.hideDialog( if (model.state == ViewState.Idle && model.diagnosisTypesList.length > 0) {
context)); openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) {
if (model.state == ViewState.Idle &&
model.diagnosisTypesList.length > 0) {
openListDialogField('nameEn', 'id',
model.diagnosisTypesList,
(selectedValue) {
setState(() { setState(() {
_selectedDiagnosis = selectedValue; _selectedDiagnosis = selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -152,18 +139,13 @@ class _AdmissionRequestThirdScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).icd, hintText: TranslationBase.of(context).icd,
dropDownText: _selectedIcd != null dropDownText: _selectedIcd != null ? _selectedIcd['description'] : null,
? _selectedIcd['description']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: icdError, validationError: icdError,
onClick: model.icdCodes != null && onClick: model.icdCodes != null && model.icdCodes.length > 0
model.icdCodes.length > 0
? () { ? () {
openListDialogField( openListDialogField('description', 'code', model.icdCodes, (selectedValue) {
'description', 'code', model.icdCodes,
(selectedValue) {
setState(() { setState(() {
_selectedIcd = selectedValue; _selectedIcd = selectedValue;
}); });
@ -173,24 +155,17 @@ class _AdmissionRequestThirdScreenState
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model
.getICDCodes(patient.patientMRN) .getICDCodes(patient.patientMRN)
.then((_) => .then((_) => GifLoaderDialogUtils.hideDialog(context));
GifLoaderDialogUtils.hideDialog( if (model.state == ViewState.Idle && model.icdCodes.length > 0) {
context)); openListDialogField('description', 'code', model.icdCodes, (selectedValue) {
if (model.state == ViewState.Idle &&
model.icdCodes.length > 0) {
openListDialogField(
'description', 'code', model.icdCodes,
(selectedValue) {
setState(() { setState(() {
_selectedIcd = selectedValue; _selectedIcd = selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -200,19 +175,14 @@ class _AdmissionRequestThirdScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).diagnoseType, hintText: TranslationBase.of(context).diagnoseType,
dropDownText: _selectedDiagnosisType != null dropDownText: _selectedDiagnosisType != null ? _selectedDiagnosisType['description'] : null,
? _selectedDiagnosisType['description']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: diagnosisTypeError, validationError: diagnosisTypeError,
onClick: model.listOfDiagnosisSelectionTypes != onClick: model.listOfDiagnosisSelectionTypes != null &&
null && model.listOfDiagnosisSelectionTypes.length > 0
model.listOfDiagnosisSelectionTypes.length >
0
? () { ? () {
openListDialogField('description', 'code', openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes,
model.listOfDiagnosisSelectionTypes,
(selectedValue) { (selectedValue) {
setState(() { setState(() {
_selectedDiagnosisType = selectedValue; _selectedDiagnosisType = selectedValue;
@ -222,29 +192,20 @@ class _AdmissionRequestThirdScreenState
: () async { : () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model
.getMasterLookup(MasterKeysService .getMasterLookup(MasterKeysService.DiagnosisSelectionType)
.DiagnosisSelectionType) .then((_) => GifLoaderDialogUtils.hideDialog(context));
.then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.Idle && if (model.state == ViewState.Idle &&
model.listOfDiagnosisSelectionTypes model.listOfDiagnosisSelectionTypes.length > 0) {
.length > openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes,
0) {
openListDialogField('description', 'code',
model.listOfDiagnosisSelectionTypes,
(selectedValue) { (selectedValue) {
setState(() { setState(() {
_selectedDiagnosisType = _selectedDiagnosisType = selectedValue;
selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -279,58 +240,52 @@ class _AdmissionRequestThirdScreenState
title: TranslationBase.of(context).submit, title: TranslationBase.of(context).submit,
color: HexColor("#359846"), color: HexColor("#359846"),
onPressed: () async { onPressed: () async {
if (_selectedDiagnosis != null && await locator<AnalyticsService>().logEvent(
_selectedIcd != null && eventCategory: "Admission Request Third Screen",
_selectedDiagnosisType != null) { eventAction: "Submit Admission Request",
);
if (_selectedDiagnosis != null && _selectedIcd != null && _selectedDiagnosisType != null) {
model.admissionRequestData = admissionRequest; model.admissionRequestData = admissionRequest;
dynamic admissionRequestDiagnoses = [ dynamic admissionRequestDiagnoses = [
{ {
'diagnosisDescription': 'diagnosisDescription': _selectedDiagnosis['nameEn'],
_selectedDiagnosis['nameEn'],
'diagnosisType': _selectedDiagnosis['id'], 'diagnosisType': _selectedDiagnosis['id'],
'icdCode': _selectedIcd['code'], 'icdCode': _selectedIcd['code'],
'icdCodeDescription': 'icdCodeDescription': _selectedIcd['description'],
_selectedIcd['description'],
'type': _selectedDiagnosisType['code'], 'type': _selectedDiagnosisType['code'],
'remarks': "", 'remarks': "",
'isActive': true, 'isActive': true,
} }
]; ];
model.admissionRequestData model.admissionRequestData.admissionRequestDiagnoses = admissionRequestDiagnoses;
.admissionRequestDiagnoses =
admissionRequestDiagnoses;
await model.makeAdmissionRequest(); await model.makeAdmissionRequest();
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).admissionRequestSuccessMsg);
TranslationBase.of(context) Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE));
.admissionRequestSuccessMsg);
Navigator.popUntil(context,
ModalRoute.withName(PATIENTS_PROFILE));
} }
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill);
TranslationBase.of(context).pleaseFill);
setState(() { setState(() {
if(_selectedDiagnosis == null){ if (_selectedDiagnosis == null) {
diagnosisError = TranslationBase.of(context).fieldRequired; diagnosisError = TranslationBase.of(context).fieldRequired;
}else { } else {
diagnosisError = null; diagnosisError = null;
} }
if(_selectedIcd == null){ if (_selectedIcd == null) {
icdError = TranslationBase.of(context).fieldRequired; icdError = TranslationBase.of(context).fieldRequired;
}else { } else {
icdError = null; icdError = null;
} }
if(_selectedDiagnosisType == null){ if (_selectedDiagnosisType == null) {
diagnosisTypeError = TranslationBase.of(context).fieldRequired; diagnosisTypeError = TranslationBase.of(context).fieldRequired;
}else { } else {
diagnosisTypeError = null; diagnosisTypeError = null;
} }
}); });
@ -348,8 +303,8 @@ class _AdmissionRequestThirdScreenState
); );
} }
void openListDialogField(String attributeName, String attributeValueId, void openListDialogField(
List<dynamic> list, Function(dynamic selectedValue) okFunction) { String attributeName, String attributeValueId, List<dynamic> list, Function(dynamic selectedValue) okFunction) {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: list, list: list,
attributeName: attributeName, attributeName: attributeName,

@ -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/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.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/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/patient-admission-request-viewmodel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
@ -26,12 +28,10 @@ import '../../../../routes.dart';
class AdmissionRequestSecondScreen extends StatefulWidget { class AdmissionRequestSecondScreen extends StatefulWidget {
@override @override
_AdmissionRequestSecondScreenState createState() => _AdmissionRequestSecondScreenState createState() => _AdmissionRequestSecondScreenState();
_AdmissionRequestSecondScreenState();
} }
class _AdmissionRequestSecondScreenState class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScreen> {
extends State<AdmissionRequestSecondScreen> {
final _postPlansEstimatedCostController = TextEditingController(); final _postPlansEstimatedCostController = TextEditingController();
final _estimatedCostController = TextEditingController(); final _estimatedCostController = TextEditingController();
final _expectedDaysController = TextEditingController(); final _expectedDaysController = TextEditingController();
@ -74,8 +74,7 @@ class _AdmissionRequestSecondScreenState
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(patient),
patient),
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {
@ -112,14 +111,12 @@ class _AdmissionRequestSecondScreenState
), ),
), ),
Container( Container(
margin: margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
EdgeInsets.symmetric(vertical: 0, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).postPlansEstimatedCost,
.postPlansEstimatedCost,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -129,15 +126,11 @@ class _AdmissionRequestSecondScreenState
), ),
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: hintText: TranslationBase.of(context).estimatedCost,
TranslationBase.of(context).estimatedCost,
controller: _estimatedCostController, controller: _estimatedCostController,
validationError: costError, validationError: costError,
inputType: TextInputType.number, inputType: TextInputType.number,
inputFormatters: [ inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))],
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -154,10 +147,8 @@ class _AdmissionRequestSecondScreenState
height: 10, height: 10,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).otherDepartmentsInterventions,
.otherDepartmentsInterventions, controller: _otherDepartmentsInterventionsController,
controller:
_otherDepartmentsInterventionsController,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
validationError: otherInterventionsError, validationError: otherInterventionsError,
minLines: 2, minLines: 2,
@ -177,23 +168,18 @@ class _AdmissionRequestSecondScreenState
), ),
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: hintText: TranslationBase.of(context).expectedDays,
TranslationBase.of(context).expectedDays,
controller: _expectedDaysController, controller: _expectedDaysController,
validationError: expectedDaysError, validationError: expectedDaysError,
inputType: TextInputType.number, inputType: TextInputType.number,
inputFormatters: [ inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))],
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).expectedAdmissionDate,
.expectedAdmissionDate,
dropDownText: _expectedAdmissionDate != null dropDownText: _expectedAdmissionDate != null
? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" ? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}"
: null, : null,
@ -209,8 +195,7 @@ class _AdmissionRequestSecondScreenState
if (_expectedAdmissionDate == null) { if (_expectedAdmissionDate == null) {
_expectedAdmissionDate = DateTime.now(); _expectedAdmissionDate = DateTime.now();
} }
_selectDate(context, _expectedAdmissionDate, _selectDate(context, _expectedAdmissionDate, (picked) {
(picked) {
setState(() { setState(() {
_expectedAdmissionDate = picked; _expectedAdmissionDate = picked;
}); });
@ -223,47 +208,32 @@ class _AdmissionRequestSecondScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).floor, hintText: TranslationBase.of(context).floor,
dropDownText: _selectedFloor != null dropDownText: _selectedFloor != null ? _selectedFloor['description'] : null,
? _selectedFloor['description']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: floorError, validationError: floorError,
onClick: model.floorList != null && onClick: model.floorList != null && model.floorList.length > 0
model.floorList.length > 0
? () { ? () {
openListDialogField( openListDialogField('description', 'floorID', model.floorList, (selectedValue) {
'description',
'floorID',
model.floorList, (selectedValue) {
setState(() { setState(() {
_selectedFloor = selectedValue; _selectedFloor = selectedValue;
}); });
}); });
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context); await model.getFloors().then((_) => GifLoaderDialogUtils.hideDialog(context));
await model.getFloors().then((_) => if (model.state == ViewState.Idle && model.floorList.length > 0) {
GifLoaderDialogUtils.hideDialog( openListDialogField('description', 'floorID', model.floorList,
context)); (selectedValue) {
if (model.state == ViewState.Idle &&
model.floorList.length > 0) {
openListDialogField(
'description',
'floorID',
model.floorList, (selectedValue) {
setState(() { setState(() {
_selectedFloor = selectedValue; _selectedFloor = selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error);
DrAppToastMsg.showErrorToast(
model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -273,46 +243,32 @@ class _AdmissionRequestSecondScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).ward, hintText: TranslationBase.of(context).ward,
dropDownText: _selectedWard != null dropDownText: _selectedWard != null ? _selectedWard['description'] : null,
? _selectedWard['description']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
onClick: model.wardList != null && onClick: model.wardList != null && model.wardList.length > 0
model.wardList.length > 0
? () { ? () {
openListDialogField( openListDialogField('description', 'nursingStationID', model.wardList,
'description', (selectedValue) {
'nursingStationID',
model.wardList, (selectedValue) {
setState(() { setState(() {
_selectedWard = selectedValue; _selectedWard = selectedValue;
}); });
}); });
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context); await model.getWards().then((_) => GifLoaderDialogUtils.hideDialog(context));
await model.getWards().then((_) => if (model.state == ViewState.Idle && model.wardList.length > 0) {
GifLoaderDialogUtils.hideDialog( openListDialogField('description', 'nursingStationID', model.wardList,
context)); (selectedValue) {
if (model.state == ViewState.Idle &&
model.wardList.length > 0) {
openListDialogField(
'description',
'nursingStationID',
model.wardList, (selectedValue) {
setState(() { setState(() {
_selectedWard = selectedValue; _selectedWard = selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error);
DrAppToastMsg.showErrorToast(
model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -321,54 +277,37 @@ class _AdmissionRequestSecondScreenState
), ),
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: hintText: TranslationBase.of(context).roomCategory,
TranslationBase.of(context).roomCategory, dropDownText:
dropDownText: _selectedRoomCategory != null _selectedRoomCategory != null ? _selectedRoomCategory['description'] : null,
? _selectedRoomCategory['description']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: roomError, validationError: roomError,
onClick: model.roomCategoryList != null && onClick: model.roomCategoryList != null && model.roomCategoryList.length > 0
model.roomCategoryList.length > 0
? () { ? () {
openListDialogField( openListDialogField('description', 'categoryID', model.roomCategoryList,
'description',
'categoryID',
model.roomCategoryList,
(selectedValue) { (selectedValue) {
setState(() { setState(() {
_selectedRoomCategory = _selectedRoomCategory = selectedValue;
selectedValue;
}); });
}); });
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context); await model
await model.getRoomCategories().then( .getRoomCategories()
(_) => .then((_) => GifLoaderDialogUtils.hideDialog(context));
GifLoaderDialogUtils.hideDialog( if (model.state == ViewState.Idle && model.roomCategoryList.length > 0) {
context)); openListDialogField('description', 'categoryID', model.roomCategoryList,
if (model.state == ViewState.Idle &&
model.roomCategoryList.length > 0) {
openListDialogField(
'description',
'categoryID',
model.roomCategoryList,
(selectedValue) { (selectedValue) {
setState(() { setState(() {
_selectedRoomCategory = _selectedRoomCategory = selectedValue;
selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error);
DrAppToastMsg.showErrorToast(
model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -376,8 +315,7 @@ class _AdmissionRequestSecondScreenState
height: 10, height: 10,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).treatmentLine,
TranslationBase.of(context).treatmentLine,
controller: _treatmentLineController, controller: _treatmentLineController,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
validationError: treatmentsError, validationError: treatmentsError,
@ -388,8 +326,7 @@ class _AdmissionRequestSecondScreenState
height: 10, height: 10,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).complications,
TranslationBase.of(context).complications,
controller: _complicationsController, controller: _complicationsController,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
validationError: complicationsError, validationError: complicationsError,
@ -400,8 +337,7 @@ class _AdmissionRequestSecondScreenState
height: 10, height: 10,
), ),
AppTextFieldCustom( AppTextFieldCustom(
hintText: hintText: TranslationBase.of(context).otherProcedure,
TranslationBase.of(context).otherProcedure,
controller: _otherProceduresController, controller: _otherProceduresController,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
validationError: proceduresError, validationError: proceduresError,
@ -413,53 +349,34 @@ class _AdmissionRequestSecondScreenState
), ),
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: hintText: TranslationBase.of(context).admissionType,
TranslationBase.of(context).admissionType, dropDownText: _selectedAdmissionType != null ? _selectedAdmissionType['nameEn'] : null,
dropDownText: _selectedAdmissionType != null
? _selectedAdmissionType['nameEn']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: admissionTypeError, validationError: admissionTypeError,
onClick: model.admissionTypeList != null && onClick: model.admissionTypeList != null && model.admissionTypeList.length > 0
model.admissionTypeList.length > 0
? () { ? () {
openListDialogField('nameEn', 'id', openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) {
model.admissionTypeList,
(selectedValue) {
setState(() { setState(() {
_selectedAdmissionType = _selectedAdmissionType = selectedValue;
selectedValue;
}); });
}); });
} }
: () async { : () async {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context);
await model await model
.getMasterLookup(MasterKeysService .getMasterLookup(MasterKeysService.AdmissionRequestType)
.AdmissionRequestType) .then((_) => GifLoaderDialogUtils.hideDialog(context));
.then((_) => if (model.state == ViewState.Idle && model.admissionTypeList.length > 0) {
GifLoaderDialogUtils.hideDialog( openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) {
context));
if (model.state == ViewState.Idle &&
model.admissionTypeList.length >
0) {
openListDialogField('nameEn', 'id',
model.admissionTypeList,
(selectedValue) {
setState(() { setState(() {
_selectedAdmissionType = _selectedAdmissionType = selectedValue;
selectedValue;
}); });
}); });
} else if (model.state == } else if (model.state == ViewState.ErrorLocal) {
ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error);
DrAppToastMsg.showErrorToast(
model.error);
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Empty List");
"Empty List");
} }
}, },
), ),
@ -492,144 +409,115 @@ class _AdmissionRequestSecondScreenState
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
color: HexColor("#D02127"), color: HexColor("#D02127"),
onPressed: () async { onPressed: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Admission Request Second Screen",
eventAction: "Go To Admission Request Three",
);
if (_estimatedCostController.text != "" && if (_estimatedCostController.text != "" &&
_postPlansEstimatedCostController.text != "" && _postPlansEstimatedCostController.text != "" &&
_expectedDaysController.text != "" && _expectedDaysController.text != "" &&
_expectedAdmissionDate != null && _expectedAdmissionDate != null &&
_otherDepartmentsInterventionsController.text != _otherDepartmentsInterventionsController.text != "" &&
"" &&
_selectedFloor != null && _selectedFloor != null &&
_selectedRoomCategory != _selectedRoomCategory != null /*_selectedWard is not required*/ &&
null /*_selectedWard is not required*/ &&
_treatmentLineController.text != "" && _treatmentLineController.text != "" &&
_complicationsController.text != "" && _complicationsController.text != "" &&
_otherProceduresController.text != "" && _otherProceduresController.text != "" &&
_selectedAdmissionType != null) { _selectedAdmissionType != null) {
model.admissionRequestData = admissionRequest; model.admissionRequestData = admissionRequest;
model.admissionRequestData.estimatedCost = model.admissionRequestData.estimatedCost = int.parse(_estimatedCostController.text);
int.parse(_estimatedCostController.text); model.admissionRequestData.elementsForImprovement =
model.admissionRequestData
.elementsForImprovement =
_postPlansEstimatedCostController.text; _postPlansEstimatedCostController.text;
model.admissionRequestData.expectedDays = model.admissionRequestData.expectedDays = int.parse(_expectedDaysController.text);
int.parse(_expectedDaysController.text); model.admissionRequestData.admissionDate = _expectedAdmissionDate.toIso8601String();
model.admissionRequestData.admissionDate = model.admissionRequestData.otherDepartmentInterventions =
_expectedAdmissionDate.toIso8601String();
model.admissionRequestData
.otherDepartmentInterventions =
_otherDepartmentsInterventionsController.text; _otherDepartmentsInterventionsController.text;
model.admissionRequestData.admissionLocationID = model.admissionRequestData.admissionLocationID = _selectedFloor['floorID'];
_selectedFloor['floorID'];
model.admissionRequestData.wardID = model.admissionRequestData.wardID =
_selectedWard != null _selectedWard != null ? _selectedWard['nursingStationID'] : 0;
? _selectedWard['nursingStationID'] model.admissionRequestData.roomCategoryID = _selectedRoomCategory['categoryID'];
: 0;
model.admissionRequestData.roomCategoryID =
_selectedRoomCategory['categoryID'];
model.admissionRequestData model.admissionRequestData.admissionRequestProcedures = [];
.admissionRequestProcedures = [];
model.admissionRequestData.mainLineOfTreatment = model.admissionRequestData.mainLineOfTreatment = _treatmentLineController.text;
_treatmentLineController.text; model.admissionRequestData.complications = _complicationsController.text;
model.admissionRequestData.complications = model.admissionRequestData.otherProcedures = _otherProceduresController.text;
_complicationsController.text; model.admissionRequestData.admissionType = _selectedAdmissionType['id'];
model.admissionRequestData.otherProcedures =
_otherProceduresController.text;
model.admissionRequestData.admissionType =
_selectedAdmissionType['id'];
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {
PATIENT_ADMISSION_REQUEST_3, 'patient': patient,
arguments: { 'patientType': patientType,
'patient': patient, 'arrivalType': arrivalType,
'patientType': patientType, 'admission-data': model.admissionRequestData
'arrivalType': arrivalType, });
'admission-data': model.admissionRequestData
});
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill);
TranslationBase.of(context).pleaseFill);
setState(() { setState(() {
if (_estimatedCostController.text == "") { if (_estimatedCostController.text == "") {
costError = costError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
costError = null; costError = null;
} }
if (_postPlansEstimatedCostController.text == if (_postPlansEstimatedCostController.text == "") {
"") { plansError = TranslationBase.of(context).fieldRequired;
plansError =
TranslationBase.of(context).fieldRequired;
} else { } else {
plansError = null; plansError = null;
} }
if (_expectedDaysController.text == "") { if (_expectedDaysController.text == "") {
expectedDaysError = expectedDaysError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
expectedDaysError = null; expectedDaysError = null;
} }
if (_expectedAdmissionDate == null) { if (_expectedAdmissionDate == null) {
expectedDatesError = expectedDatesError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
expectedDatesError = null; expectedDatesError = null;
} }
if (_otherDepartmentsInterventionsController if (_otherDepartmentsInterventionsController.text == "") {
.text == otherInterventionsError = TranslationBase.of(context).fieldRequired;
"") {
otherInterventionsError =
TranslationBase.of(context).fieldRequired;
} else { } else {
otherInterventionsError = null; otherInterventionsError = null;
} }
if (_selectedFloor == null) { if (_selectedFloor == null) {
floorError = floorError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
floorError = null; floorError = null;
} }
if (_selectedRoomCategory == null) { if (_selectedRoomCategory == null) {
roomError = roomError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
roomError = null; roomError = null;
} }
if (_treatmentLineController.text == "") { if (_treatmentLineController.text == "") {
treatmentsError = treatmentsError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
treatmentsError = null; treatmentsError = null;
} }
if (_complicationsController.text == "") { if (_complicationsController.text == "") {
complicationsError = complicationsError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
complicationsError = null; complicationsError = null;
} }
if (_otherProceduresController.text == "") { if (_otherProceduresController.text == "") {
proceduresError = proceduresError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
proceduresError = null; proceduresError = null;
} }
if (_selectedAdmissionType == null) { if (_selectedAdmissionType == null) {
admissionTypeError = admissionTypeError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
admissionTypeError = null; admissionTypeError = null;
} }
@ -647,8 +535,7 @@ class _AdmissionRequestSecondScreenState
); );
} }
Future _selectDate(BuildContext context, DateTime dateTime, Future _selectDate(BuildContext context, DateTime dateTime, Function(DateTime picked) updateDate) async {
Function(DateTime picked) updateDate) async {
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(
context: context, context: context,
initialDate: dateTime, initialDate: dateTime,
@ -661,8 +548,8 @@ class _AdmissionRequestSecondScreenState
} }
} }
void openListDialogField(String attributeName, String attributeValueId, void openListDialogField(
List<dynamic> list, Function(dynamic selectedValue) okFunction) { String attributeName, String attributeValueId, List<dynamic> list, Function(dynamic selectedValue) okFunction) {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: list, list: list,
attributeName: attributeName, attributeName: attributeName,

@ -121,6 +121,7 @@ class _LabsHomePageState extends State<LabsHomePage> {
model: model, model: model,
procedureType: ProcedureType.LAB_RESULT, procedureType: ProcedureType.LAB_RESULT,
), ),
settings: RouteSettings(name: 'AddProcedureTabPage'),
), ),
); );
}, },

@ -1,8 +1,10 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/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/PatientMedicalReportViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_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/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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
@ -75,163 +77,168 @@ class _MedicalReportPageState extends State<MedicalReportPage> {
), ),
), ),
AddNewOrder( AddNewOrder(
onTap: () { onTap: () async {
// if (model.hasOnHold()) { // if (model.hasOnHold()) {
// Helpers.showErrorToast("Please Verified the on hold report to be able to add new one"); // Helpers.showErrorToast("Please Verified the on hold report to be able to add new one");
// } else // } else
await locator<AnalyticsService>().logEvent(
eventCategory: "Medical Report Page",
eventAction: "Add New Medical Report",
);
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddVerifyMedicalReport( builder: (context) => AddVerifyMedicalReport(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
model: model, model: model,
status: MedicalReportStatus.ADD, status: MedicalReportStatus.ADD,
)), ),
settings: RouteSettings(name: 'AddVerifyMedicalReport'),
),
); );
}, },
label: TranslationBase.of(context).createNewMedicalReport, label: TranslationBase.of(context).createNewMedicalReport,
), ),
// if (model.state != ViewState.ErrorLocal)ß // if (model.state != ViewState.ErrorLocal)ß
...List.generate( ...List.generate(
model.medicalReportList.length, model.medicalReportList.length,
(index) => InkWell( (index) => InkWell(
onTap: () { onTap: () {
if (model.medicalReportList[index].status == 1) { if (model.medicalReportList[index].status == 1) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddVerifyMedicalReport( builder: (context) => AddVerifyMedicalReport(
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
medicalReport: model.medicalReportList[index], medicalReport: model.medicalReportList[index],
model: model, model: model,
medicalNote: model.medicalReportList[index].reportDataHtml, 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,
),
],
), ),
], settings: RouteSettings(name: 'AddVerifyMedicalReport')),
), );
Row( } else {
crossAxisAlignment: CrossAxisAlignment.center, Navigator.of(context).pushNamed(PATIENT_MEDICAL_REPORT_DETAIL, arguments: {
children: [ 'patient': patient,
Container( 'patientType': patientType,
margin: EdgeInsets.only(left: 0, top: 4, right: 8, bottom: 0), 'arrivalType': arrivalType,
child: LargeAvatar( 'type': MedicalReportStatus.ADD,
name: projectViewModel.isArabic 'medicalReport': model.medicalReportList[index],
? model.medicalReportList[index].doctorNameN 'model': model,
: model.medicalReportList[index].doctorName, });
url: model.medicalReportList[index].doctorImageURL, }
},
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, AppText(
height: 50, projectViewModel.isArabic
), ? model.medicalReportList[index].doctorNameN ?? ""
Expanded( : model.medicalReportList[index].doctorName ?? "",
child: Container( fontSize: 1.9 * SizeConfig.textMultiplier,
child: Column( fontWeight: FontWeight.w700,
crossAxisAlignment: CrossAxisAlignment.start, color: Color(0xFF2E303A),
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),
),
],
),
), ),
],
)),
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( width: 50,
height: 50, height: 50,
),
Expanded(
child: Container(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon( AppText(
model.medicalReportList[index].status == 1 ? DoctorApp.edit_1 : EvaIcons.eye, 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( SizedBox(
height: 15, height: 15,
) )

@ -1,9 +1,11 @@
import 'package:doctor_app_flutter/core/model/note/note_model.dart'; 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/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/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_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/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/models/patient/progress_note_request.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.dart'; import 'package:doctor_app_flutter/screens/patients/profile/note/update_note.dart';
@ -43,8 +45,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
AuthenticationViewModel authenticationViewModel; AuthenticationViewModel authenticationViewModel;
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
getProgressNoteList(BuildContext context, PatientViewModel model, getProgressNoteList(BuildContext context, PatientViewModel model, {bool isLocalBusy = false}) async {
{bool isLocalBusy = false}) async {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
@ -59,10 +60,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
tokenID: token, tokenID: token,
patientTypeID: patient.patientType, patientTypeID: patient.patientType,
languageID: 2); languageID: 2);
model model.getPatientProgressNote(progressNoteRequest.toJson(), isLocalBusy: isLocalBusy).then((c) {
.getPatientProgressNote(progressNoteRequest.toJson(),
isLocalBusy: isLocalBusy)
.then((c) {
notesList = model.patientProgressNoteList; notesList = model.patientProgressNoteList;
}); });
} }
@ -71,170 +69,113 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
authenticationViewModel = Provider.of(context); authenticationViewModel = Provider.of(context);
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
final routeArgs = ModalRoute final routeArgs = ModalRoute.of(context).settings.arguments as Map;
.of(context)
.settings
.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
if (routeArgs.containsKey('isDischargedPatient')) if (routeArgs.containsKey('isDischargedPatient')) isDischargedPatient = routeArgs['isDischargedPatient'];
isDischargedPatient = routeArgs['isDischargedPatient'];
return BaseView<PatientViewModel>( return BaseView<PatientViewModel>(
onModelReady: (model) => getProgressNoteList(context, model), onModelReady: (model) => getProgressNoteList(context, model),
builder: (_, model, w) => builder: (_, model, w) => AppScaffold(
AppScaffold( baseViewModel: model,
baseViewModel: model, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
backgroundColor: Theme // appBarTitle: TranslationBase.of(context).progressNote,
.of(context) appBar: PatientProfileAppBar(
.scaffoldBackgroundColor, patient,
// appBarTitle: TranslationBase.of(context).progressNote, isInpatient: true,
appBar: PatientProfileAppBar( ),
patient, body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0
isInpatient: true, ? DrAppEmbeddedError(error: TranslationBase.of(context).errorNoProgressNote)
), : Container(
body: model.patientProgressNoteList == null || color: Colors.grey[200],
model.patientProgressNoteList.length == 0 child: Column(
? DrAppEmbeddedError( children: <Widget>[
error: TranslationBase if (!isDischargedPatient)
.of(context) AddNewOrder(
.errorNoProgressNote) onTap: () async {
: Container( await locator<AnalyticsService>().logEvent(
color: Colors.grey[200], eventCategory: "Progress Note Screen",
child: Column( eventAction: "Update Progress Note",
children: <Widget>[ );
if (!isDischargedPatient) Navigator.push(
AddNewOrder( context,
onTap: () { MaterialPageRoute(
Navigator.push( builder: (context) => UpdateNoteOrder(
context, patientModel: model,
MaterialPageRoute( patient: patient,
builder: (context) => visitType: widget.visitType,
UpdateNoteOrder( isUpdate: false,
patientModel: model, ),
patient: patient, settings: RouteSettings(name: 'UpdateNoteOrder'),
visitType: widget.visitType, ),
isUpdate: false, );
)), },
); label: widget.visitType == 3
}, ? TranslationBase.of(context).addNewOrderSheet
label: widget.visitType == 3 : TranslationBase.of(context).addProgressNote,
? TranslationBase ),
.of(context) Expanded(
.addNewOrderSheet child: Container(
: TranslationBase child: ListView.builder(
.of(context) itemCount: model.patientProgressNoteList.length,
.addProgressNote, itemBuilder: (BuildContext ctxt, int index) {
), return FractionallySizedBox(
Expanded( widthFactor: 0.95,
child: Container( child: CardWithBgWidget(
child: ListView.builder( hasBorder: false,
itemCount: model.patientProgressNoteList.length, bgColor: model.patientProgressNoteList[index].status == 1 &&
itemBuilder: (BuildContext ctxt, int index) { authenticationViewModel.doctorProfile.doctorID !=
return FractionallySizedBox( model.patientProgressNoteList[index].createdBy
widthFactor: 0.95, ? Color(0xFFCC9B14)
child: CardWithBgWidget( : model.patientProgressNoteList[index].status == 4
hasBorder: false, ? Colors.red.shade700
bgColor: model.patientProgressNoteList[index] : model.patientProgressNoteList[index].status == 2
.status == ? Colors.green[600]
1 && : Color(0xFFCC9B14),
authenticationViewModel.doctorProfile.doctorID != widget: Column(
model children: [
.patientProgressNoteList[ Column(
index] crossAxisAlignment: CrossAxisAlignment.start,
.createdBy children: [
? Color(0xFFCC9B14) if (model.patientProgressNoteList[index].status == 1 &&
: model.patientProgressNoteList[index] authenticationViewModel.doctorProfile.doctorID !=
.status == model.patientProgressNoteList[index].createdBy)
4 AppText(
? Colors.red.shade700 TranslationBase.of(context).notePending,
: model.patientProgressNoteList[index] fontWeight: FontWeight.bold,
.status == color: Color(0xFFCC9B14),
2 fontSize: 12,
? Colors.green[600] ),
: Color(0xFFCC9B14), if (model.patientProgressNoteList[index].status == 4)
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( AppText(
TranslationBase TranslationBase.of(context).noteCanceled,
.of(context)
.noteCanceled,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.red.shade700, color: Colors.red.shade700,
fontSize: 12, fontSize: 12,
), ),
if (model if (model.patientProgressNoteList[index].status == 2)
.patientProgressNoteList[
index]
.status ==
2)
AppText( AppText(
TranslationBase TranslationBase.of(context).noteVerified,
.of(context)
.noteVerified,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.green[600], color: Colors.green[600],
fontSize: 12, fontSize: 12,
), ),
if (model.patientProgressNoteList[index].status != 2 && if (model.patientProgressNoteList[index].status != 2 &&
model model.patientProgressNoteList[index].status != 4 &&
.patientProgressNoteList[ authenticationViewModel.doctorProfile.doctorID ==
index] model.patientProgressNoteList[index].createdBy)
.status !=
4 &&
authenticationViewModel
.doctorProfile.doctorID ==
model
.patientProgressNoteList[
index]
.createdBy)
Row( Row(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) => UpdateNoteOrder(
UpdateNoteOrder( note: model.patientProgressNoteList[index],
note: model patientModel: model,
.patientProgressNoteList[ patient: patient,
index], visitType: widget.visitType,
patientModel:
model,
patient:
patient,
visitType: widget
.visitType,
isUpdate: true, isUpdate: true,
)), )),
); );
@ -242,9 +183,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey[600], color: Colors.grey[600],
borderRadius: borderRadius: BorderRadius.circular(10),
BorderRadius.circular(
10),
), ),
// color:Colors.red[600], // color:Colors.red[600],
@ -259,10 +198,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2, width: 2,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).update,
.of(
context)
.update,
fontSize: 10, fontSize: 10,
color: Colors.white, color: Colors.white,
), ),
@ -280,61 +216,33 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
context: context, context: context,
actionName: "verify", actionName: "verify",
confirmFun: () async { confirmFun: () async {
GifLoaderDialogUtils GifLoaderDialogUtils.showMyDialog(context);
.showMyDialog( UpdateNoteReqModel reqModel = UpdateNoteReqModel(
context); admissionNo: int.parse(patient.admissionNo),
UpdateNoteReqModel cancelledNote: false,
reqModel = lineItemNo: model.patientProgressNoteList[index].lineItemNo,
UpdateNoteReqModel( createdBy: model.patientProgressNoteList[index].createdBy,
admissionNo: int notes: model.patientProgressNoteList[index].notes,
.parse(patient
.admissionNo),
cancelledNote:
false,
lineItemNo: model
.patientProgressNoteList[
index]
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: true, verifiedNote: true,
patientTypeID: patientTypeID: patient.patientType,
patient
.patientType,
patientOutSA: false, patientOutSA: false,
); );
await model await model.updatePatientProgressNote(reqModel);
.updatePatientProgressNote( await getProgressNoteList(context, model, isLocalBusy: true);
reqModel); GifLoaderDialogUtils.hideDialog(context);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
}); });
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.green[600], color: Colors.green[600],
borderRadius: borderRadius: BorderRadius.circular(10),
BorderRadius.circular(
10),
), ),
// color:Colors.red[600], // color:Colors.red[600],
child: Row( child: Row(
children: [ children: [
Icon( Icon(
FontAwesomeIcons FontAwesomeIcons.check,
.check,
size: 12, size: 12,
color: Colors.white, color: Colors.white,
), ),
@ -342,10 +250,7 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
width: 2, width: 2,
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).noteVerify,
.of(
context)
.noteVerify,
fontSize: 10, fontSize: 10,
color: Colors.white, color: Colors.white,
), ),
@ -361,67 +266,37 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
onTap: () async { onTap: () async {
showMyDialog( showMyDialog(
context: context, context: context,
actionName: actionName: TranslationBase.of(context).cancel,
TranslationBase
.of(
context)
.cancel,
confirmFun: () async { confirmFun: () async {
GifLoaderDialogUtils GifLoaderDialogUtils.showMyDialog(
.showMyDialog(
context, context,
); );
UpdateNoteReqModel UpdateNoteReqModel reqModel = UpdateNoteReqModel(
reqModel = admissionNo: int.parse(patient.admissionNo),
UpdateNoteReqModel(
admissionNo: int
.parse(patient
.admissionNo),
cancelledNote: true, cancelledNote: true,
lineItemNo: model lineItemNo: model.patientProgressNoteList[index].lineItemNo,
.patientProgressNoteList[ createdBy: model.patientProgressNoteList[index].createdBy,
index] notes: model.patientProgressNoteList[index].notes,
.lineItemNo,
createdBy: model
.patientProgressNoteList[
index]
.createdBy,
notes: model
.patientProgressNoteList[
index]
.notes,
verifiedNote: false, verifiedNote: false,
patientTypeID: patientTypeID: patient.patientType,
patient
.patientType,
patientOutSA: false, patientOutSA: false,
); );
await model await model.updatePatientProgressNote(reqModel);
.updatePatientProgressNote( await getProgressNoteList(context, model, isLocalBusy: true);
reqModel); GifLoaderDialogUtils.hideDialog(context);
await getProgressNoteList(
context, model,
isLocalBusy:
true);
GifLoaderDialogUtils
.hideDialog(
context);
}); });
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.red[600], color: Colors.red[600],
borderRadius: borderRadius: BorderRadius.circular(10),
BorderRadius.circular(
10),
), ),
// color:Colors.red[600], // color:Colors.red[600],
child: Row( child: Row(
children: [ children: [
Icon( Icon(
FontAwesomeIcons FontAwesomeIcons.trash,
.trash,
size: 12, size: 12,
color: Colors.white, color: Colors.white,
), ),
@ -447,41 +322,25 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
height: 10, height: 10,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.60,
.size
.width *
0.60,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
AppText( AppText(
TranslationBase TranslationBase.of(context).createdBy,
.of(
context)
.createdBy,
fontSize: 10, fontSize: 10,
), ),
Expanded( Expanded(
child: AppText( child: AppText(
model model.patientProgressNoteList[index].doctorName ?? '',
.patientProgressNoteList[ fontWeight: FontWeight.w600,
index]
.doctorName ??
'',
fontWeight:
FontWeight.w600,
fontSize: 12, fontSize: 12,
), ),
), ),
@ -493,85 +352,55 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
Column( Column(
children: [ children: [
AppText( AppText(
model model.patientProgressNoteList[index].createdOn != null
.patientProgressNoteList[
index]
.createdOn !=
null
? AppDateUtils.getDayMonthYearDateFormatted( ? AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils AppDateUtils.getDateTimeFromServerFormat(
.getDateTimeFromServerFormat( model.patientProgressNoteList[index].createdOn),
model isArabic: projectViewModel.isArabic)
.patientProgressNoteList[ : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now(),
index] isArabic: projectViewModel.isArabic),
.createdOn),
isArabic:
projectViewModel
.isArabic)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now(),
isArabic:
projectViewModel
.isArabic),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
AppText( AppText(
model model.patientProgressNoteList[index].createdOn != null
.patientProgressNoteList[ ? AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(
index] model.patientProgressNoteList[index].createdOn))
.createdOn != : AppDateUtils.getHour(DateTime.now()),
null
? AppDateUtils.getHour(AppDateUtils
.getDateTimeFromServerFormat(
model
.patientProgressNoteList[
index]
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
], ],
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.end,
CrossAxisAlignment.end,
) )
], ],
), ),
SizedBox( SizedBox(
height: 8, height: 8,
), ),
Row( Row(mainAxisAlignment: MainAxisAlignment.start, children: [
mainAxisAlignment: Expanded(
MainAxisAlignment.start, child: AppText(
children: [ model.patientProgressNoteList[index].notes,
Expanded( fontSize: 10,
child: AppText( ),
model ),
.patientProgressNoteList[ ])
index] ],
.notes, ),
fontSize: 10, SizedBox(
), height: 20,
), ),
]) ],
], ),
),
SizedBox(
height: 20,
),
],
), ),
), );
); }),
}), ),
), ),
), ],
], ),
), ),
),
), ),
); );
} }
@ -580,100 +409,92 @@ class _ProgressNoteState extends State<ProgressNoteScreen> {
showDialog( showDialog(
context: context, context: context,
builder: (ctx) => Center( builder: (ctx) => Center(
child: Container( child: Container(
width: MediaQuery width: MediaQuery.of(context).size.width * 0.8,
.of(context) height: 200,
.size child: AppScaffold(
.width * 0.8, isShowAppBar: false,
height: 200, body: Container(
child: AppScaffold( color: Colors.white,
isShowAppBar: false, child: Center(
body: Container( child: Column(
color: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// SizedBox(height: 20,),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
AppText( // SizedBox(height: 20,),
TranslationBase SizedBox(
.of(context) height: 10,
.noteConfirm, ),
fontWeight: FontWeight.w600, Row(
color: Colors.black, mainAxisAlignment: MainAxisAlignment.center,
fontSize: 16, 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( Container(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
color: Colors.white, color: Colors.white,
child: AppText( child: AppText(
projectViewModel.isArabic?"هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟":'Are you sure you want $actionName this order?', projectViewModel.isArabic
fontSize: 15, ? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟"
textAlign: TextAlign.center, : 'Are you sure you want $actionName this order?',
), fontSize: 15,
), textAlign: TextAlign.center,
),
),
SizedBox( SizedBox(
height: 8, 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();
})
],
),
)
],
), ),
), ),
), ),
), ));
),
)
);
} }
} }

@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/core/enum/viewstate.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/service/VideoCallService.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/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
@ -232,6 +233,10 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
onPressed: () async { onPressed: () async {
if ((isFromLiveCare && patient.appointmentNo != null) || if ((isFromLiveCare && patient.appointmentNo != null) ||
patient.patientStatusType == 43) { patient.patientStatusType == 43) {
await locator<AnalyticsService>().logEvent(
eventCategory: "Patient Profile",
eventAction: "Create Episode",
);
PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel( PostEpisodeReqModel postEpisodeReqModel = PostEpisodeReqModel(
appointmentNo: int.parse(patient.appointmentNo.toString()), appointmentNo: int.parse(patient.appointmentNo.toString()),
patientMRN: patient.patientMRN); patientMRN: patient.patientMRN);
@ -264,7 +269,11 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
color: Colors.white, color: Colors.white,
height: 30, height: 30,
), ),
onPressed: () { onPressed: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Patient Profile ",
eventAction: "Update Episode",
);
if ((isFromLiveCare && if ((isFromLiveCare &&
patient.appointmentNo != null && patient.appointmentNo != null &&
patient.appointmentNo != 0) || patient.appointmentNo != 0) ||
@ -324,7 +333,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => EndCallScreen(patient: patient))); builder: (BuildContext context) => EndCallScreen(patient: patient),settings: RouteSettings(name: 'EndCallScreen'),),);
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.startCall(isReCall: false, vCID: patient.vcId); await model.startCall(isReCall: false, vCID: patient.vcId);

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; 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/core/viewModel/radiology_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -11,6 +12,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../../../locator.dart';
class RadiologyDetailsPage extends StatelessWidget { class RadiologyDetailsPage extends StatelessWidget {
final FinalRadiology finalRadiology; final FinalRadiology finalRadiology;
final PatiantInformtion patient; final PatiantInformtion patient;
@ -19,12 +22,7 @@ class RadiologyDetailsPage extends StatelessWidget {
final bool isInpatient; final bool isInpatient;
RadiologyDetailsPage( RadiologyDetailsPage(
{Key key, {Key key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false});
this.finalRadiology,
this.patient,
this.patientType,
this.arrivalType,
this.isInpatient = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -36,7 +34,7 @@ class RadiologyDetailsPage extends StatelessWidget {
invoiceNo: finalRadiology.invoiceNo), invoiceNo: finalRadiology.invoiceNo),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(
patient, patient,
appointmentDate: finalRadiology.orderDate, appointmentDate: finalRadiology.orderDate,
doctorName: finalRadiology.doctorName, doctorName: finalRadiology.doctorName,
clinic: finalRadiology.clinicDescription, clinic: finalRadiology.clinicDescription,
@ -44,7 +42,6 @@ class RadiologyDetailsPage extends StatelessWidget {
profileUrl: finalRadiology.doctorImageURL, profileUrl: finalRadiology.doctorImageURL,
invoiceNO: finalRadiology.invoiceNo.toString(), invoiceNO: finalRadiology.invoiceNo.toString(),
isAppointmentHeader: true, isAppointmentHeader: true,
), ),
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
@ -68,9 +65,11 @@ class RadiologyDetailsPage extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), 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(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AppText( child: AppText(
@ -94,13 +93,16 @@ class RadiologyDetailsPage extends StatelessWidget {
height: 80, height: 80,
width: double.maxFinite, width: double.maxFinite,
child: Container( child: Container(
margin: margin: EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12),
EdgeInsets.only(left: 35, right: 35, top: 12, bottom: 12),
child: SecondaryButton( child: SecondaryButton(
color: Color(0xffD02127), color: Color(0xffD02127),
disabled: finalRadiology.dIAPACSURL == "", disabled: finalRadiology.dIAPACSURL == "",
textColor: Color(0xffFFFFFF), textColor: Color(0xffFFFFFF),
onTap: () { onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "RadiologyDetailsPage",
eventAction: "Open Radiology Image",
);
launch(model.radImageURL); launch(model.radImageURL);
}, },
label: TranslationBase.of(context).openRad, label: TranslationBase.of(context).openRad,

@ -117,7 +117,7 @@ class _RadiologyHomePageState extends State<RadiologyHomePage> {
patient: patient, patient: patient,
model: model, model: model,
procedureType: ProcedureType.RADIOLOGY, procedureType: ProcedureType.RADIOLOGY,
), ), settings: RouteSettings(name: 'AddProcedureTabPage')
), ),
); );
}, },

@ -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/MyReferralPatientModel.dart';
import 'package:doctor_app_flutter/core/model/referral/add_referred_remarks_request.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/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/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/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/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
@ -138,6 +140,10 @@ class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient>
Expanded( Expanded(
child: AppButton( child: AppButton(
onPressed: () async { onPressed: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Replay On Referral Patient",
eventAction: "Add Replay on Referral",
);
if (replayOnReferralController.text.isNotEmpty) { if (replayOnReferralController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.patientReferralViewModel.replayReferred( await widget.patientReferralViewModel.replayReferred(

@ -18,8 +18,7 @@ import 'package:flutter/material.dart';
class MyReferralDetailScreen extends StatelessWidget { class MyReferralDetailScreen extends StatelessWidget {
final MyReferralPatientModel referralPatient; final MyReferralPatientModel referralPatient;
const MyReferralDetailScreen({Key key, this.referralPatient}) const MyReferralDetailScreen({Key key, this.referralPatient}) : super(key: key);
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -54,8 +53,7 @@ class MyReferralDetailScreen extends StatelessWidget {
), ),
Expanded( Expanded(
child: AppText( child: AppText(
(Helpers.capitalize(referralPatient.firstName + " "+ (Helpers.capitalize(referralPatient.firstName + " " + referralPatient.lastName)),
referralPatient.lastName)),
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -95,62 +93,48 @@ class MyReferralDetailScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
AppText( AppText(
referralPatient.referralStatus != null referralPatient.referralStatus != null
? model.getReferralStatusNameByCode( ? model.getReferralStatusNameByCode(referralPatient.referralStatus, context)
referralPatient.referralStatus,
context)
: "", : "",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 1.9 * SizeConfig.textMultiplier, fontSize: 1.9 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: referralPatient.referralStatus == 1 color: referralPatient.referralStatus == 1
? Color(0xffc4aa54) ? Color(0xffc4aa54)
: referralPatient.referralStatus == : referralPatient.referralStatus == 46 || referralPatient.referralStatus == 2
46 ||
referralPatient
.referralStatus ==
2
? Colors.green[700] ? Colors.green[700]
: Colors.red[700], : Colors.red[700],
), ),
AppText( AppText(
AppDateUtils.getDayMonthYearDateFormatted( AppDateUtils.getDayMonthYearDateFormatted(referralPatient.referralDate),
referralPatient.referralDate),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 2.0 * SizeConfig.textMultiplier,
2.0 * SizeConfig.textMultiplier,
color: Color(0XFF28353E), color: Color(0XFF28353E),
) )
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).fileNumber,
.fileNumber,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 1.7 * SizeConfig.textMultiplier,
1.7 * SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
"${referralPatient.patientID}", "${referralPatient.patientID}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -159,75 +143,56 @@ class MyReferralDetailScreen extends StatelessWidget {
AppDateUtils.getTimeHHMMA(referralPatient.referralDate), AppDateUtils.getTimeHHMMA(referralPatient.referralDate),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: fontSize: 1.8 * SizeConfig.textMultiplier,
1.8 * SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
) )
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).referredFrom,
.referredFrom,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
AppText( AppText(
referralPatient.targetProjectId ==referralPatient.sourceProjectId referralPatient.targetProjectId == referralPatient.sourceProjectId
? TranslationBase.of( ? TranslationBase.of(context).sameBranch
context) : TranslationBase.of(context).otherBranch,
.sameBranch
: TranslationBase.of(
context)
.otherBranch,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * fontSize: 1.8 * SizeConfig.textMultiplier,
SizeConfig
.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).remarks + " : ",
.remarks +
" : ",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier,
SizeConfig.textMultiplier,
color: Color(0XFF575757), color: Color(0XFF575757),
), ),
Expanded( Expanded(
child: AppText( child: AppText(
referralPatient.referringDoctorRemarks?? referralPatient.referringDoctorRemarks ?? '',
'',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.8 * fontSize: 1.8 * SizeConfig.textMultiplier,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
), ),
@ -239,29 +204,22 @@ class MyReferralDetailScreen extends StatelessWidget {
Row( Row(
children: [ children: [
AppText( AppText(
referralPatient.nationalityName != referralPatient.nationalityName != null
null
? referralPatient.nationalityName ? referralPatient.nationalityName
: "", : "",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontSize: fontSize: 1.4 * SizeConfig.textMultiplier,
1.4 * SizeConfig.textMultiplier,
), ),
referralPatient.nationalityFlagURL != referralPatient.nationalityFlagURL != null
null
? ClipRRect( ? ClipRRect(
borderRadius: borderRadius: BorderRadius.circular(20.0),
BorderRadius.circular(20.0),
child: Image.network( child: Image.network(
referralPatient referralPatient.nationalityFlagURL,
.nationalityFlagURL,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext errorBuilder:
context, (BuildContext context, Object exception, StackTrace stackTrace) {
Object exception,
StackTrace stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -274,8 +232,7 @@ class MyReferralDetailScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: margin: EdgeInsets.only(left: 10, right: 0),
EdgeInsets.only(left: 10, right: 0),
child: Image.asset( child: Image.asset(
'assets/images/patient/ic_ref_arrow_up.png', 'assets/images/patient/ic_ref_arrow_up.png',
height: 50, height: 50,
@ -283,20 +240,14 @@ class MyReferralDetailScreen extends StatelessWidget {
), ),
), ),
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0),
left: 0, padding: EdgeInsets.only(left: 4.0, right: 4.0),
top: 25,
right: 0,
bottom: 0),
padding: EdgeInsets.only(
left: 4.0, right: 4.0),
child: Container( child: Container(
width: 40, width: 40,
height: 40, height: 40,
child: CircleAvatar( child: CircleAvatar(
radius: 25.0, radius: 25.0,
backgroundImage: NetworkImage( backgroundImage: NetworkImage(referralPatient.doctorImageURL),
referralPatient.doctorImageURL),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
), ),
), ),
@ -304,19 +255,14 @@ class MyReferralDetailScreen extends StatelessWidget {
Expanded( Expanded(
flex: 4, flex: 4,
child: Container( child: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0),
left: 10,
top: 25,
right: 10,
bottom: 0),
child: Column( child: Column(
children: [ children: [
AppText( AppText(
referralPatient.doctorName, referralPatient.doctorName,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 1.7 * fontSize: 1.7 * SizeConfig.textMultiplier,
SizeConfig.textMultiplier,
color: Color(0XFF2E303A), color: Color(0XFF2E303A),
), ),
], ],
@ -347,8 +293,7 @@ class MyReferralDetailScreen extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
child: SizedBox( child: SizedBox(
child: ProfileMedicalInfoWidgetSearch( child: ProfileMedicalInfoWidgetSearch(
patient: model patient: model.getPatientFromReferralO(referralPatient),
.getPatientFromReferralO(referralPatient),
patientType: "7", patientType: "7",
isInpatient: false, isInpatient: false,
from: null, from: null,
@ -380,9 +325,7 @@ class MyReferralDetailScreen extends StatelessWidget {
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept);
TranslationBase.of(context)
.referralSuccessMsgAccept);
model.getMyReferralOutPatientService(); model.getMyReferralOutPatientService();
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context); Navigator.pop(context);
@ -407,9 +350,7 @@ class MyReferralDetailScreen extends StatelessWidget {
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject);
TranslationBase.of(context)
.referralSuccessMsgReject);
model.getMyReferralOutPatientService(); model.getMyReferralOutPatientService();
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context); Navigator.pop(context);

@ -1,6 +1,8 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/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/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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
@ -21,8 +23,7 @@ import 'package:hexcolor/hexcolor.dart';
class PatientMakeReferralScreen extends StatefulWidget { class PatientMakeReferralScreen extends StatefulWidget {
// previous design page is: ReferPatientScreen // previous design page is: ReferPatientScreen
@override @override
_PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState();
_PatientMakeReferralScreenState();
} }
class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> { class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
@ -55,14 +56,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
referToList = List(); referToList = List();
dynamic sameBranch = { dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch};
"id": 1, dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch};
"name": TranslationBase.of(context).sameBranch
};
dynamic otherBranch = {
"id": 2,
"name": TranslationBase.of(context).otherBranch
};
referToList.add(sameBranch); referToList.add(sameBranch);
referToList.add(otherBranch); referToList.add(otherBranch);
@ -74,8 +69,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(patient),
patient),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Column( child: Column(
@ -109,57 +103,25 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
model.patientReferral.length == 0 model.patientReferral.length == 0
? referralForm(model, screenSize) ? referralForm(model, screenSize)
: PatientReferralItemWidget( : PatientReferralItemWidget(
referralStatus: model referralStatus: model.patientReferral[model.patientReferral.length - 1].referralStatus,
.patientReferral[ patientName: model.patientReferral[model.patientReferral.length - 1].patientName,
model.patientReferral.length - 1] patientGender:
.referralStatus, model.patientReferral[model.patientReferral.length - 1].patientDetails.gender,
patientName: model referredDate:
.patientReferral[ model.patientReferral[model.patientReferral.length - 1].referredOn.split(" ")[0],
model.patientReferral.length - 1] referredTime:
.patientName, model.patientReferral[model.patientReferral.length - 1].referredOn.split(" ")[1],
patientGender: model patientID: "${model.patientReferral[model.patientReferral.length - 1].patientID}",
.patientReferral[ isSameBranch:
model.patientReferral.length - 1] model.patientReferral[model.patientReferral.length - 1].isReferralDoctorSameBranch,
.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, isReferral: true,
remark: model remark: model.patientReferral[model.patientReferral.length - 1].remarksFromSource,
.patientReferral[ nationality:
model.patientReferral.length - 1] model.patientReferral[model.patientReferral.length - 1].patientDetails.nationalityName,
.remarksFromSource, nationalityFlag: model.patientReferral[model.patientReferral.length - 1].nationalityFlagUrl,
nationality: model doctorAvatar: model.patientReferral[model.patientReferral.length - 1].doctorImageUrl,
.patientReferral[ referralDoctorName:
model.patientReferral.length - 1] model.patientReferral[model.patientReferral.length - 1].referredByDoctorInfo,
.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, clinicDescription: null,
), ),
], ],
@ -171,29 +133,29 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
title: TranslationBase.of(context).refer, title: TranslationBase.of(context).refer,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: HexColor("#359846"), color: HexColor("#359846"),
onPressed: () { onPressed: () async {
setState(() { setState(() async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Refer Patient",
eventAction: "Submit Refer",
);
if (_referTo == null) { if (_referTo == null) {
branchError = branchError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
branchError = null; branchError = null;
} }
if (_selectedBranch == null) { if (_selectedBranch == null) {
hospitalError = hospitalError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
hospitalError = null; hospitalError = null;
} }
if (_selectedClinic == null) { if (_selectedClinic == null) {
clinicError = clinicError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
clinicError = null; clinicError = null;
} }
if (_selectedDoctor == null) { if (_selectedDoctor == null) {
doctorError = doctorError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
doctorError = null; doctorError = null;
} }
@ -204,16 +166,10 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
_selectedDoctor == null || _selectedDoctor == null ||
_remarksController.text == null) return; _remarksController.text == null) return;
model model
.makeReferral( .makeReferral(patient, appointmentDate.toIso8601String(), _selectedBranch['facilityId'],
patient, _selectedClinic['ClinicID'], _selectedDoctor['DoctorID'], _remarksController.text)
appointmentDate.toIso8601String(),
_selectedBranch['facilityId'],
_selectedClinic['ClinicID'],
_selectedDoctor['DoctorID'],
_remarksController.text)
.then((_) { .then((_) {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg);
TranslationBase.of(context).referralSuccessMsg);
Navigator.pop(context); Navigator.pop(context);
}); });
}, },
@ -259,8 +215,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model
.getClinics(_selectedBranch['facilityId']) .getClinics(_selectedBranch['facilityId'])
.then((_) => .then((_) => GifLoaderDialogUtils.hideDialog(context));
GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} }
@ -287,47 +242,42 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).hospital, hintText: TranslationBase.of(context).hospital,
dropDownText: _selectedBranch != null dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null,
? _selectedBranch['facilityName']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: hospitalError, validationError: hospitalError,
onClick: model.branchesList != null && onClick:
model.branchesList.length > 0 && model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2
_referTo != null && ? () {
_referTo['id'] == 2 ListSelectDialog dialog = ListSelectDialog(
? () { list: model.branchesList,
ListSelectDialog dialog = ListSelectDialog( attributeName: 'facilityName',
list: model.branchesList, attributeValueId: 'facilityId',
attributeName: 'facilityName', okText: TranslationBase.of(context).ok,
attributeValueId: 'facilityId', okFunction: (selectedValue) {
okText: TranslationBase.of(context).ok, setState(() async {
okFunction: (selectedValue) { _selectedBranch = selectedValue;
setState(() async { _selectedClinic = null;
_selectedBranch = selectedValue; _selectedDoctor = null;
_selectedClinic = null; GifLoaderDialogUtils.showMyDialog(context);
_selectedDoctor = null; await model
GifLoaderDialogUtils.showMyDialog(context); .getClinics(_selectedBranch['facilityId'])
await model .then((_) => GifLoaderDialogUtils.hideDialog(context));
.getClinics(_selectedBranch['facilityId']) if (model.state == ViewState.ErrorLocal) {
.then((_) => DrAppToastMsg.showErrorToast(model.error);
GifLoaderDialogUtils.hideDialog(context)); }
if (model.state == ViewState.ErrorLocal) { });
DrAppToastMsg.showErrorToast(model.error); },
} );
}); showDialog(
}, barrierDismissible: false,
); context: context,
showDialog( builder: (BuildContext context) {
barrierDismissible: false, return dialog;
context: context, },
builder: (BuildContext context) { );
return dialog; }
}, : null,
);
}
: null,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -335,15 +285,11 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).clinic, hintText: TranslationBase.of(context).clinic,
dropDownText: _selectedClinic != null dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null,
? _selectedClinic['ClinicDescription']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: clinicError, validationError: clinicError,
onClick: _selectedBranch != null && onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0
model.clinicsList != null &&
model.clinicsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.clinicsList, list: model.clinicsList,
@ -358,12 +304,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
_selectedClinic = selectedValue; _selectedClinic = selectedValue;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model await model
.getClinicDoctors( .getClinicDoctors(patient, _selectedClinic['ClinicID'], _selectedBranch['facilityId'])
patient, .then((_) => GifLoaderDialogUtils.hideDialog(context));
_selectedClinic['ClinicID'],
_selectedBranch['facilityId'])
.then((_) =>
GifLoaderDialogUtils.hideDialog(context));
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} }
@ -386,14 +328,11 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor, hintText: TranslationBase.of(context).doctor,
dropDownText: dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null,
_selectedDoctor != null ? _selectedDoctor['Name'] : null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: doctorError, validationError: doctorError,
onClick: _selectedClinic != null && onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0
model.doctorsList != null &&
model.doctorsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.doctorsList, list: model.doctorsList,
@ -418,12 +357,9 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
} }
: () { : () {
if (_selectedClinic == null) { if (_selectedClinic == null) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("You need to select a clinic first");
"You need to select a clinic first"); } else if (model.doctorsList == null || model.doctorsList.length == 0) {
} else if (model.doctorsList == null || DrAppToastMsg.showErrorToast("There is no doctors for this clinic");
model.doctorsList.length == 0) {
DrAppToastMsg.showErrorToast(
"There is no doctors for this clinic");
} }
}, },
), ),
@ -433,9 +369,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).date, hintText: TranslationBase.of(context).date,
dropDownText: appointmentDate != null dropDownText:
? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" appointmentDate != null ? "${AppDateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" : null,
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
suffixIcon: IconButton( suffixIcon: IconButton(

@ -1,7 +1,9 @@
import 'package:doctor_app_flutter/config/size_config.dart'; 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/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/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/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( Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 0), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 0),
@ -486,13 +489,18 @@ class ReferralPatientDetailScreen extends StatelessWidget {
hPadding: 8, hPadding: 8,
vPadding: 12, vPadding: 12,
onPressed: () async { onPressed: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Referral Patient Detail",
eventAction: "Replay To Patient",
);
Navigator.push( Navigator.push(
context, context,
SlideUpPageRoute( SlideUpPageRoute(
widget: AddReplayOnReferralPatient( widget: AddReplayOnReferralPatient(
patientReferralViewModel: patientReferralViewModel, patientReferralViewModel: patientReferralViewModel,
myReferralInPatientModel: referredPatient, myReferralInPatientModel: referredPatient,
isEdited: referredPatient.referredDoctorRemarks!=null && referredPatient.referredDoctorRemarks.isNotEmpty, isEdited: referredPatient.referredDoctorRemarks != null &&
referredPatient.referredDoctorRemarks.isNotEmpty,
), ),
), ),
); );

@ -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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_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/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/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/auto_complete_text_field.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
@ -32,6 +33,7 @@ class AddAssessmentDetails extends StatefulWidget {
addSelectedAssessment; addSelectedAssessment;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final bool isUpdate; final bool isUpdate;
AddAssessmentDetails( AddAssessmentDetails(
{Key key, {Key key,
this.mySelectedAssessment, this.mySelectedAssessment,
@ -129,14 +131,14 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addAssessmentDetails),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Center( child: Center(
child: Column( child: Column(
children: [ children: [
BottomSheetTitle(
title: TranslationBase.of(context).addAssessmentDetails),
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Container( child: Container(
@ -253,6 +255,8 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition, list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisCondition,
okFunction: okFunction:
(MasterKeyModel selectedValue) { (MasterKeyModel selectedValue) {
setState(() { setState(() {
@ -305,6 +309,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisType, list: model.listOfDiagnosisType,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisType,
okFunction: okFunction:
(MasterKeyModel selectedValue) { (MasterKeyModel selectedValue) {
setState(() { setState(() {
@ -367,7 +372,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
), ),
), ),
), ),
bottomSheet: Container( bottomSheet: model.state == ViewState.Busy?Container(height: 0,):Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
@ -434,6 +439,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
{SOAPViewModel model, {SOAPViewModel model,
MySelectedAssessment mySelectedAssessment, MySelectedAssessment mySelectedAssessment,
bool isUpdate = false}) async { bool isUpdate = false}) async {
GifLoaderDialogUtils.showMyDialog(context);
if (isUpdate) { if (isUpdate) {
PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -464,8 +470,9 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
await model.postAssessment(postAssessmentRequestModel); await model.postAssessment(postAssessmentRequestModel);
} }
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -473,10 +480,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code;
mySelectedAssessment.doctorName = doctorProfile.doctorName; mySelectedAssessment.doctorName = doctorProfile.doctorName;
widget.addSelectedAssessment(mySelectedAssessment, isUpdate);
if (!isUpdate) {
widget.addSelectedAssessment(mySelectedAssessment, isUpdate);
}
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} }

@ -26,14 +26,12 @@ import 'add_assessment_details.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class UpdateAssessmentPage extends StatefulWidget { class UpdateAssessmentPage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
List<MySelectedAssessment> mySelectedAssessmentList;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final Function changeLoadingState; final Function changeLoadingState;
final int currentIndex; final int currentIndex;
UpdateAssessmentPage( UpdateAssessmentPage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.mySelectedAssessmentList,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.currentIndex}); this.changeLoadingState, this.currentIndex});
@ -43,19 +41,20 @@ class UpdateAssessmentPage extends StatefulWidget {
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> { class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
bool isAssessmentExpand = false; bool isAssessmentExpand = false;
List<MySelectedAssessment> mySelectedAssessmentList = List();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.mySelectedAssessmentList.clear(); mySelectedAssessmentList.clear();
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: '', doctorID: '',
appointmentNo: int.parse(widget.patientInfo.appointmentNo)); appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientAssessment(getAssessmentReqModel); await model.getPatientAssessment(getAssessmentReqModel);
if (model.patientAssessmentList.isNotEmpty) { if (model.patientAssessmentList.isNotEmpty) {
if (model.listOfDiagnosisCondition.length == 0) { if (model.listOfDiagnosisCondition.length == 0) {
@ -96,7 +95,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
createdOn: element.createdOn, createdOn: element.createdOn,
icdCode10ID: element.icdCode10ID); icdCode10ID: element.icdCode10ID);
widget.mySelectedAssessmentList.add(temMySelectedAssessment); mySelectedAssessmentList.add(temMySelectedAssessment);
} }
}); });
} }
@ -147,7 +146,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
height: 20, height: 20,
), ),
Column( Column(
children: widget.mySelectedAssessmentList children: mySelectedAssessmentList
.map((assessment) { .map((assessment) {
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
@ -348,7 +347,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
height: 6, height: 6,
), ),
AppText( AppText(
(assessment.remark != null || (assessment.remark != null &&
assessment.remark != assessment.remark !=
'') '')
? TranslationBase.of( ? TranslationBase.of(
@ -501,14 +500,15 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
color: Colors.red[700], color: Colors.red[700],
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
if (widget.mySelectedAssessmentList.isEmpty) { if (mySelectedAssessmentList.isEmpty) {
Helpers.showErrorToast( Helpers.showErrorToast(
TranslationBase TranslationBase
.of(context) .of(context)
.assessmentErrorMsg); .assessmentErrorMsg);
} else { } else {
widget.changePageViewIndex(3);
widget.changeLoadingState(true); widget.changeLoadingState(true);
widget.changePageViewIndex(3);
} }
}, },
), ),
@ -542,11 +542,12 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
mySelectedAssessment: assessment, mySelectedAssessment: assessment,
patientInfo: widget.patientInfo, patientInfo: widget.patientInfo,
isUpdate: isUpdate, isUpdate: isUpdate,
mySelectedAssessmentList: widget.mySelectedAssessmentList, mySelectedAssessmentList: mySelectedAssessmentList,
addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, addSelectedAssessment: (MySelectedAssessment mySelectedAssessment,
bool isUpdate) async { bool isUpdate) async {
setState(() { setState(() {
widget.mySelectedAssessmentList.add(mySelectedAssessment); if(!isUpdate)
mySelectedAssessmentList.add(mySelectedAssessment);
}); });
}); });
}); });

@ -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/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.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/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/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
@ -31,79 +32,55 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination); await model.getMasterLookup(MasterKeysService.PhysicalExamination);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
backgroundColor: Color.fromRGBO(248, 248, 248, 1), appBar: BottomSheetTitle(
body: Column( title: "${TranslationBase.of(context).addExamination}",
mainAxisAlignment: MainAxisAlignment.start, ),
children: [ backgroundColor: Color.fromRGBO(248, 248, 248, 1),
Container( body: Column(
padding: mainAxisAlignment: MainAxisAlignment.start,
EdgeInsets.only(left: 16, top: 70, right: 16, bottom: 16),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: AppText( child: SingleChildScrollView(
"${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: Column( child: Column(
children: [ children: [
ExaminationsListSearchWidget( Container(
masterList: model.physicalExaminationList, margin: EdgeInsets.all(16.0),
isServiceSelected: (master) => padding: EdgeInsets.all(0.0),
isServiceSelected(master), decoration: BoxDecoration(
removeHistory: (history) { shape: BoxShape.rectangle,
setState(() { color: Colors.white,
widget.removeExamination(history); borderRadius: BorderRadius.circular(12),
}); border: Border.fromBorderSide(BorderSide(
}, color: Colors.grey.shade400,
addHistory: (selectedExamination) { width: 0.4,
setState(() { )),
widget.mySelectedExamination ),
.add(selectedExamination); 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(() {});
},
), ),
], ],
), ),

@ -14,19 +14,21 @@ import 'package:provider/provider.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class AddExaminationWidget extends StatefulWidget { class AddExaminationWidget extends StatefulWidget {
MasterKeyModel item; MasterKeyModel item;
final Function(MasterKeyModel) removeHistory; final Function(MasterKeyModel) removeExamination;
final Function(MySelectedExamination) addHistory; final Function(MySelectedExamination) addExamination;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
bool isExpand; bool isExpand;
final Function expandClick; final Function expandClick;
final List<MySelectedExamination> mySelectedExamination;
AddExaminationWidget({ AddExaminationWidget({
this.item, this.item,
this.removeHistory, this.removeExamination,
this.addHistory, this.addExamination,
this.isServiceSelected, this.isServiceSelected,
this.isExpand, this.isExpand,
this.expandClick, this.expandClick,
this.mySelectedExamination,
}); });
@override @override
@ -40,7 +42,17 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
@override @override
void initState() { 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(); super.initState();
} }
@ -70,14 +82,15 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
if (widget.isServiceSelected(widget.item)) { if (widget.isServiceSelected(widget.item)) {
widget.removeHistory(widget.item); if (examination.isLocal)
widget.removeExamination(widget.item);
widget.expandClick(); widget.expandClick();
} else { } else {
examination.isNormal = status == 1; examination.isNormal = status == 1;
examination.isAbnormal = status == 2; examination.isAbnormal = status == 2;
examination.notExamined = status == 3; examination.notExamined = status == 3;
examination.remark = remarksController.text; examination.remark = remarksController.text;
widget.addHistory(examination); widget.addExamination(examination);
widget.expandClick(); widget.expandClick();
} }
}); });
@ -113,18 +126,18 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Row( child: InkWell(
children: [ onTap: () {
InkWell( setState(() {
onTap: () { status = 1;
setState(() { });
status = 1; examination.isNormal = true;
}); examination.isAbnormal = false;
examination.isNormal = true; examination.notExamined = false;
examination.isAbnormal = false; },
examination.notExamined = false; child: Row(
}, children: [
child: Container( Container(
padding: EdgeInsets.all(2.0), padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6), margin: EdgeInsets.symmetric(horizontal: 6),
width: 20, width: 20,
@ -143,28 +156,28 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
), ),
), AppText(
AppText( TranslationBase.of(context).normal,
TranslationBase.of(context).normal, fontWeight: FontWeight.normal,
fontWeight: FontWeight.normal, fontFamily: 'Poppins',
fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.6,
fontSize: SizeConfig.textMultiplier * 1.6, ),
), ],
], ),
)), )),
Expanded( Expanded(
child: Row( child: InkWell(
children: [ onTap: () {
InkWell( setState(() {
onTap: () { status = 2;
setState(() { });
status = 2; examination.isNormal = false;
}); examination.isAbnormal = true;
examination.isNormal = false; examination.notExamined = false;
examination.isAbnormal = true; },
examination.notExamined = false; child: Row(
}, children: [
child: Container( Container(
padding: EdgeInsets.all(2.0), padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6), margin: EdgeInsets.symmetric(horizontal: 6),
width: 20, width: 20,
@ -183,57 +196,58 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
), ),
), ),
), AppText(
AppText( TranslationBase.of(context).abnormal,
TranslationBase.of(context).abnormal, fontWeight: FontWeight.normal,
fontWeight: FontWeight.normal, fontFamily: 'Poppins',
fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.6,
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( child: Row(
children: [ children: [
InkWell( Container(
onTap: () { padding: EdgeInsets.all(2.0),
setState(() { margin: EdgeInsets.symmetric(horizontal: 6),
status = 3; width: 20,
}); height: 20,
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(
decoration: BoxDecoration( decoration: BoxDecoration(
color: status == 3 color: Colors.white,
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle, 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(
Expanded( TranslationBase.of(context).notExamined,
child: AppText( fontWeight: FontWeight.normal,
TranslationBase.of(context).notExamined, fontFamily: 'Poppins',
fontWeight: FontWeight.normal, fontSize: SizeConfig.textMultiplier * 1.6,
fontFamily: 'Poppins', ),
fontSize: SizeConfig.textMultiplier * 1.6, ),
), ],
), ),
], )),
)),
], ],
), ),
Container( Container(
@ -256,4 +270,15 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
), ),
); );
} }
MySelectedExamination getSelectedExam(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam = widget.mySelectedExamination.where(
(element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (exam.length > 0) {
return exam.first;
}
return null;
}
} }

@ -40,25 +40,6 @@ class ExaminationItemCard extends StatelessWidget {
fontSize: SizeConfig.textMultiplier * 1.8, 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( AppText(
@ -79,6 +60,7 @@ class ExaminationItemCard extends StatelessWidget {
SizedBox( SizedBox(
height: 4, height: 4,
), ),
if(examination.remark.isNotEmpty)
AppText( AppText(
examination.remark, examination.remark,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,

@ -8,16 +8,17 @@ import 'package:flutter/material.dart';
import 'add_examination_widget.dart'; import 'add_examination_widget.dart';
class ExaminationsListSearchWidget extends StatefulWidget { class ExaminationsListSearchWidget extends StatefulWidget {
final Function(MasterKeyModel) removeHistory; final Function(MasterKeyModel) removeExamination;
final Function(MySelectedExamination) addHistory; final Function(MySelectedExamination) addHistory;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
final List<MasterKeyModel> masterList; final List<MasterKeyModel> masterList;
final List<MySelectedExamination> mySelectedExamination;
ExaminationsListSearchWidget( ExaminationsListSearchWidget(
{this.removeHistory, {this.removeExamination,
this.addHistory, this.addHistory,
this.isServiceSelected, this.isServiceSelected,
this.masterList}); this.masterList, this.mySelectedExamination});
@override @override
_ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState createState() =>
@ -61,8 +62,9 @@ class _ExaminationsListSearchWidgetState
...items.mapIndexed((index, item) { ...items.mapIndexed((index, item) {
return AddExaminationWidget( return AddExaminationWidget(
item: item, item: item,
addHistory: widget.addHistory, addExamination: widget.addHistory,
removeHistory: widget.removeHistory, removeExamination: widget.removeExamination,
mySelectedExamination: widget.mySelectedExamination,
isServiceSelected: widget.isServiceSelected, isServiceSelected: widget.isServiceSelected,
isExpand: index == expandedIndex, isExpand: index == expandedIndex,
expandClick: () { expandClick: () {

@ -28,13 +28,11 @@ class UpdateObjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final Function changeLoadingState; final Function changeLoadingState;
final int currentIndex; final int currentIndex;
final List<MySelectedExamination> mySelectedExamination;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
UpdateObjectivePage( UpdateObjectivePage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.mySelectedExamination,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
this.currentIndex}); this.currentIndex});
@ -45,8 +43,10 @@ class UpdateObjectivePage extends StatefulWidget {
class _UpdateObjectivePageState extends State<UpdateObjectivePage> { class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List();
BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -62,11 +62,13 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.mySelectedExamination.clear(); mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( GetPhysicalExamReqModel getPhysicalExamReqModel =
patientMRN: widget.patientInfo.patientMRN, GetPhysicalExamReqModel(
episodeID: widget.patientInfo.episodeNo.toString(), patientMRN: widget.patientInfo.patientMRN,
appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel); await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
@ -79,14 +81,18 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
id: element.examId, id: element.examId,
); );
MySelectedExamination tempEam = MySelectedExamination( MySelectedExamination tempEam = MySelectedExamination(
selectedExamination: examMaster, selectedExamination: examMaster,
remark: element.remarks, remark: element.remarks,
isNormal: element.isNormal, isNormal: element.isNormal,
createdBy: element.createdBy, createdBy: element.createdBy,
notExamined: element.notExamined, createdOn: element.createdOn,
isNew: element.isNew, editedOn: element.editedOn,
isAbnormal: element.isAbnormal); notExamined: element.notExamined,
widget.mySelectedExamination.add(tempEam); isNew: element.isNew,
isLocal: false,
isAbnormal: element.isAbnormal,
);
mySelectedExamination.add(tempEam);
}); });
} }
@ -102,9 +108,12 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).physicalSystemExamination, headerTitle:
TranslationBase.of(context).physicalSystemExamination,
onTap: () { onTap: () {
setState(() { setState(() {
isSysExaminationExpand = !isSysExaminationExpand; isSysExaminationExpand = !isSysExaminationExpand;
@ -113,15 +122,17 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column( child: Column(
children: [ children: [
SOAPOpenItems( SOAPOpenItems(
label: "${TranslationBase.of(context).addExamination}", label:
"${TranslationBase.of(context).addExamination}",
onTap: () { onTap: () {
openExaminationList(context); openExaminationList(context);
}, },
), ),
Column( Column(
children: widget.mySelectedExamination.map((examination) { children: mySelectedExamination.map((examination) {
return ExaminationItemCard(examination, () { return ExaminationItemCard(examination, () {
removeExamination(examination.selectedExamination); removeExamination(
examination.selectedExamination);
}); });
}).toList(), }).toList(),
) )
@ -198,40 +209,45 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
} }
submitUpdateObjectivePage(SOAPViewModel model) async { submitUpdateObjectivePage(SOAPViewModel model) async {
if (widget.mySelectedExamination.isNotEmpty) { if (mySelectedExamination.isNotEmpty) {
widget.changeLoadingState(true);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); PostPhysicalExamRequestModel postPhysicalExamRequestModel =
widget.mySelectedExamination.forEach((exam) { new PostPhysicalExamRequestModel();
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null) mySelectedExamination.forEach((exam) {
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
null)
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
[];
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(ListHisProgNotePhysicalExaminationVM( postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
patientMRN: widget.patientInfo.patientMRN, .add(ListHisProgNotePhysicalExaminationVM(
episodeId: widget.patientInfo.episodeNo, patientMRN: widget.patientInfo.patientMRN,
appointmentNo: widget.patientInfo.appointmentNo, episodeId: widget.patientInfo.episodeNo,
remarks: exam.remark ?? '', appointmentNo: widget.patientInfo.appointmentNo,
createdBy: exam.createdBy ?? doctorProfile.doctorID, remarks: exam.remark ?? '',
createdOn: DateTime.now().toIso8601String(), createdBy: exam.createdBy ?? doctorProfile.doctorID,
editedBy: doctorProfile.doctorID, createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
editedOn: DateTime.now().toIso8601String(), editedBy: doctorProfile.doctorID,
examId: exam.selectedExamination.id, editedOn: DateTime.now().toIso8601String(),
examType: exam.selectedExamination.typeId, examId: exam.selectedExamination.id,
isAbnormal: exam.isAbnormal, examType: exam.selectedExamination.typeId,
isNormal: exam.isNormal, isAbnormal: exam.isAbnormal,
notExamined: exam.notExamined, isNormal: exam.isNormal,
examinationType: exam.isNormal notExamined: exam.notExamined,
? 1 examinationType: exam.isNormal
: exam.isAbnormal ? 1
? 2 : exam.isAbnormal
: 3, ? 2
examinationTypeName: exam.isNormal : 3,
? "Normal" examinationTypeName: exam.isNormal
: exam.isAbnormal ? "Normal"
? 'AbNormal' : exam.isAbnormal
: "Not Examined", ? 'AbNormal'
isNew: exam.isNew)); : "Not Examined",
isNew: exam.isNew));
}); });
if (model.patientPhysicalExamList.isEmpty) { if (model.patientPhysicalExamList.isEmpty) {
@ -241,10 +257,10 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
} }
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
widget.changeLoadingState(false);
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
widget.changeLoadingState(true); widget.changeLoadingState(true);
widget.changePageViewIndex(2); widget.changePageViewIndex(2);
} }
} else { } else {
@ -253,12 +269,14 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
} }
removeExamination(MasterKeyModel masterKey) { removeExamination(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> history = widget.mySelectedExamination.where((element) => Iterable<MySelectedExamination> history = mySelectedExamination.where(
masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); (element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (history.length > 0) if (history.length > 0)
setState(() { setState(() {
widget.mySelectedExamination.remove(history.first); mySelectedExamination.remove(history.first);
}); });
} }
@ -267,7 +285,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
context, context,
FadePage( FadePage(
page: AddExaminationPage( page: AddExaminationPage(
mySelectedExamination: widget.mySelectedExamination, mySelectedExamination: mySelectedExamination,
addSelectedExamination: () { addSelectedExamination: () {
setState(() { setState(() {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -276,21 +294,6 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
removeExamination: (masterKey) => removeExamination(masterKey)), 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 addSelectedExamination;
final Function(MasterKeyModel) removeExamination; 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); : super(key: key);
@override @override
@ -314,7 +321,8 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination); await model
.getMasterLookup(MasterKeysService.PhysicalExamination);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -324,19 +332,21 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: Container( child: Container(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ child: Column(
SizedBox( crossAxisAlignment: CrossAxisAlignment.start,
height: 16, children: [
), SizedBox(
AppText( height: 16,
TranslationBase.of(context).physicalSystemExamination, ),
fontWeight: FontWeight.bold, AppText(
fontSize: 16, TranslationBase.of(context).physicalSystemExamination,
), fontWeight: FontWeight.bold,
SizedBox( fontSize: 16,
height: 16, ),
), SizedBox(
]), height: 16,
),
]),
))), ))),
)), )),
); );

@ -27,14 +27,12 @@ class UpdatePlanPage extends StatefulWidget {
final Function changeLoadingState; final Function changeLoadingState;
final int currentIndex; final int currentIndex;
GetPatientProgressNoteResModel patientProgressNote;
UpdatePlanPage( UpdatePlanPage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
this.patientProgressNote,
this.currentIndex}); this.currentIndex});
@override @override
@ -44,10 +42,14 @@ class UpdatePlanPage extends StatefulWidget {
class _UpdatePlanPageState extends State<UpdatePlanPage> { class _UpdatePlanPageState extends State<UpdatePlanPage> {
bool isAddProgress = true; bool isAddProgress = true;
bool isProgressExpanded = 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( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -62,32 +64,74 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.patientProgressNote.planNote != null) { if (patientProgressNote.planNote != null) {
setState(() { setState(() {
isAddProgress = false; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( GetGetProgressNoteReqModel getGetProgressNoteReqModel =
appointmentNo: int.parse(widget.patientInfo.appointmentNo), GetGetProgressNoteReqModel(
patientMRN: widget.patientInfo.patientMRN, appointmentNo:
episodeID: widget.patientInfo.episodeNo.toString(), int.parse(widget.patientInfo.appointmentNo.toString()),
editedBy: '', patientMRN: widget.patientInfo.patientMRN,
doctorID: ''); episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel); await model.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) { if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote); progressNoteController.text = Helpers.parseHtmlString(
widget.patientProgressNote.planNote = progressNoteController.text; model.patientProgressNoteList[0].planNote);
widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; patientProgressNote.planNote = progressNoteController.text;
widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; patientProgressNote.createdByName =
widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; model.patientProgressNoteList[0].createdByName;
widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; 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(() { setState(() {
isAddProgress = false; isAddProgress = false;
}); });
@ -104,7 +148,9 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
widthFactor: 0.90, widthFactor: 0.90,
child: Column( child: Column(
children: [ children: [
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -123,33 +169,41 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
children: [ children: [
if (isAddProgress) if (isAddProgress)
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15), margin: EdgeInsets.only(
left: 10, right: 10, top: 15),
child: AppTextFieldCustom( child: AppTextFieldCustom(
hintText: TranslationBase.of(context).progressNote, hintText: TranslationBase.of(context)
.progressNote,
controller: progressNoteController, controller: progressNoteController,
minLines: 2, minLines: 2,
maxLines: 4, maxLines: 4,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
onChanged: (value) { onChanged: (value) {
widget.patientProgressNote.planNote = value; setState(() {
patientProgressNote.planNote = value;
});
}, },
), ),
), ),
SizedBox( SizedBox(
height: 9, height: 9,
), ),
if (widget.patientProgressNote.planNote != null && !isAddProgress) if (patientProgressNote.planNote != null &&
!isAddProgress)
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 5, left: 5,
right: 5, right: 5,
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
@ -158,40 +212,61 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
fontSize: 12, fontSize: 12,
), ),
AppText( AppText(
widget.patientProgressNote.appointmentNo ?? '', patientProgressNote
.appointmentNo !=
null
? patientProgressNote
.appointmentNo
.toString()
: '',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14,
), ),
], ],
), ),
AppText( AppText(
widget.patientProgressNote.createdOn != null patientProgressNote.createdOn !=
? AppDateUtils.getDayMonthYearDateFormatted( null
DateTime.parse(widget.patientProgressNote.createdOn)) ? AppDateUtils
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), .getDayMonthYearDateFormatted(
DateTime.parse(
patientProgressNote
.createdOn))
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
) )
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( // Row(
children: [ // children: [
AppText( // AppText(
'Condition: ', // 'Condition: ',
fontSize: 12, // fontSize: 12,
), // ),
AppText(widget.patientProgressNote.mName ?? '', // AppText(
fontWeight: FontWeight.w600), // patientProgressNote.mName ??
], // '',
), // fontWeight: FontWeight.w600),
// ],
// ),
AppText( AppText(
widget.patientProgressNote.createdOn != null patientProgressNote.createdOn !=
null
? AppDateUtils.getHour( ? AppDateUtils.getHour(
DateTime.parse(widget.patientProgressNote.createdOn)) DateTime.parse(
: AppDateUtils.getHour(DateTime.now()), patientProgressNote
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
) )
@ -201,7 +276,8 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
height: 8, height: 8,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: AppText( child: AppText(
@ -213,7 +289,6 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
onTap: () { onTap: () {
setState(() { setState(() {
isAddProgress = true; isAddProgress = true;
widget.changePageViewIndex(3, isChangeState: false);
}); });
}, },
child: Icon( child: Icon(
@ -274,30 +349,23 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
), ),
Expanded( Expanded(
child: AppButton( child: AppButton(
title: TranslationBase.of(context).next, title: isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700],
loading: model.state == ViewState.BusyLocal,
disabled: progressNoteController.text.isEmpty, disabled: progressNoteController.text.isEmpty,
onPressed: () async { onPressed: () async {
if (progressNoteController.text.isNotEmpty) { if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) { 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); submitPlan(model);
} else { } else {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} else { } else {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Helpers.showErrorToast(
TranslationBase.of(context)
.progressNoteErrorMsg);
} }
}, },
), ),
@ -318,19 +386,20 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
submitPlan(SOAPViewModel model) async { submitPlan(SOAPViewModel model) async {
if (progressNoteController.text.isNotEmpty) { if (progressNoteController.text.isNotEmpty) {
PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( widget.changeLoadingState(true);
patientMRN: widget.patientInfo.patientMRN, PostProgressNoteRequestModel postProgressNoteRequestModel =
episodeId: widget.patientInfo.episodeNo, new PostProgressNoteRequestModel(
appointmentNo: widget.patientInfo.appointmentNo, patientMRN: widget.patientInfo.patientMRN,
planNote: widget.patientProgressNote.planNote, episodeId: widget.patientInfo.episodeNo,
doctorID: '', appointmentNo: widget.patientInfo.appointmentNo,
editedBy: ''); planNote: patientProgressNote.planNote,
doctorID: '',
editedBy: '');
if (model.patientProgressNoteList.isEmpty) { if (model.patientProgressNoteList.isEmpty) {
await model.postProgressNote(postProgressNoteRequestModel); await model.postProgressNote(postProgressNoteRequestModel);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; postProgressNoteRequestModel.editedBy = doctorProfile.doctorID;
await model.patchProgressNote(postProgressNoteRequestModel); await model.patchProgressNote(postProgressNoteRequestModel);
@ -339,8 +408,37 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } 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 { } else {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);
} }

@ -1,7 +1,7 @@
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BottomSheetTitle extends StatelessWidget { class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget {
const BottomSheetTitle({ const BottomSheetTitle({
Key key, this.title, Key key, this.title,
}) : super(key: key); }) : super(key: key);
@ -57,4 +57,7 @@ class BottomSheetTitle extends StatelessWidget {
), ),
); );
} }
@override
Size get preferredSize => Size(double.maxFinite,115);
} }

@ -247,6 +247,8 @@ class StepsWidget extends StatelessWidget {
"Plan", "Plan",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12, fontSize: 12,
textAlign: TextAlign.end,
marginLeft: 25,
), ),
StatusLabel( StatusLabel(
selectedStepId: index, selectedStepId: index,
@ -530,20 +532,22 @@ class StatusLabel extends StatelessWidget {
), ),
border: Border.all(color: HexColor('#707070'), width: 0.30), border: Border.all(color: HexColor('#707070'), width: 0.30),
), ),
child: AppText( child: Center(
stepId == selectedStepId child: AppText(
? "inProgress" stepId == selectedStepId
: stepId < selectedStepId ? "inProgress"
? "Completed" : stepId < selectedStepId
: " Locked ", ? "Completed"
fontWeight: FontWeight.bold, : "Locked",
textAlign: TextAlign.center, fontWeight: FontWeight.bold,
fontSize: 10, textAlign: TextAlign.center,
color: stepId == selectedStepId fontSize: 10,
? Color(0xFFCC9B14) color: stepId == selectedStepId
: stepId < selectedStepId ? Color(0xFFCC9B14)
? Color(0xFF359846) : stepId < selectedStepId
: Color(0xFF969696), ? Color(0xFF359846)
: Color(0xFF969696),
),
), ),
); );
} }

@ -1,5 +1,6 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart'; 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/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/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_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/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/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/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:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../shared_soap_widgets/bottom_sheet_title.dart'; import '../../shared_soap_widgets/bottom_sheet_title.dart';
import 'master_key_checkbox_search_allergies_widget.dart';
class AddAllergies extends StatefulWidget { class AddAllergies extends StatefulWidget {
final Function addAllergiesFun; final Function addAllergiesFun;
@ -83,95 +84,107 @@ class _AddAllergiesState extends State<AddAllergies> {
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
body: Center( appBar: BottomSheetTitle(
child: Container( title: TranslationBase.of(context).addAllergies,
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, body: Center(
children: [ child: Container(
BottomSheetTitle( child: Column(
title: TranslationBase.of(context).addAllergies, 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( SizedBox(
height: 10, height: 10,
), ),
SizedBox( Container(
height: 16, child: FractionallySizedBox(
), widthFactor: .80,
Expanded( child: Center(
child: Center( child: AppButton(
child: FractionallySizedBox( title: TranslationBase.of(context).addAllergies,
widthFactor: 0.9, padding: 10,
child: Center( color: Color(0xFF359846),
child: NetworkBaseView( onPressed: () {
baseViewModel: model, setState(() {
child: MasterKeyCheckboxSearchAllergiesWidget( widget.addAllergiesFun(myAllergiesListLocal);
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),
),
),
), ),
), ),
), ),
), ),
SizedBox( 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<AddAllergies> {
addAllergyLocally(MySelectedAllergy mySelectedAllergy) { addAllergyLocally(MySelectedAllergy mySelectedAllergy) {
if (mySelectedAllergy.selectedAllergy == null) { if (mySelectedAllergy.selectedAllergy == null) {
Helpers.showErrorToast(TranslationBase Helpers.showErrorToast(TranslationBase.of(context).requiredMsg);
.of(context)
.requiredMsg);
} else { } else {
setState(() { setState(() {
List<MySelectedAllergy> allergy = List<MySelectedAllergy> allergy =
// ignore: missing_return // ignore: missing_return
myAllergiesListLocal myAllergiesListLocal
.where((element) => .where((element) =>
mySelectedAllergy.selectedAllergy.id == mySelectedAllergy.selectedAllergy.id ==
element.selectedAllergy.id) element.selectedAllergy.id)
.toList(); .toList();
if (allergy.isEmpty) { if (allergy.isEmpty) {

@ -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<AddAllergiesItem> {
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);
}
});
}
}

@ -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<MasterKeyModel> 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<MasterKeyCheckboxSearchAllergiesWidget> {
List<MasterKeyModel> 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<MasterKeyModel> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<MasterKeyModel> 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);
});
}
}
}

@ -34,10 +34,8 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
return Column( return Column(
children: [ children: [
SOAPOpenItems(label: "${TranslationBase.of(context).addAllergies}",onTap: () { SOAPOpenItems(label: "${TranslationBase.of(context).addAllergies}",onTap: () {
openAllergiesList(context, changeAllState); openAllergiesList(context, changeAllState, removeAllergy);
},), },),
SizedBox( SizedBox(
height: 20, height: 20,
@ -153,16 +151,18 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
).toList(); ).toList();
if (allergy.length > 0) { if (allergy.length > 0) {
if(allergy.first.isLocal) {
setState(() {
widget.myAllergiesList.remove(allergy.first);
});
}
setState(() { setState(() {
allergy[0].isChecked = false; allergy[0].isChecked = false;
}); });
} }
print(allergy);
} }
openAllergiesList(BuildContext context, Function changeParentState) { openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) {
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white, backgroundColor: Colors.white,
isScrollControlled: true, isScrollControlled: true,
@ -175,15 +175,29 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
bool isAllDataFilled = true; bool isAllDataFilled = true;
mySelectedAllergy.forEach((element) { mySelectedAllergy.forEach((element) {
if (element.selectedAllergySeverity == null) { if (element.selectedAllergySeverity == null) {
element.hasValidationError = true;
isAllDataFilled = false; isAllDataFilled = false;
} }
}); });
if (isAllDataFilled) { if (isAllDataFilled) {
mySelectedAllergy.forEach((element) { 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); widget.myAllergiesList.add(element);
} }
}); });
/// remove items.
List<MySelectedAllergy> 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(); changeParentState();
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.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/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart';
@ -19,10 +20,15 @@ class AddHistoryDialog extends StatefulWidget {
final PageController controller; final PageController controller;
final List<MySelectedHistory> myHistoryList; final List<MySelectedHistory> myHistoryList;
final Function addSelectedHistories; final Function addSelectedHistories;
final Function (MasterKeyModel) removeHistory; final Function(MasterKeyModel) removeHistory;
const AddHistoryDialog( 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); : super(key: key);
@override @override
@ -51,96 +57,96 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addHistory),
body: Center( body: Center(
child: Container( child: Container(
child: Column( child: Column(
children: [ children: [
BottomSheetTitle(title:TranslationBase.of(context).addHistory), SizedBox(
SizedBox( height: 10,
height: 10, ),
), PriorityBar(onTap: (activePriority) async {
PriorityBar(onTap: (activePriority) async { widget.changePageViewIndex(activePriority);
widget.changePageViewIndex(activePriority); }),
}), SizedBox(
SizedBox( height: 20,
height: 20, ),
), Expanded(
Expanded( child: FractionallySizedBox(
child: FractionallySizedBox( widthFactor: 0.9,
widthFactor: 0.9, child: PageView(
child: PageView( physics: NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(), controller: widget.controller,
controller: widget.controller, onPageChanged: (index) {
onPageChanged: (index) { setState(() {});
setState(() { },
}); scrollDirection: Axis.horizontal,
}, children: <Widget>[
scrollDirection: Axis.horizontal, NetworkBaseView(
children: <Widget>[ baseViewModel: model,
NetworkBaseView( child: MasterKeyCheckboxSearchWidget(
baseViewModel: model, model: model,
child: MasterKeyCheckboxSearchWidget( masterList: model.historyFamilyList,
model: model, removeHistory: (history) {
masterList: model.historyFamilyList, setState(() {
removeHistory: (history){ widget.removeHistory(history);
setState(() { });
widget.removeHistory(history); },
}); addHistory: (history) {
}, setState(() {
addHistory: (history){ createAndAddHistory(history);
setState(() { });
createAndAddHistory( },
history); addSelectedHistories: () {
}); widget.addSelectedHistories();
}, },
addSelectedHistories: (){ isServiceSelected: (master) =>
widget.addSelectedHistories(); isServiceSelected(master),
}, ),
isServiceSelected: (master) =>isServiceSelected(master), ),
), NetworkBaseView(
), baseViewModel: model,
NetworkBaseView( child: MasterKeyCheckboxSearchWidget(
baseViewModel: model, model: model,
child: MasterKeyCheckboxSearchWidget( masterList: model
model: model, .mergeHistorySurgicalWithHistorySportList,
masterList: model.mergeHistorySurgicalWithHistorySportList, removeHistory: (history) {
removeHistory: (history){ setState(() {
setState(() { widget.removeHistory(history);
widget.removeHistory(history); });
}); },
}, addHistory: (history) {
addHistory: (history){ setState(() {
setState(() { createAndAddHistory(history);
createAndAddHistory( });
history); },
}); addSelectedHistories: () {
}, widget.addSelectedHistories();
addSelectedHistories: (){ },
widget.addSelectedHistories(); isServiceSelected: (master) =>
}, isServiceSelected(master),
isServiceSelected: (master) =>isServiceSelected(master), ),
), ),
), NetworkBaseView(
NetworkBaseView( baseViewModel: model,
baseViewModel: model, child: MasterKeyCheckboxSearchWidget(
child: MasterKeyCheckboxSearchWidget( model: model,
model: model, masterList: model.historyMedicalList,
masterList: model.historyMedicalList, removeHistory: (history) {
removeHistory: (history){ setState(() {
setState(() { widget.removeHistory(history);
widget.removeHistory(history); });
}); },
}, addHistory: (history) {
addHistory: (history){ setState(() {
setState(() { createAndAddHistory(history);
createAndAddHistory( });
history); },
}); addSelectedHistories: () {
}, widget.addSelectedHistories();
addSelectedHistories: (){ },
widget.addSelectedHistories();
},
isServiceSelected: (master) => isServiceSelected: (master) =>
isServiceSelected(master), isServiceSelected(master),
), ),
@ -149,59 +155,63 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
), ),
), ),
), ),
SizedBox(height:MediaQuery.of(context).size.height * 0.11 ,) SizedBox(
height: MediaQuery.of(context).size.height * 0.11,
)
], ],
) )),
),
), ),
bottomSheet: Container( bottomSheet: model.state == ViewState.Busy
decoration: BoxDecoration( ? Container(
color: Colors.white, height: 0,
borderRadius: BorderRadius.all( )
Radius.circular(0.0), : Container(
), decoration: BoxDecoration(
border: Border.all(color: HexColor('#707070'), width: 0), color: Colors.white,
), borderRadius: BorderRadius.all(
height: MediaQuery.of(context).size.height * 0.1, Radius.circular(0.0),
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();
},
),
), ),
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) { createAndAddHistory(MasterKeyModel history) {
List<MySelectedHistory> myhistory = widget.myHistoryList.where((element) => List<MySelectedHistory> myhistory = widget.myHistoryList
history.id == .where((element) =>
element.selectedHistory.id && history.id == element.selectedHistory.id &&
history.typeId == history.typeId == element.selectedHistory.typeId)
element.selectedHistory.typeId .toList();
).toList();
if (myhistory.isEmpty) { if (myhistory.isEmpty) {
setState(() { setState(() {
@ -217,18 +227,14 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
} }
isServiceSelected(MasterKeyModel masterKey) { isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedHistory> history = Iterable<MySelectedHistory> history = widget.myHistoryList.where(
widget (element) =>
.myHistoryList masterKey.id == element.selectedHistory.id &&
.where((element) => masterKey.typeId == element.selectedHistory.typeId &&
masterKey.id == element.selectedHistory.id && element.isChecked);
masterKey.typeId == element.selectedHistory.typeId &&
element.isChecked);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }
return false; return false;
} }
} }

@ -123,10 +123,19 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
).toList(); ).toList();
if (history.length > 0) if (history.length > 0) {
setState(() { if(history.first.isLocal) {
history[0].isChecked = false; setState(() {
}); widget.myHistoryList.remove(history.first);
});
} else {
setState(() {
history[0].isChecked = false;
});
}
}
} }
openHistoryList(BuildContext context) { openHistoryList(BuildContext context) {

@ -1,6 +1,7 @@
// ignore: must_be_immutable // ignore: must_be_immutable
import 'package:autocomplete_textfield/autocomplete_textfield.dart'; 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/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/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/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
@ -74,15 +75,15 @@ class _AddMedicationState extends State<AddMedication> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
body: Center( body: Center(
child: Container( child: Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -187,6 +188,7 @@ class _AddMedicationState extends State<AddMedication> {
list: model.medicationDoseTimeList, list: model.medicationDoseTimeList,
okText: okText:
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
selectedValue: _selectedMedicationDose,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedMedicationDose = _selectedMedicationDose =
@ -235,6 +237,7 @@ class _AddMedicationState extends State<AddMedication> {
list: model.medicationStrengthList, list: model.medicationStrengthList,
okText: okText:
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
selectedValue: _selectedMedicationStrength,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedMedicationStrength = _selectedMedicationStrength =
@ -283,6 +286,7 @@ class _AddMedicationState extends State<AddMedication> {
MasterKeyDailog dialog = MasterKeyDailog dialog =
MasterKeyDailog( MasterKeyDailog(
list: model.medicationRouteList, list: model.medicationRouteList,
selectedValue: _selectedMedicationRoute,
okText: okText:
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
@ -332,6 +336,7 @@ class _AddMedicationState extends State<AddMedication> {
list: model.medicationFrequencyList, list: model.medicationFrequencyList,
okText: okText:
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
selectedValue: _selectedMedicationFrequency,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedMedicationFrequency = _selectedMedicationFrequency =
@ -381,7 +386,7 @@ class _AddMedicationState extends State<AddMedication> {
]), ]),
), ),
), ),
bottomSheet: Container( bottomSheet:model.state == ViewState.Busy?Container(height: 0,): Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(

@ -30,16 +30,12 @@ import 'history/update_history_widget.dart';
class UpdateSubjectivePage extends StatefulWidget { class UpdateSubjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final Function changeLoadingState; final Function changeLoadingState;
final List<MySelectedAllergy> myAllergiesList;
final List<MySelectedHistory> myHistoryList;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final int currentIndex; final int currentIndex;
UpdateSubjectivePage( UpdateSubjectivePage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.myAllergiesList,
this.myHistoryList,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
this.currentIndex}); this.currentIndex});
@ -59,6 +55,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
String medicationControllerError = ''; String medicationControllerError = '';
String illnessControllerError = ''; String illnessControllerError = '';
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
List<MySelectedAllergy> myAllergiesList=List();
List<MySelectedHistory> myHistoryList=List();
getHistory(SOAPViewModel model) async { getHistory(SOAPViewModel model) async {
widget.changeLoadingState(true); widget.changeLoadingState(true);
@ -93,9 +91,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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()) { if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) {
@ -105,9 +103,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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()) { if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) {
@ -117,9 +115,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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()) { if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) {
@ -129,9 +127,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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<UpdateSubjectivePage> {
isChecked: element.isChecked, isChecked: element.isChecked,
createdBy: element.createdBy, createdBy: element.createdBy,
remark: element.remarks, remark: element.remarks,
isLocal : false,
selectedAllergySeverity: selectedAllergySeverity); 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<UpdateSubjectivePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.myAllergiesList.clear(); myAllergiesList.clear();
widget.myHistoryList.clear(); myHistoryList.clear();
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -246,7 +245,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
}); });
}, },
child: Column( child: Column(
children: [UpdateHistoryWidget(myHistoryList: widget.myHistoryList)], children: [UpdateHistoryWidget(myHistoryList: myHistoryList)],
), ),
isExpanded: isHistoryExpand, isExpanded: isHistoryExpand,
), ),
@ -264,7 +263,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
child: Column( child: Column(
children: [ children: [
UpdateAllergiesWidget( UpdateAllergiesWidget(
myAllergiesList: widget.myAllergiesList, myAllergiesList: myAllergiesList,
), ),
SizedBox( SizedBox(
height: 30, height: 30,
@ -304,10 +303,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700],
loading: model.state == ViewState.BusyLocal, // loading: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
addSubjectiveInfo( addSubjectiveInfo(
model: model, myAllergiesList: widget.myAllergiesList, myHistoryList: widget.myHistoryList); model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
}, },
), ),
), ),
@ -325,6 +324,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
addSubjectiveInfo( addSubjectiveInfo(
{SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async { {SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async {
if(FocusScope.of(context).hasFocus)
FocusScope.of(context).unfocus();
widget.changeLoadingState(true);
formKey.currentState.save(); formKey.currentState.save();
formKey.currentState.validate(); formKey.currentState.validate();
@ -338,7 +340,6 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} }
if (myHistoryList.length != 0) { if (myHistoryList.length != 0) {
await postHistories(model: model, myHistoryList: myHistoryList); await postHistories(model: model, myHistoryList: myHistoryList);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
@ -370,6 +371,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
medicationControllerError = TranslationBase.of(context).emptyMessage; medicationControllerError = TranslationBase.of(context).emptyMessage;
} }
}); });
widget.changeLoadingState(false);
Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg);
} }
} }
@ -380,7 +383,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
widget.myAllergiesList.forEach((allergy) { myAllergiesList.forEach((allergy) {
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM( postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM(
@ -404,6 +407,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
await model.patchAllergy(postAllergyRequestModel); await model.patchAllergy(postAllergyRequestModel);
} }
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
@ -419,7 +425,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
postHistories({List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async { postHistories({List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async {
PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: '');
widget.myHistoryList.forEach((history) { myHistoryList.forEach((history) {
if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = [];
postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,

@ -31,11 +31,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
int _currentIndex = 0; int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList = List(); List<MySelectedAllergy> myAllergiesList = List();
List<MySelectedHistory> myHistoryList = List(); List<MySelectedHistory> myHistoryList = List();
List<MySelectedExamination> mySelectedExamination = List();
List<MySelectedAssessment> mySelectedAssessment = List();
GetPatientProgressNoteResModel patientProgressNote =
GetPatientProgressNoteResModel();
changePageViewIndex(pageIndex,{isChangeState = true}) { changePageViewIndex(pageIndex,{isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState) if (pageIndex != _currentIndex && isChangeState)
@ -65,12 +61,11 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
return BaseView<DoctorReplayViewModel>( return AppScaffold(
builder: (_, model, w) => AppScaffold( isLoading: _isLoading,
isLoading: _isLoading, isShowAppBar: false,
isShowAppBar: false, body: SingleChildScrollView(
body: SingleChildScrollView( child: SingleChildScrollView(
child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -105,27 +100,22 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
UpdateSubjectivePage( UpdateSubjectivePage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdateObjectivePage( UpdateObjectivePage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
mySelectedExamination: mySelectedExamination,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdateAssessmentPage( UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
mySelectedAssessmentList: mySelectedAssessment,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdatePlanPage( UpdatePlanPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
patientInfo: patient, patientInfo: patient,
patientProgressNote: patientProgressNote,
changeLoadingState: changeLoadingState) changeLoadingState: changeLoadingState)
], ],
), ),
@ -137,6 +127,6 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
), ),
), ),
), ),
)); );
} }
} }

@ -1,5 +1,7 @@
import 'package:doctor_app_flutter/config/size_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/core/viewModel/patient-vital-sign-viewmodel.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/lookups/patient_lookup.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -18,8 +20,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
int projectID; int projectID;
bool isNotOneAppointment; bool isNotOneAppointment;
VitalSignDetailsScreen( VitalSignDetailsScreen({this.appointmentNo, this.projectID, this.isNotOneAppointment = true});
{this.appointmentNo, this.projectID, this.isNotOneAppointment = true});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -34,14 +35,12 @@ class VitalSignDetailsScreen extends StatelessWidget {
String assetBasePath = "${imageBasePath}patient/vital_signs/"; String assetBasePath = "${imageBasePath}patient/vital_signs/";
return BaseView<VitalSignsViewModel>( return BaseView<VitalSignsViewModel>(
onModelReady: (model) => onModelReady: (model) => model.getPatientVitalSignHistory(patient, from, to, isInpatient),
model.getPatientVitalSignHistory(patient, from, to, isInpatient),
builder: (_, mode, widget) => AppScaffold( builder: (_, mode, widget) => AppScaffold(
baseViewModel: mode, baseViewModel: mode,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: PatientProfileAppBar( appBar: PatientProfileAppBar(patient),
patient),
appBarTitle: TranslationBase.of(context).vitalSign, appBarTitle: TranslationBase.of(context).vitalSign,
body: mode.patientVitalSignsHistory.length > 0 body: mode.patientVitalSignsHistory.length > 0
? Column( ? Column(
@ -57,7 +56,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AppText( AppText(
"${patient.firstName ?? patient?.patientDetails?.firstName?? patient.fullName?? ''}'s", "${patient.firstName ?? patient?.patientDetails?.firstName ?? patient.fullName ?? ''}'s",
fontSize: SizeConfig.textMultiplier * 1.6, fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
@ -75,8 +74,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
height: MediaQuery.of(context).size.height * 0.23, height: MediaQuery.of(context).size.height * 0.23,
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(12.0), padding: EdgeInsets.all(12.0),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
horizontal: 16.0, vertical: 8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
color: Colors.white, color: Colors.white,
@ -100,17 +98,13 @@ class VitalSignDetailsScreen extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 1 mode.getBMIStatus() != 1
? '${assetBasePath}underweight_BMI.png' ? '${assetBasePath}underweight_BMI.png'
: '${assetBasePath}underweight_BMI-r.png', : '${assetBasePath}underweight_BMI-r.png',
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.10,
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -118,38 +112,28 @@ class VitalSignDetailsScreen extends StatelessWidget {
AppText( AppText(
"${TranslationBase.of(context).bmiUnderWeight}", "${TranslationBase.of(context).bmiUnderWeight}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier * 1.15, color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : null,
color: mode.getBMIStatus() == 1
? Color(0XFFD02127)
: null,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
AppText( AppText(
"(<18.5)", "(<18.5)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier * 1.15, color: mode.getBMIStatus() == 1 ? Color(0XFFD02127) : null,
color: mode.getBMIStatus() == 1
? Color(0XFFD02127)
: null,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 2 mode.getBMIStatus() != 2
? '${assetBasePath}health_BMI.png' ? '${assetBasePath}health_BMI.png'
: '${assetBasePath}health_BMI-r.png', : '${assetBasePath}health_BMI-r.png',
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.10,
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -158,40 +142,29 @@ class VitalSignDetailsScreen extends StatelessWidget {
child: AppText( child: AppText(
"${TranslationBase.of(context).normal}", "${TranslationBase.of(context).normal}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier *
1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 2 color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
), ),
AppText( AppText(
"(18.5-24.9)", "(18.5-24.9)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 2 color: mode.getBMIStatus() == 2 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 3 mode.getBMIStatus() != 3
? '${assetBasePath}ovrweight_BMI.png' ? '${assetBasePath}ovrweight_BMI.png'
: '${assetBasePath}ovrweight_BMI-r.png', : '${assetBasePath}ovrweight_BMI-r.png',
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.10,
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -199,38 +172,28 @@ class VitalSignDetailsScreen extends StatelessWidget {
AppText( AppText(
"${TranslationBase.of(context).bmiOverWeight}", "${TranslationBase.of(context).bmiOverWeight}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.155,
SizeConfig.textMultiplier * 1.155,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 3 color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
AppText( AppText(
"(25-29.9)", "(25-29.9)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.155,
SizeConfig.textMultiplier * 1.155,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 3 color: mode.getBMIStatus() == 3 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 4 mode.getBMIStatus() != 4
? '${assetBasePath}Obese_BMI.png' ? '${assetBasePath}Obese_BMI.png'
: '${assetBasePath}Obese_BMI-r.png', : '${assetBasePath}Obese_BMI-r.png',
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.10,
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -238,38 +201,28 @@ class VitalSignDetailsScreen extends StatelessWidget {
AppText( AppText(
"${TranslationBase.of(context).bmiObese}", "${TranslationBase.of(context).bmiObese}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 4 color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
AppText( AppText(
"(30-34.9)", "(30-34.9)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 4 color: mode.getBMIStatus() == 4 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(
mode.getBMIStatus() != 5 mode.getBMIStatus() != 5
? '${assetBasePath}Obese_BMI.png' ? '${assetBasePath}Obese_BMI.png'
: '${assetBasePath}Obese_BMI-r.png', : '${assetBasePath}Obese_BMI-r.png',
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.10,
.size
.height *
0.10,
), ),
const SizedBox( const SizedBox(
height: 4, height: 4,
@ -279,24 +232,17 @@ class VitalSignDetailsScreen extends StatelessWidget {
child: AppText( child: AppText(
"${TranslationBase.of(context).bmiObeseExtreme}", "${TranslationBase.of(context).bmiObeseExtreme}",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier *
1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 5 color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
), ),
AppText( AppText(
"(35<)", "(35<)",
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: fontSize: SizeConfig.textMultiplier * 1.15,
SizeConfig.textMultiplier * 1.15,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: mode.getBMIStatus() == 5 color: mode.getBMIStatus() == 5 ? Color(0XFFD02127) : null,
? Color(0XFFD02127)
: null,
), ),
], ],
)), )),
@ -308,11 +254,9 @@ class VitalSignDetailsScreen extends StatelessWidget {
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16),
horizontal: 16.0, vertical: 16),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
GridView.count( GridView.count(
shrinkWrap: true, shrinkWrap: true,
@ -326,16 +270,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Height,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).height,
.Height, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.height,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -345,63 +283,51 @@ class VitalSignDetailsScreen extends StatelessWidget {
: null, : null,
child: Container( child: Container(
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).height,
.height, imagePath: "${assetBasePath}height.png",
imagePath:
"${assetBasePath}height.png",
lastVal: mode.heightCm, lastVal: mode.heightCm,
unit: TranslationBase.of(context) unit: TranslationBase.of(context).cm,
.cm,
), ),
), ),
), ),
InkWell( if (isNotOneAppointment)
onTap: () => isNotOneAppointment InkWell(
? Navigator.push( onTap: () async {
context, await locator<AnalyticsService>().logEvent(
FadePage( eventCategory: "Vital Sign Details Screen",
page: eventAction: "Vital Sign Details",
VitalSignItemDetailsScreen( );
pageKey: vitalSignDetails
.Weight, Navigator.push(
pageTitle: context,
TranslationBase.of( FadePage(
context) page: VitalSignItemDetailsScreen(
.weight, pageKey: vitalSignDetails.Weight,
vitalList: mode pageTitle: TranslationBase.of(context).weight,
.patientVitalSignsHistory, vitalList: mode.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
),
), ),
) ),
: null, );
child: VitalSignItem( },
des: TranslationBase.of(context) child: VitalSignItem(
.weight, des: TranslationBase.of(context).weight,
imagePath: imagePath: "${assetBasePath}weight.png",
"${assetBasePath}weight.png", unit: TranslationBase.of(context).kg,
unit: lastVal: mode.weightKg,
TranslationBase.of(context).kg, ),
lastVal: mode.weightKg,
), ),
),
InkWell( InkWell(
onTap: () => isNotOneAppointment onTap: () => isNotOneAppointment
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Temperature,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).temperature,
.Temperature, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.temperature,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -411,13 +337,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
: null, : null,
child: Container( child: Container(
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).temperature,
.temperature, imagePath: "${assetBasePath}temperature.png",
imagePath:
"${assetBasePath}temperature.png",
lastVal: mode.temperatureCelcius, lastVal: mode.temperatureCelcius,
unit: TranslationBase.of(context) unit: TranslationBase.of(context).tempC,
.tempC,
), ),
), ),
), ),
@ -426,16 +349,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.heart,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).heart,
.heart, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.heart,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -444,13 +361,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).heart,
.heart, imagePath: "${assetBasePath}heart_rate.png",
imagePath:
"${assetBasePath}heart_rate.png",
lastVal: mode.hartRat, lastVal: mode.hartRat,
unit: unit: TranslationBase.of(context).bpm,
TranslationBase.of(context).bpm,
), ),
), ),
InkWell( InkWell(
@ -458,16 +372,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Respiration,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).respirationRate,
.Respiration, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.respirationRate,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -476,14 +384,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).respirationRate,
.respirationRate, imagePath: "${assetBasePath}respiration_rate.png",
imagePath: lastVal: mode.respirationBeatPerMinute,
"${assetBasePath}respiration_rate.png", unit: TranslationBase.of(context).respirationSigns,
lastVal:
mode.respirationBeatPerMinute,
unit: TranslationBase.of(context)
.respirationSigns,
), ),
), ),
InkWell( InkWell(
@ -491,16 +395,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.BloodPressure,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).bloodPressure,
.BloodPressure, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.bloodPressure,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -509,13 +407,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).bloodPressure,
.bloodPressure, imagePath: "${assetBasePath}blood_pressure.png",
imagePath:
"${assetBasePath}blood_pressure.png",
lastVal: mode.bloodPressure, lastVal: mode.bloodPressure,
unit: TranslationBase.of(context) unit: TranslationBase.of(context).sysDias,
.sysDias,
), ),
), ),
InkWell( InkWell(
@ -523,16 +418,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.Oxygenation,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).oxygenation,
.Oxygenation, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.oxygenation,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -541,10 +430,8 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).oxygenation,
.oxygenation, imagePath: "${assetBasePath}oxg.png",
imagePath:
"${assetBasePath}oxg.png",
lastVal: "${mode.oxygenation}%", lastVal: "${mode.oxygenation}%",
unit: "", unit: "",
), ),
@ -554,16 +441,10 @@ class VitalSignDetailsScreen extends StatelessWidget {
? Navigator.push( ? Navigator.push(
context, context,
FadePage( FadePage(
page: page: VitalSignItemDetailsScreen(
VitalSignItemDetailsScreen( pageKey: vitalSignDetails.PainScale,
pageKey: vitalSignDetails pageTitle: TranslationBase.of(context).painScale,
.PainScale, vitalList: mode.patientVitalSignsHistory,
pageTitle:
TranslationBase.of(
context)
.painScale,
vitalList: mode
.patientVitalSignsHistory,
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
@ -572,10 +453,8 @@ class VitalSignDetailsScreen extends StatelessWidget {
) )
: null, : null,
child: VitalSignItem( child: VitalSignItem(
des: TranslationBase.of(context) des: TranslationBase.of(context).painScale,
.painScale, imagePath: "${assetBasePath}painScale.png",
imagePath:
"${assetBasePath}painScale.png",
lastVal: mode.painScore, lastVal: mode.painScore,
unit: TranslationBase.of(context).severe, unit: TranslationBase.of(context).severe,
), ),
@ -588,19 +467,17 @@ class VitalSignDetailsScreen extends StatelessWidget {
), ),
), ),
], ],
), ),
), ),
), ),
], ],
) )
: Container( : Container(
color: Theme color: Theme.of(context).scaffoldBackgroundColor,
.of(context) child: ErrorMessage(
.scaffoldBackgroundColor, error: TranslationBase.of(context).vitalSignEmptyMsg,
child: ErrorMessage(error: TranslationBase )),
.of(context)
.vitalSignEmptyMsg,)),
), ),
); );
} }
} }

@ -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/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_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/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/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_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/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/SOAP/GetAssessmentReqModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -638,6 +640,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
title: TranslationBase.of(context).addMedication, title: TranslationBase.of(context).addMedication,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
onPressed: () async { onPressed: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Prescription Form",
eventAction: "Add Prescription",
);
if (route != null && if (route != null &&
duration != null && duration != null &&
doseTime != null && doseTime != null &&

@ -104,7 +104,7 @@ class PrescriptionsPage extends StatelessWidget {
prescriptionModel: model, prescriptionModel: model,
procedureType: procedureType:
ProcedureType.PRESCRIPTION, ProcedureType.PRESCRIPTION,
)), ),settings: RouteSettings(name: 'AddProcedureTabPage')),
); );
}, },
label: TranslationBase.of(context) label: TranslationBase.of(context)

@ -108,7 +108,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
patient: widget.patient, patient: widget.patient,
model: widget.prescriptionModel, model: widget.prescriptionModel,
groupProcedures: groupProcedures, groupProcedures: groupProcedures,
), ), settings: RouteSettings(name: 'PrescriptionCheckOutScreen')
), ),
); );
} else { } else {
@ -128,7 +128,7 @@ class _AddFavouriteProcedureState extends State<AddFavouriteProcedure> {
patient: widget.patient, patient: widget.patient,
addButtonTitle: widget.procedureType.getAddButtonTitle(context), addButtonTitle: widget.procedureType.getAddButtonTitle(context),
toolbarTitle: widget.procedureType.getToolbarLabel(context), toolbarTitle: widget.procedureType.getToolbarLabel(context),
), ), settings: RouteSettings(name: 'ProcedureCheckOutScreen')
), ),
); );
} }

@ -1,7 +1,9 @@
import 'package:doctor_app_flutter/config/size_config.dart'; 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/categories_procedure.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.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/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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/procedures/add-procedure-page.dart'; import 'package:doctor_app_flutter/screens/procedures/add-procedure-page.dart';
@ -21,11 +23,10 @@ class ProcedureCheckOutScreen extends StatefulWidget {
final String toolbarTitle; final String toolbarTitle;
ProcedureCheckOutScreen( 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 @override
_ProcedureCheckOutScreenState createState() => _ProcedureCheckOutScreenState createState() => _ProcedureCheckOutScreenState();
_ProcedureCheckOutScreenState();
} }
class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> { class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
@ -36,8 +37,7 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
builder: (BuildContext context, ProcedureViewModel model, Widget child) => builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold(
AppScaffold(
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
isShowAppBar: false, isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
@ -82,10 +82,8 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
widget.items.length, widget.items.length,
(index) => Container( (index) => Container(
margin: EdgeInsets.only(bottom: 15.0), margin: EdgeInsets.only(bottom: 15.0),
decoration: BoxDecoration( decoration:
color: Colors.white, BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(10.0))),
borderRadius:
BorderRadius.all(Radius.circular(10.0))),
child: ExpansionTile( child: ExpansionTile(
initiallyExpanded: true, initiallyExpanded: true,
title: Row( title: Row(
@ -98,9 +96,7 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
SizedBox( SizedBox(
width: 6.0, width: 6.0,
), ),
Expanded( Expanded(child: AppText(widget.items[index].procedureName)),
child: AppText(
widget.items[index].procedureName)),
], ],
), ),
children: [ children: [
@ -113,11 +109,9 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
Row( Row(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: 11),
horizontal: 11),
child: AppText( child: AppText(
TranslationBase.of(context) TranslationBase.of(context).orderType,
.orderType,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0xff2B353E), color: Color(0xff2B353E),
), ),
@ -129,14 +123,11 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
Radio( Radio(
activeColor: Color(0xFFD02127), activeColor: Color(0xFFD02127),
value: 0, value: 0,
groupValue: groupValue: widget.items[index].selectedType,
widget.items[index].selectedType,
onChanged: (value) { onChanged: (value) {
widget.items[index].selectedType = widget.items[index].selectedType = 0;
0;
setState(() { setState(() {
widget.items[index].type = widget.items[index].type = value.toString();
value.toString();
}); });
}, },
), ),
@ -147,15 +138,12 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
), ),
Radio( Radio(
activeColor: Color(0xFFD02127), activeColor: Color(0xFFD02127),
groupValue: groupValue: widget.items[index].selectedType,
widget.items[index].selectedType,
value: 1, value: 1,
onChanged: (value) { onChanged: (value) {
widget.items[index].selectedType = widget.items[index].selectedType = 1;
1;
setState(() { setState(() {
widget.items[index].type = widget.items[index].type = value.toString();
value.toString();
}); });
}, },
), ),
@ -174,8 +162,7 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
height: 2.0, height: 2.0,
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 12, vertical: 15.0),
horizontal: 12, vertical: 15.0),
child: TextFields( child: TextFields(
hintText: TranslationBase.of(context).remarks, hintText: TranslationBase.of(context).remarks,
controller: remarksController, controller: remarksController,
@ -222,11 +209,13 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
), ),
); );
}); });
await locator<AnalyticsService>().logEvent(
eventCategory: "Procedure Checkout Screen",
eventAction: "Add New Procedure",
);
Navigator.pop(context); Navigator.pop(context);
await model.preparePostProcedure( await model.preparePostProcedure(
entityList: entityList, entityList: entityList, patient: widget.patient, remarks: remarksController.text);
patient: widget.patient,
remarks: remarksController.text);
Navigator.pop(context); Navigator.pop(context);
Navigator.pop(context); Navigator.pop(context);
}, },

@ -110,7 +110,7 @@ class ProcedureScreen extends StatelessWidget {
patient: patient, patient: patient,
model: model, model: model,
procedureType: ProcedureType.PROCEDURE, procedureType: ProcedureType.PROCEDURE,
), ), settings: RouteSettings(name: 'AddProcedureTabPage')
), ),
); );
}, },

@ -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/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.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/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/patient_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/scan_qr_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/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -61,7 +63,11 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
), ),
AppButton( AppButton(
title: TranslationBase.of(context).scanQr, title: TranslationBase.of(context).scanQr,
onPressed: () { onPressed: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "QrReaderScreen",
eventAction: "Scan QR",
);
_scanQrAndGetPatient(context, model); _scanQrAndGetPatient(context, model);
}, },
icon: Image.asset('assets/images/qr_code_white.png'), icon: Image.asset('assets/images/qr_code_white.png'),
@ -82,10 +88,7 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
int patientID = 0; int patientID = 0;
if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]); if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]);
PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel( PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel(
patientID: patientID,clinicID: 0, patientID: patientID, clinicID: 0, doctorID: 0, projectID: int.parse(listOfParams[0]));
doctorID: 0,
projectID: int.parse(listOfParams[0])
);
await model.getInPatientList(patientSearchRequestModel, isMyInpatient: false).then((d) { await model.getInPatientList(patientSearchRequestModel, isMyInpatient: false).then((d) {
if (model.state != ViewState.ErrorLocal) { if (model.state != ViewState.ErrorLocal) {

@ -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/leave_rechdule_response.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/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/base/base_view.dart';
import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
@ -20,23 +22,29 @@ class AddRescheduleLeavScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectsProvider = Provider.of(context); projectsProvider = Provider.of(context);
return BaseView<SickLeaveViewModel>( return BaseView<SickLeaveViewModel>(
onModelReady: (model) => onModelReady: (model) => {model.getRescheduleLeave(), model.getCoveringDoctors()},
{model.getRescheduleLeave(), model.getCoveringDoctors()},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).rescheduleLeaves, appBarTitle: TranslationBase.of(context).rescheduleLeaves,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column(children: [ child: Column(children: [
AddNewOrder( onTap: () { AddNewOrder(
openLeave( onTap: () async {
context, await locator<AnalyticsService>().logEvent(
false, eventCategory: "Add Reschedule"
); "Leave Screen",
},label: TranslationBase.of(context).applyForReschedule,), eventAction: "apply For Reschedule",
);
openLeave(
context,
false,
);
},
label: TranslationBase.of(context).applyForReschedule,
),
Column( Column(
children: model.getReschduleLeave children: model.getReschduleLeave.map<Widget>((GetRescheduleLeavesResponse item) {
.map<Widget>((GetRescheduleLeavesResponse item) {
return RoundedContainer( return RoundedContainer(
child: Column( child: Column(
children: [ children: [
@ -62,71 +70,55 @@ class AddRescheduleLeavScreen extends StatelessWidget {
child: Wrap( child: Wrap(
children: <Widget>[ children: <Widget>[
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
mainAxisAlignment: Container(
MainAxisAlignment.spaceBetween, padding: EdgeInsets.all(3),
children: [ margin: EdgeInsets.only(top: 10),
Container( child: AppText(
padding: EdgeInsets.all(3), item.statusDescription,
margin: fontWeight: FontWeight.bold,
EdgeInsets.only(top: 10), color: item.status == 10
child: AppText( ? Colors.red[800]
item.statusDescription, : item.status == 2
fontWeight: FontWeight.bold, ? HexColor('#CC9B14')
color: item.status == 10 : item.status == 9
? Colors.red[800] ? Colors.green
: item.status == 2 : Colors.red,
? HexColor('#CC9B14') fontSize: 14,
: item.status == 9 ),
? Colors.green ),
: Colors.red, Padding(
fontSize: 14, padding: EdgeInsets.only(top: 10),
), child: AppText(
), AppDateUtils.convertStringToDateFormat(
Padding( item.createdOn, 'yyyy-MM-dd HH:mm'),
padding: fontWeight: FontWeight.bold,
EdgeInsets.only(top: 10), ))
child: AppText( ]),
AppDateUtils
.convertStringToDateFormat(
item.createdOn,
'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold,
))
]),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
Container( Container(
child: AppText( child: AppText(
item.requisitionType == 1 item.requisitionType == 1
? TranslationBase.of(context) ? TranslationBase.of(context).offTime
.offTime
: item.requisitionType == 2 : item.requisitionType == 2
? TranslationBase.of(context) ? TranslationBase.of(context).holiday
.holiday
: item.requisitionType == 3 : item.requisitionType == 3
? TranslationBase.of( ? TranslationBase.of(context).changeOfSchedule
context) : TranslationBase.of(context).newSchedule,
.changeOfSchedule
: TranslationBase.of(
context)
.newSchedule,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
)), )),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
Row(children: [ Row(children: [
AppText(TranslationBase.of(context) AppText(TranslationBase.of(context).startDate),
.startDate),
AppText( AppText(
AppDateUtils.convertStringToDateFormat( AppDateUtils.convertStringToDateFormat(
item.dateTimeFrom, item.dateTimeFrom, 'yyyy-MM-dd HH:mm'),
'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
) )
@ -142,13 +134,10 @@ class AddRescheduleLeavScreen extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
AppText(TranslationBase.of(context) AppText(TranslationBase.of(context).endDate),
.endDate),
AppText( AppText(
AppDateUtils AppDateUtils.convertStringToDateFormat(
.convertStringToDateFormat( item.dateTimeTo, 'yyyy-MM-dd HH:mm'),
item.dateTimeTo,
'yyyy-MM-dd HH:mm'),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
) )
], ],
@ -160,13 +149,10 @@ class AddRescheduleLeavScreen extends StatelessWidget {
model.coveringDoctors.length > 0 model.coveringDoctors.length > 0
? Row(children: [ ? Row(children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).coveringDoctor,
.coveringDoctor,
), ),
AppText( AppText(
getDoctor( getDoctor(model.coveringDoctors, item.coveringDoctorId),
model.coveringDoctors,
item.coveringDoctorId),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
) )
]) ])
@ -176,28 +162,18 @@ class AddRescheduleLeavScreen extends StatelessWidget {
// .reasons, // .reasons,
// fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
// ), // ),
Row( Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
mainAxisAlignment: Padding(
MainAxisAlignment.spaceBetween, padding: EdgeInsets.only(bottom: 5),
children: [ child: AppText(getReasons(model.allReasons, item.reasonId))),
Padding( (item.status == 2)
padding: EdgeInsets.only( ? IconButton(
bottom: 5), icon: Image.asset('assets/images/edit.png'),
child: AppText(getReasons( // color: Colors.green, //Colors.black,
model.allReasons, onPressed: () => {openLeave(context, true, extendedData: item)},
item.reasonId))), )
(item.status == 2) : SizedBox(),
? IconButton( ]),
icon: Image.asset(
'assets/images/edit.png'),
// color: Colors.green, //Colors.black,
onPressed: () => {
openLeave(context, true,
extendedData: item)
},
)
: SizedBox(),
]),
], ],
), ),
SizedBox( SizedBox(

@ -982,6 +982,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddRescheduleLeavScreen(), builder: (context) => AddRescheduleLeavScreen(),
settings: RouteSettings(name: 'AddRescheduleLeaveScreen')
// MyReferredPatient(), // MyReferredPatient(),
), ),
); );
@ -1045,7 +1046,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddRescheduleLeavScreen(), builder: (context) => AddRescheduleLeavScreen(),
// MyReferredPatient(), settings: RouteSettings(name: 'AddRescheduleLeaveScreen')
), ),
); );
} }

@ -1,8 +1,10 @@
import 'package:doctor_app_flutter/config/size_config.dart'; 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/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/project_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/sick_leave_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/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
@ -64,7 +66,12 @@ class AddSickLeavScreen extends StatelessWidget {
], ],
)), )),
InkWell( InkWell(
onTap: () { onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Add Sick Leave Screen"
"Leave Screen",
eventAction: "apply For Sick Leave",
);
openSickLeave( openSickLeave(
context, context,
false, false,

@ -562,6 +562,7 @@ class TranslationBase {
localizedValues['no-priscription-listed'][locale.languageCode]; localizedValues['no-priscription-listed'][locale.languageCode];
String get next => localizedValues['next'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode];
String get finish => localizedValues['finish'][locale.languageCode];
String get previous => localizedValues['previous'][locale.languageCode]; String get previous => localizedValues['previous'][locale.languageCode];

@ -1,6 +1,8 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_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/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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.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:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
class PatientProfileHeaderNewDesignAppBar extends StatelessWidget class PatientProfileHeaderNewDesignAppBar extends StatelessWidget with PreferredSizeWidget {
with PreferredSizeWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
@ -23,8 +24,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final Stream<String> videoCallDurationStream; final Stream<String> videoCallDurationStream;
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(this.patient, this.patientType, this.arrivalType,
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false, this.isFromLiveCare = false, this.videoCallDurationStream}); {this.height = 0.0,
this.isInpatient = false,
this.isDischargedPatient = false,
this.isFromLiveCare = false,
this.videoCallDurationStream});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -43,7 +48,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
), ),
height: height == 0 ? isInpatient? 215:200 : height, height: height == 0
? isInpatient
? 215
: 200
: height,
child: Container( child: Container(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
margin: EdgeInsets.only(top: 50), margin: EdgeInsets.only(top: 50),
@ -60,10 +69,8 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
Expanded( Expanded(
child: AppText( child: AppText(
patient.firstName != null patient.firstName != null
? (Helpers.capitalize(patient.firstName) + ? (Helpers.capitalize(patient.firstName) + " " + Helpers.capitalize(patient.lastName))
" " + : Helpers.capitalize(patient.fullName ?? patient.patientDetails.fullName),
Helpers.capitalize(patient.lastName))
: Helpers.capitalize(patient.fullName??patient.patientDetails.fullName),
fontSize: SizeConfig.textMultiplier * 1.8, fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -81,7 +88,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 4), margin: EdgeInsets.symmetric(horizontal: 4),
child: InkWell( child: InkWell(
onTap: () { onTap: () async {
await locator<AnalyticsService>().logEvent(
eventCategory: "Patient Profile Header",
eventAction: "Call Patient",
);
launch("tel://" + patient.mobileNumber); launch("tel://" + patient.mobileNumber);
}, },
child: Icon( child: Icon(
@ -93,14 +104,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
StreamBuilder( StreamBuilder(
stream: videoCallDurationStream, stream: videoCallDurationStream,
builder: (BuildContext context, AsyncSnapshot<String> snapshot) { builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if(snapshot.hasData && snapshot.data != null) if (snapshot.hasData && snapshot.data != null)
return InkWell( return InkWell(
onTap: (){ onTap: () {},
},
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)), decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)),
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 10), 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 else
@ -116,9 +129,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
width: 60, width: 60,
height: 60, height: 60,
child: Image.asset( child: Image.asset(
gender == 1 gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png',
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -130,8 +141,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SERVICES_PATIANT2[int.parse(patientType)] == SERVICES_PATIANT2[int.parse(patientType)] == "patientArrivalList"
"patientArrivalList"
? Container( ? Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -151,19 +161,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: 12, fontSize: 12,
), ),
arrivalType == '1'|| patient.arrivedOn == null arrivalType == '1' || patient.arrivedOn == null
? AppText( ? AppText(
patient.startTime != null patient.startTime != null ? patient.startTime : '',
? patient.startTime
: '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
) )
: AppText( : AppText(
patient.arrivedOn != null patient.arrivedOn != null
? AppDateUtils.convertStringToDateFormat( ? AppDateUtils.convertStringToDateFormat(
patient.arrivedOn, patient.arrivedOn, 'MM-dd-yyyy HH:mm')
'MM-dd-yyyy HH:mm')
: '', : '',
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -171,15 +178,13 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
], ],
)) ))
: SizedBox(), : SizedBox(),
if (SERVICES_PATIANT2[int.parse(patientType)] == if (SERVICES_PATIANT2[int.parse(patientType)] == "List_MyOutPatient" && !isFromLiveCare)
"List_MyOutPatient" && !isFromLiveCare)
Container( Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AppText( AppText(
TranslationBase.of(context).appointmentDate + TranslationBase.of(context).appointmentDate + " : ",
" : ",
fontSize: 14, fontSize: 14,
), ),
patient.startTime != null patient.startTime != null
@ -191,7 +196,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
color: HexColor("#20A169"), color: HexColor("#20A169"),
), ),
child: AppText( child: AppText(
patient.startTime??"", patient.startTime ?? "",
color: Colors.white, color: Colors.white,
fontSize: 1.5 * SizeConfig.textMultiplier, fontSize: 1.5 * SizeConfig.textMultiplier,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -202,14 +207,13 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
SizedBox( SizedBox(
width: 3.5, width: 3.5,
), ),
Container( Container(
child: AppText( child: AppText(
convertDateFormat2( convertDateFormat2(patient.appointmentDate ?? ''),
patient.appointmentDate ?? ''), fontSize: 1.5 * SizeConfig.textMultiplier,
fontSize: 1.5 * SizeConfig.textMultiplier, fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold,
),
), ),
),
SizedBox( SizedBox(
height: 0.5, height: 0.5,
) )
@ -224,27 +228,21 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
children: [ children: [
RichText( RichText(
text: TextSpan( text: TextSpan(
style: TextStyle( style: TextStyle(fontSize: 1.6 * SizeConfig.textMultiplier, color: Colors.black),
fontSize: 1.6 * SizeConfig.textMultiplier,
color: Colors.black),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: TranslationBase.of(context).fileNumber, text: TranslationBase.of(context).fileNumber,
style: TextStyle( style: TextStyle(fontSize: 12, fontFamily: 'Poppins')),
fontSize: 12, fontFamily: 'Poppins')),
new TextSpan( new TextSpan(
text: patient.patientId.toString(), text: patient.patientId.toString(),
style: TextStyle( style: TextStyle(fontWeight: FontWeight.w700, fontFamily: 'Poppins', fontSize: 14)),
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
fontSize: 14)),
], ],
), ),
), ),
Row( Row(
children: [ children: [
AppText( AppText(
patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', patient.nationalityName ?? patient.nationality ?? patient.nationalityId ?? '',
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12, fontSize: 12,
), ),
@ -255,9 +253,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
patient.nationalityFlagURL, patient.nationalityFlagURL,
height: 25, height: 25,
width: 30, width: 30,
errorBuilder: (BuildContext context, errorBuilder: (BuildContext context, Object exception, StackTrace stackTrace) {
Object exception,
StackTrace stackTrace) {
return Text('No Image'); return Text('No Image');
}, },
)) ))
@ -275,19 +271,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(text: TranslationBase.of(context).age + " : ", style: TextStyle(fontSize: 14)),
text: TranslationBase.of(context).age+ " : ",
style: TextStyle(fontSize: 14)),
new TextSpan( new TextSpan(
text: text:
"${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth??"" : patient.dateofBirth??"", context,isServerFormat: !isFromLiveCare)}", "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ?? "" : patient.dateofBirth ?? "", context, isServerFormat: !isFromLiveCare)}",
style: TextStyle( style: TextStyle(fontWeight: FontWeight.w700, fontSize: 14)),
fontWeight: FontWeight.w700, fontSize: 14)),
], ],
), ),
), ),
), ),
if(isInpatient) if (isInpatient)
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -295,27 +288,22 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
child: RichText( child: RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: fontSize: 2.0 * SizeConfig.textMultiplier,
2.0 * SizeConfig.textMultiplier,
color: Colors.black, color: Colors.black,
fontFamily: 'Poppins', fontFamily: 'Poppins',
), ),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: patient.admissionDate == null text: patient.admissionDate == null
? "" ? ""
: TranslationBase.of(context) : TranslationBase.of(context).admissionDate + " : ",
.admissionDate + style: TextStyle(fontSize: 14)),
" : ", new TextSpan(
style: TextStyle(fontSize: 14)), text: patient.admissionDate == null
new TextSpan( ? ""
text: patient.admissionDate == null : "${AppDateUtils.convertDateFromServerFormat(patient.admissionDate.toString(), 'yyyy-MM-dd')}",
? "" style: TextStyle(fontWeight: FontWeight.w700, fontSize: 15)),
: "${AppDateUtils.convertDateFromServerFormat(patient.admissionDate.toString(), 'yyyy-MM-dd')}", ]))),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 15)),
]))),
if (patient.admissionDate != null) if (patient.admissionDate != null)
Row( Row(
children: [ children: [
@ -323,11 +311,11 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
"${TranslationBase.of(context).numOfDays}: ", "${TranslationBase.of(context).numOfDays}: ",
fontSize: 15, fontSize: 15,
), ),
if(isDischargedPatient && patient.dischargeDate!=null) if (isDischargedPatient && patient.dischargeDate != null)
AppText( AppText(
"${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", "${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w700) fontWeight: FontWeight.w700)
else else
AppText( AppText(
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
@ -356,8 +344,7 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final startIndex = str.indexOf(start); final startIndex = str.indexOf(start);
final endIndex = str.indexOf(end, startIndex + start.length); final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch( var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(str.substring(startIndex + start.length, endIndex)));
int.parse(str.substring(startIndex + start.length, endIndex)));
newDate = date.year.toString() + newDate = date.year.toString() +
"/" + "/" +
date.month.toString().padLeft(2, '0') + date.month.toString().padLeft(2, '0') +
@ -365,13 +352,12 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
date.day.toString().padLeft(2, '0'); date.day.toString().padLeft(2, '0');
} }
return newDate??''; return newDate ?? '';
} }
isToday(date) { isToday(date) {
DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date); DateTime tempDate = new DateFormat("yyyy-MM-dd").parse(date);
return DateFormat("yyyy-MM-dd").format(tempDate) == return DateFormat("yyyy-MM-dd").format(tempDate) == DateFormat("yyyy-MM-dd").format(DateTime.now());
DateFormat("yyyy-MM-dd").format(DateTime.now());
} }
myBoxDecoration() { myBoxDecoration() {

@ -71,6 +71,7 @@ class PrescriptionOutPatientWidget extends StatelessWidget {
prescriptionResModel: prescriptionResModel:
patientPrescriptionsList[index], patientPrescriptionsList[index],
), ),
settings: RouteSettings(name: 'OutPatientPrescriptionDetailsScreen')
), ),
); );
}, },

@ -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: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 14),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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,
);
}
}

@ -118,6 +118,7 @@ class _AppDrawerState extends State<AppDrawer> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => AddRescheduleLeavScreen(), builder: (context) => AddRescheduleLeavScreen(),
settings: RouteSettings(name: 'AddRescheduleLeaveScreen')
// MyReferredPatient(), // MyReferredPatient(),
)); ));
}, },

@ -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<MasterKeyModel> 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<MasterKeyCheckboxSearchAllergiesWidget> {
List<MasterKeyModel> 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<MasterKeyModel> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<MasterKeyModel> 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);
});
}
}
}

@ -27,6 +27,7 @@ class AppTextFieldCustom extends StatefulWidget {
final String validationError; final String validationError;
final bool isPrscription; final bool isPrscription;
final bool isSecure; final bool isSecure;
final bool focus;
AppTextFieldCustom({ AppTextFieldCustom({
this.height = 0, this.height = 0,
@ -47,6 +48,7 @@ class AppTextFieldCustom extends StatefulWidget {
this.validationError, this.validationError,
this.isPrscription = false, this.isPrscription = false,
this.isSecure = false, this.isSecure = false,
this.focus = false,
}); });
@override @override
@ -54,6 +56,32 @@ class AppTextFieldCustom extends StatefulWidget {
} }
class _AppTextFieldCustomState extends State<AppTextFieldCustom> { class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -104,10 +132,11 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.height != 0 && widget.maxLines == 1 widget.height != 0 && widget.maxLines == 1
? widget.height - 22 ? widget.height - 22
: null, : null,
child: TextField( child: TextFormField(
textAlign: projectViewModel.isArabic textAlign: projectViewModel.isArabic
? TextAlign.right ? TextAlign.right
: TextAlign.left, : TextAlign.left,
focusNode: _focusNode,
decoration: TextFieldsUtils decoration: TextFieldsUtils
.textFieldSelectorDecoration( .textFieldSelectorDecoration(
widget.hintText, null, true), widget.hintText, null, true),
@ -129,7 +158,7 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
? widget.inputFormatters ? widget.inputFormatters
: [], : [],
onChanged: (value) { onChanged: (value) {
setState(() {}); // setState(() {});
if (widget.onChanged != null) { if (widget.onChanged != null) {
widget.onChanged(value); widget.onChanged(value);
} }
@ -162,9 +191,10 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
), ),
), ),
), ),
if (widget.validationError != null) if (widget.validationError != null && widget.validationError.isNotEmpty)
TextFieldsError(error: widget.validationError), TextFieldsError(error: widget.validationError),
], ],
); );
} }
} }

@ -13,9 +13,9 @@ class CustomValidationError extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if(error == null ) if(error == null )
error = TranslationBase error = TranslationBase
.of(context) .of(context)
.emptyMessage; .emptyMessage;
return Column( return Column(
children: [ children: [
SizedBox( SizedBox(

@ -7,6 +7,7 @@ class FadePage extends PageRouteBuilder {
FadePage({this.page}) FadePage({this.page})
: super( : super(
opaque: false, opaque: false,
settings: RouteSettings(name: page.runtimeType.toString()),
fullscreenDialog: true, fullscreenDialog: true,
barrierDismissible: true, barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.8), barrierColor: Colors.black.withOpacity(0.8),

@ -24,6 +24,7 @@ class SlideUpPageRoute extends PageRouteBuilder {
opaque: opaque, opaque: opaque,
barrierColor: Color.fromRGBO(0, 0, 0, 0.5), barrierColor: Color.fromRGBO(0, 0, 0, 0.5),
barrierDismissible: true, barrierDismissible: true,
settings: RouteSettings(name: widget.runtimeType.toString()),
transitionDuration: Duration(milliseconds: 800), transitionDuration: Duration(milliseconds: 800),
transitionsBuilder: ((BuildContext context, transitionsBuilder: ((BuildContext context,
Animation<double> animation, Animation<double> animation,

Loading…
Cancel
Save