From 896078507f4ca8e0509349a81a666c53955cb709 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 20 Jan 2021 18:41:26 +0300 Subject: [PATCH] gub fixes --- lib/client/base_app_client.dart | 5 +- lib/core/service/prescription_service.dart | 55 ++++++++++++++++++- .../prescription/add_prescription_form.dart | 6 +- lib/widgets/auth/verification_methods.dart | 16 +++--- lib/widgets/otp/sms-popup.dart | 5 +- 5 files changed, 71 insertions(+), 16 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index c1438159..e38db07c 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -96,8 +96,9 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - await helpers.logout(); - helpers.showErrorToast('Your session expired Please login agian'); + onFailure(getError(parsed), statusCode); + //await helpers.logout(); + //helpers.showErrorToast('Your session expired Please login agian'); } else if (parsed['MessageStatus'] == 1) { if (!parsed['IsAuthenticated']) onFailure(getError(parsed), statusCode); diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 6558ad6e..3f8b217a 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -101,7 +101,60 @@ class PrescriptionService extends BaseService { List prescription) async { Map request = { "Prescription": { - "objPatientInfo": {"Gender": patient.gender, "Age": patient.age}, + "objPatientInfo": {"Gender": "Male", "Age": "21/06/1967"}, + "objVitalSign": {"Height": "180", "Weight": "37"}, + "objPrescriptionItems": [ + { + "DrugId": "83-20-00-30-20-03-03", + "DrugName": "WARFARIN 1 MG TAB 28'S (N)", + "Dose": "1", + "DoseType": "04", + "Unit": "actuation(s)", + "FrequencyType": "1/3/Day", + "Duration": "3/Day", + "IsScreen": "true" + }, + { + "DrugId": "64-20-00-10-00-03-15", + "DrugName": "PANADOL 500 MG TAB 24'S(DIS)", + "Dose": "1", + "DoseType": "04", + "Unit": "MG", + "FrequencyType": "3/1/Day", + "Duration": "4/Day", + "RouteID": "24", + "IsScreen": "true" + } + ], + "objAllergies": { + "Allergy": { + "objProperties": {"Id": "26", "Name": "phenoxymethylpenicillin"} + } + }, + "objDiagnosis": { + "Diagnosis": { + "objProperties": {"Id": "A01.1", "Name": "Paratyphoid fever A"} + } + }, + "IsDoctor": "false", + "IsPharmacist": "false" + }, + "IPAdress": "10.10.10.10", + "Channel": 9, + "LanguageID": 2, + "VersionID": 5.3, + "SessionID": "BlUSkYymTt", + "IsLoginForDoctorApp": true, + "PatientOutSA": 0, + "TokenID": "@dm!n", + "OutSA": true + }; + Map requestN = { + "Prescription": { + "objPatientInfo": { + "Gender": patient.gender == 1 ? 'Male' : 'Female', + "Age": patient.age + }, "objVitalSign": {"Height": vital.heightCm, "Weight": vital.weightKg}, "objPrescriptionItems": prescription[0].entityList, "objAllergies": allergy, diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 76569c3f..56877240 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -714,9 +714,9 @@ class _PrescriptionFormWidgetState extends State { title: TranslationBase.of(context) .addMedication, onPressed: () { - formKey.currentState.save(); - Navigator.pop(context); - openDrugToDrug(); + // formKey.currentState.save(); + // Navigator.pop(context); + // openDrugToDrug(); if (strength == null || route == null || frequency == null || diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index adc35982..2bf39881 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -71,6 +71,7 @@ class _VerificationMethodsState extends State { void initState() { super.initState(); _loggedUserFuture = getSharedPref(); + _getAvailableBiometrics(); } Future getSharedPref() async { @@ -499,9 +500,10 @@ class _VerificationMethodsState extends State { authenticateUser(3, BiometricType.fingerprint.index, authProv) }, child: RoundedContainer( - backgroundColor: BiometricType.fingerprint.index == 1 - ? Colors.white - : Colors.white.withOpacity(.7), + backgroundColor: + checkIfBiometricAvailable(BiometricType.fingerprint) + ? Colors.white + : Colors.white.withOpacity(.7), borderColor: Colors.grey, showBorder: true, child: Padding( @@ -566,9 +568,7 @@ class _VerificationMethodsState extends State { }) }, child: RoundedContainer( - backgroundColor: BiometricType.fingerprint.index == 1 - ? Colors.white - : Colors.white.withOpacity(.7), + backgroundColor: Colors.white, borderColor: Colors.grey, showBorder: true, child: Padding( @@ -756,11 +756,11 @@ class _VerificationMethodsState extends State { getDocProfiles(clinic, authProv); } } else { - //changeLoadingStata(false); + Navigator.pop(context); helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { - //changeLoadingStata(false); + Navigator.pop(context); helpers.showErrorToast(err); }); } diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index dfcb33cd..fb5a9a0c 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -52,7 +52,7 @@ class SMSOTP { String errorMsg; ProjectViewModel projectProvider; String displayTime = ''; - + bool isClosed = false; displayDialog(BuildContext context) async { return showDialog( context: context, @@ -65,6 +65,7 @@ class SMSOTP { IconButton( icon: Icon(Icons.close), onPressed: () { + this.isClosed = true; Navigator.pop(context); this.onFailure(); }, @@ -307,7 +308,7 @@ class SMSOTP { timer = Future.delayed(Duration(seconds: 1), () { if (this.remainingTime > 0) { - startTimer(setState); + if (isClosed == false) startTimer(setState); } else { Navigator.pop(context); }