|
|
|
|
@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/dialogs/success_dialog.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/location/Location.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart';
|
|
|
|
|
@ -144,6 +145,18 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
try {
|
|
|
|
|
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId, isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng);
|
|
|
|
|
if(g?.messageStatus != 1) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (cxt) => ConfirmDialog(
|
|
|
|
|
message: g?.errorEndUserMessage ?? "Unexpected error occurred",
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
bool status = await model.fetchAttendanceTracking(context);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
showMDialog(
|
|
|
|
|
@ -152,6 +165,8 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
isDismissable: false,
|
|
|
|
|
child: SuccessDialog(widget.isFromDashboard),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
print(ex);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
@ -166,6 +181,18 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
Utils.showLoading(context);
|
|
|
|
|
try {
|
|
|
|
|
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng);
|
|
|
|
|
if(g?.messageStatus != 1) {
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (cxt) => ConfirmDialog(
|
|
|
|
|
message: g?.errorEndUserMessage ?? "Unexpected error occurred",
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
bool status = await model.fetchAttendanceTracking(context);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
showMDialog(
|
|
|
|
|
@ -174,6 +201,7 @@ class _MarkAttendanceWidgetState extends State<MarkAttendanceWidget> {
|
|
|
|
|
isDismissable: false,
|
|
|
|
|
child: SuccessDialog(widget.isFromDashboard),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
print(ex);
|
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
|
|