|  |  |  | @ -3,7 +3,9 @@ import 'dart:io'; | 
		
	
		
			
				|  |  |  |  | import 'package:easy_localization/easy_localization.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter/material.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:flutter_svg/flutter_svg.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:google_maps_flutter/google_maps_flutter.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:geolocator/geolocator.dart'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | // import 'package:google_maps_flutter/google_maps_flutter.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/app_state/app_state.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/classes/colors.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -89,7 +91,8 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |           children: [ | 
		
	
		
			
				|  |  |  |  |             Padding( | 
		
	
		
			
				|  |  |  |  |               padding: const EdgeInsets.only(left: 25, right: 25, top: 10, bottom: 10), | 
		
	
		
			
				|  |  |  |  |               child: (provider.isConnectedToHMG ? LocaleKeys.connectedWithHmg.tr() : LocaleKeys.networkMustHMG.tr()).toText12(color: Colors.white), | 
		
	
		
			
				|  |  |  |  |               // child: (provider.isConnectedToHMG ? LocaleKeys.connectedWithHmg.tr() : LocaleKeys.networkMustHMG.tr()).toText12(color: Colors.white), | 
		
	
		
			
				|  |  |  |  |               child: (provider.isConnectedToHMG ? "Connected With HMG" : "Network Must be HMG").toText12(color: Colors.white), | 
		
	
		
			
				|  |  |  |  |             ), | 
		
	
		
			
				|  |  |  |  |             Container( | 
		
	
		
			
				|  |  |  |  |               padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), | 
		
	
	
		
			
				
					|  |  |  | @ -112,15 +115,15 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |                       attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, provider.isConnectedToHMG, () async { | 
		
	
		
			
				|  |  |  |  |                         if (await provider.checkHmgNetworkConnectivity()) { | 
		
	
		
			
				|  |  |  |  |                           if (isNfcLocationEnabled) { | 
		
	
		
			
				|  |  |  |  |                             Location.getCurrentLocation((LatLng? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                             Location.getCurrentLocation((Position? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                               if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                                 markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "",provider: provider); | 
		
	
		
			
				|  |  |  |  |                                 markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "", provider: provider); | 
		
	
		
			
				|  |  |  |  |                               } else { | 
		
	
		
			
				|  |  |  |  |                                 performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "",provider: provider); | 
		
	
		
			
				|  |  |  |  |                                 performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "", provider: provider); | 
		
	
		
			
				|  |  |  |  |                               } | 
		
	
		
			
				|  |  |  |  |                             }, context); | 
		
	
		
			
				|  |  |  |  |                           } else { | 
		
	
		
			
				|  |  |  |  |                             performNfcAttendance(widget.model,provider: provider); | 
		
	
		
			
				|  |  |  |  |                             performNfcAttendance(widget.model, provider: provider); | 
		
	
		
			
				|  |  |  |  |                           } | 
		
	
		
			
				|  |  |  |  |                         } else { | 
		
	
		
			
				|  |  |  |  |                           Utils.showToast("Please connect with the HMG internet to mark attendance"); | 
		
	
	
		
			
				
					|  |  |  | @ -130,15 +133,15 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |                         attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, provider.isConnectedToHMG, () async { | 
		
	
		
			
				|  |  |  |  |                           if (await provider.checkHmgNetworkConnectivity()) { | 
		
	
		
			
				|  |  |  |  |                             if (isWifiLocationEnabled) { | 
		
	
		
			
				|  |  |  |  |                               Location.getCurrentLocation((LatLng? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                               Location.getCurrentLocation((Position? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                                 if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                                   markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "",provider: provider); | 
		
	
		
			
				|  |  |  |  |                                   markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "", provider: provider); | 
		
	
		
			
				|  |  |  |  |                                 } else { | 
		
	
		
			
				|  |  |  |  |                                   performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "",provider: provider); | 
		
	
		
			
				|  |  |  |  |                                   performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "", provider: provider); | 
		
	
		
			
				|  |  |  |  |                                 } | 
		
	
		
			
				|  |  |  |  |                               }, context); | 
		
	
		
			
				|  |  |  |  |                             } else { | 
		
	
		
			
				|  |  |  |  |                               performWifiAttendance(widget.model,provider: provider); | 
		
	
		
			
				|  |  |  |  |                               performWifiAttendance(widget.model, provider: provider); | 
		
	
		
			
				|  |  |  |  |                             } | 
		
	
		
			
				|  |  |  |  |                           } else { | 
		
	
		
			
				|  |  |  |  |                             Utils.showToast("Please connect with the HMG internet to mark attendance"); | 
		
	
	
		
			
				
					|  |  |  | @ -148,18 +151,18 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |                         }), | 
		
	
		
			
				|  |  |  |  |                       if (isQrEnabled) | 
		
	
		
			
				|  |  |  |  |                         attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, provider.isConnectedToHMG, () async { | 
		
	
		
			
				|  |  |  |  |                           if (isQrLocationEnabled) { | 
		
	
		
			
				|  |  |  |  |                             Location.getCurrentLocation((LatLng? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                               if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                                 markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "",provider: provider); | 
		
	
		
			
				|  |  |  |  |                               } else { | 
		
	
		
			
				|  |  |  |  |                                 performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                               } | 
		
	
		
			
				|  |  |  |  |                             }, context); | 
		
	
		
			
				|  |  |  |  |                           } else { | 
		
	
		
			
				|  |  |  |  |                             performQrCodeAttendance(widget.model); | 
		
	
		
			
				|  |  |  |  |                           } | 
		
	
		
			
				|  |  |  |  |                           // performQrCodeAttendance(model); | 
		
	
		
			
				|  |  |  |  |                           // if (isQrLocationEnabled) { | 
		
	
		
			
				|  |  |  |  |                           //   Location.getCurrentLocation((Position? latlng, bool isMocked) { | 
		
	
		
			
				|  |  |  |  |                           //     if (isMocked) { | 
		
	
		
			
				|  |  |  |  |                           //       markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "", provider: provider); | 
		
	
		
			
				|  |  |  |  |                           //     } else { | 
		
	
		
			
				|  |  |  |  |                           //       performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); | 
		
	
		
			
				|  |  |  |  |                           //     } | 
		
	
		
			
				|  |  |  |  |                           //   }, context); | 
		
	
		
			
				|  |  |  |  |                           // } else { | 
		
	
		
			
				|  |  |  |  |                           //   performQrCodeAttendance(widget.model); | 
		
	
		
			
				|  |  |  |  |                           // } | 
		
	
		
			
				|  |  |  |  |                           performQrCodeAttendance(widget.model); | 
		
	
		
			
				|  |  |  |  |                         }), | 
		
	
		
			
				|  |  |  |  |                     ], | 
		
	
		
			
				|  |  |  |  |                   ) | 
		
	
	
		
			
				
					|  |  |  | @ -233,7 +236,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |             provider.closeWifiRequest(); | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         } catch (ex) { | 
		
	
		
			
				|  |  |  |  |           print(ex); | 
		
	
		
			
				|  |  |  |  |           Utils.hideLoading(context); | 
		
	
	
		
			
				
					|  |  |  | @ -307,22 +309,39 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> { | 
		
	
		
			
				|  |  |  |  |       ), | 
		
	
		
			
				|  |  |  |  |     ); | 
		
	
		
			
				|  |  |  |  |     if (qrCodeValue != null) { | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       try { | 
		
	
		
			
				|  |  |  |  |         GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); | 
		
	
		
			
				|  |  |  |  |         bool status = await model.fetchAttendanceTracking(context); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |         showMDialog( | 
		
	
		
			
				|  |  |  |  |           context, | 
		
	
		
			
				|  |  |  |  |           backgroundColor: Colors.transparent, | 
		
	
		
			
				|  |  |  |  |           isDismissable: true, | 
		
	
		
			
				|  |  |  |  |           child: SuccessDialog(widget.isFromDashboard), | 
		
	
		
			
				|  |  |  |  |         ); | 
		
	
		
			
				|  |  |  |  |       } catch (ex) { | 
		
	
		
			
				|  |  |  |  |         print(ex); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |         Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       print("-----------f---"); | 
		
	
		
			
				|  |  |  |  |       print(qrCodeValue); | 
		
	
		
			
				|  |  |  |  |       Utils.showToast(qrCodeValue); | 
		
	
		
			
				|  |  |  |  |       // Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       checkLocalIP(qrCodeValue); | 
		
	
		
			
				|  |  |  |  |       // try { | 
		
	
		
			
				|  |  |  |  |       //   GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); | 
		
	
		
			
				|  |  |  |  |       //   bool status = await model.fetchAttendanceTracking(context); | 
		
	
		
			
				|  |  |  |  |       //   Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       //   showMDialog( | 
		
	
		
			
				|  |  |  |  |       //     context, | 
		
	
		
			
				|  |  |  |  |       //     backgroundColor: Colors.transparent, | 
		
	
		
			
				|  |  |  |  |       //     isDismissable: true, | 
		
	
		
			
				|  |  |  |  |       //     child: SuccessDialog(widget.isFromDashboard), | 
		
	
		
			
				|  |  |  |  |       //   ); | 
		
	
		
			
				|  |  |  |  |       // } catch (ex) { | 
		
	
		
			
				|  |  |  |  |       //   print(ex); | 
		
	
		
			
				|  |  |  |  |       //   Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       //   Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |       // } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void checkLocalIP(String qrValue) async { | 
		
	
		
			
				|  |  |  |  |     Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       await DashboardApiClient().checkLocelIP(qrValue); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       Utils.confirmDialog(context, "Local Ip called"); | 
		
	
		
			
				|  |  |  |  |     } catch (ex) { | 
		
	
		
			
				|  |  |  |  |       print(ex); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       Utils.handleException(ex, context, null); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |