Merge branch 'development_new_design_2.0' into zik_new_design_2.0

* development_new_design_2.0:
  fix issues
  Base app client updates
  prescription reminders added
  Medical Reminder 1.0
  lakum fixes
  Medical Reminder
merge-update-with-lab-changes
Zohaib Iqbal Kambrani 4 years ago
commit 3bd94ee05e

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

@ -171,6 +171,7 @@ const Map localizedValues = {
"minute": {"en": "Minutes", "ar": "دقيقة"}, "minute": {"en": "Minutes", "ar": "دقيقة"},
"hour": {"en": "Hour", "ar": "ساعة"}, "hour": {"en": "Hour", "ar": "ساعة"},
"reminderSuccess": {"en": "The reminder has been added successfully", "ar": "تمت إضافة التذكير بنجاح"}, "reminderSuccess": {"en": "The reminder has been added successfully", "ar": "تمت إضافة التذكير بنجاح"},
"reminderCancelSuccess": {"en": "The reminder has been cancelled successfully", "ar": "تم إلغاء التذكير بنجاح"},
"patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"},
"patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"},
"patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"},
@ -449,6 +450,7 @@ const Map localizedValues = {
"Frequency": {"en": "Frequency", "ar": "المعدل"}, "Frequency": {"en": "Frequency", "ar": "المعدل"},
"DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"}, "DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"},
"AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"}, "AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"},
"CancelReminder": {"en": "Cancel Reminder", "ar": "إلغاء تذكير"},
"reminderDes": { "reminderDes": {
"en": "Please select treatment start day and time to be notified when it\'s time to take the medicine", "en": "Please select treatment start day and time to be notified when it\'s time to take the medicine",
"ar": "يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" "ar": "يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء"

@ -1,5 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert' as convert; import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
@ -92,8 +92,8 @@ class LacumViewModel extends BaseViewModel {
Uint8List convertBase64ToBarCodeImage() { Uint8List convertBase64ToBarCodeImage() {
try { try {
final _byteImage = convert.base64Decode( final _byteImage = base64Decode(
lacumGroupInformation.lakumInquiryInformationObjVersion.barCode); lacumGroupInformation.lakumInquiryInformationObjVersion.barCode.split(',').last);
return _byteImage; return _byteImage;
} catch (e) { } catch (e) {
print(e); print(e);

@ -14,13 +14,15 @@ Future<Map<Permission, PermissionStatus>> requestPermissions() async {
} }
showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{Function onSuccess, String title, String description}) async { {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async {
if (await Permission.calendar.request().isGranted) { if (await Permission.calendar.request().isGranted) {
_showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess);
} else { } else {
requestPermissions().then((results) { requestPermissions().then((results) {
if (results[Permission.calendar].isGranted) { if (results[Permission.calendar].isGranted) {
_showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess);
} }
}); });
} }
@ -29,7 +31,7 @@ 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, Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{Function onSuccess, String title, String description}) async { {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async {
return showDialog<void>( return showDialog<void>(
context: context, context: context,
barrierDismissible: true, // user must tap button! barrierDismissible: true, // user must tap button!
@ -56,16 +58,20 @@ Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String
// dateTime.add(new Duration(minutes: -120)); // dateTime.add(new Duration(minutes: -120));
dateTime = Jiffy(dateTime).subtract(hours: 2); dateTime = Jiffy(dateTime).subtract(hours: 2);
} }
CalendarUtils calendarUtils = await CalendarUtils.getInstance(); if (onMultiDateSuccess == null) {
calendarUtils CalendarUtils calendarUtils = await CalendarUtils.getInstance();
.createOrUpdateEvent( calendarUtils
title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, .createOrUpdateEvent(
description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName,
scheduleDateTime: dateTime, description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted,
eventId: eventId) scheduleDateTime: dateTime,
.then((value) {}); eventId: eventId)
.then((value) {});
onSuccess(); onSuccess();
} else {
onMultiDateSuccess(i);
}
}, },
), ),
); );
@ -144,12 +150,14 @@ class _ReminderDialogState extends State<ReminderDialog> {
}); });
}, },
), ),
Text(TranslationBase.of(context).appoReminder30, Text(
TranslationBase.of(context).appoReminder30,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.48, letterSpacing: -0.48,
),), ),
),
], ],
), ),
Row( Row(
@ -163,12 +171,14 @@ class _ReminderDialogState extends State<ReminderDialog> {
}); });
}, },
), ),
Text(TranslationBase.of(context).appoReminder60, Text(
TranslationBase.of(context).appoReminder60,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.48, letterSpacing: -0.48,
),), ),
),
], ],
), ),
Row( Row(
@ -182,12 +192,14 @@ class _ReminderDialogState extends State<ReminderDialog> {
}); });
}, },
), ),
Text(TranslationBase.of(context).appoReminder90, Text(
TranslationBase.of(context).appoReminder90,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.48, letterSpacing: -0.48,
),), ),
),
], ],
), ),
Row( Row(

@ -1,13 +1,17 @@
import 'dart:collection';
import 'package:device_calendar/device_calendar.dart';
import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart';
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/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/BookAppointment/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/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/gif_loader_dialog_utils.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';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -18,21 +22,34 @@ import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class PrescriptionDetailsPage extends StatelessWidget { class PrescriptionDetailsPage extends StatefulWidget {
final PrescriptionReport prescriptionReport; final PrescriptionReport prescriptionReport;
final Prescriptions prescriptions; final Prescriptions prescriptions;
PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions});
@override
_PrescriptionDetailsPageState createState() => _PrescriptionDetailsPageState();
}
class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
bool hasReminder = false;
@override
void initState() {
checkIfHasReminder();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
showNewAppBar: true, showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: true, showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).prescriptions, appBarTitle: TranslationBase.of(context).prescriptions,
body: Column( body: Column(
@ -40,18 +57,18 @@ class PrescriptionDetailsPage extends StatelessWidget {
children: <Widget>[ children: <Widget>[
DoctorHeader( DoctorHeader(
headerModel: HeaderModel( headerModel: HeaderModel(
prescriptions.doctorName, widget.prescriptions.doctorName,
prescriptions.doctorID, widget.prescriptions.doctorID,
prescriptions.doctorImageURL, widget.prescriptions.doctorImageURL,
prescriptions.speciality, widget.prescriptions.speciality,
"", "",
prescriptions.name, widget.prescriptions.name,
DateUtil.convertStringToDate(prescriptions.appointmentDate), DateUtil.convertStringToDate(widget.prescriptions.appointmentDate),
DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.prescriptions.appointmentDate)),
prescriptions.nationalityFlagURL, widget.prescriptions.nationalityFlagURL,
prescriptions.doctorRate, widget.prescriptions.doctorRate,
prescriptions.actualDoctorRate, widget.prescriptions.actualDoctorRate,
prescriptions.noOfPatientsRate, widget.prescriptions.noOfPatientsRate,
"", "",
), ),
isNeedToShowButton: false, isNeedToShowButton: false,
@ -102,7 +119,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
children: [ children: [
Container( Container(
child: Image.network( child: Image.network(
prescriptionReport.imageSRCUrl, widget.prescriptionReport.imageSRCUrl,
fit: BoxFit.cover, fit: BoxFit.cover,
width: 48, width: 48,
height: 49, height: 49,
@ -123,13 +140,15 @@ class PrescriptionDetailsPage extends StatelessWidget {
], ],
), ),
onTap: () { onTap: () {
showZoomImageDialog(context, prescriptionReport.imageSRCUrl); showZoomImageDialog(context, widget.prescriptionReport.imageSRCUrl);
}, },
), ),
SizedBox(width: 12), SizedBox(width: 12),
Expanded( Expanded(
child: Text( child: Text(
(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, (widget.prescriptionReport.itemDescription.isNotEmpty ? widget.prescriptionReport.itemDescription : widget.prescriptionReport.itemDescriptionN ?? '')
.toLowerCase()
.capitalizeFirstofEach,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64),
), ),
) )
@ -147,10 +166,10 @@ class PrescriptionDetailsPage extends StatelessWidget {
), ),
TableRow( TableRow(
children: [ children: [
Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), Utils.tableColumnValue(widget.prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), Utils.tableColumnValue(widget.prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), Utils.tableColumnValue(widget.prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel),
Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), Utils.tableColumnValue(widget.prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel),
], ],
), ),
]), ]),
@ -159,7 +178,7 @@ class PrescriptionDetailsPage extends StatelessWidget {
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48),
), ),
Text( Text(
prescriptionReport.remarks, widget.prescriptionReport.remarks,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
), ),
], ],
@ -182,8 +201,8 @@ class PrescriptionDetailsPage extends StatelessWidget {
context, context,
FadePage( FadePage(
page: PharmacyForPrescriptionsPage( page: PharmacyForPrescriptionsPage(
itemID: prescriptionReport.itemID, itemID: widget.prescriptionReport.itemID,
prescriptionReport: prescriptionReport, prescriptionReport: widget.prescriptionReport,
), ),
), ),
); );
@ -195,54 +214,35 @@ class PrescriptionDetailsPage extends StatelessWidget {
SizedBox(width: 10), SizedBox(width: 10),
Expanded( Expanded(
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).addReminder, hasReminder ? TranslationBase.of(context).cancelReminder : TranslationBase.of(context).addReminder,
() { () {
DateTime startDate = DateTime.now(); if (hasReminder) {
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); cancelReminders();
} else {
showReminderDialog( DateTime startDate = DateTime.now();
context, DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + widget.prescriptionReport.days);
endDate, showReminderDialog(
"", context,
prescriptionReport.itemID.toString(), endDate,
"", "",
"", widget.prescriptionReport.itemID.toString(),
title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", "",
description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", "",
onSuccess: () { title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder",
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ",
}, onSuccess: () {
); AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
return; },
onMultiDateSuccess: (int selectedIndex) {
showGeneralDialog( setCalender(context, widget.prescriptionReport.itemID.toString(), selectedIndex);
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: PrescriptionReminderDialog(
eventId: prescriptionReport.itemID.toString(),
title: "${prescriptionReport.itemDescriptionN} Prescription Reminder",
description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
startDate: startDate,
endDate: endDate,
location: prescriptionReport.remarks,
days: 1,
),
),
);
}, },
transitionDuration: Duration(milliseconds: 500), );
barrierDismissible: true, return;
barrierLabel: '', }
context: context,
pageBuilder: (context, animation1, animation2) {});
}, },
iconData: Icons.notifications_active, iconData: Icons.notifications_active,
color: Color(0xffD02127), color: Color(0xffD02127),
fontSize: 13.0,
//textColor: Color(0xff2B353E), //textColor: Color(0xff2B353E),
), ),
), ),
@ -253,4 +253,100 @@ class PrescriptionDetailsPage extends StatelessWidget {
), ),
); );
} }
checkIfHasReminder() async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30);
DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120);
RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) {
Result<UnmodifiableListView<Event>> events = value;
events.data.forEach((element) {
if (element.title.contains(widget.prescriptionReport.itemDescriptionN))
setState(() {
hasReminder = true;
});
});
});
print("Has Reminder: " + hasReminder.toString());
}
cancelReminders() async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30);
DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120);
RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) {
Result<UnmodifiableListView<Event>> events = value;
events.data.forEach((element) {
if (element.title.contains(widget.prescriptionReport.itemDescriptionN)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element);
});
});
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderCancelSuccess);
setState(() {
hasReminder = false;
});
}
setCalender(BuildContext context, String eventId, int reminderIndex) async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startDate = DateUtil.convertStringToDate(widget.prescriptionReport.startDate);
DateTime actualDate = DateTime(startDate.year, startDate.month, startDate.day, 8, 0); //Time will start at 8:00 AM from starting date
if (widget.prescriptionReport?.frequencyNumber == null) widget.prescriptionReport.frequencyNumber = 1; //Some time frequency number is null so by default will be 2
GifLoaderDialogUtils.showMyDialog(context);
for (int i = 0; i < widget.prescriptionReport.days; i++) {
//event for number of days.
for (int j = 0; j < widget.prescriptionReport.frequencyNumber ?? 1; j++) {
// event for number of times per day.
if (j != 0) {
actualDate.add(new Duration(hours: 8)); // 8 hours addition for daily dose.
}
//Time subtraction from actual reminder time. like before 30, or 1 hour.
if (reminderIndex == 0) {
// Before 30 mints
actualDate = Jiffy(actualDate).subtract(minutes: 30);
// dateTime.add(new Duration(minutes: -30));
} else if (reminderIndex == 1) {
// Before 1 hour
// dateTime.add(new Duration(minutes: -60));
actualDate = Jiffy(actualDate).subtract(hours: 1);
} else if (reminderIndex == 2) {
// Before 1 hour and 30 mints
// dateTime.add(new Duration(minutes: -90));
actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30);
} else if (reminderIndex == 3) {
// Before 2 hours
// dateTime.add(new Duration(minutes: -120));
actualDate = Jiffy(actualDate).subtract(hours: 2);
}
calendarUtils
.createOrUpdateEvent(
title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder",
description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ",
scheduleDateTime: actualDate,
eventId: eventId + (i.toString() + j.toString()), //event id with varitions
)
.then((value) {});
actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0);
}
actualDate = Jiffy(actualDate).add(days: 1);
print(actualDate);
}
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
GifLoaderDialogUtils.hideDialog(context);
setState(() {
hasReminder = true;
});
}
} }

