Add Confirm send email dialog

merge-update-with-lab-changes
Mohammad Aljammal 5 years ago committed by Mohammad Aljammal
parent e35f706be3
commit 92e6275162

@ -1154,4 +1154,12 @@ const Map localizedValues = {
"en": "This service allows you to chat with customer service directly without the need to call.", "en": "This service allows you to chat with customer service directly without the need to call.",
"ar": "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." "ar": "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً."
}, },
"send-email": {
"en": "Send a copy of this report to the email",
"ar": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني"
},
"update-email": {
"en": "Update Email",
"ar": "تحديث البريد الالكتروني"
}
}; };

@ -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<ConfirmSendEmailDialog> {
@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,
),
],
)
],
);
}
}

@ -12,6 +12,8 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'confirm_send_email_dialog.dart';
class PrescriptionItemsPage extends StatelessWidget { class PrescriptionItemsPage extends StatelessWidget {
final Prescriptions prescriptions; final Prescriptions prescriptions;
@ -30,47 +32,60 @@ class PrescriptionItemsPage extends StatelessWidget {
height: MediaQuery.of(context).size.height * 0.8, height: MediaQuery.of(context).size.height * 0.8,
child: Column( child: Column(
children: [ children: [
if (!prescriptions.isInOutPatient)
if(!prescriptions.isInOutPatient) ...List.generate(
...List.generate(model.prescriptionReportList.length, (index) => InkWell( model.prescriptionReportList.length,
(index) => InkWell(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
page: PrescriptionDetailsPage( page: PrescriptionDetailsPage(
prescriptionReport: model.prescriptionReportList[index], prescriptionReport:
model.prescriptionReportList[index],
), ),
), ),
), ),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.only(top: 10, left: 10, right: 10), margin:
EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(10.0), Radius.circular(10.0),
), ),
border: Border.all(color: Colors.grey[200], width: 0.5), border: Border.all(
color: Colors.grey[200], width: 0.5),
), ),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
ClipRRect( ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)), borderRadius:
BorderRadius.all(Radius.circular(5)),
child: Image.network( child: Image.network(
model.prescriptionReportList[index].imageSRCUrl, model.prescriptionReportList[index]
.imageSRCUrl,
fit: BoxFit.cover, fit: BoxFit.cover,
width: 60, width: 60,
height: 70, height: 70,
), ),
), ),
SizedBox(width: 10,), SizedBox(
width: 10,
),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty? child: Texts(model
model.prescriptionReportList[index].itemDescription :model .prescriptionReportList[index]
.prescriptionReportList[index].itemDescriptionN)), .itemDescription
.isNotEmpty
? model.prescriptionReportList[index]
.itemDescription
: model.prescriptionReportList[index]
.itemDescriptionN)),
)), )),
Icon( Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
@ -81,29 +96,40 @@ class PrescriptionItemsPage extends StatelessWidget {
), ),
), ),
)) ))
else else
...List.generate( ...List.generate(
model.prescriptionReportEnhList.length, model.prescriptionReportEnhList.length,
(index) => InkWell( (index) => InkWell(
onTap: (){ onTap: () {
PrescriptionReport prescriptionReport = PrescriptionReport( PrescriptionReport prescriptionReport =
imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl, PrescriptionReport(
itemDescription: model.prescriptionReportEnhList[index].itemDescription, imageSRCUrl: model
itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription, .prescriptionReportEnhList[index].imageSRCUrl,
routeN: model.prescriptionReportEnhList[index].route, itemDescription: model
frequency: model.prescriptionReportEnhList[index].frequency, .prescriptionReportEnhList[index]
frequencyN: model.prescriptionReportEnhList[index].frequency, .itemDescription,
doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, 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, days: model.prescriptionReportEnhList[index].days,
itemID: model.prescriptionReportEnhList[index].itemID, itemID:
remarks: model.prescriptionReportEnhList[index].remarks model.prescriptionReportEnhList[index].itemID,
); remarks: model
.prescriptionReportEnhList[index].remarks);
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: PrescriptionDetailsPage( page: PrescriptionDetailsPage(
prescriptionReport:prescriptionReport, prescriptionReport: prescriptionReport,
), ),
), ),
); );
@ -116,13 +142,16 @@ class PrescriptionItemsPage extends StatelessWidget {
ClipRRect( ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)), borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network( child: Image.network(
model.prescriptionReportEnhList[index].imageSRCUrl, model
.prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover, fit: BoxFit.cover,
width: 60, width: 60,
height: 70, height: 70,
), ),
), ),
SizedBox(width: 10,), SizedBox(
width: 10,
),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
@ -159,21 +188,17 @@ class PrescriptionItemsPage extends StatelessWidget {
width: MediaQuery.of(context).size.width * 0.8, width: MediaQuery.of(context).size.width * 0.8,
child: Button( child: Button(
label: TranslationBase.of(context).sendCopy, label: TranslationBase.of(context).sendCopy,
onTap: () => model.sendPrescriptionEmail( onTap: () {
appointmentDate: prescriptions.appointmentDate, showConfirmMessage(context,model);
patientID: prescriptions.patientID, },
clinicName: prescriptions.companyName,
doctorName: prescriptions.doctorName,
mes: TranslationBase.of(context).sendSuc,
projectID: prescriptions.projectID),
loading: model.state == ViewState.BusyLocal, loading: model.state == ViewState.BusyLocal,
), ),
), ),
if(false) if (false)
Container( Container(
width: MediaQuery.of(context).size.width * 0.8, width: MediaQuery.of(context).size.width * 0.8,
child: Button( child: Button(
label:TranslationBase.of(context).resendOrder, label: TranslationBase.of(context).resendOrder,
backgroundColor: Colors.green[200], backgroundColor: Colors.green[200],
)) ))
], ],
@ -182,4 +207,22 @@ class PrescriptionItemsPage extends StatelessWidget {
), ),
); );
} }
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);
},
),
);
}
} }

@ -1015,6 +1015,8 @@ class TranslationBase {
String get lastVisit => localizedValues['last-visit'][locale.languageCode]; String get lastVisit => localizedValues['last-visit'][locale.languageCode];
String get tapTitle => localizedValues['tap-title'][locale.languageCode]; String get tapTitle => localizedValues['tap-title'][locale.languageCode];
String get later => localizedValues['later'][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<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save