Calender Event Fixes

dev_v3.13.6_BLE_Faiz
Aamir.Muhammad 1 year ago
parent 515896c265
commit 2e25940b62

@ -280,20 +280,15 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
Future.forEach(
calendarUtils.calendars,
(Calendar calender) => {
calendarUtils.retrieveEvents(calender.id!, params).then((value) {
Result<UnmodifiableListView<Event>> 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<UnmodifiableListView<Event>> 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<PrescriptionDetailsPage> {
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;

Loading…
Cancel
Save