diff --git a/lib/core/model/privilege/ProjectDetailListModel.dart b/lib/core/model/privilege/ProjectDetailListModel.dart index b8241797..782c376b 100644 --- a/lib/core/model/privilege/ProjectDetailListModel.dart +++ b/lib/core/model/privilege/ProjectDetailListModel.dart @@ -1,9 +1,9 @@ class ProjectDetailListModel { - int projectID; - String latitude; - String longitude; - int geofenceRadius; - String checkInQrCode; + int? projectID; + String? latitude; + String? longitude; + int? geofenceRadius; + String? checkInQrCode; ProjectDetailListModel( {this.projectID, diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index e077e545..915703aa 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -47,9 +47,8 @@ class _AnicllaryOrdersState extends State with SingleTic String? selectedInstallmentPlan; List selectedProcList = []; - List _ancillaryProcLists = []; - + String? tamaraPaymentStatus; String? tamaraOrderID; @@ -376,16 +375,11 @@ class _AnicllaryOrdersState extends State with SingleTic ); } - // Widget getAncillaryDetails() { - // Map newMap = groupBy(_ancillaryProcLists[0].ancillaryOrderProcDetailsList, (obj) => obj.procedureCategoryName); - // return Padding(padding: EdgeInsets.only(top: 0, bottom: 200), child: getHeaderDetails(newMap)); - // } + - Widget getAncillaryDetails(AnciallryOrdersViewModel model) { + Widget getAncillaryDetails() { Map> newMap = {}; - - // Grouping the list manually by the 'procedureCategoryName' key - model.ancillaryListsDetails[0].ancillaryOrderProcDetailsList!.forEach((obj) { + _ancillaryProcLists[0].ancillaryOrderProcDetailsList!.forEach((obj) { String key = obj.procedureCategoryName!; if (newMap.containsKey(key)) { newMap[key]!.add(obj); @@ -399,9 +393,8 @@ class _AnicllaryOrdersState extends State with SingleTic child: getHeaderDetails(newMap), ); } - - - Widget getHeaderDetails(newMap) { + + Widget getHeaderDetails(newMap) { List list = []; newMap.forEach((key, value) { list.add( @@ -526,15 +519,14 @@ class _AnicllaryOrdersState extends State with SingleTic onSelectedMethod: (String method, [String? selectedInstallmentPlan]) { selectedPaymentMethod = method; this.selectedInstallmentPlan = selectedInstallmentPlan; - openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), AppoitmentAllHistoryResultList(), model, selectedInstallmentPlan); + openPayment(selectedPaymentMethod, projectViewModel.user, double.parse(getTotalValue()), AppoitmentAllHistoryResultList(), selectedInstallmentPlan); }, patientShare: double.parse(getTotalValue()), isFromAdvancePayment: !projectViewModel.havePrivilege(94), )); } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, [String selectedInstallmentPlan]) { - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, AnciallryOrdersViewModel model, [String? selectedInstallmentPlan]) { + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, num amount, AppoitmentAllHistoryResultList appo, [String? selectedInstallmentPlan]) { browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); transID = Utils.getAdvancePaymentTransID(widget.projectID, projectViewModel.user.patientID!); diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 99bd8717..0f253b63 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -52,9 +52,8 @@ class _QRCodeState extends State { late BuildContext _context; late ProjectViewModel projectViewModel; - LocationUtils locationUtils; - ProjectDetailListModel projectDetailListModel; - + late LocationUtils locationUtils; + ProjectDetailListModel projectDetailListModel = ProjectDetailListModel(); @override void initState() { @@ -99,11 +98,11 @@ class _QRCodeState extends State { startLocationCheckIn() async { locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils.getCurrentLocation(callBack: (value) { - projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, widget.appointment.projectID); - double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude), double.parse(projectDetailListModel.longitude)).ceilToDouble() * 1000; + projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, widget.appointment!.projectID); + double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; print(dist); - if (dist <= projectDetailListModel.geofenceRadius) { - sendNfcCheckInRequest(projectDetailListModel.checkInQrCode); + if (dist <= projectDetailListModel.geofenceRadius!) { + sendNfcCheckInRequest(projectDetailListModel.checkInQrCode!); } else { AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError); } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index b53f5515..cefaaa4f 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -865,7 +865,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { } dataLoaded = true; if (widget.isFromMyAppointments) { - performNextAction(widget.appointment); + performNextAction(widget.appointment!); widget.isFromMyAppointments = false; } }); diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index ebbb6069..21bef1ce 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -821,7 +821,7 @@ class Utils { static double _toRadians(double degrees) => degrees * pi / 180; - static double _haversin(double radians) => pow(sin(radians / 2), 2); + static num _haversin(double radians) => pow(sin(radians / 2), 2); static Widget tableColumnValueWithUnderLine(String text, {bool isLast = false, bool isCapitable = true}) { return Column( @@ -872,7 +872,7 @@ class Utils { } static ProjectDetailListModel getProjectDetailObj(ProjectViewModel projectViewModel, int projectID) { - ProjectDetailListModel projectDetailListModel; + ProjectDetailListModel projectDetailListModel = ProjectDetailListModel(); projectViewModel.projectDetailListModel.forEach((element) { if (element.projectID == projectID) { projectDetailListModel = element; @@ -881,7 +881,7 @@ class Utils { return projectDetailListModel; } - static String generateSignature() {} + //static String generateSignature() {} } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), required Widget child}) {