diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f4a104cf..b8c756ed 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1511,4 +1511,9 @@ const Map localizedValues = { "serviceNotAvailable": { "en": "Dear, this service is not available now, please try again later", "ar": "عزيزي المراجع, هذه الخدمة غير متوفرة الان يرجى المحاوله لاحقا"}, "doctorScheduleNot": {"en": "Doctor schedule not available", "ar": "جدول الطبيب غير متوفر"}, "RRTRequestSuccess": { "en": "Request has been sent successfully, You will be contacted soon.", "ar": "تم إرسال الطلب بنجاح ، وسيتم الاتصال بك باسرع وقت ممكن" }, + "rateDoctorAppo": { "en": "Rate DR & Appointment", "ar": "معدل الدكتور والتعيين" }, + "invoice": { "en": "Invoice", "ar": "الفاتورة" }, + "requestedDate": { "en": "Reqeusted Date", "ar": "التاريخ " }, + "callDuration": { "en": "Call Duration", "ar": "مدة الاتصال" }, + "alreadyRated": { "en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً" }, }; diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index a038aaf4..651165e4 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -21,6 +21,7 @@ class DoctorList { bool isDoctorAllowVedioCall; bool isDoctorDummy; bool isLiveCare; + bool isLiveCareClinic; bool isDoctorHasPrePostImages; String latitude; String longitude; @@ -63,6 +64,7 @@ class DoctorList { this.isDoctorAllowVedioCall, this.isDoctorDummy, this.isLiveCare, + this.isLiveCareClinic, this.isDoctorHasPrePostImages, this.latitude, this.longitude, @@ -105,6 +107,7 @@ class DoctorList { isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; isDoctorDummy = json['IsDoctorDummy']; isLiveCare = json['IsLiveCare']; + isLiveCareClinic = json['IsLiveCareClinic']; isDoctorHasPrePostImages = json['IsDoctorHasPrePostImages']; latitude = json['Latitude']; longitude = json['Longitude']; @@ -150,6 +153,7 @@ class DoctorList { data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; data['IsDoctorDummy'] = this.isDoctorDummy; data['IsLiveCare'] = this.isLiveCare; + data['IsLiveCareClinic'] = this.isLiveCareClinic; data['IsDoctorHasPrePostImages'] = this.isDoctorHasPrePostImages; data['Latitude'] = this.latitude; data['Longitude'] = this.longitude; diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index f5b6de95..6d3a3afa 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -171,7 +171,7 @@ class _DoctorProfileState extends State with TickerProviderStateM child: Text( TranslationBase.of(context).availableAppo, style: TextStyle( - color: Colors.black, + color: widget.isLiveCareAppointment ? Colors.grey : Colors.black, fontSize: 12, letterSpacing: -0.36, fontWeight: FontWeight.w600, diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 36e8274f..785fcb71 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; @@ -8,8 +9,10 @@ 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/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class LiveCareHistoryCard extends StatefulWidget { ErRequestHistoryList erRequestHistoryList; @@ -24,6 +27,8 @@ class _LiveCareHistoryCardState extends State { AuthenticatedUser authUser = new AuthenticatedUser(); AppSharedPreferences sharedPref = AppSharedPreferences(); + ProjectViewModel projectViewModel; + @override void initState() { getAuthenticatedUser(); @@ -32,6 +37,7 @@ class _LiveCareHistoryCardState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return Container( margin: EdgeInsets.all(10.0), child: Card( @@ -48,23 +54,14 @@ class _LiveCareHistoryCardState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text("Requested date:", - style: - TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + Text(TranslationBase.of(context).requestedDate, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), Container( - margin: EdgeInsets.only(top: 10.0), + margin: EdgeInsets.only(top: 0.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(widget.erRequestHistoryList.sArrivalTime, - style: TextStyle(fontSize: 14.0)), - Text( - "Call Duration\n" + - getCallTime( - widget.erRequestHistoryList.callDuration), - textAlign: TextAlign.center, - style: - TextStyle(fontSize: 14.0, color: Colors.grey[600])), + Text(widget.erRequestHistoryList.sArrivalTime, style: TextStyle(fontSize: 14.0)), + Text(TranslationBase.of(context).callDuration + "\n" + getCallTime(widget.erRequestHistoryList.callDuration), textAlign: TextAlign.center, style: TextStyle(fontSize: 14.0, color: Colors.grey[600])), ], ), ), @@ -76,8 +73,7 @@ class _LiveCareHistoryCardState extends State { color: Colors.green, ), margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: Text(widget.erRequestHistoryList.stringCallStatus, - style: TextStyle(fontSize: 14.0, color: Colors.white)), + child: Text(widget.erRequestHistoryList.stringCallStatus, style: TextStyle(fontSize: 14.0, color: Colors.white)), ), Divider( color: Colors.grey[500], @@ -90,17 +86,15 @@ class _LiveCareHistoryCardState extends State { Expanded( child: InkWell( onTap: () { - print("Invoice"); openInvoice(); }, child: Container( child: Row( children: [ - Icon(Icons.content_paste, color: Colors.blue), + Icon(Icons.content_paste, color: Colors.red), Container( margin: EdgeInsets.only(left: 10.0), - child: Text("Invoice", - textAlign: TextAlign.center), + child: Text(TranslationBase.of(context).invoice, textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), ), ], ), @@ -110,7 +104,6 @@ class _LiveCareHistoryCardState extends State { Expanded( child: InkWell( onTap: () { - print("Complaints"); openComplaint(); }, child: Container( @@ -119,8 +112,7 @@ class _LiveCareHistoryCardState extends State { Icon(Icons.add, size: 24.0, color: Colors.red), Container( margin: EdgeInsets.only(left: 10.0), - child: Text("Complaints", - textAlign: TextAlign.center), + child: Text(TranslationBase.of(context).complaint, textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), ), ], ), @@ -130,19 +122,16 @@ class _LiveCareHistoryCardState extends State { Expanded( child: InkWell( onTap: () { - print("Rate Dr & Appointment"); + rateLiveCareAppo(); }, child: Container( child: Row( children: [ - Icon(Icons.star, - size: 24.0, color: Colors.yellow[700]), + Icon(Icons.star, size: 24.0, color: Colors.yellow[700]), Container( width: MediaQuery.of(context).size.width * 0.2, margin: EdgeInsets.only(left: 10.0), - child: Text("Rate Dr & Appointment", - overflow: TextOverflow.clip, - textAlign: TextAlign.center), + child: Text(TranslationBase.of(context).rateDoctorAppo, overflow: TextOverflow.clip, textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), ), ], ), @@ -159,16 +148,25 @@ class _LiveCareHistoryCardState extends State { ); } + + rateLiveCareAppo() { + if(widget.erRequestHistoryList.isAppointmentHaveRating) { + AppToast.showErrorToast(message: TranslationBase.of(context).alreadyRated); + } else { + + } + } + openInvoice() { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: "Send a copy of this invoice to the email: " + - authUser.emailAddress, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {sendInvoiceEmail(context)}, - cancelFunction: () => {}); - dialog.showAlertDialog(context); + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + sendInvoiceEmail(context); + }, + ), + ); } openComplaint() { @@ -176,17 +174,10 @@ class _LiveCareHistoryCardState extends State { } sendInvoiceEmail(context) { - ConfirmDialog.closeAlertDialog(context); LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service - .sendLiveCareInvoiceEmail( - widget.erRequestHistoryList.appointmentNo.toString(), - widget.erRequestHistoryList.projectID, - authUser.emailAddress, - context) - .then((res) { - AppToast.showSuccessToast(message: "LiveCare invoice sent successfully"); + service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList.appointmentNo.toString(), widget.erRequestHistoryList.projectID, authUser.emailAddress, context).then((res) { + AppToast.showSuccessToast(message: TranslationBase(context).emailSentSuccessfully); }).catchError((err) { AppToast.showErrorToast(message: err); print(err); @@ -195,8 +186,7 @@ class _LiveCareHistoryCardState extends State { getAuthenticatedUser() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 493de707..c9b4fec2 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -78,6 +78,9 @@ class _clinic_listState extends State { print("LiveCare Type Selected"); setState(() { currentSelectedLiveCareType = "immediate"; + // isDataLoaded = true; + // print(liveCareOnlineClinicsListResponse.length); + getLiveCareClinicsList(); }); } }); diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index c7997647..28e1c1a9 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -80,7 +80,7 @@ class DoctorHomePage extends StatelessWidget { nationalityFlagURL: _doctorList.nationalityFlagURL); return DoctorView( doctor: doctorList, - isLiveCareAppointment: false, + isLiveCareAppointment: _doctorList.isLiveCareClinic, ); }, separatorBuilder: (context, index) => SizedBox(height: 14), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index cdc3eac2..ae7af907 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2260,8 +2260,21 @@ class TranslationBase { String get emptySchedule => localizedValues["emptySchedule"][locale.languageCode]; String get serviceNotAvailable => localizedValues["serviceNotAvailable"][locale.languageCode]; + String get doctorScheduleNot => localizedValues["doctorScheduleNot"][locale.languageCode]; + String get RRTRequestSuccess => localizedValues["RRTRequestSuccess"][locale.languageCode]; + + String get rateDoctorAppo => localizedValues["rateDoctorAppo"][locale.languageCode]; + + String get invoice => localizedValues["invoice"][locale.languageCode]; + + String get requestedDate => localizedValues["requestedDate"][locale.languageCode]; + + String get callDuration => localizedValues["callDuration"][locale.languageCode]; + + String get alreadyRated => localizedValues["alreadyRated"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate {