Ask Doctor page fixes

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 106489b085
commit 25fb5decc0

@ -1457,4 +1457,8 @@ const Map localizedValues = {
"en": "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.",
"ar": "تم تصميم هذه الخدمة لمساعدتك في تحديد وتتبع كميات المياه التي يتوجب شربها بشكل يومي. كما توفر هذه الخدمة تذكيرات الجدول الزمني وتقدم تحليلًا إحصائيًا لمقدار ما استهلكته خلال اليوم أو الأسبوع أو الشهر."
},
"ask-doc-empty": {
"en": "This service is available to doctors visited during the past 15 days",
"ar": "هذه الخدمة متاحة للاطباء الذين تمت زيارتهم خلال ال 15 يوم الماضية"
},
};

@ -16,14 +16,16 @@ class AskDoctorService extends BaseService {
body['DoctorID'] = doctorId;
body['ProjectID'] = projectId;
dynamic localRes;
await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT,
onSuccess: (dynamic response, int statusCode) {
///OKAY
var asd="";
localRes = response;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
return Future.value(localRes);
}
Future getCallRequestTypeLOV() async {

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/ask_doctor/AskDoctorReqTypes.dart';
import 'package:diplomaticquarterapp/core/model/ask_doctor/DoctorResponse.dart';
@ -6,51 +7,40 @@ import 'package:diplomaticquarterapp/core/service/medical/my_doctor_service.dart
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
class AskDoctorViewModel extends BaseViewModel {
AskDoctorService _askDoctorService = locator<AskDoctorService>();
MyDoctorService _myDoctorService = locator<MyDoctorService>();
List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital =
List();
List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital = List();
List<AskDoctorReqTypes> get askDoctorReqTypes =>
_askDoctorService.askDoctorReqTypes;
List<AskDoctorReqTypes> get askDoctorReqTypes => _askDoctorService.askDoctorReqTypes;
List<DoctorResponse> get doctorResponseList =>
_askDoctorService.doctorResponseList;
List<DoctorResponse> get doctorResponseList => _askDoctorService.doctorResponseList;
Future getMyDoctor() async {
setState(ViewState.Busy);
await _myDoctorService.getPatientDoctorAppointmentList(
top: 25, beforeDays: 15);
await _myDoctorService.getPatientDoctorAppointmentList(top: 25, beforeDays: 15);
if (_myDoctorService.hasError) {
error = _myDoctorService.error;
setState(ViewState.Error);
} else
var asd = "";
_myDoctorService.patientDoctorAppointmentList.forEach((element) {
List<PatientDoctorAppointmentList> doctorByClinic =
patientDoctorAppointmentListHospital
.where((elementClinic) =>
elementClinic.filterName == element.projectName)
.toList();
if (doctorByClinic.length != 0) {
patientDoctorAppointmentListHospital[
patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])]
.patientDoctorAppointmentList
.add(element);
} else {
patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(
filterName: element.projectName,
patientDoctorAppointment: element));
}
} else if (_myDoctorService.patientDoctorAppointmentList.length != 0) {
_myDoctorService.patientDoctorAppointmentList.forEach((element) {
List<PatientDoctorAppointmentList> doctorByClinic = patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList();
if (doctorByClinic.length != 0) {
patientDoctorAppointmentListHospital[patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
} else {
patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
setState(ViewState.Idle);
});
} else {
setState(ViewState.Idle);
});
AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).askDocEmpty);
}
}
Future getCallRequestTypeLOVs() async {
@ -66,8 +56,7 @@ class AskDoctorViewModel extends BaseViewModel {
Future getCallInfoHoursResult({int projectId, int doctorId}) async {
setState(ViewState.Busy);
await _askDoctorService.getCallInfoHoursResult(
projectId: projectId, doctorId: doctorId);
await _askDoctorService.getCallInfoHoursResult(projectId: projectId, doctorId: doctorId);
if (_askDoctorService.hasError) {
error = _askDoctorService.error;
setState(ViewState.ErrorLocal);
@ -95,11 +84,9 @@ class AskDoctorViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future sendRequestLOV(
{DoctorList doctorList, String requestType, String remark}) async {
Future sendRequestLOV({DoctorList doctorList, String requestType, String remark}) async {
setState(ViewState.BusyLocal);
await _askDoctorService.sendRequestLOV(
doctorList: doctorList, requestType: requestType, remark: remark);
await _askDoctorService.sendRequestLOV(doctorList: doctorList, requestType: requestType, remark: remark);
if (_askDoctorService.hasError) {
error = _askDoctorService.error;
setState(ViewState.ErrorLocal);

@ -135,6 +135,8 @@ class DoctorView extends StatelessWidget {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}

@ -232,7 +232,6 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context);
WidgetsBinding.instance.addPostFrameCallback((_) {
locationUtils.getCurrentLocation();
if (projectViewModel.isLogin) {
familyFileProvider.getSharedRecordByStatus();
}
@ -249,6 +248,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
}
requestPermissions().then((results) {
locationUtils.getCurrentLocation();
_firebaseMessaging.getToken().then((String token) {
print("Firebase Token: " + token);
sharedPref.setString(PUSH_TOKEN, token);
@ -266,7 +266,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
// if (results[Permission.calendar].isGranted) ;
});
requestPermissions();
// requestPermissions();
// });
//

@ -1,4 +1,4 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/service/medical/ask_doctor_services.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
@ -6,14 +6,16 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/ask_doctor/request_type.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
class AskDoctorPage extends StatelessWidget {
AskDoctorService service = new AskDoctorService();
@override
Widget build(BuildContext context) {
return BaseView<AskDoctorViewModel>(
@ -65,9 +67,10 @@ class AskDoctorPage extends StatelessWidget {
doctor: doctorList,
isLiveCareAppointment: false,
onTap: () {
model.getCallInfoHoursResult(doctorId: _doctor.doctorID, projectId: _doctor.projectID).then((value) {
if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) {
// Navigator.pop(context);
GifLoaderDialogUtils.showMyDialog(context);
service.getCallInfoHoursResult(doctorId: _doctor.doctorID, projectId: _doctor.projectID).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['ErrorEndUserMessage'] == null) {
Navigator.push(
context,
FadePage(
@ -75,8 +78,12 @@ class AskDoctorPage extends StatelessWidget {
),
);
} else {
AppToast.showErrorToast(message: model.error);
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
if (err != null) AppToast.showErrorToast(message: err);
print(err);
});
},
);

@ -3,9 +3,8 @@ 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/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -32,6 +31,8 @@ class _RequestTypePageState extends State<RequestTypePage> {
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).requestType,
baseViewModel: model,
showNewAppBar: true,
showNewAppBarTitle: true,
body: SingleChildScrollView(
child: Container(
margin: EdgeInsets.all(10),
@ -99,22 +100,24 @@ class _RequestTypePageState extends State<RequestTypePage> {
),
bottomSheet: Container(
width: double.maxFinite,
// height: MediaQuery.of(context).size.height * 0.1,
height: 80.0,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: SecondaryButton(
label: TranslationBase.of(context).submit,
loading: model.state == ViewState.BusyLocal,
textColor: Colors.white,
onTap: () {
model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) {
if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) {
Navigator.pop(context);
}
});
},
color: Colors.grey[800],
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
child: DefaultButton(
TranslationBase.of(context).submit,
() => {
model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) {
if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) {
Navigator.pop(context);
}
})
},
color: Color(0xffD02127),
textColor: Colors.white,
disabledColor: Color(0xffEAEAEA),
),
),
),
),

@ -86,12 +86,6 @@ class RadiologyDetailsPage extends StatelessWidget {
'${finalRadiology.reportData}',
style: TextStyle(fontSize: 12, letterSpacing: -0.48),
),
// Texts(
// '${finalRadiology.reportData}',
// textAlign: TextAlign.start,
// fontSize: 12,
//
// ),
mHeight(16),
(projectViewModel.havePrivilege(9) || projectViewModel.havePrivilege(8))
? (finalRadiology.dIAPACSURL != "" && projectViewModel.havePrivilege(9))

@ -2162,6 +2162,8 @@ class TranslationBase {
localizedValues["child-vaccine-info"][locale.languageCode];
String get h2oInfo =>
localizedValues["h2o-info"][locale.languageCode];
String get askDocEmpty =>
localizedValues["ask-doc-empty"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -504,6 +504,7 @@ class _AppDrawerState extends State<AppDrawer> {
var appLanguage = await sharedPref.getString(APP_LANGUAGE);
await sharedPref.clear();
await sharedPref.setString(APP_LANGUAGE, appLanguage);
await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL);
this.user = null;
Navigator.of(context).pushNamed(HOME);
// projectProvider.platformBridge().unRegisterHmgGeofences();

Loading…
Cancel
Save