From 0fe6d880fdfbaf70ea066a9c11e04cb37e606e18 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 7 Jun 2021 10:53:36 +0300 Subject: [PATCH] add livecare send instructions --- lib/config/config.dart | 1 + .../patient/LiveCarePatientServices.dart | 13 +++++++++++++ .../viewModel/LiveCarePatientViewModel.dart | 12 ++++++++++++ lib/screens/live_care/end_call_screen.dart | 19 ++++++++++++++++++- 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 41e3313d..92e4e188 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -89,6 +89,7 @@ const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = 'Services/DoctorApplication.svc/RES const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; +const SEND_SMS_INSTRUCTIONS = 'LiveCareApi/DoctorApp/SendSMSInstruction'; const GET_ALTERNATIVE_SERVICE = 'LiveCareApi/DoctorApp/GetAlternativeServices'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index b8712a9b..7e42380d 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -103,6 +103,19 @@ class LiveCarePatientServices extends BaseService { }, isLiveCare: _isLive); } + Future sendSMSInstruction(int vcID) async { + hasError = false; + await baseAppClient.post(SEND_SMS_INSTRUCTIONS, + onSuccess: (dynamic response, int statusCode) { + transferToAdminResponse = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: { + "VC_ID": vcID, + }, isLiveCare: _isLive); + } + Future getAlternativeServices(int vcID) async { hasError = false; alternativeServicesList.clear(); diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index 032c7a07..d2786388 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -153,6 +153,18 @@ class LiveCarePatientViewModel extends BaseViewModel { } } + Future sendSMSInstruction(int vcID) async { + setState(ViewState.BusyLocal); + await _liveCarePatientServices.sendSMSInstruction(vcID); + if (_liveCarePatientServices.hasError) { + error = _liveCarePatientServices.error; + setState(ViewState.ErrorLocal); + } else { + await getPendingPatientERForDoctorApp(); + setState(ViewState.Idle); + } + } + searchData(String str) { var strExist = str.length > 0 ? true : false; if (strExist) { diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index ee1a036d..c4e52b34 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -136,7 +136,24 @@ class _EndCallScreenState extends State { TranslationBase.of(context).instruction, "", 'patient/health_summary.png', - onTap: () {}, + onTap: () { + Helpers.showConfirmationDialog(context, + "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).sendLC}${TranslationBase.of(context).instruction} ?", + () async { + Navigator.of(context).pop(); + GifLoaderDialogUtils.showMyDialog(context); + liveCareModel.sendSMSInstruction(widget.patient.vcId); + GifLoaderDialogUtils.hideDialog(context); + if (liveCareModel.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(liveCareModel.error); + } else { + DrAppToastMsg.showSuccesToast("You successfully sent SMS instructions"); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + Navigator.of(context).pop(); + } + }); + }, isInPatient: isInpatient, isDartIcon: true, isDisable: true,