Merge branch 'development_new_design_2.0' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into development_new_design_2.0

merge-requests/390/head
Sultan Khan 4 years ago
commit ad7527ee65

@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';

@ -498,9 +498,15 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
Future navigateToBookConfirm(context) async {
Navigator.push(
context,
FadePage(
page: BookConfirm(
doctor: widget.doctor, isLiveCareAppointment: widget.isLiveCareAppointment, selectedDate: DocAvailableAppointments.selectedDate, selectedTime: DocAvailableAppointments.selectedTime)));
context,
FadePage(
page: BookConfirm(
doctor: widget.doctor,
isLiveCareAppointment: widget.isLiveCareAppointment,
selectedDate: DocAvailableAppointments.selectedDate,
selectedTime: DocAvailableAppointments.selectedTime,
),
),
);
}
}

@ -57,8 +57,7 @@ class _BookReminderPageState extends State<BookReminderPage> {
@override
Widget build(BuildContext context) {
// print("selectedTime "+selectedTime??"");
print("appoDateFormatted " + widget.appoDateFormatted ?? "");
print("appoTimeFormatted " + widget.appoTimeFormatted ?? "");
print("appointmentNo1 " + widget.patientShareResponse.appointmentNo.toString() ?? "");
return AppScaffold(
appBarTitle: widget.docObject.doctorTitle + " " + widget.docObject.name,
isShowDecPage: false,
@ -194,15 +193,19 @@ class _BookReminderPageState extends State<BookReminderPage> {
disabledTextColor: Colors.white,
disabledColor: CustomColors.green,
onPressed: () async {
if (await Permission.calendar.request().isGranted) {
_showReminderDialog(context);
} else {
requestPermissions().then((results) {
if (results[Permission.calendar].isGranted) {
_showReminderDialog(context);
}
});
}
print(widget.patientShareResponse.appointmentNo);
showReminderDialog(
context,
widget.dateTime,
widget.docObject.name,
widget.patientShareResponse.appointmentNo.toString(),
widget.appoDateFormatted,
widget.appoTimeFormatted,
onSuccess: () {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
navigateToBookSuccess(context);
},
);
},
child: Text(TranslationBase.of(context).yes, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)),
),
@ -223,49 +226,6 @@ class _BookReminderPageState extends State<BookReminderPage> {
BookSuccess(docObject: widget.docObject, patientShareResponse: widget.patientShareResponse, appoDateFormatted: widget.appoDateFormatted, appoTimeFormatted: widget.appoTimeFormatted)));
}
Future<void> _showReminderDialog(BuildContext context) async {
return showDialog<void>(
context: context,
barrierDismissible: true, // user must tap button!
builder: (BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), //this right here
child: ReminderDialog(
onClick: (int i) async {
if (i == 0) {
// Before 30 mints
widget.dateTime = Jiffy(widget.dateTime).subtract(minutes: 30);
// dateTime.add(new Duration(minutes: -30));
} else if (i == 1) {
// Before 1 hour
// dateTime.add(new Duration(minutes: -60));
widget.dateTime = Jiffy(widget.dateTime).subtract(hours: 1);
} else if (i == 2) {
// Before 1 hour and 30 mints
// dateTime.add(new Duration(minutes: -90));
widget.dateTime = Jiffy(widget.dateTime).subtract(hours: 1, minutes: 30);
} else if (i == 3) {
// Before 2 hours
// dateTime.add(new Duration(minutes: -120));
widget.dateTime = Jiffy(widget.dateTime).subtract(hours: 2);
}
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
calendarUtils
.createOrUpdateEvent(
title: TranslationBase.of(context).reminderTitle + " " + widget.docObject.name,
description: "At " + widget.appoDateFormatted + " " + widget.appoTimeFormatted,
scheduleDateTime: widget.dateTime)
.then((value) {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
navigateToBookSuccess(context);
});
},
),
);
},
);
}
Future<Map<Permission, PermissionStatus>> requestPermissions() async {
var permissionResults = [Permission.calendar].request();
return permissionResults;

@ -24,7 +24,7 @@ class DoctorView extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (isShowFlag) getDoctorsProfile(context, doctor);
if (isShowFlag) getDoctorsProfile(context, doctor,isAppo: true);
},
child: Container(
decoration: BoxDecoration(

@ -1,6 +1,87 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
import 'package:manage_calendar_events/manage_calendar_events.dart';
import 'package:permission_handler/permission_handler.dart';
Future<Map<Permission, PermissionStatus>> requestPermissions() async {
var permissionResults = [Permission.calendar].request();
return permissionResults;
}
showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, {Function onSuccess}) async {
if (await Permission.calendar.request().isGranted) {
_showReminderDialog(
context,
dateTime,
doctorName,
eventId,
appoDateFormatted,
appoTimeFormatted,
onSuccess: onSuccess,
);
} else {
requestPermissions().then((results) {
if (results[Permission.calendar].isGranted) {
_showReminderDialog(
context,
dateTime,
doctorName,
eventId,
appoDateFormatted,
appoTimeFormatted,
onSuccess: onSuccess,
);
}
});
}
}
final CalendarPlugin _myPlugin = CalendarPlugin();
Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, {Function onSuccess}) async {
return showDialog<void>(
context: context,
barrierDismissible: true, // user must tap button!
builder: (BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), //this right here
child: ReminderDialog(
onClick: (int i) async {
if (i == 0) {
// Before 30 mints
dateTime = Jiffy(dateTime).subtract(minutes: 30);
// dateTime.add(new Duration(minutes: -30));
} else if (i == 1) {
// Before 1 hour
// dateTime.add(new Duration(minutes: -60));
dateTime = Jiffy(dateTime).subtract(hours: 1);
} else if (i == 2) {
// Before 1 hour and 30 mints
// dateTime.add(new Duration(minutes: -90));
dateTime = Jiffy(dateTime).subtract(hours: 1, minutes: 30);
} else if (i == 3) {
// Before 2 hours
// dateTime.add(new Duration(minutes: -120));
dateTime = Jiffy(dateTime).subtract(hours: 2);
}
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
calendarUtils
.createOrUpdateEvent(
title: TranslationBase.of(context).reminderTitle + " " + doctorName, description: "At " + appoDateFormatted + " " + appoTimeFormatted, scheduleDateTime: dateTime, eventId: eventId)
.then((value) {});
onSuccess();
},
),
);
},
);
}
class ReminderDialog extends StatefulWidget {
Function onClick;

@ -6,7 +6,8 @@ import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_mode
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart';
@ -17,6 +18,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButton
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/PrescriptionReport.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart';
import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart';
import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart';
@ -24,7 +26,9 @@ import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_p
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.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/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart';
@ -153,7 +157,6 @@ class _AppointmentActionsState extends State<AppointmentActions> {
}
_handleButtonClicks(AppoDetailsButton) {
switch (AppoDetailsButton.caller) {
case "openReschedule":
widget.tabController.animateTo((widget.tabController.index + 1) % 2);
@ -182,7 +185,18 @@ class _AppointmentActionsState extends State<AppointmentActions> {
break;
case "addReminder":
showReminderDialog(widget.appo);
// showReminderDialog(widget.appo);
showReminderDialog(
context,
DateUtil.convertStringToDate(widget.appo.appointmentDate),
widget.appo.doctorNameObj,
"",
DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate)),
DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.appo.appointmentDate)),
onSuccess: () {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
},
);
break;
case "goToTodoList":
@ -502,32 +516,35 @@ class _AppointmentActionsState extends State<AppointmentActions> {
}
}
showReminderDialog(AppoitmentAllHistoryResultList appo) {
showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) {
final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
return Transform(
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity(
opacity: a1.value,
child: ReminderDialog(
eventId: appo.appointmentNo.toString(),
title: "Doctor Appointment",
description: "You have an appointment with " + appo.doctorTitle + " " + appo.doctorNameObj,
startDate: appo.appointmentDate,
endDate: appo.appointmentDate,
location: appo.projectName,
),
),
);
},
transitionDuration: Duration(milliseconds: 500),
barrierDismissible: true,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) {});
}
// showReminderDialog(AppoitmentAllHistoryResultList appo) {
//
//
// //old reminder dialog having location
// showGeneralDialog(
// barrierColor: Colors.black.withOpacity(0.5),
// transitionBuilder: (context, a1, a2, widget) {
// final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
// return Transform(
// transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
// child: Opacity(
// opacity: a1.value,
// child: ReminderDialog(
// eventId: appo.appointmentNo.toString(),
// title: "Doctor Appointment",
// description: "You have an appointment with " + appo.doctorTitle + " " + appo.doctorNameObj,
// startDate: appo.appointmentDate,
// endDate: appo.appointmentDate,
// location: appo.projectName,
// ),
// ),
// );
// },
// transitionDuration: Duration(milliseconds: 500),
// barrierDismissible: true,
// barrierLabel: '',
// context: context,
// pageBuilder: (context, animation1, animation2) {});
// }
askYourDoc() {
GifLoaderDialogUtils.showMyDialog(context);

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

Loading…
Cancel
Save