|
|
|
|
@ -94,8 +94,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
// if (isNfcEnabled)
|
|
|
|
|
attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () {
|
|
|
|
|
if (isNfcLocationEnabled) {
|
|
|
|
|
Location.getCurrentLocation((LatLng? latlng) {
|
|
|
|
|
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
|
|
|
|
|
if (isMocked) {
|
|
|
|
|
markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
|
|
|
|
|
} else {
|
|
|
|
|
performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
|
|
|
|
|
}
|
|
|
|
|
}, context);
|
|
|
|
|
} else {
|
|
|
|
|
performNfcAttendance(widget.model);
|
|
|
|
|
@ -104,8 +108,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
if (isWifiEnabled)
|
|
|
|
|
attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () {
|
|
|
|
|
if (isWifiLocationEnabled) {
|
|
|
|
|
Location.getCurrentLocation((LatLng? latlng) {
|
|
|
|
|
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
|
|
|
|
|
if (isMocked) {
|
|
|
|
|
markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
|
|
|
|
|
} else {
|
|
|
|
|
performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
|
|
|
|
|
}
|
|
|
|
|
}, context);
|
|
|
|
|
} else {
|
|
|
|
|
performWifiAttendance(widget.model);
|
|
|
|
|
@ -115,8 +123,12 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
if (isQrEnabled)
|
|
|
|
|
attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async {
|
|
|
|
|
if (isQrLocationEnabled) {
|
|
|
|
|
Location.getCurrentLocation((LatLng? latlng) {
|
|
|
|
|
Location.getCurrentLocation((LatLng? latlng, bool isMocked) {
|
|
|
|
|
if (isMocked) {
|
|
|
|
|
markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? "");
|
|
|
|
|
} else {
|
|
|
|
|
performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? "");
|
|
|
|
|
}
|
|
|
|
|
}, context);
|
|
|
|
|
} else {
|
|
|
|
|
performQrCodeAttendance(widget.model);
|
|
|
|
|
@ -157,7 +169,6 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
child: SuccessDialog(widget.isFromDashboard),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
print(ex);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
@ -276,6 +287,21 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void markFakeAttendance(String sourceName, String lat, String long) async {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
try {
|
|
|
|
|
await DashboardApiClient().markFakeLocation(sourceName: sourceName, lat: lat, long: long);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.confirmDialog(context, LocaleKeys.fakeLocation.tr());
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
print(ex);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
Utils.handleException(ex, context, (msg) {
|
|
|
|
|
Utils.confirmDialog(context, msg);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
|