From b281efe14c5442dd66250a59b0c26ddd9785c868 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 22 May 2022 09:13:25 +0300 Subject: [PATCH] fix monthly attendance --- assets/langs/ar-SA.json | 2 + assets/langs/en-US.json | 2 + lib/api/monthlyAttendance_api_client.dart | 72 +++++ lib/classes/colors.dart | 2 +- lib/models/generic_response_model.dart | 48 ++- ...get_day_hours_type_details_list_model.dart | 180 +++++++++++ ...et_schedule_shifts_details_list_model.dart | 129 ++++++++ .../get_time_card_summary_list_model.dart | 153 ++++++++++ lib/ui/attendance/monthly_attendance.dart | 279 ++++++++++++------ .../attendence_details_bottom_sheet.dart | 2 +- lib/ui/landing/widget/services_widget.dart | 5 +- 11 files changed, 774 insertions(+), 100 deletions(-) create mode 100644 lib/api/monthlyAttendance_api_client.dart create mode 100644 lib/models/get_day_hours_type_details_list_model.dart create mode 100644 lib/models/get_schedule_shifts_details_list_model.dart create mode 100644 lib/models/get_time_card_summary_list_model.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index d9d2a54..275a647 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -63,6 +63,7 @@ "actualCheckOut": "وقت الخروج", "actualCheckIn": "وقت الدخول", "present": "حضور", + "pres" : "حضور", "shiftTime": "وقت التناوب", "absent": "غياب", "attendance": "الحضور", @@ -225,6 +226,7 @@ "requestDate": "تاريخ الطلب", "analyzedDate": "تاريخ التحليل", "urgent": "العاجلة", + "approvedCheckIn" : "وقت الدخول", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 857437e..301fd7f 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -63,6 +63,7 @@ "actualCheckOut": "Actual Check Out", "actualCheckIn": "Actual Check In", "present": "PRESENT 11", + "pres" : "present", "shiftTime": "Shift Time", "absent": "ABSENT 10", "attendance": "Attendance", @@ -223,6 +224,7 @@ "relatedTo": "Related To", "requestDate": "Request Date", "analyzedDate": "Analyzed Date", + "approvedCheckIn" : "Approved Check In", "urgent": "Urgent", "profile": { "reset_password": { diff --git a/lib/api/monthlyAttendance_api_client.dart b/lib/api/monthlyAttendance_api_client.dart new file mode 100644 index 0000000..4f6aca7 --- /dev/null +++ b/lib/api/monthlyAttendance_api_client.dart @@ -0,0 +1,72 @@ + +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/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; +import 'package:mohem_flutter_app/models/get_mobile_login_info_list_model.dart'; +import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; +import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; +import 'api_client.dart'; + +class MonthlyAttendanceApiClient { + static final MonthlyAttendanceApiClient _instance = MonthlyAttendanceApiClient._internal(); + + MonthlyAttendanceApiClient._internal(); + + factory MonthlyAttendanceApiClient() => _instance; + + + Future getTimeCardSummary(String month, int year) async { + String url = "${ApiConsts.erpRest}GET_TIME_CARD_SUMMARY"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, + "SearchMonth": month, + "SearchYear": year, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return (responseData.getTimeCardSummaryList?.length ?? 0) > 0 ? responseData.getTimeCardSummaryList!.first : null; + }, url, postParams); + } + + Future> getDayHoursTypeDetails(String month, int year) async { + String url = "${ApiConsts.erpRest}GET_DAY_HOURS_TYPE_DETAILS"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + "P_SELECTED_RESP_ID": -999, + "SearchMonth": month, + "SearchYear": year, + }; + postParams.addAll(AppState().postParamsJson); + // postParams["DeviceToken"] = deviceToken; + // postParams["DeviceType"] = deviceType; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + print("Response Data______"); + print(responseData.getDayHoursTypeDetailsList!.length); + return responseData.getDayHoursTypeDetailsList ?? []; + }, url, postParams); + } + + + Future getScheduleShiftsDetails(int pRTPID) async { + String url = "${ApiConsts.erpRest}GET_SCHEDULE_SHIFTS_DETAILS"; + Map postParams = { + "P_PAGE_LIMIT": 10, + "P_PAGE_NUM": 1, + "P_RTP_ID": pRTPID, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return (responseData.getScheduleShiftsDetailsList?.length ?? 0) > 0 ? responseData.getScheduleShiftsDetailsList!.first : null; + }, url, postParams); + } + +} \ No newline at end of file diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 5643297..80fbbe7 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -27,7 +27,7 @@ class MyColors { static const Color white = Color(0xffffffff); static const Color green = Color(0xffffffff); static const Color borderColor = Color(0xffE8E8E8); - static const Color grey67Color = Color(0xff676767); + // static const Color grey67Color = Color(0xff676767); static const Color whiteColor = Color(0xFFEEEEEE); static const Color greenColor = Color(0xff1FA269); static const Color lightGreenColor = Color(0xff2AB2AB); diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 1c19832..f8403dd 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -2,6 +2,7 @@ import 'package:mohem_flutter_app/models/get_absence_collection_notification_bod import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_attachement_list_model.dart'; import 'package:mohem_flutter_app/models/get_basic_det_ntf_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_mo_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart'; @@ -9,8 +10,10 @@ import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dar import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; +import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; @@ -104,7 +107,7 @@ class GenericResponseModel { List? getContactDffStructureList; List? getContactNotificationBodyList; List? getCountriesList; - List? getDayHoursTypeDetailsList; + List? getDayHoursTypeDetailsList; List? getDeductionsList; List? getDefaultValueList; List? getEITCollectionNotificationBodyList; @@ -149,7 +152,7 @@ class GenericResponseModel { List? getSITCollectionNotificationBodyList; List? getSITDFFStructureList; List? getSITTransactionList; - List? getScheduleShiftsDetailsList; + List? getScheduleShiftsDetailsList; List? getShiftTypesList; List? getStampMsNotificationBodyList; List? getStampNsNotificationBodyList; @@ -161,7 +164,7 @@ class GenericResponseModel { List? getTermColsStructureList; List? getTermDffStructureList; List? getTermNotificationBodyList; - List? getTimeCardSummaryList; + List? getTimeCardSummaryList; List? getUserItemTypesList; List? getVacationRulesList; List? getVaccinationOnHandList; @@ -637,7 +640,13 @@ class GenericResponseModel { getContactDffStructureList = json['GetContactDffStructureList']; getContactNotificationBodyList = json['GetContactNotificationBodyList']; getCountriesList = json['GetCountriesList']; - getDayHoursTypeDetailsList = json['GetDayHoursTypeDetailsList']; + if (json['GetDayHoursTypeDetailsList'] != null) { + getDayHoursTypeDetailsList = []; + json['GetDayHoursTypeDetailsList'].forEach((v) { + getDayHoursTypeDetailsList! + .add(new GetDayHoursTypeDetailsList.fromJson(v)); + }); + } getDeductionsList = json['GetDeductionsList']; getDefaultValueList = json['GetDefaultValueList']; getEITCollectionNotificationBodyList = json['GetEITCollectionNotificationBodyList']; @@ -712,7 +721,13 @@ class GenericResponseModel { getSITCollectionNotificationBodyList = json['GetSITCollectionNotificationBodyList']; getSITDFFStructureList = json['GetSITDFFStructureList']; getSITTransactionList = json['GetSITTransactionList']; - getScheduleShiftsDetailsList = json['GetScheduleShiftsDetailsList']; + if (json['GetScheduleShiftsDetailsList'] != null) { + getScheduleShiftsDetailsList = []; + json['GetScheduleShiftsDetailsList'].forEach((v) { + getScheduleShiftsDetailsList! + .add(new GetScheduleShiftsDetailsList.fromJson(v)); + }); + } getShiftTypesList = json['GetShiftTypesList']; if (json['GetStampMsNotificationBodyList'] != null) { @@ -743,7 +758,13 @@ class GenericResponseModel { getTermColsStructureList = json['GetTermColsStructureList']; getTermDffStructureList = json['GetTermDffStructureList']; getTermNotificationBodyList = json['GetTermNotificationBodyList']; - getTimeCardSummaryList = json['GetTimeCardSummaryList']; + + if (json['GetTimeCardSummaryList'] != null) { + getTimeCardSummaryList = []; + json['GetTimeCardSummaryList'].forEach((v) { + getTimeCardSummaryList!.add(new GetTimeCardSummaryList.fromJson(v)); + }); + } getUserItemTypesList = json['GetUserItemTypesList']; getVacationRulesList = json['GetVacationRulesList']; getVaccinationOnHandList = json['GetVaccinationOnHandList']; @@ -1002,7 +1023,10 @@ class GenericResponseModel { data['GetContactDffStructureList'] = this.getContactDffStructureList; data['GetContactNotificationBodyList'] = this.getContactNotificationBodyList; data['GetCountriesList'] = this.getCountriesList; - data['GetDayHoursTypeDetailsList'] = this.getDayHoursTypeDetailsList; + if (this.getDayHoursTypeDetailsList != null) { + data['GetDayHoursTypeDetailsList'] = + this.getDayHoursTypeDetailsList!.map((v) => v.toJson()).toList(); + } data['GetDeductionsList'] = this.getDeductionsList; data['GetDefaultValueList'] = this.getDefaultValueList; data['GetEITCollectionNotificationBodyList'] = this.getEITCollectionNotificationBodyList; @@ -1067,7 +1091,10 @@ class GenericResponseModel { data['GetSITCollectionNotificationBodyList'] = this.getSITCollectionNotificationBodyList; data['GetSITDFFStructureList'] = this.getSITDFFStructureList; data['GetSITTransactionList'] = this.getSITTransactionList; - data['GetScheduleShiftsDetailsList'] = this.getScheduleShiftsDetailsList; + if (this.getScheduleShiftsDetailsList != null) { + data['GetScheduleShiftsDetailsList'] = + this.getScheduleShiftsDetailsList!.map((v) => v.toJson()).toList(); + } data['GetShiftTypesList'] = this.getShiftTypesList; if (this.getStampMsNotificationBodyList != null) { @@ -1092,7 +1119,10 @@ class GenericResponseModel { data['GetTermColsStructureList'] = this.getTermColsStructureList; data['GetTermDffStructureList'] = this.getTermDffStructureList; data['GetTermNotificationBodyList'] = this.getTermNotificationBodyList; - data['GetTimeCardSummaryList'] = this.getTimeCardSummaryList; + if (this.getTimeCardSummaryList != null) { + data['GetTimeCardSummaryList'] = + this.getTimeCardSummaryList!.map((v) => v.toJson()).toList(); + } data['GetUserItemTypesList'] = this.getUserItemTypesList; data['GetVacationRulesList'] = this.getVacationRulesList; data['GetVaccinationOnHandList'] = this.getVaccinationOnHandList; diff --git a/lib/models/get_day_hours_type_details_list_model.dart b/lib/models/get_day_hours_type_details_list_model.dart new file mode 100644 index 0000000..5d0a0ab --- /dev/null +++ b/lib/models/get_day_hours_type_details_list_model.dart @@ -0,0 +1,180 @@ +class GetDayHoursTypeDetailsList { + Null? aBSENCEATTENDANCEID; + Null? aBSENCEATTENDANCETYPEID; + String? aBSENTFLAG; + String? aCTUALHRS; + String? aNALAYZEDFLAG; + String? aPPROVEDTIMEBACKHRS; + String? aPPRTIMEBACKFLAG; + int? aSSIGNMENTID; + String? aTTENDEDFLAG; + Null? cALENDARENTRYID; + String? cOMPOFFFLAG; + String? cOMPOFFHRS; + String? cOMPOFFHHRS; + String? cOMPOFFNHRS; + String? cOMPOFFWHRS; + String? dAYTYPE; + String? eARLYOUTFLAG; + String? eARLYOUTHRS; + String? eXCESSFLAG; + String? eXCESSHRS; + int? fROMROWNUM; + String? lATEINFLAG; + String? lATEINHRS; + String? mISSINGSWIPEFLAG; + String? nONSCHEDULEDFLAG; + Null? nOOFROWS; + String? oNCALLHRS; + Null? pERSONEXTRAINFOID; + String? pLANNEDOTHRS; + String? pLANNEDOTHRSFLAG; + String? rEMARKS; + int? rOWNUM; + int? rTPID; + String? sCHEDULEDHRS; + String? sCHEDULEDONCALLHRS; + String? sCHEDULEDPLANNEDOTHRS; + String? sCHEDULEDATE; + String? sHORTAGEFLAG; + String? sHORTAGEHRS; + String? tIMEBACKFLAG; + String? tIMEBACKHRS; + int? tOROWNUM; + + GetDayHoursTypeDetailsList( + {this.aBSENCEATTENDANCEID, + this.aBSENCEATTENDANCETYPEID, + this.aBSENTFLAG, + this.aCTUALHRS, + this.aNALAYZEDFLAG, + this.aPPROVEDTIMEBACKHRS, + this.aPPRTIMEBACKFLAG, + this.aSSIGNMENTID, + this.aTTENDEDFLAG, + this.cALENDARENTRYID, + this.cOMPOFFFLAG, + this.cOMPOFFHRS, + this.cOMPOFFHHRS, + this.cOMPOFFNHRS, + this.cOMPOFFWHRS, + this.dAYTYPE, + this.eARLYOUTFLAG, + this.eARLYOUTHRS, + this.eXCESSFLAG, + this.eXCESSHRS, + this.fROMROWNUM, + this.lATEINFLAG, + this.lATEINHRS, + this.mISSINGSWIPEFLAG, + this.nONSCHEDULEDFLAG, + this.nOOFROWS, + this.oNCALLHRS, + this.pERSONEXTRAINFOID, + this.pLANNEDOTHRS, + this.pLANNEDOTHRSFLAG, + this.rEMARKS, + this.rOWNUM, + this.rTPID, + this.sCHEDULEDHRS, + this.sCHEDULEDONCALLHRS, + this.sCHEDULEDPLANNEDOTHRS, + this.sCHEDULEDATE, + this.sHORTAGEFLAG, + this.sHORTAGEHRS, + this.tIMEBACKFLAG, + this.tIMEBACKHRS, + this.tOROWNUM}); + + GetDayHoursTypeDetailsList.fromJson(Map json) { + aBSENCEATTENDANCEID = json['ABSENCE_ATTENDANCE_ID']; + aBSENCEATTENDANCETYPEID = json['ABSENCE_ATTENDANCE_TYPE_ID']; + aBSENTFLAG = json['ABSENT_FLAG']; + aCTUALHRS = json['ACTUAL_HRS']; + aNALAYZEDFLAG = json['ANALAYZED_FLAG']; + aPPROVEDTIMEBACKHRS = json['APPROVED_TIMEBACK_HRS']; + aPPRTIMEBACKFLAG = json['APPR_TIMEBACK_FLAG']; + aSSIGNMENTID = json['ASSIGNMENT_ID']; + aTTENDEDFLAG = json['ATTENDED_FLAG']; + cALENDARENTRYID = json['CALENDAR_ENTRY_ID']; + cOMPOFFFLAG = json['COMP_OFF_FLAG']; + cOMPOFFHRS = json['COMP_OFF_HRS']; + cOMPOFFHHRS = json['COMP_OFF_H_HRS']; + cOMPOFFNHRS = json['COMP_OFF_N_HRS']; + cOMPOFFWHRS = json['COMP_OFF_W_HRS']; + dAYTYPE = json['DAY_TYPE']; + eARLYOUTFLAG = json['EARLY_OUT_FLAG']; + eARLYOUTHRS = json['EARLY_OUT_HRS']; + eXCESSFLAG = json['EXCESS_FLAG']; + eXCESSHRS = json['EXCESS_HRS']; + fROMROWNUM = json['FROM_ROW_NUM']; + lATEINFLAG = json['LATE_IN_FLAG']; + lATEINHRS = json['LATE_IN_HRS']; + mISSINGSWIPEFLAG = json['MISSING_SWIPE_FLAG']; + nONSCHEDULEDFLAG = json['NON_SCHEDULED_FLAG']; + nOOFROWS = json['NO_OF_ROWS']; + oNCALLHRS = json['ON_CALL_HRS']; + pERSONEXTRAINFOID = json['PERSON_EXTRA_INFO_ID']; + pLANNEDOTHRS = json['PLANNED_OT_HRS']; + pLANNEDOTHRSFLAG = json['PLANNED_OT_HRS_FLAG']; + rEMARKS = json['REMARKS']; + rOWNUM = json['ROW_NUM']; + rTPID = json['RTP_ID']; + sCHEDULEDHRS = json['SCHEDULED_HRS']; + sCHEDULEDONCALLHRS = json['SCHEDULED_ON_CALL_HRS']; + sCHEDULEDPLANNEDOTHRS = json['SCHEDULED_PLANNED_OT_HRS']; + sCHEDULEDATE = json['SCHEDULE_DATE']; + sHORTAGEFLAG = json['SHORTAGE_FLAG']; + sHORTAGEHRS = json['SHORTAGE_HRS']; + tIMEBACKFLAG = json['TIMEBACK_FLAG']; + tIMEBACKHRS = json['TIMEBACK_HRS']; + tOROWNUM = json['TO_ROW_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['ABSENCE_ATTENDANCE_ID'] = this.aBSENCEATTENDANCEID; + data['ABSENCE_ATTENDANCE_TYPE_ID'] = this.aBSENCEATTENDANCETYPEID; + data['ABSENT_FLAG'] = this.aBSENTFLAG; + data['ACTUAL_HRS'] = this.aCTUALHRS; + data['ANALAYZED_FLAG'] = this.aNALAYZEDFLAG; + data['APPROVED_TIMEBACK_HRS'] = this.aPPROVEDTIMEBACKHRS; + data['APPR_TIMEBACK_FLAG'] = this.aPPRTIMEBACKFLAG; + data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; + data['ATTENDED_FLAG'] = this.aTTENDEDFLAG; + data['CALENDAR_ENTRY_ID'] = this.cALENDARENTRYID; + data['COMP_OFF_FLAG'] = this.cOMPOFFFLAG; + data['COMP_OFF_HRS'] = this.cOMPOFFHRS; + data['COMP_OFF_H_HRS'] = this.cOMPOFFHHRS; + data['COMP_OFF_N_HRS'] = this.cOMPOFFNHRS; + data['COMP_OFF_W_HRS'] = this.cOMPOFFWHRS; + data['DAY_TYPE'] = this.dAYTYPE; + data['EARLY_OUT_FLAG'] = this.eARLYOUTFLAG; + data['EARLY_OUT_HRS'] = this.eARLYOUTHRS; + data['EXCESS_FLAG'] = this.eXCESSFLAG; + data['EXCESS_HRS'] = this.eXCESSHRS; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['LATE_IN_FLAG'] = this.lATEINFLAG; + data['LATE_IN_HRS'] = this.lATEINHRS; + data['MISSING_SWIPE_FLAG'] = this.mISSINGSWIPEFLAG; + data['NON_SCHEDULED_FLAG'] = this.nONSCHEDULEDFLAG; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['ON_CALL_HRS'] = this.oNCALLHRS; + data['PERSON_EXTRA_INFO_ID'] = this.pERSONEXTRAINFOID; + data['PLANNED_OT_HRS'] = this.pLANNEDOTHRS; + data['PLANNED_OT_HRS_FLAG'] = this.pLANNEDOTHRSFLAG; + data['REMARKS'] = this.rEMARKS; + data['ROW_NUM'] = this.rOWNUM; + data['RTP_ID'] = this.rTPID; + data['SCHEDULED_HRS'] = this.sCHEDULEDHRS; + data['SCHEDULED_ON_CALL_HRS'] = this.sCHEDULEDONCALLHRS; + data['SCHEDULED_PLANNED_OT_HRS'] = this.sCHEDULEDPLANNEDOTHRS; + data['SCHEDULE_DATE'] = this.sCHEDULEDATE; + data['SHORTAGE_FLAG'] = this.sHORTAGEFLAG; + data['SHORTAGE_HRS'] = this.sHORTAGEHRS; + data['TIMEBACK_FLAG'] = this.tIMEBACKFLAG; + data['TIMEBACK_HRS'] = this.tIMEBACKHRS; + data['TO_ROW_NUM'] = this.tOROWNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_schedule_shifts_details_list_model.dart b/lib/models/get_schedule_shifts_details_list_model.dart new file mode 100644 index 0000000..8003446 --- /dev/null +++ b/lib/models/get_schedule_shifts_details_list_model.dart @@ -0,0 +1,129 @@ + +class GetScheduleShiftsDetailsList { + String? aCTUALWOBHRS; + String? aPPROVEDENDDATETIME; + String? aPPROVEDENDREASON; + String? aPPROVEDENDREASONDESC; + String? aPPROVEDENDTIME; + String? aPPROVEDSTARTDATETIME; + String? aPPROVEDSTARTREASON; + String? aPPROVEDSTARTREASONDESC; + String? aPPROVEDSTARTTIME; + int? aSSIGNMENTID; + String? bREAKNAME; + int? fROMROWNUM; + int? nOOFROWS; + String? pERCENTAGE; + int? rOWNUM; + int? rTPID; + int? rTPSCHEDULEID; + String? sCHEDULEDATE; + int? sEQNO; + String? sHTACTUALENDDATETIME; + String? sHTACTUALENDTIME; + String? sHTACTUALHRS; + String? sHTACTUALSTARTDATETIME; + String? sHTACTUALSTARTTIME; + String? sHTCODE; + String? sHTNAME; + String? sHTTYPE; + String? sHTTYPEDESC; + int? tOROWNUM; + + GetScheduleShiftsDetailsList( + {this.aCTUALWOBHRS, + this.aPPROVEDENDDATETIME, + this.aPPROVEDENDREASON, + this.aPPROVEDENDREASONDESC, + this.aPPROVEDENDTIME, + this.aPPROVEDSTARTDATETIME, + this.aPPROVEDSTARTREASON, + this.aPPROVEDSTARTREASONDESC, + this.aPPROVEDSTARTTIME, + this.aSSIGNMENTID, + this.bREAKNAME, + this.fROMROWNUM, + this.nOOFROWS, + this.pERCENTAGE, + this.rOWNUM, + this.rTPID, + this.rTPSCHEDULEID, + this.sCHEDULEDATE, + this.sEQNO, + this.sHTACTUALENDDATETIME, + this.sHTACTUALENDTIME, + this.sHTACTUALHRS, + this.sHTACTUALSTARTDATETIME, + this.sHTACTUALSTARTTIME, + this.sHTCODE, + this.sHTNAME, + this.sHTTYPE, + this.sHTTYPEDESC, + this.tOROWNUM}); + + GetScheduleShiftsDetailsList.fromJson(Map json) { + aCTUALWOBHRS = json['ACTUAL_WOB_HRS']; + aPPROVEDENDDATETIME = json['APPROVED_END_DATETIME']; + aPPROVEDENDREASON = json['APPROVED_END_REASON']; + aPPROVEDENDREASONDESC = json['APPROVED_END_REASON_DESC']; + aPPROVEDENDTIME = json['APPROVED_END_TIME']; + aPPROVEDSTARTDATETIME = json['APPROVED_START_DATETIME']; + aPPROVEDSTARTREASON = json['APPROVED_START_REASON']; + aPPROVEDSTARTREASONDESC = json['APPROVED_START_REASON_DESC']; + aPPROVEDSTARTTIME = json['APPROVED_START_TIME']; + aSSIGNMENTID = json['ASSIGNMENT_ID']; + bREAKNAME = json['BREAK_NAME']; + fROMROWNUM = json['FROM_ROW_NUM']; + nOOFROWS = json['NO_OF_ROWS']; + pERCENTAGE = json['PERCENTAGE']; + rOWNUM = json['ROW_NUM']; + rTPID = json['RTP_ID']; + rTPSCHEDULEID = json['RTP_SCHEDULE_ID']; + sCHEDULEDATE = json['SCHEDULE_DATE']; + sEQNO = json['SEQ_NO']; + sHTACTUALENDDATETIME = json['SHT_ACTUAL_END_DATETIME']; + sHTACTUALENDTIME = json['SHT_ACTUAL_END_TIME']; + sHTACTUALHRS = json['SHT_ACTUAL_HRS']; + sHTACTUALSTARTDATETIME = json['SHT_ACTUAL_START_DATETIME']; + sHTACTUALSTARTTIME = json['SHT_ACTUAL_START_TIME']; + sHTCODE = json['SHT_CODE']; + sHTNAME = json['SHT_NAME']; + sHTTYPE = json['SHT_TYPE']; + sHTTYPEDESC = json['SHT_TYPE_DESC']; + tOROWNUM = json['TO_ROW_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['ACTUAL_WOB_HRS'] = this.aCTUALWOBHRS; + data['APPROVED_END_DATETIME'] = this.aPPROVEDENDDATETIME; + data['APPROVED_END_REASON'] = this.aPPROVEDENDREASON; + data['APPROVED_END_REASON_DESC'] = this.aPPROVEDENDREASONDESC; + data['APPROVED_END_TIME'] = this.aPPROVEDENDTIME; + data['APPROVED_START_DATETIME'] = this.aPPROVEDSTARTDATETIME; + data['APPROVED_START_REASON'] = this.aPPROVEDSTARTREASON; + data['APPROVED_START_REASON_DESC'] = this.aPPROVEDSTARTREASONDESC; + data['APPROVED_START_TIME'] = this.aPPROVEDSTARTTIME; + data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; + data['BREAK_NAME'] = this.bREAKNAME; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['PERCENTAGE'] = this.pERCENTAGE; + data['ROW_NUM'] = this.rOWNUM; + data['RTP_ID'] = this.rTPID; + data['RTP_SCHEDULE_ID'] = this.rTPSCHEDULEID; + data['SCHEDULE_DATE'] = this.sCHEDULEDATE; + data['SEQ_NO'] = this.sEQNO; + data['SHT_ACTUAL_END_DATETIME'] = this.sHTACTUALENDDATETIME; + data['SHT_ACTUAL_END_TIME'] = this.sHTACTUALENDTIME; + data['SHT_ACTUAL_HRS'] = this.sHTACTUALHRS; + data['SHT_ACTUAL_START_DATETIME'] = this.sHTACTUALSTARTDATETIME; + data['SHT_ACTUAL_START_TIME'] = this.sHTACTUALSTARTTIME; + data['SHT_CODE'] = this.sHTCODE; + data['SHT_NAME'] = this.sHTNAME; + data['SHT_TYPE'] = this.sHTTYPE; + data['SHT_TYPE_DESC'] = this.sHTTYPEDESC; + data['TO_ROW_NUM'] = this.tOROWNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_time_card_summary_list_model.dart b/lib/models/get_time_card_summary_list_model.dart new file mode 100644 index 0000000..6799bfa --- /dev/null +++ b/lib/models/get_time_card_summary_list_model.dart @@ -0,0 +1,153 @@ + + +class GetTimeCardSummaryList { + int? aBSENTDAYS; + int? aCTUALHRS; + int? aPPROVEDTIMEBACKHRS; + int? aSSIGNMENTID; + int? aTTENDEDDAYS; + int? bUSINESSTRIP; + int? cOMPOFFHHRS; + int? cOMPOFFNHRS; + int? cOMPOFFWHRS; + int? dESIREDSCHEDULEDHRS; + int? eARLYOUTHRS; + int? eXCESSHRS; + int? hALFDAYLEAVE; + int? lATEINHRS; + int? lEAVESHOLIDAYSHRS; + int? nONSCHEDULEDAYS; + int? nOTANALYZEDDAYS; + int? oFFDAYS; + int? oNCALLHRS; + int? pAIDLEAVE; + int? pERIODDAYS; + int? pLANNEDOTHRS; + int? pUBLICHOLIDAY; + int? sCHEDULEDHRS; + int? sCHEDULEDONCALLHRS; + int? sCHEDULEDPLANNEDOTHRS; + int? sCHEDULEDAYS; + int? sHORTAGEHRS; + int? sHORTAGESCHEDULEHRS; + int? sICKLEAVE; + int? tIMEBACKHRS; + double? tIMEBACKBALANCE; + int? uNAUTHORIZEDLEAVE; + int? uNCOVERDSHORTAGEHRS; + int? uNPAIDLEAVE; + + GetTimeCardSummaryList( + {this.aBSENTDAYS, + this.aCTUALHRS, + this.aPPROVEDTIMEBACKHRS, + this.aSSIGNMENTID, + this.aTTENDEDDAYS, + this.bUSINESSTRIP, + this.cOMPOFFHHRS, + this.cOMPOFFNHRS, + this.cOMPOFFWHRS, + this.dESIREDSCHEDULEDHRS, + this.eARLYOUTHRS, + this.eXCESSHRS, + this.hALFDAYLEAVE, + this.lATEINHRS, + this.lEAVESHOLIDAYSHRS, + this.nONSCHEDULEDAYS, + this.nOTANALYZEDDAYS, + this.oFFDAYS, + this.oNCALLHRS, + this.pAIDLEAVE, + this.pERIODDAYS, + this.pLANNEDOTHRS, + this.pUBLICHOLIDAY, + this.sCHEDULEDHRS, + this.sCHEDULEDONCALLHRS, + this.sCHEDULEDPLANNEDOTHRS, + this.sCHEDULEDAYS, + this.sHORTAGEHRS, + this.sHORTAGESCHEDULEHRS, + this.sICKLEAVE, + this.tIMEBACKHRS, + this.tIMEBACKBALANCE, + this.uNAUTHORIZEDLEAVE, + this.uNCOVERDSHORTAGEHRS, + this.uNPAIDLEAVE}); + + GetTimeCardSummaryList.fromJson(Map json) { + aBSENTDAYS = json['ABSENT_DAYS']; + aCTUALHRS = json['ACTUAL_HRS']; + aPPROVEDTIMEBACKHRS = json['APPROVED_TIMEBACK_HRS']; + aSSIGNMENTID = json['ASSIGNMENT_ID']; + aTTENDEDDAYS = json['ATTENDED_DAYS']; + bUSINESSTRIP = json['BUSINESS_TRIP']; + cOMPOFFHHRS = json['COMP_OFF_H_HRS']; + cOMPOFFNHRS = json['COMP_OFF_N_HRS']; + cOMPOFFWHRS = json['COMP_OFF_W_HRS']; + dESIREDSCHEDULEDHRS = json['DESIRED_SCHEDULED_HRS']; + eARLYOUTHRS = json['EARLY_OUT_HRS']; + eXCESSHRS = json['EXCESS_HRS']; + hALFDAYLEAVE = json['HALF_DAY_LEAVE']; + lATEINHRS = json['LATE_IN_HRS']; + lEAVESHOLIDAYSHRS = json['LEAVES_HOLIDAYS_HRS']; + nONSCHEDULEDAYS = json['NON_SCHEDULE_DAYS']; + nOTANALYZEDDAYS = json['NOT_ANALYZED_DAYS']; + oFFDAYS = json['OFF_DAYS']; + oNCALLHRS = json['ON_CALL_HRS']; + pAIDLEAVE = json['PAID_LEAVE']; + pERIODDAYS = json['PERIOD_DAYS']; + pLANNEDOTHRS = json['PLANNED_OTHRS']; + pUBLICHOLIDAY = json['PUBLIC_HOLIDAY']; + sCHEDULEDHRS = json['SCHEDULED_HRS']; + sCHEDULEDONCALLHRS = json['SCHEDULED_ON_CALL_HRS']; + sCHEDULEDPLANNEDOTHRS = json['SCHEDULED_PLANNED_OT_HRS']; + sCHEDULEDAYS = json['SCHEDULE_DAYS']; + sHORTAGEHRS = json['SHORTAGE_HRS']; + sHORTAGESCHEDULEHRS = json['SHORTAGE_SCHEDULE_HRS']; + sICKLEAVE = json['SICK_LEAVE']; + tIMEBACKHRS = json['TIMEBACK_HRS']; + tIMEBACKBALANCE = json['TIME_BACK_BALANCE']; + uNAUTHORIZEDLEAVE = json['UNAUTHORIZED_LEAVE']; + uNCOVERDSHORTAGEHRS = json['UNCOVERD_SHORTAGE_HRS']; + uNPAIDLEAVE = json['UNPAID_LEAVE']; + } + + Map toJson() { + final Map data = new Map(); + data['ABSENT_DAYS'] = this.aBSENTDAYS; + data['ACTUAL_HRS'] = this.aCTUALHRS; + data['APPROVED_TIMEBACK_HRS'] = this.aPPROVEDTIMEBACKHRS; + data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; + data['ATTENDED_DAYS'] = this.aTTENDEDDAYS; + data['BUSINESS_TRIP'] = this.bUSINESSTRIP; + data['COMP_OFF_H_HRS'] = this.cOMPOFFHHRS; + data['COMP_OFF_N_HRS'] = this.cOMPOFFNHRS; + data['COMP_OFF_W_HRS'] = this.cOMPOFFWHRS; + data['DESIRED_SCHEDULED_HRS'] = this.dESIREDSCHEDULEDHRS; + data['EARLY_OUT_HRS'] = this.eARLYOUTHRS; + data['EXCESS_HRS'] = this.eXCESSHRS; + data['HALF_DAY_LEAVE'] = this.hALFDAYLEAVE; + data['LATE_IN_HRS'] = this.lATEINHRS; + data['LEAVES_HOLIDAYS_HRS'] = this.lEAVESHOLIDAYSHRS; + data['NON_SCHEDULE_DAYS'] = this.nONSCHEDULEDAYS; + data['NOT_ANALYZED_DAYS'] = this.nOTANALYZEDDAYS; + data['OFF_DAYS'] = this.oFFDAYS; + data['ON_CALL_HRS'] = this.oNCALLHRS; + data['PAID_LEAVE'] = this.pAIDLEAVE; + data['PERIOD_DAYS'] = this.pERIODDAYS; + data['PLANNED_OTHRS'] = this.pLANNEDOTHRS; + data['PUBLIC_HOLIDAY'] = this.pUBLICHOLIDAY; + data['SCHEDULED_HRS'] = this.sCHEDULEDHRS; + data['SCHEDULED_ON_CALL_HRS'] = this.sCHEDULEDONCALLHRS; + data['SCHEDULED_PLANNED_OT_HRS'] = this.sCHEDULEDPLANNEDOTHRS; + data['SCHEDULE_DAYS'] = this.sCHEDULEDAYS; + data['SHORTAGE_HRS'] = this.sHORTAGEHRS; + data['SHORTAGE_SCHEDULE_HRS'] = this.sHORTAGESCHEDULEHRS; + data['SICK_LEAVE'] = this.sICKLEAVE; + data['TIMEBACK_HRS'] = this.tIMEBACKHRS; + data['TIME_BACK_BALANCE'] = this.tIMEBACKBALANCE; + data['UNAUTHORIZED_LEAVE'] = this.uNAUTHORIZEDLEAVE; + data['UNCOVERD_SHORTAGE_HRS'] = this.uNCOVERDSHORTAGEHRS; + data['UNPAID_LEAVE'] = this.uNPAIDLEAVE; + return data; + }} \ No newline at end of file diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index af7df52..7391211 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -2,11 +2,17 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; +import 'package:mohem_flutter_app/api/monthlyAttendance_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; +import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; +import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; +import 'package:provider/provider.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:flutter/cupertino.dart'; @@ -26,25 +32,103 @@ class _MonthlyAttendanceState extends State { bool isAbsent = true; bool isMissingDays = true; bool isOffDays = true; - - DateTime date = DateTime.now(); late var formattedDate; + var currentMonth = DateTime.now().month; + String searchMonth = getMonth(DateTime.now().month); + int searchYear = DateTime.now().year; + int? pRTPID; + + List getDayHoursTypeDetailsList = []; + GetTimeCardSummaryList? getTimeCardSummaryList; + + // GetDayHoursTypeDetailsList? getDayHoursTypeDetailsList; + GetScheduleShiftsDetailsList? getScheduleShiftsDetailsList; + @override void initState() { - formattedDate = DateFormat('d-MMM-yy').format(date); super.initState(); + getTimeCardSummary(searchMonth, searchYear); + getDayHoursTypeDetails(date.day, searchMonth, searchYear); + formattedDate = DateFormat('MMM-yyyy').format(date); + } + + void getTimeCardSummary(searchMonth, searchYear) async { + try { + Utils.showLoading(context); + getTimeCardSummaryList = await MonthlyAttendanceApiClient().getTimeCardSummary(searchMonth, searchYear); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } - Map dataMap = { - "Present": 65, - "Absent": 35, - }; + void getDayHoursTypeDetails(index, searchMonth, searchYear) async { + try { + Utils.showLoading(context); + getDayHoursTypeDetailsList = await MonthlyAttendanceApiClient().getDayHoursTypeDetails(searchMonth, searchYear); + Utils.hideLoading(context); + pRTPID = getDayHoursTypeDetailsList[index].rTPID; + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + countAllAttendDays(); + getScheduleShiftsDetails(pRTPID); + } + + getScheduleShiftsDetails(pRTPID) async { + try { + Utils.showLoading(context); + getScheduleShiftsDetailsList = await MonthlyAttendanceApiClient().getScheduleShiftsDetails(pRTPID); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + countAllAttendDays() { + // print(getDayHoursTypeDetailsList.length); + for (int i = 0; i < getDayHoursTypeDetailsList.length; i++) { + if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'Y') { + isPresent = true; + isAbsent = false; + isMissingDays = false; + isOffDays = false; + } else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].aBSENTFLAG == 'Y') { + isPresent = false; + isAbsent = true; + isMissingDays = false; + isOffDays = false; + } else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].dAYTYPE == 'OFF') { + isPresent = false; + isAbsent = false; + isMissingDays = false; + isOffDays = true; + } else { + isPresent = false; + isAbsent = false; + isMissingDays = true; + isOffDays = false; + } + } + } + + final CalendarController _calendarController = CalendarController(); final List _colorList = [Color(0xff2AB2AB), Color(0xff202529)]; @override Widget build(BuildContext context) { + Map dataMap = { + "Present": getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble(), + "Absent": getTimeCardSummaryList!.aBSENTDAYS!.toDouble(), + }; return Scaffold( appBar: AppBar( backgroundColor: MyColors.white, @@ -66,20 +150,18 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.attendance - .tr().toText24(isBold: true, color: MyColors.darkIconColor), + "Attendance".toText24(isBold: true, color: MyColors.darkIconColor), Row( children: [ - Text(formattedDate), - // "June 13, 2021".toText16(color: MyColors.greyACColor), + Text(formattedDate), const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), ], ).onPress(() async { - await showDatePicker( + await showDatePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(2021), - lastDate: DateTime(2025), + lastDate: DateTime.now(), builder: (context, child) { return Theme( data: ThemeData.dark().copyWith( @@ -95,31 +177,34 @@ class _MonthlyAttendanceState extends State { ); }, ).then((selectedDate) { - if (selectedDate != null) { - setState(() { - date = selectedDate; - formattedDate = DateFormat('d-MMM-yy').format(selectedDate); - }); - } - }); + if (selectedDate != null) { + var selectedMonth = DateFormat('MMMM').format(selectedDate); + var selectedYear = DateFormat('yyyy').format(selectedDate); + searchMonth = selectedMonth; + searchYear = int.parse(selectedYear); + setState(() { + // date = selectedDate; + formattedDate = DateFormat('MMMM-yyyy').format(selectedDate); + getTimeCardSummary(searchMonth, searchYear); + getDayHoursTypeDetails(selectedDate.day, searchMonth, searchYear); + }); + } + }); }) ], ).paddingOnly(left: 21, right: 21), 18.height, - AspectRatio(aspectRatio: 333 / 270, child: calenderWidget()).paddingOnly(left: 21, right: 21), + AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()).paddingOnly(left: 21, right: 21), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - optionUI(LocaleKeys.scheduleDays.tr(), "16"), + optionUI("Schedule\nDays", "${getTimeCardSummaryList!.sCHEDULEDAYS}"), 6.width, - optionUI(LocaleKeys.offDays - .tr(), "0"), + optionUI("Off\nDays", "${getTimeCardSummaryList!.oFFDAYS}"), 6.width, - optionUI(LocaleKeys.nonAnalyzed - .tr(), "0"), + optionUI("Non\nAnalyzed", "${getTimeCardSummaryList!.uNAUTHORIZEDLEAVE}"), 6.width, - optionUI(LocaleKeys.shortageHour - .tr(), "6"), + optionUI("Shortage\nHour", "${getTimeCardSummaryList!.sHORTAGEHRS}"), ], ).paddingOnly(left: 21, right: 21), 35.height, @@ -144,10 +229,8 @@ class _MonthlyAttendanceState extends State { children: [ Column( children: [ - LocaleKeys.attendance - .tr().toText12(isBold: true, color: MyColors.grey3AColor), - LocaleKeys.stats - .tr().toText24(isBold: true, color: MyColors.grey3AColor), + "Attendance".toText12(isBold: true, color: MyColors.grey3AColor), + "Stats".toText24(isBold: true, color: MyColors.grey3AColor), ], ).paddingOnly(left: 21, top: 29, bottom: 36), Row( @@ -162,8 +245,7 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: LocaleKeys.present - .tr().toText16(isBold: true, color: MyColors.lightGreenColor), + child: "PRESENT ${getTimeCardSummaryList!.aTTENDEDDAYS}".toText16(isBold: true, color: MyColors.lightGreenColor), ), ], ).paddingOnly(left: 21, right: 23), @@ -180,8 +262,7 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: LocaleKeys.absent - .tr().toText16( + child: "ABSENT ${getTimeCardSummaryList!.aBSENTDAYS}".toText16( isBold: true, color: MyColors.backgroundBlackColor, ), @@ -252,26 +333,25 @@ class _MonthlyAttendanceState extends State { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [title.toText10(color: MyColors.darkTextColor).expanded, value.toText20(color: MyColors.darkTextColor)], + children: [title.toText10(color: MyColors.darkTextColor).expanded, value.toText20(color: MyColors.darkTextColor)], ), ), ).expanded; } - Widget calenderWidget() { + Widget calendarWidget() { return SfCalendar( view: CalendarView.month, + // onViewChanged: viewChanged, + controller: _calendarController, headerHeight: 0, todayHighlightColor: MyColors.grey3AColor, viewHeaderStyle: const ViewHeaderStyle( - dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600), + dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600), ), monthCellBuilder: (cxt, build) { - int val = build.date.day % 4; - isPresent = val == 0; - isAbsent = val == 1; - isMissingDays = val == 2; - isOffDays = val == 3; + int val = build.date.day; + val == countAllAttendDays(); if (isPresent) { return Container( margin: const EdgeInsets.all(4), @@ -294,7 +374,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.white, @@ -318,7 +398,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.white, @@ -342,7 +422,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: Color(0xff1F2428), @@ -359,7 +439,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.greyA5Color, @@ -399,7 +479,16 @@ class _MonthlyAttendanceState extends State { ); } - void calendarTapped(CalendarTapDetails details) { + calendarTapped(CalendarTapDetails details) { + dynamic string = getScheduleShiftsDetailsList!.pERCENTAGE; + dynamic percentage = string!.indexOf('%'); + print(percentage); + print(details.date?.day.toString()); + int? index = details.date?.day; + if (index != null) { + index = index - 1; + } + getDayHoursTypeDetails(index, getMonth(details.date!.month), details.date?.year); showModalBottomSheet( context: context, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)), @@ -436,14 +525,14 @@ class _MonthlyAttendanceState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Column(children: [ - "June 13, 2021".toText24(isBold: true, color: Colors.white), - LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.lightGreyEFColor), + "${getScheduleShiftsDetailsList!.sCHEDULEDATE!.substring(0, 9)}".toText24(isBold: true, color: Colors.white), + "Attendance Details".tr().toText16(color: MyColors.lightGreyEFColor), 21.height, ]).paddingOnly(top: 25, left: 21, right: 21, bottom: 10), Center( child: CircularStepProgressBar( totalSteps: 16 * 4, - currentStep: 16, + currentStep: percentage, width: 210, height: 210, selectedColor: MyColors.gradiantEndColor, @@ -452,13 +541,11 @@ class _MonthlyAttendanceState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - "99%".toText44(color: Colors.white, isBold: true), - LocaleKeys.completed - .tr().toText11(color: MyColors.greyACColor), + "${getScheduleShiftsDetailsList!.pERCENTAGE}".toText44(color: Colors.white, isBold: true), + "Completed".tr().toText11(color: MyColors.greyACColor), 19.height, - LocaleKeys.shiftTime - .tr().toText11(color: MyColors.greyACColor), - "08:00 - 17:00".toText22(color: Colors.white, isBold: true), + "Shift Time".tr().toText11(color: MyColors.greyACColor), + "${getScheduleShiftsDetailsList!.sHTNAME}".toText22(color: Colors.white, isBold: true), ], ), ), @@ -487,12 +574,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.actualCheckIn - .tr().toText11( + "Actual Check In ".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "08:27".toText22(color: Colors.black, isBold: true), + "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true), ], ), ), @@ -500,12 +586,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.actualCheckOut - .tr().toText11( + "Actual Check Out".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "18:20".toText22(color: Colors.black, isBold: true), + "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -524,12 +609,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.approvedCheckIn - .tr().toText11( + "Approved Check In".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "09:27".toText22(color: MyColors.greenColor, isBold: true), + "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true), ], ), ), @@ -537,12 +621,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.approvedCheckOut - .tr().toText11( + "Approved Check Out".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "18:20".toText22(color: MyColors.greenColor, isBold: true), + "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true), ], ), ], @@ -561,12 +644,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.lateIn - .tr().toText11( + "Late In".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:27".toText22(color: MyColors.redColor, isBold: true), + "${getDayHoursTypeDetailsList[i].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true), ], ), ), @@ -574,12 +656,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.excess - .tr().toText11( + "Excess".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:00".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[i].eXCESSHRS}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -598,12 +679,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.shortage - .tr().toText11( + "Shortage".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:00".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[i].sHORTAGEHRS}".toText22(color: Colors.black, isBold: true), ], ), ), @@ -611,12 +691,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.earlyOut - .tr().toText11( + "Early Out".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:00".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[i].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -639,16 +718,40 @@ class _MonthlyAttendanceState extends State { ); } + List _getDataSource() { final List meetings = []; - - // _events.forEach((key, value) { - // final DateTime startTime = DateTime(key.year, key.month, key.day, 21, 0, 0); - // final DateTime endTime = DateTime(key.year, key.month, key.day, 22, 0, 0); - // meetings.add(Meeting("", startTime, endTime, MyColors.backgroundBlackColor, false)); - // }); return meetings; } + + static getMonth(int month) { + switch (month) { + case 1: + return "January"; + case 2: + return "February"; + case 3: + return "March"; + case 4: + return "April"; + case 5: + return "May"; + case 6: + return "June"; + case 7: + return "July"; + case 8: + return "August"; + case 9: + return "September"; + case 10: + return "October"; + case 11: + return "November"; + case 12: + return "December"; + } + } } class MeetingDataSource extends CalendarDataSource { diff --git a/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart b/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart index 4c42d6c..ea9f798 100644 --- a/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart +++ b/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart @@ -66,7 +66,7 @@ class _AttendenceDetailsBottomSheetState extends State