diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a28507a4..cf75eca9 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -132,6 +132,9 @@ class BaseAppClient { if (parsed['ErrorType'] == 4) { navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); } + if (parsed['ErrorType'] == 2) { + await logout(); + } if (isAllowAny) { onSuccess(parsed, statusCode); } else if (parsed['IsAuthenticated'] == null) { @@ -165,11 +168,11 @@ class BaseAppClient { onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } - } else if (!parsed['IsAuthenticated']) { - await logout(); - - //helpers.showErrorToast('Your session expired Please login agian'); - } else { + } + // else if (!parsed['IsAuthenticated']) { + // await logout(); + // } + else { if (parsed['SameClinicApptList'] != null) { onSuccess(parsed, statusCode); } else { diff --git a/lib/core/service/insurance_service.dart b/lib/core/service/insurance_service.dart index a4917f03..176043e1 100644 --- a/lib/core/service/insurance_service.dart +++ b/lib/core/service/insurance_service.dart @@ -10,6 +10,8 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; class InsuranceCardService extends BaseService { List _cardList = List(); @@ -161,7 +163,7 @@ class InsuranceCardService extends BaseService { ); } - Future uploadInsuranceCard({String patientIdentificationID, int patientID, String image = ""}) async { + Future uploadInsuranceCard(BuildContext context, {String patientIdentificationID, int patientID, String image = ""}) async { error = ""; Map body = Map(); body['PatientID'] = patientID; @@ -170,14 +172,26 @@ class InsuranceCardService extends BaseService { body['PatientIdentificationID'] = patientIdentificationID; body['InsuranceCardImage'] = image; + dynamic localRes; + await baseAppClient.post( UPLOAD_INSURANCE_CARD, - onSuccess: (dynamic response, int statusCode) {}, + onSuccess: (dynamic response, int statusCode) { + print(response); + if(response['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: TranslationBase.of(context).requestSent); + } else { + AppToast.showErrorToast(message: response['ErrorEndUserMessage']); + } + localRes = response; + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; + throw error; }, body: body, ); + return Future.value(localRes); } } diff --git a/lib/core/service/medical/ActiveMedicationsService.dart b/lib/core/service/medical/ActiveMedicationsService.dart index 0025df29..f82290b7 100644 --- a/lib/core/service/medical/ActiveMedicationsService.dart +++ b/lib/core/service/medical/ActiveMedicationsService.dart @@ -10,8 +10,8 @@ class ActiveMedicationsService extends BaseService{ hasError = false; super.error = ""; Map body = Map(); - body['isDentalAllowedBackend'] = false; - body['PatientID'] = 1298851; + // body['isDentalAllowedBackend'] = false; + // body['PatientID'] = 1298851; await baseAppClient.post(ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID, onSuccess: (response, statusCode) async { activePrescriptionReport.clear(); diff --git a/lib/core/viewModels/insurance_card_View_model.dart b/lib/core/viewModels/insurance_card_View_model.dart index 234db5d4..a04bbb39 100644 --- a/lib/core/viewModels/insurance_card_View_model.dart +++ b/lib/core/viewModels/insurance_card_View_model.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/insurance/insurance_card.dart'; import 'package:diplomaticquarterapp/core/model/insurance/insurance_card_update_model.dart'; import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:flutter/material.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -72,9 +73,9 @@ class InsuranceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } - Future uploadInsuranceCard({String patientIdentificationID, int patientID,String image =""}) async { + Future uploadInsuranceCard(BuildContext context, {String patientIdentificationID, int patientID,String image =""}) async { setState(ViewState.BusyLocal); - await _insuranceCardService.uploadInsuranceCard(patientIdentificationID: patientIdentificationID,patientID: patientID,image: image); + await _insuranceCardService.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID,patientID: patientID,image: image); if (_insuranceCardService.hasError) { error = _insuranceCardService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index b6ee6f3b..26425335 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -316,13 +316,15 @@ class InsuranceCardUpdateDetails extends StatelessWidget { color: CustomColors.accentColor, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); - await model.uploadInsuranceCard(patientIdentificationID: patientIdentificationID, patientID: patientID); - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - AppToast.showErrorToast(message: model.error); - } else { - AppToast.showSuccessToast(message: TranslationBase.of(context).requestSent); - } + model.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID, patientID: patientID).then((res) { + print(res); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err.toString()); + print(err); + }); + }, ), if (insuranceCardDetailsModel.isNotEmpty) @@ -408,7 +410,7 @@ class InsuranceCardUpdateDetails extends StatelessWidget { name: name, image: (file, image) async { GifLoaderDialogUtils.showMyDialog(context); - await model.uploadInsuranceCard(patientIdentificationID: patientIdentificationID, patientID: patientID, image: image); + await model.uploadInsuranceCard(context, patientIdentificationID: patientIdentificationID, patientID: patientID, image: image); GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal || model.state == ViewState.Error) { AppToast.showErrorToast(message: model.error); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index c9b4fec2..87dd7d2b 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -252,7 +252,9 @@ class _clinic_listState extends State { }); } - Navigator.push(context, FadePage(page: PaymentMethod())).then((value) { + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }))).then((value) { print(value); if (value != null) { openPayment(value, authUser, double.parse(getERAppointmentFeesList.total), appo); @@ -485,7 +487,7 @@ class _clinic_listState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: startScheduleLiveCare, - child: Text("Start", style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)), ), ), ), @@ -500,7 +502,7 @@ class _clinic_listState extends State { children: [ isDataLoaded ? Container( - height: MediaQuery.of(context).size.height * 0.8, + height: MediaQuery.of(context).size.height * 0.75, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -558,17 +560,13 @@ class _clinic_listState extends State { ? Align( alignment: FractionalOffset.bottomCenter, child: Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), color: Colors.grey[100], - transform: Matrix4.translationValues(0.0, -65.0, 0.0), width: MediaQuery.of(context).size.width, height: 50.0, - margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 20.0), - child: Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: DefaultButton(TranslationBase.of(context).start, () { - startLiveCare(); - }), - ), + child: DefaultButton(TranslationBase.of(context).start, () { + startLiveCare(); + }), ), ) : Container(), diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index ddf5d0b9..9e1e042e 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -298,7 +298,11 @@ class _AdvancePaymentPageState extends State { GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { Utils.hideKeyboard(context); - Navigator.push(context, FadePage(page: PaymentMethod())).then( + Navigator.push(context, FadePage(page: PaymentMethod( + onSelectedMethod: (String metohd) { + setState(() {}); + } + ))).then( (value) { Navigator.push( context, diff --git a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart index b9847a0b..2e05d19c 100644 --- a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart +++ b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart @@ -152,7 +152,7 @@ class LineChartCurvedState extends State { print(e); } }); - + print("MinX: " + max.roundToDouble().toString()); return max.roundToDouble(); } @@ -169,7 +169,7 @@ class LineChartCurvedState extends State { print(e); } int value = min.toInt(); - + print("MinY: " + value.toDouble().toString()); return value.toDouble(); }