From b1128be94f583d95f510547fe7b4293cb22373da Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 26 Sep 2021 17:41:26 +0300 Subject: [PATCH] Updates & fixes --- .../MyAppointments/AppointmentDetails.dart | 4 +- .../widgets/AppointmentActions.dart | 45 +++++++++---------- .../insurance/insurance_approval_screen.dart | 2 +- lib/pages/landing/landing_page.dart | 2 +- .../my_invoices/invoice_detail_page.dart | 13 +++++- lib/uitl/SignalRUtil.dart | 38 ++++++++++++++++ lib/uitl/utils.dart | 2 +- 7 files changed, 76 insertions(+), 30 deletions(-) diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 26f631c2..69c121f4 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -132,7 +132,7 @@ class _AppointmentDetailsState extends State with SingleTick onTap: (index) { setState(() { if (index == 1) { - if (widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.isExecludeDoctor) { + if (widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) { _tabController.index = _tabController.previousIndex; AppointmentDetails.showFooterButton = false; } else { @@ -143,7 +143,7 @@ class _AppointmentDetailsState extends State with SingleTick }, tabs: [ Tab(child: Text(TranslationBase.of(context).appoActions, style: TextStyle(color: Colors.black))), - widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.isExecludeDoctor + widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment ? Tab( child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.grey)), ) diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 76f0235d..3806fb7d 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -1,5 +1,5 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -13,11 +13,11 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.d import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/PrescriptionReport.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_items_page.dart'; import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_page.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; @@ -391,29 +391,24 @@ class _AppointmentActionsState extends State { } openPrescriptionReport() { - GifLoaderDialogUtils.showMyDialog(context); - List prescriptionReportEnhList = List(); - DoctorsListService service = new DoctorsListService(); - service.getPatientPrescriptionReports(widget.appo, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - if (res['ListPRM'].length != 0) { - res['ListPRM'].forEach((report) { - prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report)); - }); - print(prescriptionReportEnhList.length); - navigateToMedicinePrescriptionReport(prescriptionReportEnhList, res['ListPRM']); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).noRecords); - } - }).catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); - }); + Prescriptions prescriptions = new Prescriptions(); + + prescriptions.doctorName = widget.appo.doctorNameObj; + prescriptions.doctorImageURL = widget.appo.doctorImageURL; + prescriptions.speciality = widget.appo.doctorSpeciality; + prescriptions.name = widget.appo.projectName; + prescriptions.appointmentDate = widget.appo.appointmentDate; + prescriptions.nationalityFlagURL = null; + prescriptions.doctorRate = widget.appo.doctorRate; + prescriptions.actualDoctorRate = widget.appo.actualDoctorRate; + prescriptions.noOfPatientsRate = widget.appo.noOfPatientsRate; + prescriptions.isInOutPatient = widget.appo.isInOutPatient; + + navigateToMedicinePrescriptionReport(prescriptions); } - Future navigateToMedicinePrescriptionReport(List prescriptionReportEnhList, dynamic listPres) async { - Navigator.push(context, FadePage(page: PrescriptionReportPage(prescriptionReportEnhList: prescriptionReportEnhList, listPres: listPres, appo: widget.appo))); + Future navigateToMedicinePrescriptionReport(Prescriptions prescriptions) async { + Navigator.push(context, FadePage(page: PrescriptionItemsPage(prescriptions: prescriptions))); } Future navigateToLabResults(PatientLabOrders patientLabOrders) async { @@ -557,6 +552,8 @@ class _AppointmentActionsState extends State { rateAppointment() { widget.browser = new MyInAppBrowser(); - widget.browser.openBrowser('http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'); + var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'; + print(url); + launch(url); } } diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 195b6060..cb1f76ff 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -202,7 +202,7 @@ class _InsuranceApprovalState extends State { fontWeight: FontWeight.w600, ), Texts( - convertDateFormat(model.insuranceApproval[index].receiptOn), + model.insuranceApproval[index].receiptOn != null ? convertDateFormat(model.insuranceApproval[index].receiptOn) : "", fontSize: 17.5, fontWeight: FontWeight.w600, ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 00efc157..37bca6f8 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -545,7 +545,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController.jumpToPage(0); }, ), - notificationCount != '' + projectViewModel.isLogin && notificationCount != '' ? new Positioned( right: projectViewModel.isArabic ? 35 : 0, top: 5, diff --git a/lib/pages/medical/my_invoices/invoice_detail_page.dart b/lib/pages/medical/my_invoices/invoice_detail_page.dart index 23f3ba6a..0ef58a5d 100644 --- a/lib/pages/medical/my_invoices/invoice_detail_page.dart +++ b/lib/pages/medical/my_invoices/invoice_detail_page.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -182,7 +183,17 @@ class InvoiceDetail extends StatelessWidget { width: MediaQuery.of(context).size.width, // height: 70.0, margin: EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0, bottom: 20.0), - child: DefaultButton(TranslationBase.of(context).sendEmail, () => {sendInvoiceEmail()}), + child: DefaultButton(TranslationBase.of(context).sendEmail, () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + sendInvoiceEmail(); + }, + ), + ); + }), ), ); } diff --git a/lib/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart index e69de29b..9231b81a 100644 --- a/lib/uitl/SignalRUtil.dart +++ b/lib/uitl/SignalRUtil.dart @@ -0,0 +1,38 @@ +import 'dart:io'; + +import 'package:flutter/cupertino.dart'; +import 'package:http/io_client.dart'; +import 'package:signalr_core/signalr_core.dart'; + +class SignalRUtil { + String hubName; + BuildContext context; + + SignalRUtil({@required this.hubName, @required this.context}); + + HubConnection connectionBuilder; + + void startSignalRConnection() async { + connectionBuilder = HubConnectionBuilder() + .withUrl( + hubName, + HttpConnectionOptions( + client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), + logging: (level, message) => print(message), + )) + .build(); + + await connectionBuilder.start(); + + connectionBuilder.on('ReceiveMessage', (message) { + print(message.toString()); + }); + + await connectionBuilder.invoke('SendMessage', args: ['Bob', 'Says hi!']); + } + + bool getConnectionState() { + if (connectionBuilder.state == HubConnectionState.connected) return true; + if (connectionBuilder.state == HubConnectionState.connected) return true; + } +} diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 1adb0308..00bff619 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -292,7 +292,7 @@ class Utils { title: TranslationBase.of(context).myMedical, imagePath: 'active_medication.svg', subTitle: TranslationBase.of(context).myMedicalSubtitle, - isEnable: false, + isEnable: projectViewModel.havePrivilege(48), ), ));