diff --git a/lib/config/config.dart b/lib/config/config.dart index 6c4da7b1..6afcb64f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -27,7 +27,8 @@ const PATIENT_GET_CLINIC_BY_PROJECT_URL = const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo"; const GET_CLINICS = "Services/DoctorApplication.svc/REST/GetClinics"; -//const GET_PROJECTS = 'Services/Lists.svc/REST/GetProjectForDoctorAPP'; +const GET_REFERRAL_FACILITIES = 'Services/DoctorApplication.svc/REST/GetReferralFacilities'; + const GET_PROJECTS = 'Services/DoctorApplication.svc/REST/GetProjectInfo'; const GET_PATIENT_VITAL_SIGN = diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index 813fef35..3136b549 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -49,6 +49,20 @@ class PatientReferralService extends LookupService { }, body: info); } + Future getReferralFacilities() async { + hasError = false; + + Map body = Map(); + body['isSameBranch'] = false; + + await baseAppClient.post(GET_REFERRAL_FACILITIES, onSuccess: (response, statusCode) async { + projectsList = response['ProjectInfo']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getProjectInfo(int projectId) async { Map body = Map(); body['ProjectID'] = projectId; diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 5771d1db..00ef09f6 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -62,7 +62,7 @@ class PatientReferralViewModel extends BaseViewModel { Future getBranches() async { setState(ViewState.BusyLocal); - await _referralPatientService.getProjectsList(); + await _referralPatientService.getReferralFacilities(); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.Error); @@ -77,7 +77,7 @@ class PatientReferralViewModel extends BaseViewModel { await _referralPatientService.getProjectInfo(projectId); if (_referralPatientService.hasError) { error = _referralPatientService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } @@ -87,7 +87,7 @@ class PatientReferralViewModel extends BaseViewModel { await _referralPatientService.getDoctorsList(clinicId); if (_referralPatientService.hasError) { error = _referralPatientService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index b2a71f4b..6f053089 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -177,15 +178,18 @@ class _PatientMakeReferralScreenState extends State { _selectedBranch = null; _selectedClinic = null; _selectedDoctor = null; - model.getDoctorBranch().then((value) { + model.getDoctorBranch().then((value) async { _selectedBranch = value; if (_referTo['id'] == 1) { GifLoaderDialogUtils.showMyDialog(context); - model + await model .getClinics(_selectedBranch['facilityId']) .then((_) => GifLoaderDialogUtils.hideDialog( context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } } }); }); @@ -226,15 +230,18 @@ class _PatientMakeReferralScreenState extends State { attributeValueId: 'facilityId', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { - setState(() { + setState(() async { _selectedBranch = selectedValue; _selectedClinic = null; _selectedDoctor = null; GifLoaderDialogUtils.showMyDialog(context); - model + await model .getClinics(_selectedBranch['facilityId']) .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } }); }, ); @@ -277,15 +284,18 @@ class _PatientMakeReferralScreenState extends State { TranslationBase.of(context).clinicSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { - setState(() { + setState(() async { _selectedDoctor = null; _selectedClinic = selectedValue; GifLoaderDialogUtils.showMyDialog(context); - model + await model .getClinicDoctors( _selectedClinic['ClinicID'].toString()) .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } }); }, ); diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index f262a0f6..f00bfe72 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -343,17 +343,17 @@ class _PrescriptionFormWidgetState extends State { .width * 0.550, child: TextFields( - inputFormatters: [ - LengthLimitingTextInputFormatter( - 4), - WhitelistingTextInputFormatter - .digitsOnly - ], + // inputFormatters: [ + // LengthLimitingTextInputFormatter( + // 4), + // WhitelistingTextInputFormatter + // .digitsOnly + // ], hintText: TranslationBase.of(context) .strength, controller: strengthController, - keyboardType: TextInputType.number, + keyboardType: TextInputType.numberWithOptions(decimal: true,), onChanged: (String value) { setState(() { strengthChar = value.length; diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 6efc5900..70ff06c2 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -578,10 +578,10 @@ class _UpdatePrescriptionFormState extends State { decoration: textFieldSelectorDecoration( model - .patientAssessmentList[ + .patientAssessmentList.isNotEmpty? model.patientAssessmentList[ 0] .icdCode10ID - .toString(), + .toString():'', indication != null ? indication['name'] : null, @@ -608,10 +608,10 @@ class _UpdatePrescriptionFormState extends State { decoration: textFieldSelectorDecoration( model - .patientAssessmentList[ + .patientAssessmentList.isNotEmpty? model.patientAssessmentList[ 0] .asciiDesc - .toString(), + .toString():'', indication != null ? indication['name'] : null, diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 04a82a80..adb0aef0 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -233,11 +233,7 @@ class _VerificationMethodsState extends State { Expanded( child: InkWell( onTap: () => { - authenticateUser( - 3, - BiometricType - .face.index, - authProv) + authenticateUser(3, true, authProv) }, child: getButton( user.logInTypeID, @@ -488,8 +484,7 @@ class _VerificationMethodsState extends State { onTap: () => { if (checkIfBiometricAvailable(BiometricType.fingerprint)) { - authenticateUser( - 3, BiometricType.fingerprint.index, authProv) + authenticateUser(3, true, authProv) } }, child: RoundedContainer( @@ -524,7 +519,7 @@ class _VerificationMethodsState extends State { return InkWell( onTap: () { if (checkIfBiometricAvailable(BiometricType.face)) { - authenticateUser(4, BiometricType.face.index, authProv); + authenticateUser(4, true, authProv); } }, child: RoundedContainer( @@ -706,7 +701,7 @@ class _VerificationMethodsState extends State { } loginWithFingurePrintFace(type, isActive, authProv) async { - if (isActive == 1) { + if (isActive) { // this.startBiometricLoginIfAvailable(); authenticated = await auth.authenticateWithBiometrics( localizedReason: 'Scan your fingerprint to authenticate',