Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into sultan-patientapp

merge-update-with-lab-changes
Sultan Khan 5 years ago
commit 59892870e2

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -25,18 +26,13 @@ class CustomRadioState extends State<CustomRadio> {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.requestData != null) { if (widget.requestData != null) {
widget.requestData.forEach((element) { widget.requestData.forEach((element) {
sampleData.add(new RadioModel( sampleData.add(new RadioModel(false, element.description, element.parameterCode));
false, element.description, element.parameterCode));
}); });
} else { } else {
sampleData.add(new RadioModel( sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder30, 30));
false, TranslationBase.of(context).appoReminder30, 30)); sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder60, 60));
sampleData.add(new RadioModel( sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder90, 90));
false, TranslationBase.of(context).appoReminder60, 60)); sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder120, 120));
sampleData.add(new RadioModel(
false, TranslationBase.of(context).appoReminder90, 90));
sampleData.add(new RadioModel(
false, TranslationBase.of(context).appoReminder120, 120));
} }
}); });
} }
@ -57,12 +53,11 @@ class CustomRadioState extends State<CustomRadio> {
sampleData.forEach((element) => element.isSelected = false); sampleData.forEach((element) => element.isSelected = false);
sampleData[index].isSelected = true; sampleData[index].isSelected = true;
if (widget.requestData != null) { if (widget.requestData != null) {
AskDocDialog.selectedParameterCode = AskDocDialog.selectedParameterCode = sampleData[index].duration;
sampleData[index].duration;
print(AskDocDialog.selectedParameterCode); print(AskDocDialog.selectedParameterCode);
} else { } else {
ReminderDialog.selectedDuration = ReminderDialog.selectedDuration = sampleData[index].duration * 60000;
sampleData[index].duration * 60000; PrescriptionReminderDialog.selectedDuration = sampleData[index].duration * 60000;
} }
}); });
}, },
@ -91,14 +86,11 @@ class RadioItem extends StatelessWidget {
height: 30.0, height: 30.0,
width: 30.0, width: 30.0,
child: new Center( child: new Center(
child: Image.asset("assets/images/new-design/check_icon.png", child: Image.asset("assets/images/new-design/check_icon.png", width: 15.0, height: 15.0),
width: 15.0, height: 15.0),
), ),
decoration: new BoxDecoration( decoration: new BoxDecoration(
color: _item.isSelected ? Colors.blue : Colors.transparent, color: _item.isSelected ? Colors.blue : Colors.transparent,
border: new Border.all( border: new Border.all(width: 1.0, color: _item.isSelected ? Colors.blue : Colors.grey),
width: 1.0,
color: _item.isSelected ? Colors.blue : Colors.grey),
borderRadius: const BorderRadius.all(const Radius.circular(50.0)), borderRadius: const BorderRadius.all(const Radius.circular(50.0)),
), ),
), ),

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/custom_radio.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/custom_radio.dart';
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.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';
@ -16,7 +17,13 @@ class ReminderDialog extends StatefulWidget {
final String endDate; final String endDate;
final String location; final String location;
ReminderDialog({@required this.eventId, @required this.title, @required this.description, @required this.startDate, @required this.endDate, @required this.location}); ReminderDialog(
{@required this.eventId,
@required this.title,
@required this.description,
@required this.startDate,
@required this.endDate,
@required this.location});
@override @override
_ReminderDialogState createState() => _ReminderDialogState(); _ReminderDialogState createState() => _ReminderDialogState();
@ -29,65 +36,54 @@ class _ReminderDialogState extends State<ReminderDialog> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
child: Dialog( child: Dialog(
shape: shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
child: Container( child: Container(
// height: MediaQuery.of(context).size.height * 0.57, // height: MediaQuery.of(context).size.height * 0.57,
width: 450.0, width: 450.0,
child: Column( child:
crossAxisAlignment: CrossAxisAlignment.start, Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: <Widget>[
mainAxisSize: MainAxisSize.min, Container(
children: <Widget>[ margin: EdgeInsets.all(20.0),
Container( child: Text(TranslationBase.of(context).setReminder,
margin: EdgeInsets.all(20.0), style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
child: Text(TranslationBase.of(context).setReminder, ),
style: TextStyle( Container(
fontSize: 20.0, transform: Matrix4.translationValues(0.0, -30.0, 0.0),
fontWeight: FontWeight.bold)), child: CustomRadio(),
), ),
Container( Container(
transform: Matrix4.translationValues(0.0, -30.0, 0.0), width: MediaQuery.of(context).size.width,
child: CustomRadio(), height: 40.0,
), margin: EdgeInsets.only(left: 30.0, top: 0.0, right: 30.0),
Container( child: RaisedButton(
width: MediaQuery.of(context).size.width, shape: RoundedRectangleBorder(
height: 40.0, borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)),
margin: EdgeInsets.only(left: 30.0, top: 0.0, right: 30.0), color: Colors.blue,
child: RaisedButton( onPressed: () {
shape: RoundedRectangleBorder( print(ReminderDialog.selectedDuration);
borderRadius: BorderRadius.circular(10.0), createCalendarEvent();
side: BorderSide(color: Colors.blue)), },
color: Colors.blue, child: Text(TranslationBase.of(context).confirm,
onPressed: () { style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
print(ReminderDialog.selectedDuration); ),
createCalendarEvent(); ),
}, Container(
child: Text(TranslationBase.of(context).confirm, width: MediaQuery.of(context).size.width,
style: TextStyle( margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0, bottom: 20.0),
color: Colors.white, child: OutlineButton(
fontWeight: FontWeight.bold)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
), color: Colors.red,
), borderSide: BorderSide(color: Colors.red),
Container( highlightColor: Colors.red,
width: MediaQuery.of(context).size.width, highlightedBorderColor: Colors.red,
margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0, bottom: 20.0), onPressed: () {
child: OutlineButton( Navigator.of(context).pop();
shape: RoundedRectangleBorder( },
borderRadius: BorderRadius.circular(10.0)), child: Text(TranslationBase.of(context).cancel_nocaps,
color: Colors.red, style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold)),
borderSide: BorderSide(color: Colors.red), ),
highlightColor: Colors.red, ),
highlightedBorderColor: Colors.red, ]),
onPressed: () {
Navigator.of(context).pop();
},
child: Text(TranslationBase.of(context).cancel_nocaps,
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold)),
),
),
]),
), ),
), ),
); );
@ -107,17 +103,14 @@ class _ReminderDialogState extends State<ReminderDialog> {
title: widget.title, title: widget.title,
description: widget.description, description: widget.description,
startDate: DateUtil.convertStringToDate(widget.startDate) startDate: DateUtil.convertStringToDate(widget.startDate)
.subtract( .subtract(new Duration(microseconds: ReminderDialog.selectedDuration)),
new Duration(microseconds: ReminderDialog.selectedDuration)),
endDate: DateUtil.convertStringToDate(widget.endDate), endDate: DateUtil.convertStringToDate(widget.endDate),
location: widget.location, location: widget.location,
duration: new Duration(minutes: 15).inMinutes, duration: new Duration(minutes: 15).inMinutes,
isAllDay: false, isAllDay: false,
hasAlarm: true); hasAlarm: true);
_myPlugin _myPlugin.createEvent(calendarId: "207749556", event: calendarEvent).then((value) {
.createEvent(calendarId: "207749556", event: calendarEvent)
.then((value) {
print("Cal event"); print("Cal event");
print(value); print(value);
if (int.parse(value) == int.parse(widget.eventId)) { if (int.parse(value) == int.parse(widget.eventId)) {

@ -0,0 +1,127 @@
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/custom_radio.dart';
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:manage_calendar_events/manage_calendar_events.dart';
class PrescriptionReminderDialog extends StatefulWidget {
static var selectedDuration;
final String eventId;
final String title;
final String description;
final DateTime startDate;
final DateTime endDate;
final String location;
final int days;
List<DateTime> _scheduleList = List();
PrescriptionReminderDialog({
@required this.eventId,
@required this.title,
@required this.description,
@required this.startDate,
@required this.endDate,
@required this.location,
@required this.days,
});
@override
_ReminderDialogState createState() => _ReminderDialogState();
}
class _ReminderDialogState extends State<PrescriptionReminderDialog> {
final CalendarPlugin _myPlugin = CalendarPlugin();
@override
Widget build(BuildContext context) {
return Container(
child: Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
child: Container(
// height: MediaQuery.of(context).size.height * 0.57,
width: 450.0,
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: <Widget>[
Container(
margin: EdgeInsets.all(20.0),
child: Text(TranslationBase.of(context).setReminder,
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
),
Container(
transform: Matrix4.translationValues(0.0, -30.0, 0.0),
child: CustomRadio(),
),
Container(
width: MediaQuery.of(context).size.width,
height: 40.0,
margin: EdgeInsets.only(left: 30.0, top: 0.0, right: 30.0),
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)),
color: Colors.blue,
onPressed: () {
createOrUpdateEvents();
},
child: Text(TranslationBase.of(context).confirm,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
),
),
Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0, bottom: 20.0),
child: OutlineButton(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
color: Colors.red,
borderSide: BorderSide(color: Colors.red),
highlightColor: Colors.red,
highlightedBorderColor: Colors.red,
onPressed: () {
Navigator.of(context).pop();
},
child: Text(TranslationBase.of(context).cancel_nocaps,
style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold)),
),
),
]),
),
),
);
}
createOrUpdateEvents() async {
Navigator.pop(context);
for (int count = 0; count < widget.days; count++) {
widget._scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day));
}
List<DateTime> scheduleDateTime = calculateDaysInterval(
widget.startDate.subtract(new Duration(microseconds: PrescriptionReminderDialog.selectedDuration)),
widget.endDate);
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
calendarUtils.createOrUpdateEvents(
scheduleList: widget._scheduleList,
description: widget.description,
title: widget.title,
scheduleDateTime: scheduleDateTime);
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
}
List<DateTime> calculateDaysInterval(DateTime startDate, DateTime endDate) {
List<DateTime> days = [];
for (int i = 0; i <= endDate.difference(startDate).inDays; i++) {
widget._scheduleList.forEach((element) {
days.add(startDate.add(Duration(days: i, hours: element.hour, minutes: element.minute)));
});
}
return days;
}
}

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.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/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -223,14 +224,15 @@ class PrescriptionDetailsPage extends StatelessWidget {
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity( child: Opacity(
opacity: a1.value, opacity: a1.value,
child: ReminderDialog( child: PrescriptionReminderDialog(
eventId: prescriptionReport.itemID.toString(), eventId: prescriptionReport.itemID.toString(),
title: "Prescription Reminder", title: "${prescriptionReport.itemDescriptionN} Prescription Reminder",
description: description:
"${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
startDate: "/Date(${startDate.millisecondsSinceEpoch}+0300)/", startDate: startDate,
endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/", endDate: endDate,
location: prescriptionReport.remarks, location: prescriptionReport.remarks,
days: 1,
), ),
), ),
); );

Loading…
Cancel
Save