@ -96,7 +96,8 @@ class _CartOrderPageState extends State<CartOrderPage> {
model.cartResponse.shoppingCarts.length, model.cartResponse.shoppingCarts.length,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(), physics: ScrollPhysics(),
// physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return ProductOrderItem( return ProductOrderItem(
item: model.cartResponse.shoppingCarts[index], item: model.cartResponse.shoppingCarts[index],

@ -69,16 +69,15 @@ class LakumMainPage extends StatelessWidget {
], ],
), ),
SizedBox( SizedBox(
width: 8, height: 12,
), ),
LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, LakumHomeButtons(mediaQuery, model),
model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear),
SizedBox( SizedBox(
height: 20, height: 12,
), ),
Container( Container(
height: 125, height: 100,
margin: EdgeInsets.symmetric(horizontal: 16), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 12.0),
child: ListView( child: ListView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
@ -109,15 +108,15 @@ class LakumMainPage extends StatelessWidget {
], ],
), ),
), ),
LacumPointsWidget( // LacumPointsWidget(
mediaQuery, // mediaQuery,
3, // 3,
TranslationBase.of(context).consumed, // TranslationBase.of(context).consumed,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null
? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) // ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount)
: 0, // : 0,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear),
SizedBox( SizedBox(
width: 8, width: 8,
), ),

