diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index dfd13cca..e034b05e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1154,4 +1154,12 @@ const Map localizedValues = { "en": "This service allows you to chat with customer service directly without the need to call.", "ar": "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." }, + "send-email": { + "en": "Send a copy of this report to the email", + "ar": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني" + }, + "update-email": { + "en": "Update Email", + "ar": "تحديث البريد الالكتروني" + } }; diff --git a/lib/pages/medical/prescriptions/confirm_send_email_dialog.dart b/lib/pages/medical/prescriptions/confirm_send_email_dialog.dart new file mode 100644 index 00000000..047b663d --- /dev/null +++ b/lib/pages/medical/prescriptions/confirm_send_email_dialog.dart @@ -0,0 +1,111 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../../../routes.dart'; + +class ConfirmSendEmailDialog extends StatefulWidget { + final String email; + final GestureTapCallback onTapSendEmail; + + ConfirmSendEmailDialog({this.email, this.onTapSendEmail}); + + @override + _ConfirmSendEmailDialogState createState() => _ConfirmSendEmailDialogState(); +} + +class _ConfirmSendEmailDialogState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), + title: Center( + child: Texts( + TranslationBase.of(context).confirm, + color: Colors.black, + ), + ), + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Texts( + TranslationBase.of(context).sendConfEmail, + color: Colors.grey, + ), + ), + Texts( + widget.email, + color: Colors.grey, + ), + SizedBox( + height: 5, + ), + Divider(), + SizedBox( + height: 5.0, + ), + InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Container( + width: double.maxFinite, + child: Center( + child: Texts( + TranslationBase.of(context).cancel, + color: Colors.red, + ), + ), + ), + ), + SizedBox( + height: 15.0, + ), + InkWell( + onTap: () { + Navigator.pop(context); + widget.onTapSendEmail(); + }, + child: Container( + width: double.maxFinite, + child: Center( + child: Texts(TranslationBase.of(context).sendEmail), + ), + ), + ), + SizedBox( + height: 15.0, + ), + InkWell( + onTap: () { + Navigator.of(context).pushNamed( + SETTINGS, + ); + }, + child: Container( + width: double.maxFinite, + child: Center( + child: Texts(TranslationBase.of(context).updateEmail), + ), + ), + ), + SizedBox( + height: 20.0, + ), + ], + ) + ], + ); + } +} diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index d4a9e500..ce2738dd 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -12,6 +12,8 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'confirm_send_email_dialog.dart'; + class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; @@ -30,121 +32,148 @@ class PrescriptionItemsPage extends StatelessWidget { height: MediaQuery.of(context).size.height * 0.8, child: Column( children: [ - - if(!prescriptions.isInOutPatient) - ...List.generate(model.prescriptionReportList.length, (index) => InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport: model.prescriptionReportList[index], - ), - ), - ), - child: Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - SizedBox(width: 10,), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty? - model.prescriptionReportList[index].itemDescription :model - .prescriptionReportList[index].itemDescriptionN)), - )), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], - ) - ], - ), - ), - )) - - else - ...List.generate( - model.prescriptionReportEnhList.length, + if (!prescriptions.isInOutPatient) + ...List.generate( + model.prescriptionReportList.length, (index) => InkWell( - onTap: (){ - PrescriptionReport prescriptionReport = PrescriptionReport( - imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, - itemDescription: model.prescriptionReportEnhList[index].itemDescription, - itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, - routeN: model.prescriptionReportEnhList[index].route, - frequency: model.prescriptionReportEnhList[index].frequency, - frequencyN: model.prescriptionReportEnhList[index].frequency, - doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, - days: model.prescriptionReportEnhList[index].days, - itemID: model.prescriptionReportEnhList[index].itemID, - remarks: model.prescriptionReportEnhList[index].remarks - ); - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport:prescriptionReport, + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: + model.prescriptionReportList[index], + ), ), ), - ); - }, - child: Container( - margin: EdgeInsets.all(8.0), - color: Colors.white, - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - SizedBox(width: 10,), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Container( + width: double.infinity, + margin: + EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: Colors.grey[200], width: 0.5), + ), + child: Row( children: [ - Texts(model.prescriptionReportEnhList[index] - .itemDescription), + ClipRRect( + borderRadius: + BorderRadius.all(Radius.circular(5)), + child: Image.network( + model.prescriptionReportList[index] + .imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(model + .prescriptionReportList[index] + .itemDescription + .isNotEmpty + ? model.prescriptionReportList[index] + .itemDescription + : model.prescriptionReportList[index] + .itemDescriptionN)), + )), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) ], ), ), + )) + else + ...List.generate( + model.prescriptionReportEnhList.length, + (index) => InkWell( + onTap: () { + PrescriptionReport prescriptionReport = + PrescriptionReport( + imageSRCUrl: model + .prescriptionReportEnhList[index].imageSRCUrl, + itemDescription: model + .prescriptionReportEnhList[index] + .itemDescription, + itemDescriptionN: model + .prescriptionReportEnhList[index] + .itemDescription, + routeN: + model.prescriptionReportEnhList[index].route, + frequency: model + .prescriptionReportEnhList[index].frequency, + frequencyN: model + .prescriptionReportEnhList[index].frequency, + doseDailyQuantity: model + .prescriptionReportEnhList[index] + .doseDailyQuantity, + days: model.prescriptionReportEnhList[index].days, + itemID: + model.prescriptionReportEnhList[index].itemID, + remarks: model + .prescriptionReportEnhList[index].remarks); + Navigator.push( + context, + FadePage( + page: PrescriptionDetailsPage( + prescriptionReport: prescriptionReport, + ), ), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], - ) - ], - ), - ), + ); + }, + child: Container( + margin: EdgeInsets.all(8.0), + color: Colors.white, + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + model + .prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(model.prescriptionReportEnhList[index] + .itemDescription), + ], + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), ), - ) + ), + ) ], ), ), @@ -159,27 +188,41 @@ class PrescriptionItemsPage extends StatelessWidget { width: MediaQuery.of(context).size.width * 0.8, child: Button( label: TranslationBase.of(context).sendCopy, - onTap: () => model.sendPrescriptionEmail( - appointmentDate: prescriptions.appointmentDate, - patientID: prescriptions.patientID, - clinicName: prescriptions.companyName, - doctorName: prescriptions.doctorName, - mes: TranslationBase.of(context).sendSuc, - projectID: prescriptions.projectID), + onTap: () { + showConfirmMessage(context,model); + }, loading: model.state == ViewState.BusyLocal, ), ), - if(false) - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label:TranslationBase.of(context).resendOrder, - backgroundColor: Colors.green[200], - )) + if (false) + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: TranslationBase.of(context).resendOrder, + backgroundColor: Colors.green[200], + )) ], ), ), ), ); } + + void showConfirmMessage(BuildContext context, PrescriptionsViewModel model) { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () { + model.sendPrescriptionEmail( + appointmentDate: prescriptions.appointmentDate, + patientID: prescriptions.patientID, + clinicName: prescriptions.companyName, + doctorName: prescriptions.doctorName, + mes: TranslationBase.of(context).sendSuc, + projectID: prescriptions.projectID); + }, + ), + ); + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 80fb0cfe..bc28227d 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1015,6 +1015,8 @@ class TranslationBase { String get lastVisit => localizedValues['last-visit'][locale.languageCode]; String get tapTitle => localizedValues['tap-title'][locale.languageCode]; String get later => localizedValues['later'][locale.languageCode]; + String get sendConfEmail => localizedValues['send-email'][locale.languageCode]; + String get updateEmail => localizedValues['update-email'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {