SetupID made dynamic

development-3.3_voipCall
haroon amjad 3 years ago
parent 3b3e911af3
commit 92c665197d

@ -5,10 +5,10 @@ import 'dart:io' show Platform;
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/service/NavigationService.dart';
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/service/NavigationService.dart';
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -47,14 +47,12 @@ class BaseAppClient {
body['DoctorID'] = doctorProfile?.doctorID; body['DoctorID'] = doctorProfile?.doctorID;
} }
if (body['DoctorID'] == "") body['DoctorID'] = null; if (body['DoctorID'] == "") body['DoctorID'] = null;
if (body['EditedBy'] == null) if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile?.doctorID;
body['EditedBy'] = doctorProfile?.doctorID;
if (body['ProjectID'] == null) { if (body['ProjectID'] == null) {
body['ProjectID'] = doctorProfile?.projectID; body['ProjectID'] = doctorProfile?.projectID;
} }
if (body['ClinicID'] == null) if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID;
body['ClinicID'] = doctorProfile?.clinicID;
} else { } else {
String doctorID = await sharedPref.getString(DOCTOR_ID); String doctorID = await sharedPref.getString(DOCTOR_ID);
if (body['DoctorID'] == '') { if (body['DoctorID'] == '') {
@ -88,21 +86,16 @@ class BaseAppClient {
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP;
body['PatientOutSA'] = body['PatientOutSA'] ?? 0; // PATIENT_OUT_SA; body['PatientOutSA'] = body['PatientOutSA'] ?? 0; // PATIENT_OUT_SA;
if (body['VidaAuthTokenID'] == null) { if (body['VidaAuthTokenID'] == null) {
body['VidaAuthTokenID'] = body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
} }
if (body['VidaRefreshTokenID'] == null) { if (body['VidaRefreshTokenID'] == null) {
body['VidaRefreshTokenID'] = body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
} }
int projectID = await sharedPref.getInt(PROJECT_ID); int projectID = await sharedPref.getInt(PROJECT_ID);
if (projectID == 2 || projectID == 3) if (projectID == 2 || projectID == 3)
body['PatientOutSA'] = true; body['PatientOutSA'] = true;
else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3)
body['facilityId'] == 3) ||
body['ProjectID'] == 2 ||
body['ProjectID'] == 3)
body['PatientOutSA'] = true; body['PatientOutSA'] = true;
else else
body['PatientOutSA'] = false; body['PatientOutSA'] = false;
@ -113,29 +106,21 @@ class BaseAppClient {
var asd = json.encode(body); var asd = json.encode(body);
var asd2; var asd2;
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(Uri.parse(url), final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'});
body: json.encode(body),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
});
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) { if (statusCode < 200 || statusCode >= 400) {
onFailure(Utils.generateContactAdminMsg(), statusCode); onFailure(Utils.generateContactAdminMsg(), statusCode);
} else { } else {
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
if (parsed['ErrorType'] == 4) { if (parsed['ErrorType'] == 4) {
helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']);
parsed['AndroidLink'], parsed['IOSLink']);
} }
if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) { if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) {
if (body['OTP_SendType'] != null) { if (body['OTP_SendType'] != null) {
onFailure(getError(parsed), statusCode); onFailure(getError(parsed), statusCode);
} else if (!isAllowAny) { } else if (!isAllowAny) {
await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX, await Provider.of<AuthenticationViewModel>(AppGlobal.CONTEX, listen: false).logout();
listen: false)
.logout();
Utils.showErrorToast('Your session expired Please login again'); Utils.showErrorToast('Your session expired Please login again');
locator<NavigationService>().pushNamedAndRemoveUntil(ROOT); locator<NavigationService>().pushNamedAndRemoveUntil(ROOT);
@ -170,10 +155,7 @@ class BaseAppClient {
String url = BASE_URL + endPoint; String url = BASE_URL + endPoint;
try { try {
Map<String, String> headers = { Map<String, String> headers = {'Content-Type': 'application/json', 'Accept': 'application/json'};
'Content-Type': 'application/json',
'Accept': 'application/json'
};
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -184,13 +166,12 @@ class BaseAppClient {
body['DoctorID'] = doctorProfile?.doctorID; body['DoctorID'] = doctorProfile?.doctorID;
} }
} }
var languageID = var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en');
await sharedPref.getStringWithDefaultValue(APP_Language, 'en');
body['SetupID'] = body.containsKey('SetupID') body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null ? body['SetupID'] != null
? body['SetupID'] ? body['SetupID']
: SETUP_ID : await sharedPref.getString(DOCTOR_SETUP_ID)
: SETUP_ID; : await sharedPref.getString(DOCTOR_SETUP_ID);
body['VersionID'] = VERSION_ID; body['VersionID'] = VERSION_ID;
body['Channel'] = CHANNEL; body['Channel'] = CHANNEL;
@ -205,12 +186,11 @@ class BaseAppClient {
: PATIENT_OUT_SA_PATIENT_REQ; : PATIENT_OUT_SA_PATIENT_REQ;
if (body.containsKey('isDentalAllowedBackend')) { if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] = body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend')
body.containsKey('isDentalAllowedBackend') ? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend'] != null ? body['isDentalAllowedBackend']
? body['isDentalAllowedBackend'] : IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND : IS_DENTAL_ALLOWED_BACKEND;
: IS_DENTAL_ALLOWED_BACKEND;
} }
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
@ -231,10 +211,8 @@ class BaseAppClient {
: PATIENT_TYPE_ID : PATIENT_TYPE_ID
: PATIENT_TYPE_ID; : PATIENT_TYPE_ID;
body['TokenID'] = body.containsKey('TokenID') ? body['TokenID']??token : token; body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] ?? token : token;
body['PatientID'] = body['PatientID'] != null body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient.patientId ?? patient.patientMRN;
? body['PatientID']
: patient.patientId ?? patient.patientMRN;
body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it
body['SessionID'] = SESSION_ID; //getSe body['SessionID'] = SESSION_ID; //getSe
@ -250,8 +228,7 @@ class BaseAppClient {
var asd = json.encode(body); var asd = json.encode(body);
var asd2; var asd2;
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(Uri.parse(url.trim()), final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
body: json.encode(body), headers: headers);
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
print("statusCode :$statusCode"); print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode < 200 || statusCode >= 400 || json == null) {
@ -263,8 +240,7 @@ class BaseAppClient {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
if (parsed['ErrorType'] == 4) { if (parsed['ErrorType'] == 4) {
helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']);
parsed['AndroidLink'], parsed['IOSLink']);
} }
if (parsed['IsAuthenticated'] == null) { if (parsed['IsAuthenticated'] == null) {
if (parsed['isSMSSent'] == true) { if (parsed['isSMSSent'] == true) {
@ -280,28 +256,20 @@ class BaseAppClient {
onFailure(getError(parsed), statusCode); onFailure(getError(parsed), statusCode);
} }
} }
} else if (parsed['MessageStatus'] == 1 || } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) {
parsed['SMSLoginRequired'] == true) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else if (parsed['MessageStatus'] == 2 && } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) {
parsed['IsAuthenticated']) {
if (parsed['SameClinicApptList'] != null) { if (parsed['SameClinicApptList'] != null) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
if (parsed['message'] == null && if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) {
parsed['ErrorEndUserMessage'] == null) {
if (parsed['ErrorSearchMsg'] == null) { if (parsed['ErrorSearchMsg'] == null) {
onFailure("Server Error found with no available message", onFailure("Server Error found with no available message", statusCode);
statusCode);
} else { } else {
onFailure(parsed['ErrorSearchMsg'], statusCode); onFailure(parsed['ErrorSearchMsg'], statusCode);
} }
} else { } else {
onFailure( onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
parsed['message'] ??
parsed['ErrorEndUserMessage'] ??
parsed['ErrorMessage'],
statusCode);
} }
} }
} else { } else {
@ -311,9 +279,7 @@ class BaseAppClient {
if (parsed['message'] != null) { if (parsed['message'] != null) {
onFailure(parsed['message'] ?? parsed['message'], statusCode); onFailure(parsed['message'] ?? parsed['message'], statusCode);
} else { } else {
onFailure( onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
} }
} }
} }
@ -334,14 +300,9 @@ class BaseAppClient {
if (parsed["ValidationErrors"] != null) { if (parsed["ValidationErrors"] != null) {
error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n";
if (parsed["ValidationErrors"]["ValidationErrors"] != null && if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) {
parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) {
for (var i = 0; error = error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n";
i < parsed["ValidationErrors"]["ValidationErrors"].length;
i++) {
error = error +
parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] +
"\n";
} }
} }
} }

@ -14,3 +14,4 @@ const DASHBOARD_DATA = 'dashboard-data';
const OTP_TYPE = 'otp-type'; const OTP_TYPE = 'otp-type';
const LAST_LOGIN_USER = 'last-login-user'; const LAST_LOGIN_USER = 'last-login-user';
const CLINIC_NAME = 'clinic-name'; const CLINIC_NAME = 'clinic-name';
const DOCTOR_SETUP_ID = 'doctor-setup-id';

@ -60,7 +60,7 @@ class CheckActivationCodeForDoctorAppResponseModel {
} }
class ListDoctorsClinic { class ListDoctorsClinic {
Null setupID; String setupID;
int projectID; int projectID;
int doctorID; int doctorID;
int clinicID; int clinicID;

@ -6,7 +6,7 @@
*@desc: Clinic Model *@desc: Clinic Model
*/ */
class ClinicModel { class ClinicModel {
Null setupID; String setupID;
int projectID; int projectID;
int doctorID; int doctorID;
int clinicID; int clinicID;

@ -11,22 +11,23 @@ import 'package:doctor_app_flutter/core/model/auth/imei_details.dart';
import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart';
import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart'; import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart';
import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.dart'; import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.dart';
import 'package:doctor_app_flutter/core/model/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/model/doctor/profile_req_Model.dart';
import 'package:doctor_app_flutter/core/model/doctor/user_model.dart';
import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart';
import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart';
import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/service/authentication_service.dart';
import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/core/model/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/model/doctor/profile_req_Model.dart';
import 'package:doctor_app_flutter/core/model/doctor/user_model.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/auth_strings.dart';
// import 'package:huawei_hmsavailability/huawei_hmsavailability.dart'; // import 'package:huawei_hmsavailability/huawei_hmsavailability.dart';
// import 'package:local_auth/auth_strings.dart'; // import 'package:local_auth/auth_strings.dart';
import 'package:local_auth/local_auth.dart'; import 'package:local_auth/local_auth.dart';
@ -43,20 +44,13 @@ class AuthenticationViewModel extends BaseViewModel {
NewLoginInformationModel get loginInfo => _authService.loginInfo; NewLoginInformationModel get loginInfo => _authService.loginInfo;
List<DoctorProfileModel> get doctorProfilesList => List<DoctorProfileModel> get doctorProfilesList => _authService.doctorProfilesList;
_authService.doctorProfilesList;
SendActivationCodeForDoctorAppResponseModel SendActivationCodeForDoctorAppResponseModel get activationCodeVerificationScreenRes => _authService.activationCodeVerificationScreenRes;
get activationCodeVerificationScreenRes =>
_authService.activationCodeVerificationScreenRes;
SendActivationCodeForDoctorAppResponseModel SendActivationCodeForDoctorAppResponseModel get activationCodeForDoctorAppRes => _authService.activationCodeForDoctorAppRes;
get activationCodeForDoctorAppRes =>
_authService.activationCodeForDoctorAppRes;
CheckActivationCodeForDoctorAppResponseModel CheckActivationCodeForDoctorAppResponseModel get checkActivationCodeForDoctorAppRes => _authService.checkActivationCodeForDoctorAppRes;
get checkActivationCodeForDoctorAppRes =>
_authService.checkActivationCodeForDoctorAppRes;
NewLoginInformationModel loggedUser; NewLoginInformationModel loggedUser;
GetIMEIDetailsModel user; GetIMEIDetailsModel user;
@ -91,32 +85,20 @@ class AuthenticationViewModel extends BaseViewModel {
profileInfo['IMEI'] = 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'] = loggedIn != null ? loggedIn['MobileNumber'] : user.mobile;
loggedIn != null ? loggedIn['MobileNumber'] : user.mobile; InsertIMEIDetailsModel insertIMEIDetailsModel = InsertIMEIDetailsModel.fromJson(profileInfo);
InsertIMEIDetailsModel insertIMEIDetailsModel = insertIMEIDetailsModel.genderDescription = profileInfo['Gender_Description'];
InsertIMEIDetailsModel.fromJson(profileInfo); insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN'];
insertIMEIDetailsModel.genderDescription = insertIMEIDetailsModel.genderDescriptionN = profileInfo['Gender_DescriptionN'];
profileInfo['Gender_Description'];
insertIMEIDetailsModel.genderDescriptionN =
profileInfo['Gender_DescriptionN'];
insertIMEIDetailsModel.genderDescriptionN =
profileInfo['Gender_DescriptionN'];
insertIMEIDetailsModel.titleDescription = profileInfo['Title_Description']; insertIMEIDetailsModel.titleDescription = profileInfo['Title_Description'];
insertIMEIDetailsModel.titleDescriptionN = insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN'];
profileInfo['Title_DescriptionN'];
insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID);
insertIMEIDetailsModel.doctorID = loggedIn != null insertIMEIDetailsModel.doctorID = loggedIn != null ? loggedIn['List_MemberInformation'][0]['MemberID'] : user.doctorID;
? loggedIn['List_MemberInformation'][0]['MemberID'] insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA;
: user.doctorID; insertIMEIDetailsModel.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
insertIMEIDetailsModel.outSA = insertIMEIDetailsModel.vidaRefreshTokenID = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA;
insertIMEIDetailsModel.vidaAuthTokenID =
await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
insertIMEIDetailsModel.vidaRefreshTokenID =
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
insertIMEIDetailsModel.password = userInfo.password; insertIMEIDetailsModel.password = userInfo.password;
insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser.listMemberInformation[0].employeeID insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser.listMemberInformation[0].employeeID : int.parse(user.editedBy.toString());
: int.parse(user.editedBy.toString());
await _authService.insertDeviceImei(insertIMEIDetailsModel); await _authService.insertDeviceImei(insertIMEIDetailsModel);
if (_authService.hasError) { if (_authService.hasError) {
@ -144,25 +126,22 @@ class AuthenticationViewModel extends BaseViewModel {
} }
/// send activation code for for msg methods /// send activation code for for msg methods
Future sendActivationCodeVerificationScreen( Future sendActivationCodeVerificationScreen(AuthMethodTypes authMethodType) async {
AuthMethodTypes authMethodType) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
ActivationCodeForVerificationScreenModel activationCodeModel = ActivationCodeForVerificationScreenModel activationCodeModel = ActivationCodeForVerificationScreenModel(
ActivationCodeForVerificationScreenModel( iMEI: user.iMEI,
iMEI: user.iMEI, facilityId: user.projectID,
facilityId: user.projectID, memberID: user.doctorID,
memberID: user.doctorID, loginDoctorID: int.parse(user.editedBy.toString()),
loginDoctorID: int.parse(user.editedBy.toString()), zipCode: user.outSA == true ? '971' : '966',
zipCode: user.outSA == true ? '971' : '966', mobileNumber: user.mobile,
mobileNumber: user.mobile, oTPSendType: authMethodType.getTypeIdService(),
oTPSendType: authMethodType.getTypeIdService(), isMobileFingerPrint: 1,
isMobileFingerPrint: 1, vidaAuthTokenID: user.vidaAuthTokenID,
vidaAuthTokenID: user.vidaAuthTokenID, vidaRefreshTokenID: user.vidaRefreshTokenID);
vidaRefreshTokenID: user.vidaRefreshTokenID);
await sharedPref.setString(DOCTOR_ID, user.editedBy.toString()); await sharedPref.setString(DOCTOR_ID, user.editedBy.toString());
await _authService await _authService.sendActivationCodeVerificationScreen(activationCodeModel);
.sendActivationCodeVerificationScreen(activationCodeModel);
if (_authService.hasError) { if (_authService.hasError) {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -171,8 +150,7 @@ class AuthenticationViewModel extends BaseViewModel {
} }
/// send activation code for silent login /// send activation code for silent login
Future sendActivationCodeForDoctorApp( Future sendActivationCodeForDoctorApp({AuthMethodTypes authMethodType, String password}) async {
{AuthMethodTypes authMethodType, String password}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
int projectID = await sharedPref.getInt(PROJECT_ID); int projectID = await sharedPref.getInt(PROJECT_ID);
ActivationCodeModel activationCodeModel = ActivationCodeModel( ActivationCodeModel activationCodeModel = ActivationCodeModel(
@ -187,57 +165,45 @@ class AuthenticationViewModel extends BaseViewModel {
error = _authService.error; error = _authService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
await sharedPref.setString( await sharedPref.setString(TOKEN, _authService.activationCodeForDoctorAppRes.logInTokenID);
TOKEN, _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( Future checkActivationCodeForDoctorApp({String activationCode, bool isSilentLogin = false}) async {
{String activationCode, bool isSilentLogin = false}) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel(
new CheckActivationCodeRequestModel( zipCode: loggedUser != null ? loggedUser.zipCode : user.zipCode,
zipCode: loggedUser != null ? loggedUser.zipCode : user.zipCode, mobileNumber: loggedUser != null ? loggedUser.mobileNumber : user.mobile,
mobileNumber: projectID: await sharedPref.getInt(PROJECT_ID) != null ? await sharedPref.getInt(PROJECT_ID) : user.projectID,
loggedUser != null ? loggedUser.mobileNumber : user.mobile, logInTokenID: await sharedPref.getString(TOKEN),
projectID: await sharedPref.getInt(PROJECT_ID) != null activationCode: activationCode ?? '0000',
? await sharedPref.getInt(PROJECT_ID) memberID: userInfo.userID != null ? int.parse(userInfo.userID) : user.doctorID,
: user.projectID, password: userInfo.password,
logInTokenID: await sharedPref.getString(TOKEN), facilityId: userInfo.projectID != null ? userInfo.projectID.toString() : user.projectID.toString(),
activationCode: activationCode ?? '0000', oTPSendType: await sharedPref.getInt(OTP_TYPE),
memberID: userInfo.userID != null iMEI: localToken,
? int.parse(userInfo.userID) loginDoctorID: loggedUser != null ? loggedUser.listMemberInformation[0].employeeID : int.parse(user.editedBy.toString()),
: user.doctorID,
password: userInfo.password, ///loggedUser.listMemberInformation[0].employeeID,
facilityId: userInfo.projectID != null // loggedUser.listMemberInformation[0].employeeID,
? userInfo.projectID.toString() isForSilentLogin: isSilentLogin,
: user.projectID.toString(), generalid: "Cs2020@2016\$2958");
oTPSendType: await sharedPref.getInt(OTP_TYPE), await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp);
iMEI: localToken,
loginDoctorID: loggedUser != null ? loggedUser.listMemberInformation[0].employeeID
: int.parse(user.editedBy.toString()),///loggedUser.listMemberInformation[0].employeeID,
// loggedUser.listMemberInformation[0].employeeID,
isForSilentLogin: isSilentLogin,
generalid: "Cs2020@2016\$2958");
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( await setDataAfterSendActivationSuccess(checkActivationCodeForDoctorAppRes);
checkActivationCodeForDoctorAppRes);
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
/// get list of Hospitals /// get list of Hospitals
Future getHospitalsList(memberID) async { Future getHospitalsList(memberID) async {
GetHospitalsRequestModel getHospitalsRequestModel = GetHospitalsRequestModel getHospitalsRequestModel = GetHospitalsRequestModel();
GetHospitalsRequestModel();
getHospitalsRequestModel.memberID = memberID; getHospitalsRequestModel.memberID = memberID;
getHospitalsRequestModel.doctorID = memberID; getHospitalsRequestModel.doctorID = memberID;
await _hospitalsService.getHospitals(getHospitalsRequestModel); await _hospitalsService.getHospitals(getHospitalsRequestModel);
@ -269,17 +235,13 @@ 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( setDataAfterSendActivationSuccess(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) async {
CheckActivationCodeForDoctorAppResponseModel
sendActivationCodeForDoctorAppResponseModel) async {
// print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode);
await sharedPref.setString(VIDA_AUTH_TOKEN_ID, await sharedPref.setString(DOCTOR_SETUP_ID, sendActivationCodeForDoctorAppResponseModel.listDoctorsClinic[0].setupID);
sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); await sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID);
await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID);
sendActivationCodeForDoctorAppResponseModel.vidaRefreshTokenID); await sharedPref.setString(TOKEN, sendActivationCodeForDoctorAppResponseModel.authenticationTokenID);
await sharedPref.setString(TOKEN,
sendActivationCodeForDoctorAppResponseModel.authenticationTokenID);
} }
saveObjToString(String key, value) async { saveObjToString(String key, value) async {
@ -288,18 +250,10 @@ class AuthenticationViewModel extends BaseViewModel {
/// ask user to add his biometric /// ask user to add his biometric
showIOSAuthMessages() async { showIOSAuthMessages() async {
const iosStrings = const IOSAuthMessages( const iosStrings = const IOSAuthMessages(cancelButton: 'cancel', goToSettingsButton: 'settings', goToSettingsDescription: 'Please set up your Touch ID.', lockOut: 'Please Enable Your Touch ID');
cancelButton: 'cancel',
goToSettingsButton: 'settings',
goToSettingsDescription: 'Please set up your Touch ID.',
lockOut: 'Please Enable Your Touch ID');
try { try {
await auth.authenticateWithBiometrics( await auth.authenticateWithBiometrics(localizedReason: 'Scan your fingerprint to authenticate', useErrorDialogs: true, stickyAuth: true, iOSAuthStrings: iosStrings);
localizedReason: 'Scan your fingerprint to authenticate',
useErrorDialogs: true,
stickyAuth: true,
iOSAuthStrings: iosStrings);
} on PlatformException catch (e) { } on PlatformException catch (e) {
DrAppToastMsg.showErrorToast(e.toString()); DrAppToastMsg.showErrorToast(e.toString());
} }
@ -312,12 +266,7 @@ class AuthenticationViewModel extends BaseViewModel {
/// get doctor profile based on clinic model /// get doctor profile based on clinic model
Future getDoctorProfileBasedOnClinic(ClinicModel clinicInfo) async { Future getDoctorProfileBasedOnClinic(ClinicModel clinicInfo) async {
ProfileReqModel docInfo = new ProfileReqModel( ProfileReqModel docInfo = new ProfileReqModel(doctorID: clinicInfo.doctorID, clinicID: clinicInfo.clinicID, license: true, projectID: clinicInfo.projectID, languageID: 2);
doctorID: clinicInfo.doctorID,
clinicID: clinicInfo.clinicID,
license: true,
projectID: clinicInfo.projectID,
languageID: 2);
///TODO change the lan ///TODO change the lan
await _authService.getDoctorProfileBasedOnClinic(docInfo); await _authService.getDoctorProfileBasedOnClinic(docInfo);
@ -332,17 +281,12 @@ 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({bool isSilentLogin = false}) async { onCheckActivationCodeSuccess({bool isSilentLogin = false}) async {
sharedPref.setString( sharedPref.setString(TOKEN, checkActivationCodeForDoctorAppRes.authenticationTokenID);
TOKEN, checkActivationCodeForDoctorAppRes.authenticationTokenID); if (checkActivationCodeForDoctorAppRes.listDoctorProfile != null && checkActivationCodeForDoctorAppRes.listDoctorProfile.isNotEmpty) {
if (checkActivationCodeForDoctorAppRes.listDoctorProfile != null && localSetDoctorProfile(checkActivationCodeForDoctorAppRes.listDoctorProfile[0]);
checkActivationCodeForDoctorAppRes.listDoctorProfile.isNotEmpty) {
localSetDoctorProfile(
checkActivationCodeForDoctorAppRes.listDoctorProfile[0]);
} else { } else {
sharedPref.setObj( sharedPref.setObj(CLINIC_NAME, checkActivationCodeForDoctorAppRes.listDoctorsClinic);
CLINIC_NAME, checkActivationCodeForDoctorAppRes.listDoctorsClinic); ClinicModel clinic = ClinicModel.fromJson(checkActivationCodeForDoctorAppRes.listDoctorsClinic[0].toJson());
ClinicModel clinic = ClinicModel.fromJson(
checkActivationCodeForDoctorAppRes.listDoctorsClinic[0].toJson());
await getDoctorProfileBasedOnClinic(clinic); await getDoctorProfileBasedOnClinic(clinic);
} }
} }
@ -387,7 +331,7 @@ class AuthenticationViewModel extends BaseViewModel {
setState(ViewState.Busy); setState(ViewState.Busy);
try { try {
token = await _firebaseMessaging.getToken(); token = await _firebaseMessaging.getToken();
} catch(ex) { } catch (ex) {
print(ex); print(ex);
} }
@ -401,10 +345,8 @@ class AuthenticationViewModel extends BaseViewModel {
} else { } else {
if (_authService.dashboardItemsList.length > 0) { if (_authService.dashboardItemsList.length > 0) {
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_REFRESH_TOKEN_ID, user.vidaRefreshTokenID);
await sharedPref.setString(VIDA_AUTH_TOKEN_ID, user.vidaAuthTokenID); await sharedPref.setString(VIDA_AUTH_TOKEN_ID, user.vidaAuthTokenID);
this.unverified = true; this.unverified = true;
} }

@ -1,16 +1,16 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.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/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart'; import 'package:doctor_app_flutter/core/model/sick_leave/sick_leave_patient_model.dart';
import 'package:doctor_app_flutter/core/service/AnalyticsService.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/locator.dart';
import 'package:doctor_app_flutter/core/model/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/patient-sick-leave/add_patient_sick_leave_screen.dart'; import 'package:doctor_app_flutter/screens/patient-sick-leave/add_patient_sick_leave_screen.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
@ -64,18 +64,14 @@ class PatientSickLeaveScreen extends StatelessWidget {
if (!projectsProvider.isArabic) if (!projectsProvider.isArabic)
AppText( AppText(
TranslationBase.of(context).patient, TranslationBase.of(context).patient,
fontSize: fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 4),
SizeConfig.getTextMultiplierBasedOnWidth() *
(SizeConfig.isWidthLarge ? 3 : 4),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: -0.72, letterSpacing: -0.72,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
AppText( AppText(
TranslationBase.of(context).sickLeave, TranslationBase.of(context).sickLeave,
fontSize: fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 6 : 6),
SizeConfig.getTextMultiplierBasedOnWidth() *
(SizeConfig.isWidthLarge ? 6 : 6),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
letterSpacing: -1.44, letterSpacing: -1.44,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
@ -105,8 +101,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
shrinkWrap: true, shrinkWrap: true,
itemCount: model.getAllSIckLeavePatient.length, itemCount: model.getAllSIckLeavePatient.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
SickLeavePatientModel item = SickLeavePatientModel item = model.getAllSIckLeavePatient[index];
model.getAllSIckLeavePatient[index];
return Column( return Column(
children: [ children: [
CardWithBgWidget( CardWithBgWidget(
@ -122,42 +117,31 @@ class PatientSickLeaveScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
if (item.doctorName != null) if (item.doctorName != null)
Row( Row(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [
crossAxisAlignment: Expanded(
CrossAxisAlignment.start, // width: MediaQuery.of(context).size.width*0.51,
mainAxisAlignment: child: AppText(
MainAxisAlignment.start, Utils.capitalize(item.doctorName ?? ""),
children: [ fontSize: 18,
Expanded( color: Color(0xff2e303a),
// width: MediaQuery.of(context).size.width*0.51, fontWeight: FontWeight.w700,
child: AppText( fontFamily: 'Poppins',
Utils.capitalize( textOverflow: TextOverflow.ellipsis,
item.doctorName ?? ""), ),
fontSize: 18, ),
color: Color(0xff2e303a), ]),
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
textOverflow:
TextOverflow.ellipsis,
),
),
]),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Row( Row(
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: borderRadius: BorderRadius.circular(50.0),
BorderRadius.circular(50.0),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: item.doctorImageURL ?? imageUrl: item.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
height: 30, height: 30,
width: 30, width: 30,
errorWidget: errorWidget: (context, url, error) => AppText(
(context, url, error) =>
AppText(
'No Image', 'No Image',
fontSize: 10, fontSize: 10,
), ),
@ -170,90 +154,36 @@ class PatientSickLeaveScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
CustomRow( CustomRow(
label: TranslationBase.of( label: TranslationBase.of(context).daysSickleave,
context) labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
.daysSickleave, valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
labelSize: SizeConfig value:
.getTextMultiplierBasedOnWidth() * (item.sickLeaveDays.toString() != null && item.sickLeaveDays.toString() != "null") ? item.sickLeaveDays.toString() : item.noOfDays.toString(),
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: (item.sickLeaveDays
.toString() !=
null &&
item.sickLeaveDays
.toString() !=
"null")
? item.sickLeaveDays
.toString()
: item.noOfDays
.toString(),
), ),
CustomRow( CustomRow(
label: TranslationBase.of( label: TranslationBase.of(context).startDate + ' ' ?? "",
context) labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
.startDate + valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
' ' ?? value: AppDateUtils.getDayMonthYearDateFormatted(
"", item.startDate.contains("/Date(") ? AppDateUtils.convertStringToDate(item.startDate) : DateTime.parse(item.startDate),
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item
.startDate)
: DateTime.parse(
item.startDate),
), ),
), ),
CustomRow( CustomRow(
label: TranslationBase.of( label: TranslationBase.of(context).endDate + ' ' ?? "",
context) labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
.endDate + valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
' ' ?? value: AppDateUtils.getDayMonthYearDateFormatted(
"", item.startDate.contains("/Date(")
labelSize: SizeConfig ? AppDateUtils.convertStringToDate(item.endDate ?? "").add(
.getTextMultiplierBasedOnWidth() * Duration(days: item.noOfDays ?? item.sickLeaveDays),
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item.endDate ??
"")
.add(
Duration(
days: item
.noOfDays ??
item.sickLeaveDays),
) )
: DateTime.parse( : DateTime.parse(item.startDate ?? "").add(
item.startDate ?? Duration(days: item.noOfDays ?? ""),
"")
.add(
Duration(
days:
item.noOfDays ??
""),
), ),
), ),
), ),
], ],
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
), ),
), ),
], ],

@ -1,12 +1,12 @@
import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/filter_type.dart';
import 'package:doctor_app_flutter/core/enum/patient_type.dart'; import 'package:doctor_app_flutter/core/enum/patient_type.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/patient/patient_model.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/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.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/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/core/model/patient/patient_model.dart';
import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/routes.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/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
@ -20,6 +20,7 @@ import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_cus
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'filter_date_page.dart'; import 'filter_date_page.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@ -107,8 +108,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: _times.map((item) { children: _times.map((item) {
bool _isActive = bool _isActive = _times[_activeLocation] == item ? true : false;
_times[_activeLocation] == item ? true : false;
return Expanded( return Expanded(
child: InkWell( child: InkWell(
@ -128,8 +128,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
await model.getPatientBasedOnDate( await model.getPatientBasedOnDate(
item: item, item: item,
selectedPatientType: widget.selectedPatientType, selectedPatientType: widget.selectedPatientType,
patientSearchRequestModel: patientSearchRequestModel: widget.patientSearchRequestModel,
widget.patientSearchRequestModel,
isSearchWithKeyInfo: widget.isSearchWithKeyInfo, isSearchWithKeyInfo: widget.isSearchWithKeyInfo,
outPatientFilterType: outPatientFilterType); outPatientFilterType: outPatientFilterType);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -140,24 +139,15 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
decoration: TabUtils.getBoxTabsBoxDecoration( decoration: TabUtils.getBoxTabsBoxDecoration(
isActive: _isActive, isActive: _isActive,
isFirst: _times.indexOf(item) == 0, isFirst: _times.indexOf(item) == 0,
isLast: isLast: _times.indexOf(item) == _times.length - 1,
_times.indexOf(item) == _times.length - 1, isMiddle: _times.indexOf(item) != 0 && _times.indexOf(item) != _times.length - 1,
isMiddle: _times.indexOf(item) != 0 &&
_times.indexOf(item) != _times.length - 1,
projectViewModel: projectsProvider), projectViewModel: projectsProvider),
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
TabUtils.getTabText( TabUtils.getTabText(title: item, isActive: _isActive),
title: item, isActive: _isActive), _isActive && _activeLocation != 0 && model.state == ViewState.Idle ? TabUtils.getTabCounter(isActive: _isActive, counter: model.filterData.length) : Container(),
_isActive &&
_activeLocation != 0 &&
model.state == ViewState.Idle
? TabUtils.getTabCounter(
isActive: _isActive,
counter: model.filterData.length)
: Container(),
], ],
), ),
), ),
@ -177,9 +167,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
marginTop: 5, marginTop: 5,
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
_activeLocation != 0 _activeLocation != 0 ? DoctorApp.filter_1 : FontAwesomeIcons.slidersH,
? DoctorApp.filter_1
: FontAwesomeIcons.slidersH,
color: Colors.black, color: Colors.black,
), ),
iconSize: 20, iconSize: 20,
@ -189,21 +177,17 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) => FilterDatePage(
FilterDatePage(
outPatientFilterType: outPatientFilterType, outPatientFilterType: outPatientFilterType,
patientSearchViewModel: model, patientSearchViewModel: model,
), ),
settings: RouteSettings( settings: RouteSettings(name: 'FilterOutPatentDateScreen'),
name: 'FilterOutPatentDateScreen'),
)); ));
}, },
), ),
positionedChild: IconButton( positionedChild: IconButton(
icon: Icon( icon: Icon(
isSortDes isSortDes ? FontAwesomeIcons.sortAmountDown : FontAwesomeIcons.sortAmountUp,
? FontAwesomeIcons.sortAmountDown
: FontAwesomeIcons.sortAmountUp,
color: Colors.black, color: Colors.black,
), ),
iconSize: 20, iconSize: 20,
@ -218,8 +202,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
child: model.filterData.isEmpty child: model.filterData.isEmpty
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context) error: TranslationBase.of(context).youDontHaveAnyPatient,
.youDontHaveAnyPatient,
), ),
) )
: ListView.builder( : ListView.builder(
@ -227,15 +210,9 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
shrinkWrap: true, shrinkWrap: true,
itemCount: model.filterData.length, itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
if (_activeLocation != 0 || if (_activeLocation != 0 || (model.filterData[index].patientStatusType != null && model.filterData[index].patientStatusType == 43))
(model.filterData[index].patientStatusType !=
null &&
model.filterData[index]
.patientStatusType ==
43))
return Padding( return Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 8, vertical: 0),
horizontal: 8, vertical: 0),
child: PatientCard( child: PatientCard(
patientInfo: model.filterData[index], patientInfo: model.filterData[index],
patientType: patientType, patientType: patientType,
@ -244,20 +221,16 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
isInpatient: widget.isInpatient, isInpatient: widget.isInpatient,
onTap: () { onTap: () {
// TODO change the parameter to daynamic // TODO change the parameter to daynamic
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
PATIENTS_PROFILE, "patient": model.filterData[index],
arguments: { "patientType": "1",
"patient": model.filterData[index], "from": widget.patientSearchRequestModel.from,
"patientType": "1", "to": widget.patientSearchRequestModel.from,
"from": widget "isSearch": false,
.patientSearchRequestModel.from, "isInpatient": false,
"to": widget "arrivalType": "7",
.patientSearchRequestModel.from, "isSearchAndOut": false,
"isSearch": false, });
"isInpatient": false,
"arrivalType": "7",
"isSearchAndOut": false,
});
}, },
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),

Loading…
Cancel
Save