From baa7182655cccdeddec21f6ff55307b5c19fe29c Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Mon, 31 Jan 2022 10:11:26 +0300 Subject: [PATCH] Dashboard API's 1.0 --- lib/api/api_client.dart | 3 + lib/api/dashboard_api_client.dart | 69 +++++++ lib/api/login_api_client.dart | 7 + lib/app_state/app_state.dart | 14 +- lib/classes/consts.dart | 3 + .../get_accrual_balances_list_model.dart | 39 ++++ .../get_attendance_tracking_list_model.dart | 55 +++++ .../get_open_missing_swipes_list_model.dart | 24 +++ .../get_open_notifications_list.dart | 23 +++ lib/models/dashboard/itg_forms_model.dart | 189 ++++++++++++++++++ lib/models/generic_response_model.dart | 23 ++- lib/models/post_params_model.dart | 51 ++++- lib/ui/landing/dashboard.dart | 5 +- lib/ui/login/login_screen.dart | 4 +- lib/ui/login/verify_login_screen.dart | 4 +- 15 files changed, 497 insertions(+), 16 deletions(-) create mode 100644 lib/api/dashboard_api_client.dart create mode 100644 lib/models/dashboard/get_accrual_balances_list_model.dart create mode 100644 lib/models/dashboard/get_attendance_tracking_list_model.dart create mode 100644 lib/models/dashboard/get_open_missing_swipes_list_model.dart create mode 100644 lib/models/dashboard/get_open_notifications_list.dart create mode 100644 lib/models/dashboard/itg_forms_model.dart diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index dcd184e..a08ed01 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -75,6 +75,9 @@ class ApiClient { } var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes); try { + if (!kReleaseMode) { + print("res: " + response.body); + } var jsonData = jsonDecode(response.body); if (jsonData["ErrorMessage"] == null) { return factoryConstructor(jsonData); diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart new file mode 100644 index 0000000..5b6f961 --- /dev/null +++ b/lib/api/dashboard_api_client.dart @@ -0,0 +1,69 @@ +import 'dart:async'; + +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/consts.dart'; +import 'package:mohem_flutter_app/models/basic_member_information_model.dart'; +import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/member_login_list_model.dart'; + +import 'api_client.dart'; + +class DashbaordApiClient { + static final DashbaordApiClient _instance = DashbaordApiClient._internal(); + + DashbaordApiClient._internal(); + + factory DashbaordApiClient() => _instance; + + Future getAttendanceTracking() async { + String url = "${ApiConsts.erpRest}GET_Attendance_Tracking"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getOpenNotifications() async { + String url = "${ApiConsts.erpRest}GET_OPEN_NOTIFICATIONS"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getItgFormsPendingTask() async { + String url = "${ApiConsts.cocRest}ITGFormsPendingTasks"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + ItgFormsModel responseData = ItgFormsModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getAccrualBalances() async { + String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES"; + Map postParams = {"P_EFFECTIVE_DATE": "1/30/2022"}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getOpenMissingSwipes() async { + String url = "${ApiConsts.erpRest}GET_OPEN_MISSING_SWIPES"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } +} diff --git a/lib/api/login_api_client.dart b/lib/api/login_api_client.dart index 1811414..fb6bb80 100644 --- a/lib/api/login_api_client.dart +++ b/lib/api/login_api_client.dart @@ -47,7 +47,14 @@ class LoginApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); + AppState().setLogged = true; AppState().postParamsObject?.setTokenID = responseData.tokenID; + AppState().postParamsObject?.mobileNumber = responseData.basicMemberInformation!.pMOBILENUMBER; + AppState().postParamsObject?.userName = AppState().getUserName; + AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEMAILADDRESS; + AppState().postParamsObject?.pSessionId = responseData.pSESSIONID; + AppState().postParamsObject?.pUserName = AppState().getUserName; + AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName; return responseData; }, url, postParams); } diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 2af87d8..65d5184 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -8,6 +8,12 @@ class AppState { factory AppState() => _instance; + bool isLogged = false; + + set setLogged(v) => isLogged = v; + + bool? get getIsLogged => isLogged; + String? forgetPasswordTokenID; set setForgetPasswordTokenID(token) => forgetPasswordTokenID = token; @@ -18,15 +24,17 @@ class AppState { PostParamsModel? get postParamsObject => _postParams; - Map get postParamsJson => _postParams?.toJson() ?? {}; + Map get postParamsJson => isLogged ? (_postParams?.toJsonAfterLogin() ?? {}) : (_postParams?.toJson() ?? {}); void setPostParamsModel(PostParamsModel _postParams) { this._postParams = _postParams; } - String? username; + String? _username; + + set setUserName(v) => _username = v; - set setUserName(_username) => username = _username; + String? get getUserName => _username; MemberLoginListModel? _memberLoginList; diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index b0453c0..4bad83c 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -6,8 +6,11 @@ class ApiConsts { static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; static String erpRest = baseUrlServices + "ERP.svc/REST/"; static String user = baseUrlServices + "api/User/"; + static String cocRest = baseUrlServices + "COCWS.svc/REST/"; } + + class GlobalConsts { static String isRememberMe = "remember_me"; static String email = "email"; diff --git a/lib/models/dashboard/get_accrual_balances_list_model.dart b/lib/models/dashboard/get_accrual_balances_list_model.dart new file mode 100644 index 0000000..a53133e --- /dev/null +++ b/lib/models/dashboard/get_accrual_balances_list_model.dart @@ -0,0 +1,39 @@ +class GetAccrualBalancesList { + GetAccrualBalancesList({ + this.accrualNetEntitlement, + this.accrualUsedEntitlement, + this.accrualYearlyEntitlement, + this.accuralPlanName, + this.endDate, + this.lastAccrualDate, + this.startDate, + }); + + double? accrualNetEntitlement; + int? accrualUsedEntitlement; + dynamic accrualYearlyEntitlement; + String? accuralPlanName; + String? endDate; + String? lastAccrualDate; + String? startDate; + + factory GetAccrualBalancesList.fromJson(Map json) => GetAccrualBalancesList( + accrualNetEntitlement: json["ACCRUAL_NET_ENTITLEMENT"] == null ? null : json["ACCRUAL_NET_ENTITLEMENT"].toDouble(), + accrualUsedEntitlement: json["ACCRUAL_USED_ENTITLEMENT"] == null ? null : json["ACCRUAL_USED_ENTITLEMENT"], + accrualYearlyEntitlement: json["ACCRUAL_YEARLY_ENTITLEMENT"], + accuralPlanName: json["ACCURAL_PLAN_NAME"] == null ? null : json["ACCURAL_PLAN_NAME"], + endDate: json["END_DATE"] == null ? null : json["END_DATE"], + lastAccrualDate: json["LAST_ACCRUAL_DATE"] == null ? null : json["LAST_ACCRUAL_DATE"], + startDate: json["START_DATE"] == null ? null : json["START_DATE"], + ); + + Map toJson() => { + "ACCRUAL_NET_ENTITLEMENT": accrualNetEntitlement == null ? null : accrualNetEntitlement, + "ACCRUAL_USED_ENTITLEMENT": accrualUsedEntitlement == null ? null : accrualUsedEntitlement, + "ACCRUAL_YEARLY_ENTITLEMENT": accrualYearlyEntitlement, + "ACCURAL_PLAN_NAME": accuralPlanName == null ? null : accuralPlanName, + "END_DATE": endDate == null ? null : endDate, + "LAST_ACCRUAL_DATE": lastAccrualDate == null ? null : lastAccrualDate, + "START_DATE": startDate == null ? null : startDate, + }; +} diff --git a/lib/models/dashboard/get_attendance_tracking_list_model.dart b/lib/models/dashboard/get_attendance_tracking_list_model.dart new file mode 100644 index 0000000..66b9ed8 --- /dev/null +++ b/lib/models/dashboard/get_attendance_tracking_list_model.dart @@ -0,0 +1,55 @@ +class GetAttendanceTrackingList { + GetAttendanceTrackingList({ + this.pBreakHours, + this.pLateInHours, + this.pRemainingHours, + this.pReturnMsg, + this.pReturnStatus, + this.pScheduledHours, + this.pShtName, + this.pSpentHours, + this.pSwipesExemptedFlag, + this.pSwipeIn, + this.pSwipeOut, + }); + + String? pBreakHours; + String? pLateInHours; + String? pRemainingHours; + String? pReturnMsg; + String? pReturnStatus; + String? pScheduledHours; + String? pShtName; + String? pSpentHours; + String? pSwipesExemptedFlag; + dynamic pSwipeIn; + dynamic pSwipeOut; + + factory GetAttendanceTrackingList.fromMap(Map json) => GetAttendanceTrackingList( + pBreakHours: json["P_BREAK_HOURS"] == null ? null : json["P_BREAK_HOURS"], + pLateInHours: json["P_LATE_IN_HOURS"] == null ? null : json["P_LATE_IN_HOURS"], + pRemainingHours: json["P_REMAINING_HOURS"] == null ? null : json["P_REMAINING_HOURS"], + pReturnMsg: json["P_RETURN_MSG"] == null ? null : json["P_RETURN_MSG"], + pReturnStatus: json["P_RETURN_STATUS"] == null ? null : json["P_RETURN_STATUS"], + pScheduledHours: json["P_SCHEDULED_HOURS"] == null ? null : json["P_SCHEDULED_HOURS"], + pShtName: json["P_SHT_NAME"] == null ? null : json["P_SHT_NAME"], + pSpentHours: json["P_SPENT_HOURS"] == null ? null : json["P_SPENT_HOURS"], + pSwipesExemptedFlag: json["P_SWIPES_EXEMPTED_FLAG"] == null ? null : json["P_SWIPES_EXEMPTED_FLAG"], + pSwipeIn: json["P_SWIPE_IN"], + pSwipeOut: json["P_SWIPE_OUT"], + ); + + Map toMap() => { + "P_BREAK_HOURS": pBreakHours == null ? null : pBreakHours, + "P_LATE_IN_HOURS": pLateInHours == null ? null : pLateInHours, + "P_REMAINING_HOURS": pRemainingHours == null ? null : pRemainingHours, + "P_RETURN_MSG": pReturnMsg == null ? null : pReturnMsg, + "P_RETURN_STATUS": pReturnStatus == null ? null : pReturnStatus, + "P_SCHEDULED_HOURS": pScheduledHours == null ? null : pScheduledHours, + "P_SHT_NAME": pShtName == null ? null : pShtName, + "P_SPENT_HOURS": pSpentHours == null ? null : pSpentHours, + "P_SWIPES_EXEMPTED_FLAG": pSwipesExemptedFlag == null ? null : pSwipesExemptedFlag, + "P_SWIPE_IN": pSwipeIn, + "P_SWIPE_OUT": pSwipeOut, + }; +} diff --git a/lib/models/dashboard/get_open_missing_swipes_list_model.dart b/lib/models/dashboard/get_open_missing_swipes_list_model.dart new file mode 100644 index 0000000..86ac6a9 --- /dev/null +++ b/lib/models/dashboard/get_open_missing_swipes_list_model.dart @@ -0,0 +1,24 @@ + +class GetOpenMissingSwipesList { + GetOpenMissingSwipesList({ + this.pOpenMissingSwipes, + this.pReturnMsg, + this.pReturnStatus, + }); + + int? pOpenMissingSwipes; + String? pReturnMsg; + String? pReturnStatus; + + factory GetOpenMissingSwipesList.fromJson(Map json) => GetOpenMissingSwipesList( + pOpenMissingSwipes: json["P_OPEN_MISSING_SWIPES"] == null ? null : json["P_OPEN_MISSING_SWIPES"], + pReturnMsg: json["P_RETURN_MSG"] == null ? null : json["P_RETURN_MSG"], + pReturnStatus: json["P_RETURN_STATUS"] == null ? null : json["P_RETURN_STATUS"], + ); + + Map toJson() => { + "P_OPEN_MISSING_SWIPES": pOpenMissingSwipes == null ? null : pOpenMissingSwipes, + "P_RETURN_MSG": pReturnMsg == null ? null : pReturnMsg, + "P_RETURN_STATUS": pReturnStatus == null ? null : pReturnStatus, + }; +} diff --git a/lib/models/dashboard/get_open_notifications_list.dart b/lib/models/dashboard/get_open_notifications_list.dart new file mode 100644 index 0000000..854b62a --- /dev/null +++ b/lib/models/dashboard/get_open_notifications_list.dart @@ -0,0 +1,23 @@ +class GetOpenNotificationsList { + GetOpenNotificationsList({ + this.itemType, + this.itemTypeDisplayName, + this.openNtfNumber, + }); + + String? itemType; + String? itemTypeDisplayName; + int? openNtfNumber; + + factory GetOpenNotificationsList.fromMap(Map json) => GetOpenNotificationsList( + itemType: json["ITEM_TYPE"] == null ? null : json["ITEM_TYPE"], + itemTypeDisplayName: json["ITEM_TYPE_DISPLAY_NAME"] == null ? null : json["ITEM_TYPE_DISPLAY_NAME"], + openNtfNumber: json["OPEN_NTF_NUMBER"] == null ? null : json["OPEN_NTF_NUMBER"], + ); + + Map toMap() => { + "ITEM_TYPE": itemType == null ? null : itemType, + "ITEM_TYPE_DISPLAY_NAME": itemTypeDisplayName == null ? null : itemTypeDisplayName, + "OPEN_NTF_NUMBER": openNtfNumber == null ? null : openNtfNumber, + }; +} diff --git a/lib/models/dashboard/itg_forms_model.dart b/lib/models/dashboard/itg_forms_model.dart new file mode 100644 index 0000000..c5a0145 --- /dev/null +++ b/lib/models/dashboard/itg_forms_model.dart @@ -0,0 +1,189 @@ +// To parse this JSON data, do +// +// final itgFormsModel = itgFormsModelFromMap(jsonString); + +import 'dart:convert'; + +ItgFormsModel itgFormsModelFromMap(String str) => ItgFormsModel.fromJson(json.decode(str)); + +String itgFormsModelToMap(ItgFormsModel data) => json.encode(data.toMap()); + +class ItgFormsModel { + ItgFormsModel({ + this.date, + this.languageId, + this.serviceName, + this.time, + this.androidLink, + this.authenticationTokenId, + this.data, + this.dataw, + this.dietType, + this.dietTypeId, + this.errorCode, + this.errorEndUserMessage, + this.errorEndUserMessageN, + this.errorMessage, + this.errorType, + this.foodCategory, + this.iosLink, + this.isAuthenticated, + this.mealOrderStatus, + this.mealType, + this.messageStatus, + this.numberOfResultRecords, + this.patientBlodType, + this.successMsg, + this.successMsgN, + this.vidaUpdatedResponse, + this.itgRequest, + this.itgFormAttachmentsList, + this.message, + this.mohemmItgDepartmentSectionsList, + this.mohemmItgProjectDepartmentsList, + this.mohemmItgResponseItem, + this.mohemmItgSectionTopicsList, + this.mohemmItgTicketDetailsList, + this.mohemmItgTicketTransactionsList, + this.mohemmItgTicketsByEmployeeList, + this.mohemmItgProjectsList, + this.mohemmItgTicketTypesList, + this.referenceNumber, + this.requestType, + this.totalCount, + this.statuseCode, + }); + + dynamic date; + int? languageId; + int? serviceName; + dynamic time; + dynamic androidLink; + dynamic authenticationTokenId; + dynamic data; + bool? dataw; + int? dietType; + int? dietTypeId; + dynamic errorCode; + dynamic errorEndUserMessage; + dynamic errorEndUserMessageN; + dynamic errorMessage; + int? errorType; + int? foodCategory; + dynamic iosLink; + bool? isAuthenticated; + int? mealOrderStatus; + int? mealType; + int? messageStatus; + int? numberOfResultRecords; + dynamic patientBlodType; + String? successMsg; + dynamic successMsgN; + dynamic vidaUpdatedResponse; + dynamic itgRequest; + dynamic itgFormAttachmentsList; + String? message; + dynamic mohemmItgDepartmentSectionsList; + dynamic mohemmItgProjectDepartmentsList; + dynamic mohemmItgResponseItem; + dynamic mohemmItgSectionTopicsList; + dynamic mohemmItgTicketDetailsList; + dynamic mohemmItgTicketTransactionsList; + dynamic mohemmItgTicketsByEmployeeList; + dynamic mohemmItgProjectsList; + dynamic mohemmItgTicketTypesList; + DateTime? referenceNumber; + dynamic requestType; + int? totalCount; + int? statuseCode; + + factory ItgFormsModel.fromJson(Map json) => ItgFormsModel( + date: json["Date"], + languageId: json["LanguageID"] == null ? null : json["LanguageID"], + serviceName: json["ServiceName"] == null ? null : json["ServiceName"], + time: json["Time"], + androidLink: json["AndroidLink"], + authenticationTokenId: json["AuthenticationTokenID"], + data: json["Data"], + dataw: json["Dataw"] == null ? null : json["Dataw"], + dietType: json["DietType"] == null ? null : json["DietType"], + dietTypeId: json["DietTypeID"] == null ? null : json["DietTypeID"], + errorCode: json["ErrorCode"], + errorEndUserMessage: json["ErrorEndUserMessage"], + errorEndUserMessageN: json["ErrorEndUserMessageN"], + errorMessage: json["ErrorMessage"], + errorType: json["ErrorType"] == null ? null : json["ErrorType"], + foodCategory: json["FoodCategory"] == null ? null : json["FoodCategory"], + iosLink: json["IOSLink"], + isAuthenticated: json["IsAuthenticated"] == null ? null : json["IsAuthenticated"], + mealOrderStatus: json["MealOrderStatus"] == null ? null : json["MealOrderStatus"], + mealType: json["MealType"] == null ? null : json["MealType"], + messageStatus: json["MessageStatus"] == null ? null : json["MessageStatus"], + numberOfResultRecords: json["NumberOfResultRecords"] == null ? null : json["NumberOfResultRecords"], + patientBlodType: json["PatientBlodType"], + successMsg: json["SuccessMsg"] == null ? null : json["SuccessMsg"], + successMsgN: json["SuccessMsgN"], + vidaUpdatedResponse: json["VidaUpdatedResponse"], + itgRequest: json["ITGRequest"], + itgFormAttachmentsList: json["Itg_FormAttachmentsList"], + message: json["Message"] == null ? null : json["Message"], + mohemmItgDepartmentSectionsList: json["Mohemm_ITG_DepartmentSectionsList"], + mohemmItgProjectDepartmentsList: json["Mohemm_ITG_ProjectDepartmentsList"], + mohemmItgResponseItem: json["Mohemm_ITG_ResponseItem"], + mohemmItgSectionTopicsList: json["Mohemm_ITG_SectionTopicsList"], + mohemmItgTicketDetailsList: json["Mohemm_ITG_TicketDetailsList"], + mohemmItgTicketTransactionsList: json["Mohemm_ITG_TicketTransactionsList"], + mohemmItgTicketsByEmployeeList: json["Mohemm_ITG_TicketsByEmployeeList"], + mohemmItgProjectsList: json["Mohemm_Itg_ProjectsList"], + mohemmItgTicketTypesList: json["Mohemm_Itg_TicketTypesList"], + referenceNumber: json["ReferenceNumber"] == null ? null : DateTime.parse(json["ReferenceNumber"]), + requestType: json["RequestType"], + totalCount: json["TotalCount"] == null ? null : json["TotalCount"], + statuseCode: json["statuseCode"] == null ? null : json["statuseCode"], + ); + + Map toMap() => { + "Date": date, + "LanguageID": languageId == null ? null : languageId, + "ServiceName": serviceName == null ? null : serviceName, + "Time": time, + "AndroidLink": androidLink, + "AuthenticationTokenID": authenticationTokenId, + "Data": data, + "Dataw": dataw == null ? null : dataw, + "DietType": dietType == null ? null : dietType, + "DietTypeID": dietTypeId == null ? null : dietTypeId, + "ErrorCode": errorCode, + "ErrorEndUserMessage": errorEndUserMessage, + "ErrorEndUserMessageN": errorEndUserMessageN, + "ErrorMessage": errorMessage, + "ErrorType": errorType == null ? null : errorType, + "FoodCategory": foodCategory == null ? null : foodCategory, + "IOSLink": iosLink, + "IsAuthenticated": isAuthenticated == null ? null : isAuthenticated, + "MealOrderStatus": mealOrderStatus == null ? null : mealOrderStatus, + "MealType": mealType == null ? null : mealType, + "MessageStatus": messageStatus == null ? null : messageStatus, + "NumberOfResultRecords": numberOfResultRecords == null ? null : numberOfResultRecords, + "PatientBlodType": patientBlodType, + "SuccessMsg": successMsg == null ? null : successMsg, + "SuccessMsgN": successMsgN, + "VidaUpdatedResponse": vidaUpdatedResponse, + "ITGRequest": itgRequest, + "Itg_FormAttachmentsList": itgFormAttachmentsList, + "Message": message == null ? null : message, + "Mohemm_ITG_DepartmentSectionsList": mohemmItgDepartmentSectionsList, + "Mohemm_ITG_ProjectDepartmentsList": mohemmItgProjectDepartmentsList, + "Mohemm_ITG_ResponseItem": mohemmItgResponseItem, + "Mohemm_ITG_SectionTopicsList": mohemmItgSectionTopicsList, + "Mohemm_ITG_TicketDetailsList": mohemmItgTicketDetailsList, + "Mohemm_ITG_TicketTransactionsList": mohemmItgTicketTransactionsList, + "Mohemm_ITG_TicketsByEmployeeList": mohemmItgTicketsByEmployeeList, + "Mohemm_Itg_ProjectsList": mohemmItgProjectsList, + "Mohemm_Itg_TicketTypesList": mohemmItgTicketTypesList, + "ReferenceNumber": referenceNumber == null ? null : referenceNumber!.toIso8601String(), + "RequestType": requestType, + "TotalCount": totalCount == null ? null : totalCount, + "statuseCode": statuseCode == null ? null : statuseCode, + }; +} diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index b993db8..fad6e51 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -1,6 +1,10 @@ import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'basic_member_information_model.dart'; +import 'dashboard/get_accrual_balances_list_model.dart'; +import 'dashboard/get_attendance_tracking_list_model.dart'; +import 'dashboard/get_open_missing_swipes_list_model.dart'; +import 'dashboard/get_open_notifications_list.dart'; import 'member_information_list_model.dart'; import 'privilege_list_model.dart'; @@ -57,13 +61,13 @@ class GenericResponseModel { List? getAbsenceCollectionNotificationBodyList; List? getAbsenceDffStructureList; List? getAbsenceTransactionList; - List? getAccrualBalancesList; + List? getAccrualBalancesList; List? getActionHistoryList; List? getAddressDffStructureList; List? getAddressNotificationBodyList; List? getApprovesList; List? getAttachementList; - List? getAttendanceTrackingList; + GetAttendanceTrackingList? getAttendanceTrackingList; List? getBasicDetColsStructureList; List? getBasicDetDffStructureList; List? getBasicDetNtfBodyList; @@ -105,8 +109,8 @@ class GenericResponseModel { List? getNotificationButtonsList; List? getNotificationReassignModeList; List? getObjectValuesList; - List? getOpenMissingSwipesList; - List? getOpenNotificationsList; + GetOpenMissingSwipesList? getOpenMissingSwipesList; + List? getOpenNotificationsList; List? getOpenNotificationsNumList; List? getOpenPeriodDatesList; List? getOrganizationsSalariesList; @@ -563,13 +567,15 @@ class GenericResponseModel { getAbsenceCollectionNotificationBodyList = json['GetAbsenceCollectionNotificationBodyList']; getAbsenceDffStructureList = json['GetAbsenceDffStructureList']; getAbsenceTransactionList = json['GetAbsenceTransactionList']; - getAccrualBalancesList = json['GetAccrualBalancesList']; + getAccrualBalancesList: + json["GetAccrualBalancesList"] == null ? null : List.from(json["GetAccrualBalancesList"].map((x) => GetAccrualBalancesList.fromJson(x))); getActionHistoryList = json['GetActionHistoryList']; getAddressDffStructureList = json['GetAddressDffStructureList']; getAddressNotificationBodyList = json['GetAddressNotificationBodyList']; getApprovesList = json['GetApprovesList']; getAttachementList = json['GetAttachementList']; - getAttendanceTrackingList = json['GetAttendanceTrackingList']; + getAttendanceTrackingList: + json["GetAttendanceTrackingList"] == null ? null : GetAttendanceTrackingList.fromMap(json["GetAttendanceTrackingList"]); getBasicDetColsStructureList = json['GetBasicDetColsStructureList']; getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; getBasicDetNtfBodyList = json['GetBasicDetNtfBodyList']; @@ -611,8 +617,9 @@ class GenericResponseModel { getNotificationButtonsList = json['GetNotificationButtonsList']; getNotificationReassignModeList = json['GetNotificationReassignModeList']; getObjectValuesList = json['GetObjectValuesList']; - getOpenMissingSwipesList = json['GetOpenMissingSwipesList']; - getOpenNotificationsList = json['GetOpenNotificationsList']; + getOpenMissingSwipesList: json["GetOpenMissingSwipesList"] == null ? null : GetOpenMissingSwipesList.fromJson(json["GetOpenMissingSwipesList"]); + getOpenNotificationsList: + json["GetOpenNotificationsList"] == null ? null : List.from(json["GetOpenNotificationsList"].map((x) => GetOpenNotificationsList.fromMap(x))); getOpenNotificationsNumList = json['GetOpenNotificationsNumList']; getOpenPeriodDatesList = json['GetOpenPeriodDatesList']; getOrganizationsSalariesList = json['GetOrganizationsSalariesList']; diff --git a/lib/models/post_params_model.dart b/lib/models/post_params_model.dart index cd6dd72..1ab86f7 100644 --- a/lib/models/post_params_model.dart +++ b/lib/models/post_params_model.dart @@ -5,8 +5,27 @@ class PostParamsModel { String? mobileType; String? logInTokenID; String? tokenID; + String? mobileNumber; + String? pEmailAddress; + String? pUserName; + String? pSelectedEmployeeNumber; + int? pSessionId; + String? userName; - PostParamsModel({this.versionID, this.channel, this.languageID, this.mobileType, this.logInTokenID, this.tokenID}); + PostParamsModel({ + this.versionID, + this.channel, + this.languageID, + this.mobileType, + this.logInTokenID, + this.tokenID, + this.mobileNumber, + this.userName, + this.pEmailAddress, + this.pSessionId, + this.pUserName, + this.pSelectedEmployeeNumber, + }); PostParamsModel.fromJson(Map json) { versionID = json['VersionID']; @@ -28,7 +47,37 @@ class PostParamsModel { return data; } + Map toJsonAfterLogin() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['MobileType'] = this.mobileType; + data['LogInTokenID'] = this.logInTokenID; + data['TokenID'] = this.tokenID; + data['MobileNumber'] = this.mobileNumber; + data['UserName'] = this.userName; + data['P_EMAIL_ADDRESS'] = this.pEmailAddress; + data['P_SESSION_ID'] = this.pSessionId; + data['P_SELECTED_EMPLOYEE_NUMBER'] = this.pSelectedEmployeeNumber; + data['P_USER_NAME'] = this.pUserName; + + return data; + } + set setLogInTokenID(String? token) => logInTokenID = token; set setTokenID(String? token) => tokenID = token; + + set setMobileNumer(String? v) => mobileNumber = v; + + set setUserName(String? v) => userName = v; + + set setPEmailAddress(String? v) => pEmailAddress = v; + + set setPSessionId(int? v) => pSessionId = v; + + set setPUserName(String? v) => pUserName = v; + + set setPSelectedEmployeeNumber(String? v) => pSelectedEmployeeNumber = v; } diff --git a/lib/ui/landing/dashboard.dart b/lib/ui/landing/dashboard.dart index ac427d1..e8c2157 100644 --- a/lib/ui/landing/dashboard.dart +++ b/lib/ui/landing/dashboard.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; @@ -25,6 +26,7 @@ class _DashboardState extends State { @override void initState() { super.initState(); + DashbaordApiClient().getAttendanceTracking(); } @override @@ -42,7 +44,8 @@ class _DashboardState extends State { List iconT = ["assets/images/monthly_attendance.svg", "assets/images/work_from_home.svg", "assets/images/ticket_request.svg", "assets/images/work_from_home.svg"]; List namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"]; - + // DashbaordApiClient().getOpenNotifications(); + DashbaordApiClient().getOpenMissingSwipes(); return Scaffold( body: Column( children: [ diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 5f0f266..2353f99 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -49,7 +49,7 @@ class _LoginScreenState extends State { _checkMobileAppVersion = await LoginApiClient().checkMobileAppVersion(); _memberLoginList = await LoginApiClient().memberLogin(username.text, password.text); AppState().setMemberLoginListModel = _memberLoginList; - AppState().username = username.text; + AppState().setUserName = username.text; print(_memberLoginList?.toJson()); Utils.hideLoading(context); Navigator.pushNamed(context, AppRoutes.verifyLogin); @@ -62,6 +62,8 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { + username.text="15153"; + password.text="e123e123e123"; return Scaffold( body: Column( children: [ diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart index b28ad4d..ba0eb98 100644 --- a/lib/ui/login/verify_login_screen.dart +++ b/lib/ui/login/verify_login_screen.dart @@ -626,7 +626,7 @@ class _VerifyLoginScreenState extends State { } else { Utils.showLoading(context); BasicMemberInformationModel? memberInformationModel = await LoginApiClient() - .mohemmSendActivationCodeByOTPNotificationType(checkBiometricIsAvailable(BiometricType.fingerprint) ? 1 : 0, AppState().memberLoginList?.pMOBILENUMBER, _flag, AppState().username); + .mohemmSendActivationCodeByOTPNotificationType(checkBiometricIsAvailable(BiometricType.fingerprint) ? 1 : 0, AppState().memberLoginList?.pMOBILENUMBER, _flag, AppState().getUserName); Utils.hideLoading(context); OtpDialog( context, @@ -635,7 +635,7 @@ class _VerifyLoginScreenState extends State { (value) async { Utils.showLoading(context); try { - GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().username); + GenericResponseModel? genericResponseModel = await LoginApiClient().checkActivationCode(false, AppState().memberLoginList?.pMOBILENUMBER, value, AppState().getUserName); if (genericResponseModel?.errorMessage != null) { Utils.showToast(genericResponseModel?.errorMessage ?? ""); // Navigator.pop(context);