lab order clinic/hospital name, prescription reminder ui, prescription availibility

merge-requests/404/merge
Sikander Saleem 5 years ago
parent 3403e07aba
commit df32ae0142

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart'; import 'package:jiffy/jiffy.dart';
import 'package:manage_calendar_events/manage_calendar_events.dart'; import 'package:manage_calendar_events/manage_calendar_events.dart';
@ -12,29 +13,14 @@ Future<Map<Permission, PermissionStatus>> requestPermissions() async {
return permissionResults; return permissionResults;
} }
showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, {Function onSuccess}) async { showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{Function onSuccess, String title, String description}) async {
if (await Permission.calendar.request().isGranted) { if (await Permission.calendar.request().isGranted) {
_showReminderDialog( _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description);
context,
dateTime,
doctorName,
eventId,
appoDateFormatted,
appoTimeFormatted,
onSuccess: onSuccess,
);
} else { } else {
requestPermissions().then((results) { requestPermissions().then((results) {
if (results[Permission.calendar].isGranted) { if (results[Permission.calendar].isGranted) {
_showReminderDialog( _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description);
context,
dateTime,
doctorName,
eventId,
appoDateFormatted,
appoTimeFormatted,
onSuccess: onSuccess,
);
} }
}); });
} }
@ -42,13 +28,15 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S
final CalendarPlugin _myPlugin = CalendarPlugin(); final CalendarPlugin _myPlugin = CalendarPlugin();
Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, {Function onSuccess}) async { Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{Function onSuccess, String title, String description}) async {
return showDialog<void>( return showDialog<void>(
context: context, context: context,
barrierDismissible: true, // user must tap button! barrierDismissible: true, // user must tap button!
builder: (BuildContext context) { builder: (BuildContext context) {
return Dialog( return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), //this right here shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0.0)),
insetPadding: EdgeInsets.all(21),
child: ReminderDialog( child: ReminderDialog(
onClick: (int i) async { onClick: (int i) async {
if (i == 0) { if (i == 0) {
@ -71,7 +59,10 @@ Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String
CalendarUtils calendarUtils = await CalendarUtils.getInstance(); CalendarUtils calendarUtils = await CalendarUtils.getInstance();
calendarUtils calendarUtils
.createOrUpdateEvent( .createOrUpdateEvent(
title: TranslationBase.of(context).reminderTitle + " " + doctorName, description: "At " + appoDateFormatted + " " + appoTimeFormatted, scheduleDateTime: dateTime, eventId: eventId) title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName,
description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted,
scheduleDateTime: dateTime,
eventId: eventId)
.then((value) {}); .then((value) {});
onSuccess(); onSuccess();
@ -97,7 +88,7 @@ class _ReminderDialogState extends State<ReminderDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: MediaQuery.of(context).size.width / 0.8, //width: MediaQuery.of(context).size.width / 0.8,
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -106,13 +97,16 @@ class _ReminderDialogState extends State<ReminderDialog> {
children: <Widget>[ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon( Icon(
Icons.notifications_active, Icons.notifications_active,
color: Color(0xff2B353E),
size: 50, size: 50,
), ),
IconButton( IconButton(
icon: Icon(Icons.clear), icon: Icon(Icons.clear),
color: Color(0xff2B353E),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -124,6 +118,7 @@ class _ReminderDialogState extends State<ReminderDialog> {
"When would you like to set a reminder for this appointment?", "When would you like to set a reminder for this appointment?",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Color(0xff2B353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
@ -133,6 +128,7 @@ class _ReminderDialogState extends State<ReminderDialog> {
"Please select from below options:", "Please select from below options:",
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: Color(0xff2B353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
@ -190,28 +186,14 @@ class _ReminderDialogState extends State<ReminderDialog> {
), ),
), ),
mHeight(12), mHeight(12),
InkWell( DefaultButton(
onTap: () { TranslationBase.of(context).save,
() {
widget.onClick(i); widget.onClick(i);
Navigator.pop(context); Navigator.pop(context);
}, },
child: Container( color: CustomColors.green,
width: double.infinity, ),
height: 45,
decoration: containerRadius(CustomColors.green, 12),
child: Center(
child: Text(
"Save",
style: TextStyle(
fontSize: 16,
letterSpacing: -0.48,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
)
], ],
), ),
); );

@ -82,7 +82,7 @@ class LabsHomePage extends StatelessWidget {
name: TranslationBase.of(context).dr + " " + labOrder.doctorName, name: TranslationBase.of(context).dr + " " + labOrder.doctorName,
billNo: labOrder.invoiceNo, billNo: labOrder.invoiceNo,
profileUrl: labOrder.doctorImageURL, profileUrl: labOrder.doctorImageURL,
subName: _isSortByClinic ? labOrder.projectName : labOrder.clinicDescription, subName: _isSortByClinic ? (labOrder.projectName ?? labOrder.clinicDescription) : (labOrder.clinicDescription ?? labOrder.projectName),
isLiveCareAppointment: labOrder.isLiveCareAppointment, isLiveCareAppointment: labOrder.isLiveCareAppointment,
date: labOrder.orderDate, date: labOrder.orderDate,
isSortByClinic: _isSortByClinic, isSortByClinic: _isSortByClinic,

@ -63,77 +63,77 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
), ),
), ),
model.pharmacyPrescriptionsList.isNotEmpty == true model.pharmacyPrescriptionsList.isNotEmpty == true
? ListView.builder( ? Expanded(
scrollDirection: Axis.vertical, child: ListView.builder(
shrinkWrap: true, scrollDirection: Axis.vertical,
itemBuilder: (context, index) => Container( physics: BouncingScrollPhysics(),
width: double.infinity, itemBuilder: (context, index) => Container(
margin: EdgeInsets.only(top: 10, left: 10, right: 10), width: double.infinity,
padding: EdgeInsets.all(8.0), margin: EdgeInsets.only(top: 10, left: 10, right: 10),
decoration: BoxDecoration( padding: EdgeInsets.all(8.0),
color: Colors.white, decoration: BoxDecoration(
borderRadius: BorderRadius.all( color: Colors.white,
Radius.circular(10.0), borderRadius: BorderRadius.all(
), Radius.circular(10.0),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
model.pharmacyPrescriptionsList[index].projectImageURL,
fit: BoxFit.cover,
width: 60,
height: 70,
),
), ),
Expanded( border: Border.all(color: Colors.grey[200], width: 0.5),
child: Padding( ),
padding: const EdgeInsets.all(8.0), child: Row(
child: Column( children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.start, ClipRRect(
children: <Widget>[ borderRadius: BorderRadius.all(Radius.circular(5)),
Texts(model.pharmacyPrescriptionsList[index].locationDescription), child: Image.network(
SizedBox( model.pharmacyPrescriptionsList[index].projectImageURL,
height: 5, fit: BoxFit.cover,
), width: 60,
Texts(model.pharmacyPrescriptionsList[index].cityName), height: 70,
],
), ),
), ),
), Expanded(
InkWell( child: Padding(
onTap: () { padding: const EdgeInsets.all(8.0),
MapsLauncher.launchCoordinates( child: Column(
double.parse(model.pharmacyPrescriptionsList[index].latitude), crossAxisAlignment: CrossAxisAlignment.start,
double.parse(model.pharmacyPrescriptionsList[index].longitude)); children: <Widget>[
}, Texts(model.pharmacyPrescriptionsList[index].locationDescription),
child: Icon( SizedBox(
Icons.pin_drop, height: 5,
size: 18, ),
color: Colors.red[900], Texts(model.pharmacyPrescriptionsList[index].cityName),
],
),
),
), ),
), InkWell(
SizedBox( onTap: () {
width: 15, MapsLauncher.launchCoordinates(double.parse(model.pharmacyPrescriptionsList[index].latitude), double.parse(model.pharmacyPrescriptionsList[index].longitude));
), },
InkWell(
onTap: Feedback.wrapForTap(() {
launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}");
}, context),
child: Container(
child: Icon( child: Icon(
Icons.call, Icons.pin_drop,
size: 18, size: 18,
color: Colors.red[900], color: Colors.red[900],
), ),
), ),
) SizedBox(
], width: 15,
),
InkWell(
onTap: Feedback.wrapForTap(() {
launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}");
}, context),
child: Container(
child: Icon(
Icons.call,
size: 18,
color: Colors.red[900],
),
),
)
],
),
), ),
itemCount: model.pharmacyPrescriptionsList.length,
), ),
itemCount: model.pharmacyPrescriptionsList.length,
) )
: Padding( : Padding(
padding: const EdgeInsets.only(top: 65.0), padding: const EdgeInsets.only(top: 65.0),

@ -3,8 +3,10 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
@ -100,9 +102,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
], ],
), ),
SizedBox(height: 12), SizedBox(height: 12),
Table( Table(border: TableBorder(horizontalInside: BorderSide(width: 1, color: Colors.black, style: BorderStyle.solid)), children: [
border: TableBorder(horizontalInside: BorderSide(width: 1, color: Colors.black, style: BorderStyle.solid)),
children: [
TableRow( TableRow(
children: [ children: [
Utils.tableColumnTitle(TranslationBase.of(context).route, showDivider: false), Utils.tableColumnTitle(TranslationBase.of(context).route, showDivider: false),
@ -166,7 +166,21 @@ class PrescriptionDetailsPage extends StatelessWidget {
DateTime startDate = DateTime.now(); DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days);
print(prescriptionReport); showReminderDialog(
context,
endDate,
"",
prescriptionReport.itemID.toString(),
"",
"",
title: "${prescriptionReport.itemDescriptionN} Prescription Reminder",
description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
onSuccess: () {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
},
);
return;
showGeneralDialog( showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5), barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) { transitionBuilder: (context, a1, a2, widget) {

@ -43,6 +43,7 @@ class PrescriptionItemsPage extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column( child: Column(
children: [ children: [
DoctorHeader( DoctorHeader(

@ -46,18 +46,18 @@ class CalendarUtils {
}); });
} }
Future createOrUpdateEvent({ String title, String description, DateTime scheduleDateTime,String eventId}) async { Future createOrUpdateEvent({String title, String description, DateTime scheduleDateTime, String eventId}) async {
RecurrenceRule recurrenceRule = RecurrenceRule( RecurrenceRule recurrenceRule = RecurrenceRule(
RecurrenceFrequency.Daily, RecurrenceFrequency.Daily,
// daysOfWeek: daysOfWeek, // daysOfWeek: daysOfWeek,
endDate: scheduleDateTime, endDate: scheduleDateTime,
); );
print("eventId "+eventId); print("eventId " + eventId);
Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTime, end: scheduleDateTime.add(Duration(minutes: 30)), title: title, description: description); Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTime, end: scheduleDateTime.add(Duration(minutes: 30)), title: title, description: description);
deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e){ deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) {
print("catchError "+e.toString()); print("catchError " + e.toString());
}).whenComplete(() { }).whenComplete(() {
print("whenComplete "+eventId); print("whenComplete " + eventId);
}); });
} }
@ -72,8 +72,6 @@ class CalendarUtils {
return await deviceCalendarPlugin.retrieveEvents(calendarId, retrieveEventsParams); return await deviceCalendarPlugin.retrieveEvents(calendarId, retrieveEventsParams);
} }
Future createCalendar( Future createCalendar(
String calendarName, { String calendarName, {
Color calendarColor, Color calendarColor,

Loading…
Cancel
Save