@ -16,13 +16,10 @@ class PaymentMethodSelectPage extends StatefulWidget {
final bool isUpdating; final bool isUpdating;
final Function changeMainState; final Function changeMainState;
const PaymentMethodSelectPage( const PaymentMethodSelectPage({Key key, this.model, this.isUpdating = false, this.changeMainState}) : super(key: key);
{Key key, this.model, this.isUpdating = false, this.changeMainState})
: super(key: key);
@override @override
_PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState();
_PaymentMethodSelectPageState();
} }
class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> { class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
@ -85,16 +82,17 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
selectedPaymentOption = PaymentOption.mastercard; selectedPaymentOption = PaymentOption.mastercard;
}) })
}), }),
PaymentMethodCard( widget.model.cartResponse.totalAmount > 1000
cardWidth, ? PaymentMethodCard(
selectedPaymentOption, cardWidth,
PaymentOption.installments, selectedPaymentOption,
() => { PaymentOption.installments,
setState(() { () => {
selectedPaymentOption = setState(() {
PaymentOption.installments; selectedPaymentOption = PaymentOption.installments;
}) })
}), })
: Container(),
if (Platform.isIOS) if (Platform.isIOS)
PaymentMethodCard( PaymentMethodCard(
cardWidth, cardWidth,
@ -118,8 +116,7 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
TranslationBase.of(context).next, TranslationBase.of(context).next,
selectedPaymentOption != null selectedPaymentOption != null
? () { ? () {
widget.model.paymentCheckoutData.paymentOption = widget.model.paymentCheckoutData.paymentOption = selectedPaymentOption;
selectedPaymentOption;
if (widget.isUpdating) { if (widget.isUpdating) {
widget.changeMainState(); widget.changeMainState();
Navigator.pop(context); Navigator.pop(context);
@ -150,14 +147,12 @@ class PaymentMethodCard extends StatelessWidget {
final PaymentOption paymentOption; final PaymentOption paymentOption;
final Function selectMethod; final Function selectMethod;
PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod);
this.paymentOption, this.selectMethod);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool isSelected = false; bool isSelected = false;
if (selectedPaymentOption != null && if (selectedPaymentOption != null && selectedPaymentOption == paymentOption) {
selectedPaymentOption == paymentOption) {
isSelected = true; isSelected = true;
} }
@ -171,9 +166,7 @@ class PaymentMethodCard extends StatelessWidget {
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
side: isSelected side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0),
? BorderSide(color: Colors.green, width: 2.0)
: BorderSide(color: Colors.transparent, width: 0.0),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
@ -182,13 +175,7 @@ class PaymentMethodCard extends StatelessWidget {
Container( Container(
width: 24, width: 24,
height: 24, height: 24,
decoration: containerColorRadiusBorderWidth( decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
isSelected
? CustomColors.accentColor
: Colors.transparent,
100,
Colors.grey,
0.5),
), ),
mWidth(12), mWidth(12),
Container( Container(
@ -200,8 +187,7 @@ class PaymentMethodCard extends StatelessWidget {
if (isSelected) if (isSelected)
Container( Container(
decoration: containerRadius(CustomColors.green, 200), decoration: containerRadius(CustomColors.green, 200),
padding: padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12),
EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12),
child: Text( child: Text(
TranslationBase.of(context).paymentSelected, TranslationBase.of(context).paymentSelected,
style: TextStyle( style: TextStyle(

@ -185,7 +185,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
// width: 500, // width: 500,
margin: EdgeInsets.only(bottom: 6), margin: EdgeInsets.only(bottom: 10),
padding: EdgeInsets.only(bottom: 10),
color: Colors.white, color: Colors.white,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -255,7 +256,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.getProductLocationData(widget.product.sku); await model.getProductLocationData(widget.product.sku);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
//
setState(() { setState(() {
isDetails = false; isDetails = false;
isReviews = false; isReviews = false;
@ -289,7 +290,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
) )
: isAvailability : isAvailability
? AvailabilityInfo( ? AvailabilityInfo(
previousModel: model, previousModel: model
) )
: Container(), : Container(),
], ],
@ -298,17 +299,17 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
if (projectViewModel.isLogin) // if (projectViewModel.isLogin)
RecommendedProducts( // RecommendedProducts(
product: widget.product, // product: widget.product,
productDetailViewModel: model, // productDetailViewModel: model,
addToWishlistFunction: (itemID) async { // addToWishlistFunction: (itemID) async {
await addToWishlistFunction(itemID: itemID, model: model); // await addToWishlistFunction(itemID: itemID, model: model);
}, // },
deleteFromWishlistFunction: (itemID) async { // deleteFromWishlistFunction: (itemID) async {
await deleteFromWishlistFunction(itemID: itemID, model: model); // await deleteFromWishlistFunction(itemID: itemID, model: model);
}, // },
) // )
], ],
), ),
), ),

@ -30,15 +30,19 @@ class ReviewsInfo extends StatelessWidget {
Container( Container(
child: Row( child: Row(
children: [ children: [
Container( Expanded(
child: Text( child: Container(
previousModel.productDetailService[0] child: Text(
.reviews[index].customerId previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " "
.toString(), + previousModel.productDetailService[0].reviews[index].customer.lastName.toString(),
style: TextStyle( // previousModel.productDetailService[0]
fontSize: 17, // .reviews[index].customerId
color: Colors.grey, // .toString(),
fontWeight: FontWeight.w600), style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
), ),
), ),
Container( Container(

@ -229,13 +229,15 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
width: widget.mediaQuery.size.width * 1.0, width: widget.mediaQuery.size.width * 1.0,
height: widget.mediaQuery.size.width * 1.0, height: widget.mediaQuery.size.width * 1.0,
), ),
Container( Center(
margin: EdgeInsets.fromLTRB(12, 70, 12, 4), child: Container(
child: widget.model.convertBase64ToBarCodeImage() != margin: EdgeInsets.fromLTRB(12, 70, 12, 4),
null child: widget.model.convertBase64ToBarCodeImage() !=
? Image.memory( null
widget.model.convertBase64ToBarCodeImage()) ? Image.memory(
: Container(), widget.model.convertBase64ToBarCodeImage())
: Container(),
),
), ),
], ],
), ),

@ -217,12 +217,10 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
Container( Container(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
child: SvgPicture.asset( child: Icon(
projectViewModel.isArabic Icons.arrow_forward,
? 'assets/images/pharmacy/arrow_left.svg' size: 18,
: 'assets/images/pharmacy/arrow_right.svg', color: Colors.grey[500],
height: 20,
width: 20,
), ),
), ),
], ],
@ -246,11 +244,11 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
left: 13.0, right: 13.0), left: 13.0, right: 13.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Colors.blue[700], color: Color(0xFF4CAF50),
style: BorderStyle.solid, style: BorderStyle.solid,
width: 5.0, width: 5.0,
), ),
color: Colors.blue[700], color: Color(0xFF4CAF50),
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
30.0)), 30.0)),
child: deliveredOrderList[ child: deliveredOrderList[
@ -503,12 +501,10 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
Container( Container(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
child: SvgPicture.asset( child: Icon(
projectViewModel.isArabic Icons.arrow_forward,
? 'assets/images/pharmacy/arrow_left.svg' size: 18,
: 'assets/images/pharmacy/arrow_right.svg', color: Colors.grey[500],
height: 20,
width: 20,
), ),
), ),
], ],
@ -532,11 +528,11 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
left: 13.0, right: 13.0), left: 13.0, right: 13.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Colors.green, color: Colors.grey[700],
style: BorderStyle.solid, style: BorderStyle.solid,
width: 5.0, width: 5.0,
), ),
color: Colors.green, color: Colors.grey[700],
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
30.0)), 30.0)),
child: processingOrderList[ child: processingOrderList[
@ -969,12 +965,10 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
Container( Container(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
child: SvgPicture.asset( child: Icon(
projectViewModel.isArabic Icons.arrow_forward,
? 'assets/images/pharmacy/arrow_left.svg' size: 18,
: 'assets/images/pharmacy/arrow_right.svg', color: Colors.grey[500],
height: 20,
width: 20,
), ),
), ),
], ],
@ -1139,7 +1133,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
cancelledOrderList.clear(); cancelledOrderList.clear();
for (int i = 0; i < model.orders.length; i++) { for (int i = 0; i < model.orders.length; i++) {
if (model.orders[i].orderStatusId == 40 || if (model.orders[i].orderStatusId == 40 ||
model.orders[i].orderStatus == 996 || model.orders[i].orderStatusId == 996 ||
model.orders[i].orderStatusId == 200) { model.orders[i].orderStatusId == 200) {
cancelledOrderList.add(model.orders[i]); cancelledOrderList.add(model.orders[i]);
} }
@ -1243,12 +1237,10 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
), ),
Container( Container(
margin: EdgeInsets.all(8.0), margin: EdgeInsets.all(8.0),
child: SvgPicture.asset( child: Icon(
projectViewModel.isArabic Icons.arrow_forward,
? 'assets/images/pharmacy/arrow_left.svg' size: 18,
: 'assets/images/pharmacy/arrow_right.svg', color: Colors.grey[500],
height: 20,
width: 20,
), ),
), ),
], ],

