diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index 56721009..d1009753 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -19,7 +19,7 @@ class ArrivedButtons { "title": "Radiology", "subtitle": "Services", "icon": "assets/images/new-design/radiology_service_icon.png", - "caller": "insertComplaint" + "caller": "radiology" }, { "title": "Lab", diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 1d3f0bc6..6f3a2005 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; @@ -20,10 +21,9 @@ class AppointmentActions extends StatefulWidget { TabController tabController; final Function enableFooterButton; - AppointmentActions( - {@required this.appo, - @required this.tabController, - @required this.enableFooterButton}); + AppointmentActions({@required this.appo, + @required this.tabController, + @required this.enableFooterButton}); @override _AppointmentActionsState createState() => _AppointmentActionsState(); @@ -40,7 +40,9 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; + var size = MediaQuery + .of(context) + .size; final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; final double itemWidth = size.width / 2; @@ -56,57 +58,58 @@ class _AppointmentActionsState extends State { crossAxisCount: 2, childAspectRatio: (itemWidth / itemHeight), children: appoButtonsList - .map((e) => GestureDetector( - onTap: () { - _handleButtonClicks(e); - }, - child: Container( - height: 100.0, - margin: EdgeInsets.all(9.0), - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey[400], - blurRadius: 2.0, - spreadRadius: 0.0) - ], - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - margin: - EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: Text(e.title, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFFc5272d), - letterSpacing: 1.0, - fontSize: 20.0)), - ), - Container( - margin: - EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Text(e.subtitle, - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.black, - letterSpacing: 1.0, - fontSize: 15.0)), - ), - Container( - alignment: Alignment.bottomRight, - margin: - EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0), - child: Image.asset(e.icon, - width: 45.0, height: 45.0), - ), - ], + .map((e) => + GestureDetector( + onTap: () { + _handleButtonClicks(e); + }, + child: Container( + height: 100.0, + margin: EdgeInsets.all(9.0), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey[400], + blurRadius: 2.0, + spreadRadius: 0.0) + ], + borderRadius: BorderRadius.circular(10), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + margin: + EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(e.title, + overflow: TextOverflow.clip, + style: TextStyle( + color: new Color(0xFFc5272d), + letterSpacing: 1.0, + fontSize: 20.0)), ), - ), - )) + Container( + margin: + EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + child: Text(e.subtitle, + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.black, + letterSpacing: 1.0, + fontSize: 15.0)), + ), + Container( + alignment: Alignment.bottomRight, + margin: + EdgeInsets.fromLTRB(0.0, 10.0, 10.0, 7.0), + child: Image.asset(e.icon, + width: 45.0, height: 45.0), + ), + ], + ), + ), + )) .toList(), ), ), @@ -130,9 +133,15 @@ class _AppointmentActionsState extends State { case "onCancelAppointment": ConfirmDialog dialog = new ConfirmDialog( context: context, - confirmMessage: TranslationBase.of(context).cancelAppoMsg, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, + confirmMessage: TranslationBase + .of(context) + .cancelAppoMsg, + okText: TranslationBase + .of(context) + .confirm, + cancelText: TranslationBase + .of(context) + .cancel_nocaps, okFunction: () => {cancelAppointment()}, cancelFunction: () => {}); dialog.showAlertDialog(context); @@ -158,6 +167,10 @@ class _AppointmentActionsState extends State { case "askDoc": askYourDoc(); break; + + case "radiology": + openAppointmentRadiology(); + break; } } @@ -329,6 +342,21 @@ class _AppointmentActionsState extends State { }); } + openAppointmentRadiology() { + DoctorsListService service = new DoctorsListService(); + FinalRadiology finalRadiology = new FinalRadiology(); + service.getPatientRadOrders(widget.appo.appointmentNo.toString(), context) + .then((res) { + if (res['MessageStatus'] == 1) { + print(res['FinalRadiologyList']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }); + } + static Future openMap(double latitude, double longitude) async { String googleUrl = 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude'; @@ -364,11 +392,13 @@ class _AppointmentActionsState extends State { service .isAllowedToAskDoctor(widget.appo.doctorID, context) .then((res) { - print(res['PatientDoctorAppointmentResultList']); + print(res['PatientDoctorAppointmentResultList']); if (res['PatientDoctorAppointmentResultList'].length != 0) { } else { - AppToast.showErrorToast(message: TranslationBase.of(context).askDocNotAllowed); + AppToast.showErrorToast(message: TranslationBase + .of(context) + .askDocNotAllowed); } }).catchError((err) { print(err); @@ -379,7 +409,7 @@ class _AppointmentActionsState extends State { DoctorsListService service = new DoctorsListService(); service .confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, - widget.appo.projectID, context) + widget.appo.projectID, context) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 53c09727..0c7f662b 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; @@ -184,7 +185,29 @@ class _MedicalProfilePageState extends State { ), ) ], - ) + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, FadePage(page: MyAppointments())); + }, + child: MedicalProfileItem( + title: 'My Appointments', + imagePath: 'my_appointment_icon.png', + subTitle: 'List', + ), + ), + ), + Expanded( + flex: 1, + child: Container(), + ), + ], + ), ], ), ), diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 592240b2..8a2bd80f 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -697,6 +697,46 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getPatientRadOrders(String appoNo, BuildContext context) async { + Utils.showProgressDialog(context); + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "AppointmentNo": appoNo, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + await baseAppClient.post(GET_PATIENT_ORDERS, + onSuccess: (response, statusCode) async { + localRes = response; + Utils.hideProgressDialog(); + }, onFailure: (String error, int statusCode) { + Utils.hideProgressDialog(); + throw error; + }, body: request); + return Future.value(localRes); + } + + Future createAdvancePayment( AppoitmentAllHistoryResultList appo, double payedAmount,