NFC Attendance implement 1.3

merge-requests/1/merge
devmirza121 4 years ago
parent 35d683a8ae
commit eb3ddb3d9e

@ -79,7 +79,7 @@ class LoginApiClient {
Future<GenericResponseModel?> checkActivationCode(bool isDeviceNFC, String? mobileNumber, String activationCode, String? pUserName) async {
String url = "${ApiConsts.erpRest}CheckActivationCode";
Map<String, dynamic> postParams = {"isDeviceNFC": isDeviceNFC, "MobileNumber": mobileNumber, "activationCode": activationCode, "P_USER_NAME": pUserName};
Map<String, dynamic> postParams = {"IsDeviceNFC": isDeviceNFC, "MobileNumber": mobileNumber, "activationCode": activationCode, "P_USER_NAME": pUserName};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json);

@ -46,7 +46,7 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen> {
bool isAvailable = await NfcManager.instance.isAvailable();
setState(() {
AppState().privilegeListModel!.forEach((element) {
// Check availability
print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability
if (isAvailable) if (element.serviceName == "enableNFC") {
// if (element.previlege ?? false)
isNfcEnabled = true;
@ -190,21 +190,26 @@ class _TodayAttendanceScreenState extends State<TodayAttendanceScreen> {
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8),
children: <Widget>[
attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () {
showNfcReader(context, onNcfScan: (String? nfcId) async {
print(nfcId);
Utils.showLoading(context);
try {
GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "");
bool status = await model.fetchAttendanceTracking();
Utils.hideLoading(context);
} catch (ex) {
print(ex);
Utils.hideLoading(context);
Utils.handleException(ex, (msg) {
Utils.confirmDialog(context, msg);
});
}
});
if (isNfcLocationEnabled) {
print("nfc location enabled");
} else {
print("nfc not location enabled");
}
// showNfcReader(context, onNcfScan: (String? nfcId) async {
// print(nfcId);
// Utils.showLoading(context);
// try {
// GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "");
// bool status = await model.fetchAttendanceTracking();
// Utils.hideLoading(context);
// } catch (ex) {
// print(ex);
// Utils.hideLoading(context);
// Utils.handleException(ex, (msg) {
// Utils.confirmDialog(context, msg);
// });
// }
// });
// Location.getCurrentLocation((LatLng? latlng) {
// print(latlng!.longitude.toString());
// });

@ -130,6 +130,9 @@ class _LoginScreenState extends State<LoginScreen> {
Widget build(BuildContext context) {
username.text = "15153";
password.text = "Xy12345@";
// username.text = "287742";
// password.text = "509@Shafi";
return Scaffold(
body: Column(
children: [

@ -666,7 +666,7 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
(value) async {
Utils.showLoading(context);
try {
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(true, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName);
GenericResponseModel? genericResponseModel1 = await LoginApiClient().insertMobileLoginInfoNEW(
AppState().memberLoginList?.pEMAILADDRESS ?? "",
genericResponseModel?.pSESSIONID ?? 0,
@ -682,6 +682,9 @@ class _VerifyLoginScreenState extends State<VerifyLoginScreen> {
AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? [];
AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first;
MemberInformationListModel.saveToPrefs(genericResponseModel.memberInformationList ?? []);
genericResponseModel.privilegeList!.forEach((element) {
print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability
});
PrivilegeListModel.saveToPrefs(genericResponseModel.privilegeList ?? []);
Utils.saveStringFromPrefs(SharedPrefsConsts.username, AppState().getUserName!);
Utils.saveStringFromPrefs(SharedPrefsConsts.password, AppState().password!);

Loading…
Cancel
Save