@ -604,9 +604,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
print(widget.orderModel.orderStatusId); print(widget.orderModel.orderStatusId);
// if(orderStatus == 'delivered') // if(orderStatus == 'delivered')
if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994) if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994)
return Colors.blue[700]; return Color(0xFF4CAF50);
else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999) else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999)
return Colors.green; return Colors.grey[700];
else if (widget.orderModel.orderStatusId == 10) else if (widget.orderModel.orderStatusId == 10)
return Colors.orange[300]; return Colors.orange[300];
else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900]; else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900];

@ -62,7 +62,7 @@ class _AddAddressPageState extends State<AddAddressPage> {
return BaseView<PharmacyAddressesViewModel>( return BaseView<PharmacyAddressesViewModel>(
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).changeAddress, appBarTitle: TranslationBase.of(context).changeAddress,
isShowAppBar: true, isShowAppBar: false,
isPharmacy: true, isPharmacy: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Container( body: Container(

@ -10,15 +10,17 @@ final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterL
class LocalNotification { class LocalNotification {
Function(String payload) _onNotificationClick; Function(String payload) _onNotificationClick;
static LocalNotification _instance; static LocalNotification _instance;
static LocalNotification getInstance(){
static LocalNotification getInstance() {
return _instance; return _instance;
} }
static init({Function(String payload) onNotificationClick}){
if(_instance == null){ static init({Function(String payload) onNotificationClick}) {
if (_instance == null) {
_instance = LocalNotification(); _instance = LocalNotification();
_instance._onNotificationClick = onNotificationClick; _instance._onNotificationClick = onNotificationClick;
_instance._initialize(); _instance._initialize();
}else{ } else {
// assert(false,(){ // assert(false,(){
// //TODO fix it // //TODO fix it
// "LocalNotification Already Initialized"; // "LocalNotification Already Initialized";
@ -26,7 +28,7 @@ class LocalNotification {
} }
} }
_initialize(){ _initialize() {
var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon');
var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null); var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null);
var initializationSettings = InitializationSettings(initializationSettingsAndroid, initializationSettingsIOS); var initializationSettings = InitializationSettings(initializationSettingsAndroid, initializationSettingsIOS);
@ -34,11 +36,12 @@ class LocalNotification {
} }
var _random = new Random(); var _random = new Random();
_randomNumber({int from = 100000}){
_randomNumber({int from = 100000}) {
return _random.nextInt(from); return _random.nextInt(from);
} }
_vibrationPattern(){ _vibrationPattern() {
var vibrationPattern = Int64List(4); var vibrationPattern = Int64List(4);
vibrationPattern[0] = 0; vibrationPattern[0] = 0;
vibrationPattern[1] = 1000; vibrationPattern[1] = 1000;
@ -50,10 +53,11 @@ class LocalNotification {
Future showNow({@required String title, @required String subtitle, String payload}) { Future showNow({@required String title, @required String subtitle, String payload}) {
Future.delayed(Duration(seconds: 1)).then((result) async { Future.delayed(Duration(seconds: 1)).then((result) async {
var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); var androidPlatformChannelSpecifics =
AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern());
var iOSPlatformChannelSpecifics = IOSNotificationDetails(); var iOSPlatformChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err){ await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) {
print(err); print(err);
}); });
}); });
@ -81,11 +85,9 @@ class LocalNotification {
ledOffMs: 500); ledOffMs: 500);
var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff');
///change it to be as ionic // /change it to be as ionic
// var platformChannelSpecifics = NotificationDetails( var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
// androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics);
// await flutterLocalNotificationsPlugin.schedule(0, title, description,
// scheduledNotificationDateTime, platformChannelSpecifics);
} }
///Repeat notification every day at approximately 10:00:00 am ///Repeat notification every day at approximately 10:00:00 am

@ -2789,8 +2789,9 @@ class TranslationBase {
String get gr => localizedValues["gr"][locale.languageCode]; String get gr => localizedValues["gr"][locale.languageCode];
String get gramsPerMeal => localizedValues["gramsPerMeal"][locale.languageCode]; String get gramsPerMeal => localizedValues["gramsPerMeal"][locale.languageCode];
String get cancelReminder => localizedValues["CancelReminder"][locale.languageCode];
String get reminderCancelSuccess => localizedValues["reminderCancelSuccess"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save