diff --git a/lib/config/config.dart b/lib/config/config.dart index b84ee11e..5ff4e6f1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -400,6 +400,8 @@ var ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/ var GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; var GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +var GET_QUESTION_TYPES = 'Services/OUTPs.svc/REST/getQuestionsTypes'; + var UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; var SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport'; @@ -414,7 +416,9 @@ var UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWe var DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus'; var GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse'; var UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; + var INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; +var INSERT_APPOINTMENT_QUESTION = 'Services/OUTPs.svc/REST/insertAppointmentQuestion'; var GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 57ab856b..80ee3e6d 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -18,9 +18,8 @@ class AskDoctorService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; + await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT, onSuccess: (dynamic response, int statusCode) { + localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -29,11 +28,10 @@ class AskDoctorService extends BaseService { } Future getCallRequestTypeLOV() async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_CALL_REQUEST_TYPE_LOV, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_CALL_REQUEST_TYPE_LOV, onSuccess: (dynamic response, int statusCode) { askDoctorReqTypes.clear(); response['ListReqTypes'].forEach((reqType) { askDoctorReqTypes.add(AskDoctorReqTypes.fromJson(reqType)); @@ -44,16 +42,28 @@ class AskDoctorService extends BaseService { }, body: body); } + Future getQuestionTypes() async { + hasError = false; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_QUESTION_TYPES, onSuccess: (dynamic response, int statusCode) { + askDoctorReqTypes.clear(); + response['QuestionsTypes'].forEach((reqType) { + askDoctorReqTypes.add(AskDoctorReqTypes.fromJson(reqType)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getDoctorResponse() async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - body['from'] = - "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 00:00:00"; - body['from'] = - "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}:00"; - await baseAppClient.post(GET_DOCTOR_RESPONSE, - onSuccess: (dynamic response, int statusCode) { + body['from'] = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 00:00:00"; + body['from'] = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}:00"; + await baseAppClient.post(GET_DOCTOR_RESPONSE, onSuccess: (dynamic response, int statusCode) { doctorResponseList.clear(); response['List_DoctorResponse'].forEach((reqType) { doctorResponseList.add(DoctorResponse.fromJson(reqType)); @@ -65,12 +75,11 @@ class AskDoctorService extends BaseService { } Future updateReadStatus({int transactionNo}) async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; body['TransactionNo'] = transactionNo; - await baseAppClient.post(UPDATE_READ_STATUS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_READ_STATUS, onSuccess: (dynamic response, int statusCode) { //TODO fix it }, onFailure: (String error, int statusCode) { hasError = true; @@ -78,31 +87,27 @@ class AskDoctorService extends BaseService { }, body: body); } - - Future sendRequestLOV({DoctorList doctorList,String requestType,String remark}) async { - hasError =false; + Future sendRequestLOV({DoctorList doctorList, String requestType, String remark}) async { + hasError = false; Map body = Map(); body['ProjectID'] = doctorList.projectID; body['SetupID'] = doctorList.setupID; body['DoctorID'] = doctorList.doctorID; body['PatientMobileNumber'] = user.mobileNumber; body['IsMessageSent'] = false; - body['RequestDate'] = DateUtil.yearMonthDay(DateTime.now()); - body['RequestTime'] = DateUtil.time(DateTime.now()); + body['RequestDate'] = DateUtil.convertDateToString(DateTime.now()); + body['RequestTime'] = DateUtil.convertDateToString(DateTime.now()); body['Remarks'] = remark; - body['Status'] = 2;// 4 for testing only.."cancelled status insert" else should be changed to 1 in live version + body['Status'] = 2; // 4 for testing only.."cancelled status insert" else should be changed to 1 in live version body['CreatedBy'] = 102; - body['CreatedOn'] = DateUtil.yearMonthDay(DateTime.now()); + body['CreatedOn'] = DateUtil.convertDateToString(DateTime.now()); body['EditedBy'] = 102; - body['EditedOn'] = DateUtil.yearMonthDay(DateTime.now()); + body['EditedOn'] = DateUtil.convertDateToString(DateTime.now()); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(INSERT_CALL_INFO, - onSuccess: (dynamic response, int statusCode) { - - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + body['QuestionType'] = num.parse(requestType); + await baseAppClient.post(INSERT_APPOINTMENT_QUESTION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - } diff --git a/lib/core/viewModels/medical/ask_doctor_view_model.dart b/lib/core/viewModels/medical/ask_doctor_view_model.dart index d060db1f..abe2220c 100644 --- a/lib/core/viewModels/medical/ask_doctor_view_model.dart +++ b/lib/core/viewModels/medical/ask_doctor_view_model.dart @@ -54,6 +54,17 @@ class AskDoctorViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getQuestionTypes() async { + setState(ViewState.Busy); + await _askDoctorService.getQuestionTypes(); + if (_askDoctorService.hasError) { + error = _askDoctorService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else + setState(ViewState.Idle); + } + Future getCallInfoHoursResult({int projectId, int doctorId}) async { setState(ViewState.Busy); await _askDoctorService.getCallInfoHoursResult(projectId: projectId, doctorId: doctorId); diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 66cd9344..4ceb5bf5 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_mod import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -26,7 +27,7 @@ class _RequestTypePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getCallRequestTypeLOVs(), + onModelReady: (model) => model.getQuestionTypes(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).requestType, @@ -111,6 +112,7 @@ class _RequestTypePageState extends State { model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) { if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) { Navigator.pop(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).RRTRequestSuccess); } }) }, diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e91990b4..f62248b8 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -37,9 +37,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS