diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 7455f030..c3b4a2cf 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -280,20 +280,15 @@ class _PrescriptionDetailsPageState extends State { Future.forEach( calendarUtils.calendars, - (Calendar calender) => { - calendarUtils.retrieveEvents(calender.id!, params).then((value) { - Result> events = value; - events.data!.forEach((element) { - print(widget.prescriptionReport!.itemDescriptionN!); - if (element.title!.contains(widget.prescriptionReport!.itemDescriptionN!)) calendarUtils.deleteEvent(calender, element); - + (Calendar calender) => { + calendarUtils.retrieveEvents(calender.id!, params).then((value) { + Result> events = value; + events.data!.forEach((element) { + print(widget.prescriptionReport!.itemDescriptionN!); + if (element.title!.contains(widget.prescriptionReport!.itemDescriptionN!)) calendarUtils.deleteEvent(calender, element); + }); + }), }); - }), - }); - - - - AppToast.showSuccessToast(message: TranslationBase.of(context).reminderCancelSuccess); setState(() { @@ -303,12 +298,10 @@ class _PrescriptionDetailsPageState extends State { setCalender(BuildContext context, String eventId, int reminderIndex) async { DateTime actualDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0); - print("Frequency ${widget.prescriptionReport?.frequencyNumber}"); //Time will start at 8:00 AM from starting date if (widget.prescriptionReport?.frequencyNumber == null) widget.prescriptionReport!.frequencyNumber = 2; //Some time frequency number is null so by default will be 2 - int remainingDays = widget.prescriptionReport!.days!; - // - - // (Jiffy.parseFromDateTime(DateTime.now()).diff(Jiffy.parseFromDateTime(DateUtil.convertStringToDate(widget.prescriptionReport!.orderDate!)), unit: Unit.day) as int); + int remainingDays = widget.prescriptionReport!.days! - + (Jiffy.parseFromDateTime(DateTime.now()).diff(Jiffy.parseFromDateTime(DateUtil.convertStringToDate(widget.prescriptionReport!.orderDate!)), unit: Unit.day) as int); if (remainingDays.isNegative) { Utils.showErrorToast("Prescription date has been already passed you can not add a reminder for this prescription."); return;