@platform-modules/foreign-ministry 1.3.335 → 1.3.336
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +6 -5
- package/dist/i18n/workflow-chat-i18n.d.ts +5 -0
- package/dist/i18n/workflow-chat-i18n.js +21 -0
- package/dist/i18n/workflow-chat-i18n.json +320 -0
- package/dist/i18n/workflow-chat-message.builder.d.ts +316 -0
- package/dist/i18n/workflow-chat-message.builder.js +891 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/AppointmentChatModel.d.ts +2 -0
- package/dist/models/AppointmentChatModel.js +8 -0
- package/dist/models/AppointmentWorkflowModel.d.ts +2 -0
- package/dist/models/AppointmentWorkflowModel.js +8 -0
- package/dist/models/AssistanceCitizensAbroadChatModel.d.ts +2 -0
- package/dist/models/AssistanceCitizensAbroadChatModel.js +8 -0
- package/dist/models/AssistanceCitizensAbroadWorkflowModel.d.ts +1 -0
- package/dist/models/AssistanceCitizensAbroadWorkflowModel.js +4 -0
- package/dist/models/ChildrensEducationChatModel.d.ts +2 -0
- package/dist/models/ChildrensEducationChatModel.js +8 -0
- package/dist/models/ChildrensEducationWorkflowModel.d.ts +1 -0
- package/dist/models/ChildrensEducationWorkflowModel.js +4 -0
- package/dist/models/DiplomaticAcademyChatModel.d.ts +2 -0
- package/dist/models/DiplomaticAcademyChatModel.js +8 -0
- package/dist/models/DiplomaticAcademyWorkflowModel.d.ts +2 -0
- package/dist/models/DiplomaticAcademyWorkflowModel.js +8 -0
- package/dist/models/DiplomaticChatsModel.d.ts +2 -0
- package/dist/models/DiplomaticChatsModel.js +8 -0
- package/dist/models/DiplomaticWorkFlowModel.d.ts +2 -0
- package/dist/models/DiplomaticWorkFlowModel.js +8 -0
- package/dist/models/DocumentTranslationChatModel.d.ts +2 -0
- package/dist/models/DocumentTranslationChatModel.js +8 -0
- package/dist/models/DocumentTranslationWorkflowModel.d.ts +2 -0
- package/dist/models/DocumentTranslationWorkflowModel.js +8 -0
- package/dist/models/EarlyCheckoutChatModel.d.ts +2 -0
- package/dist/models/EarlyCheckoutChatModel.js +8 -0
- package/dist/models/EarlyCheckoutWorkflowModel.d.ts +2 -0
- package/dist/models/EarlyCheckoutWorkflowModel.js +8 -0
- package/dist/models/EmbassyEvaluationChatModel.d.ts +1 -0
- package/dist/models/EmbassyEvaluationChatModel.js +4 -0
- package/dist/models/EmbassyEvaluationWorkflowModel.d.ts +1 -0
- package/dist/models/EmbassyEvaluationWorkflowModel.js +4 -0
- package/dist/models/EmployeeCardChatsModel.d.ts +2 -0
- package/dist/models/EmployeeCardChatsModel.js +8 -0
- package/dist/models/EmployeeCardWorkFlowModel.d.ts +2 -0
- package/dist/models/EmployeeCardWorkFlowModel.js +8 -0
- package/dist/models/EmployeeEvaluationChatModel.d.ts +1 -0
- package/dist/models/EmployeeEvaluationChatModel.js +4 -0
- package/dist/models/EmployeeEvaluationWorkflowModel.d.ts +1 -0
- package/dist/models/EmployeeEvaluationWorkflowModel.js +4 -0
- package/dist/models/EmployeeOfMonthNominationChatModel.d.ts +1 -0
- package/dist/models/EmployeeOfMonthNominationChatModel.js +4 -0
- package/dist/models/EmployeeOfMonthNominationWorkflowModel.d.ts +1 -0
- package/dist/models/EmployeeOfMonthNominationWorkflowModel.js +4 -0
- package/dist/models/EmployeeOfMonthSupportNominationChatModel.d.ts +1 -0
- package/dist/models/EmployeeOfMonthSupportNominationChatModel.js +4 -0
- package/dist/models/EmployeeOfMonthSupportNominationWorkflowModel.d.ts +1 -0
- package/dist/models/EmployeeOfMonthSupportNominationWorkflowModel.js +4 -0
- package/dist/models/FinancialChatsModel.d.ts +2 -0
- package/dist/models/FinancialChatsModel.js +8 -0
- package/dist/models/FinancialWorkFlowModel.d.ts +2 -0
- package/dist/models/FinancialWorkFlowModel.js +8 -0
- package/dist/models/FoodChatModel.d.ts +1 -0
- package/dist/models/FoodChatModel.js +4 -0
- package/dist/models/FoodWorkflowModel.d.ts +2 -0
- package/dist/models/FoodWorkflowModel.js +8 -0
- package/dist/models/GatePassChatsModel.d.ts +2 -0
- package/dist/models/GatePassChatsModel.js +8 -0
- package/dist/models/GatePassWorkFlowModel.d.ts +2 -0
- package/dist/models/GatePassWorkFlowModel.js +8 -0
- package/dist/models/GeneralServiceChatsModel.d.ts +2 -0
- package/dist/models/GeneralServiceChatsModel.js +8 -0
- package/dist/models/GeneralServiceWorkFlowModel.d.ts +2 -0
- package/dist/models/GeneralServiceWorkFlowModel.js +8 -0
- package/dist/models/HallChatModel.d.ts +1 -0
- package/dist/models/HallChatModel.js +4 -0
- package/dist/models/HallWorkflowModel.d.ts +2 -0
- package/dist/models/HallWorkflowModel.js +8 -0
- package/dist/models/HousingRentalAccommodationChatModel.d.ts +2 -0
- package/dist/models/HousingRentalAccommodationChatModel.js +8 -0
- package/dist/models/HousingRentalAccommodationWorkflowModel.d.ts +1 -0
- package/dist/models/HousingRentalAccommodationWorkflowModel.js +4 -0
- package/dist/models/HousingRentalVehicleChatModel.d.ts +2 -0
- package/dist/models/HousingRentalVehicleChatModel.js +8 -0
- package/dist/models/HousingRentalVehicleWorkflowModel.d.ts +1 -0
- package/dist/models/HousingRentalVehicleWorkflowModel.js +4 -0
- package/dist/models/InitiatorEmployeeNominationChatModel.d.ts +1 -0
- package/dist/models/InitiatorEmployeeNominationChatModel.js +4 -0
- package/dist/models/InitiatorEmployeeNominationWorkflowModel.d.ts +1 -0
- package/dist/models/InitiatorEmployeeNominationWorkflowModel.js +4 -0
- package/dist/models/InnovativeEmployeeNominationChatModel.d.ts +1 -0
- package/dist/models/InnovativeEmployeeNominationChatModel.js +4 -0
- package/dist/models/InnovativeEmployeeNominationWorkflowModel.d.ts +1 -0
- package/dist/models/InnovativeEmployeeNominationWorkflowModel.js +4 -0
- package/dist/models/IpeGrievanceChatModel.d.ts +1 -0
- package/dist/models/IpeGrievanceChatModel.js +4 -0
- package/dist/models/IpeGrievanceWorkflowModel.d.ts +1 -0
- package/dist/models/IpeGrievanceWorkflowModel.js +4 -0
- package/dist/models/LMSCourseExternalLecturerChatModel.d.ts +2 -0
- package/dist/models/LMSCourseExternalLecturerChatModel.js +8 -0
- package/dist/models/LMSCourseExternalLecturerWorkflowModel.d.ts +2 -0
- package/dist/models/LMSCourseExternalLecturerWorkflowModel.js +8 -0
- package/dist/models/LMSExternalCourseParticipationChatModel.d.ts +2 -0
- package/dist/models/LMSExternalCourseParticipationChatModel.js +8 -0
- package/dist/models/LMSExternalCourseParticipationWorkflowModel.d.ts +2 -0
- package/dist/models/LMSExternalCourseParticipationWorkflowModel.js +8 -0
- package/dist/models/LMSExternalEntityTrainedChatModel.d.ts +2 -0
- package/dist/models/LMSExternalEntityTrainedChatModel.js +8 -0
- package/dist/models/LMSExternalEntityTrainedWorkflowModel.d.ts +2 -0
- package/dist/models/LMSExternalEntityTrainedWorkflowModel.js +8 -0
- package/dist/models/LanguageCourseChatModel.d.ts +2 -0
- package/dist/models/LanguageCourseChatModel.js +8 -0
- package/dist/models/LanguageCourseWorkflowModel.d.ts +2 -0
- package/dist/models/LanguageCourseWorkflowModel.js +8 -0
- package/dist/models/LeaveChatModel.d.ts +2 -0
- package/dist/models/LeaveChatModel.js +8 -0
- package/dist/models/LeaveWorkFlowModel.d.ts +2 -0
- package/dist/models/LeaveWorkFlowModel.js +8 -0
- package/dist/models/MediaChatModel.d.ts +2 -0
- package/dist/models/MediaChatModel.js +8 -0
- package/dist/models/MediaWorkflowModel.d.ts +2 -0
- package/dist/models/MediaWorkflowModel.js +8 -0
- package/dist/models/MedicalExpensesChatModel.d.ts +2 -0
- package/dist/models/MedicalExpensesChatModel.js +8 -0
- package/dist/models/MedicalExpensesWorkflowModel.d.ts +1 -0
- package/dist/models/MedicalExpensesWorkflowModel.js +4 -0
- package/dist/models/MeetingChatModel.d.ts +2 -0
- package/dist/models/MeetingChatModel.js +8 -0
- package/dist/models/MeetingWorkflowModel.d.ts +2 -0
- package/dist/models/MeetingWorkflowModel.js +8 -0
- package/dist/models/MissionBankAccountChatModel.d.ts +2 -0
- package/dist/models/MissionBankAccountChatModel.js +8 -0
- package/dist/models/MissionBankAccountWorkflowModel.d.ts +2 -0
- package/dist/models/MissionBankAccountWorkflowModel.js +8 -0
- package/dist/models/MissionContractsChatModel.d.ts +2 -0
- package/dist/models/MissionContractsChatModel.js +8 -0
- package/dist/models/MissionContractsWorkflowModel.d.ts +1 -0
- package/dist/models/MissionContractsWorkflowModel.js +4 -0
- package/dist/models/MissionTravelChatModel.d.ts +1 -0
- package/dist/models/MissionTravelChatModel.js +4 -0
- package/dist/models/MissionTravelWorkflowModel.d.ts +2 -0
- package/dist/models/MissionTravelWorkflowModel.js +8 -0
- package/dist/models/NationalDayCelebrationsChatModel.d.ts +2 -0
- package/dist/models/NationalDayCelebrationsChatModel.js +8 -0
- package/dist/models/NationalDayCelebrationsWorkflowModel.d.ts +1 -0
- package/dist/models/NationalDayCelebrationsWorkflowModel.js +4 -0
- package/dist/models/RecruitmentDomesticWorkersChatModel.d.ts +2 -0
- package/dist/models/RecruitmentDomesticWorkersChatModel.js +8 -0
- package/dist/models/RecruitmentDomesticWorkersWorkflowModel.d.ts +1 -0
- package/dist/models/RecruitmentDomesticWorkersWorkflowModel.js +4 -0
- package/dist/models/RegisterCandidateChatModel.d.ts +2 -0
- package/dist/models/RegisterCandidateChatModel.js +8 -0
- package/dist/models/RegisterCandidateWorkflowModel.d.ts +2 -0
- package/dist/models/RegisterCandidateWorkflowModel.js +8 -0
- package/dist/models/RegisterVacancyChatModel.d.ts +2 -0
- package/dist/models/RegisterVacancyChatModel.js +8 -0
- package/dist/models/RegisterVacancyWorkflowModel.d.ts +2 -0
- package/dist/models/RegisterVacancyWorkflowModel.js +8 -0
- package/dist/models/RepatriationCitizensChatModel.d.ts +2 -0
- package/dist/models/RepatriationCitizensChatModel.js +8 -0
- package/dist/models/RepatriationCitizensWorkflowModel.d.ts +1 -0
- package/dist/models/RepatriationCitizensWorkflowModel.js +4 -0
- package/dist/models/RequestParcelChatModel.d.ts +2 -0
- package/dist/models/RequestParcelChatModel.js +8 -0
- package/dist/models/RequestParcelWorkflowModel.d.ts +2 -0
- package/dist/models/RequestParcelWorkflowModel.js +8 -0
- package/dist/models/RequestPassportChatModel.d.ts +2 -0
- package/dist/models/RequestPassportChatModel.js +8 -0
- package/dist/models/RequestPassportWorkflowModel.d.ts +2 -0
- package/dist/models/RequestPassportWorkflowModel.js +8 -0
- package/dist/models/ResignationTerminationChatModel.d.ts +2 -0
- package/dist/models/ResignationTerminationChatModel.js +8 -0
- package/dist/models/ResignationTerminationWorkflowModel.d.ts +2 -0
- package/dist/models/ResignationTerminationWorkflowModel.js +8 -0
- package/dist/models/RetiredCardChatsModel.d.ts +2 -0
- package/dist/models/RetiredCardChatsModel.js +8 -0
- package/dist/models/RetiredCardWorkFlowModel.d.ts +2 -0
- package/dist/models/RetiredCardWorkFlowModel.js +8 -0
- package/dist/models/SecurityChatsModel.d.ts +2 -0
- package/dist/models/SecurityChatsModel.js +8 -0
- package/dist/models/SlaApprovalsViewModel.js +47 -47
- package/dist/models/SlaMyRequestsViewModel.js +52 -52
- package/dist/models/StayAfterHoursChatModel.d.ts +2 -0
- package/dist/models/StayAfterHoursChatModel.js +8 -0
- package/dist/models/StayAfterHoursWorkflowModel.d.ts +2 -0
- package/dist/models/StayAfterHoursWorkflowModel.js +8 -0
- package/dist/models/TransferAllowanceChatModel.d.ts +2 -0
- package/dist/models/TransferAllowanceChatModel.js +8 -0
- package/dist/models/TransferAllowanceWorkflowModel.d.ts +1 -0
- package/dist/models/TransferAllowanceWorkflowModel.js +4 -0
- package/dist/models/TransferMissionChatModel.d.ts +2 -0
- package/dist/models/TransferMissionChatModel.js +8 -0
- package/dist/models/TransferMissionWorkflowModel.d.ts +2 -0
- package/dist/models/TransferMissionWorkflowModel.js +8 -0
- package/dist/models/TransferSalaryBankAccountChatModel.d.ts +2 -0
- package/dist/models/TransferSalaryBankAccountChatModel.js +8 -0
- package/dist/models/TransferSalaryBankAccountWorkflowModel.d.ts +1 -0
- package/dist/models/TransferSalaryBankAccountWorkflowModel.js +4 -0
- package/dist/models/UpdateAttendanceChatModel.d.ts +1 -0
- package/dist/models/UpdateAttendanceChatModel.js +4 -0
- package/dist/models/UpdateAttendanceWorkflowModel.d.ts +2 -0
- package/dist/models/UpdateAttendanceWorkflowModel.js +8 -0
- package/package.json +1 -1
- package/scripts/check-column-types.js +38 -38
- package/scripts/check-service-tables.js +42 -42
- package/scripts/sync-sla-reports-sql.js +95 -95
- package/sql/add_fm_workflow_chat_arabic_columns.sql +153 -0
- package/sql/sla-reports-sync.manifest.json +9 -8
- package/sql/sla_reports_admin_procedures.sql +283 -283
- package/sql/sla_reports_approvals_workbook.sql +383 -383
- package/sql/sla_reports_procedures.sql +874 -874
- package/sql/sla_requests_status_data_fix.sql +6 -0
- package/sql/sla_requests_status_to_varchar.sql +28 -28
- package/sql/vw_sla_approvals.sql +108 -108
- package/sql/vw_sla_my_requests.sql +55 -55
- package/src/data-source.ts +686 -686
- package/src/helpers/employee-evaluation-request.utils.ts +178 -178
- package/src/helpers/evaluation-eligibility.utils.ts +126 -126
- package/src/i18n/workflow-chat-i18n.json +320 -0
- package/src/i18n/workflow-chat-i18n.ts +5 -0
- package/src/i18n/workflow-chat-message.builder.ts +1405 -0
- package/src/index.ts +620 -618
- package/src/models/AppointmentChatModel.ts +6 -0
- package/src/models/AppointmentWorkflowModel.ts +6 -0
- package/src/models/AssistanceCitizensAbroadChatModel.ts +6 -0
- package/src/models/AssistanceCitizensAbroadWorkflowModel.ts +3 -0
- package/src/models/ChildrensEducationChatModel.ts +6 -0
- package/src/models/ChildrensEducationWorkflowModel.ts +3 -0
- package/src/models/DiplomaticAcademyChatModel.ts +6 -0
- package/src/models/DiplomaticAcademyRequestModel.ts +80 -80
- package/src/models/DiplomaticAcademyWorkflowModel.ts +6 -0
- package/src/models/DiplomaticChatsModel.ts +6 -0
- package/src/models/DiplomaticWorkFlowModel.ts +6 -0
- package/src/models/DocumentTranslationChatModel.ts +6 -0
- package/src/models/DocumentTranslationWorkflowModel.ts +6 -0
- package/src/models/DocumentationFileModel.ts +40 -40
- package/src/models/EarlyCheckoutChatModel.ts +6 -0
- package/src/models/EarlyCheckoutWorkflowModel.ts +6 -0
- package/src/models/EmbassyEvaluationChatModel.ts +3 -0
- package/src/models/EmbassyEvaluationCycleModel.ts +45 -45
- package/src/models/EmbassyEvaluationRequestModel.ts +59 -59
- package/src/models/EmbassyEvaluationWorkflowModel.ts +3 -0
- package/src/models/EmployeeCardChatsModel.ts +6 -0
- package/src/models/EmployeeCardWorkFlowModel.ts +8 -2
- package/src/models/EmployeeEvaluationAnswerModel.ts +26 -26
- package/src/models/EmployeeEvaluationChatModel.ts +3 -0
- package/src/models/EmployeeEvaluationWorkflowModel.ts +3 -0
- package/src/models/EmployeeOfMonthNominationChatModel.ts +3 -0
- package/src/models/EmployeeOfMonthNominationWorkflowModel.ts +3 -0
- package/src/models/EmployeeOfMonthSupportNominationChatModel.ts +3 -0
- package/src/models/EmployeeOfMonthSupportNominationWorkflowModel.ts +3 -0
- package/src/models/EvaluationEligibilitySettingModel.ts +51 -51
- package/src/models/EvaluationFormModel.ts +44 -44
- package/src/models/FinancialChatsModel.ts +6 -0
- package/src/models/FinancialWorkFlowModel.ts +6 -0
- package/src/models/FoodChatModel.ts +3 -0
- package/src/models/FoodWorkflowModel.ts +6 -0
- package/src/models/GatePassChatsModel.ts +6 -0
- package/src/models/GatePassWorkFlowModel.ts +8 -2
- package/src/models/GeneralServiceChatsModel.ts +6 -0
- package/src/models/GeneralServiceWorkFlowModel.ts +6 -0
- package/src/models/HallChatModel.ts +3 -0
- package/src/models/HallWorkflowModel.ts +6 -0
- package/src/models/HousingRentalAccommodationChatModel.ts +6 -0
- package/src/models/HousingRentalAccommodationWorkflowModel.ts +3 -0
- package/src/models/HousingRentalVehicleChatModel.ts +6 -0
- package/src/models/HousingRentalVehicleWorkflowModel.ts +3 -0
- package/src/models/InitiatorEmployeeNominationChatModel.ts +3 -0
- package/src/models/InitiatorEmployeeNominationWorkflowModel.ts +3 -0
- package/src/models/InnovativeEmployeeNominationChatModel.ts +3 -0
- package/src/models/InnovativeEmployeeNominationWorkflowModel.ts +3 -0
- package/src/models/IpeGrievanceChatModel.ts +3 -0
- package/src/models/IpeGrievanceWorkflowModel.ts +3 -0
- package/src/models/LMSCourseExternalLecturerChatModel.ts +6 -0
- package/src/models/LMSCourseExternalLecturerWorkflowModel.ts +6 -0
- package/src/models/LMSExternalCourseParticipationChatModel.ts +6 -0
- package/src/models/LMSExternalCourseParticipationWorkflowModel.ts +6 -0
- package/src/models/LMSExternalEntityTrainedChatModel.ts +6 -0
- package/src/models/LMSExternalEntityTrainedPersonModel.ts +45 -45
- package/src/models/LMSExternalEntityTrainedWorkflowModel.ts +6 -0
- package/src/models/LanguageCourseChatModel.ts +6 -0
- package/src/models/LanguageCourseRequestModel.ts +67 -67
- package/src/models/LanguageCourseWorkflowModel.ts +6 -0
- package/src/models/LeaveApprovalsModel.ts +66 -66
- package/src/models/LeaveChatModel.ts +7 -1
- package/src/models/LeaveConfigModel.ts +71 -71
- package/src/models/LeaveWorkFlowModel.ts +6 -0
- package/src/models/MediaChatModel.ts +6 -0
- package/src/models/MediaWorkflowModel.ts +6 -0
- package/src/models/MedicalExpensesChatModel.ts +6 -0
- package/src/models/MedicalExpensesWorkflowModel.ts +3 -0
- package/src/models/MeetingChatModel.ts +6 -0
- package/src/models/MeetingWorkflowModel.ts +6 -0
- package/src/models/MissionBankAccountChatModel.ts +6 -0
- package/src/models/MissionBankAccountWorkflowModel.ts +6 -0
- package/src/models/MissionContractsChatModel.ts +6 -0
- package/src/models/MissionContractsWorkflowModel.ts +3 -0
- package/src/models/MissionTravelApprovalModel.ts +101 -101
- package/src/models/MissionTravelAttachmentModel.ts +56 -56
- package/src/models/MissionTravelChatModel.ts +55 -52
- package/src/models/MissionTravelPersonModel.ts +105 -105
- package/src/models/MissionTravelWorkflowModel.ts +60 -54
- package/src/models/NationalDayCelebrationsChatModel.ts +6 -0
- package/src/models/NationalDayCelebrationsWorkflowModel.ts +3 -0
- package/src/models/ProjectContactsModel.ts +51 -51
- package/src/models/ProjectFaqModel.ts +36 -36
- package/src/models/ProjectInvoicesModel.ts +41 -41
- package/src/models/ProjectModel.ts +75 -75
- package/src/models/ProjectTasksModel.ts +75 -75
- package/src/models/RecruitmentDomesticWorkersChatModel.ts +6 -0
- package/src/models/RecruitmentDomesticWorkersWorkflowModel.ts +3 -0
- package/src/models/RegisterCandidateChatModel.ts +6 -0
- package/src/models/RegisterCandidateWorkflowModel.ts +6 -0
- package/src/models/RegisterVacancyChatModel.ts +6 -0
- package/src/models/RegisterVacancyWorkflowModel.ts +6 -0
- package/src/models/RepatriationCitizensChatModel.ts +6 -0
- package/src/models/RepatriationCitizensWorkflowModel.ts +3 -0
- package/src/models/RequestParcelChatModel.ts +6 -0
- package/src/models/RequestParcelWorkflowModel.ts +6 -0
- package/src/models/RequestPassportChatModel.ts +6 -0
- package/src/models/RequestPassportWorkflowModel.ts +6 -0
- package/src/models/ResignationTerminationChatModel.ts +6 -0
- package/src/models/ResignationTerminationWorkflowModel.ts +6 -0
- package/src/models/RetiredCardChatsModel.ts +6 -0
- package/src/models/RetiredCardWorkFlowModel.ts +8 -2
- package/src/models/SecurityChatsModel.ts +6 -0
- package/src/models/ServiceSlaApprovalModel.ts +63 -63
- package/src/models/ServicesNotificationConfigsModel.ts +55 -55
- package/src/models/SlaApprovalsViewModel.ts +135 -135
- package/src/models/SlaMyRequestsViewModel.ts +172 -172
- package/src/models/SlaRequestModel.ts +57 -57
- package/src/models/StayAfterHoursChatModel.ts +6 -0
- package/src/models/StayAfterHoursWorkflowModel.ts +6 -0
- package/src/models/TransferAllowanceChatModel.ts +6 -0
- package/src/models/TransferAllowanceWorkflowModel.ts +3 -0
- package/src/models/TransferMissionChatModel.ts +6 -0
- package/src/models/TransferMissionWorkflowModel.ts +6 -0
- package/src/models/TransferSalaryBankAccountChatModel.ts +6 -0
- package/src/models/TransferSalaryBankAccountWorkflowModel.ts +3 -0
- package/src/models/UpdateAttendanceChatModel.ts +3 -0
- package/src/models/UpdateAttendanceWorkflowModel.ts +6 -0
- package/src/sla-report-views.ts +3 -3
- package/tsconfig.json +1 -0
- package/dist/helpers/sla-request-status.helper.d.ts +0 -3
- package/dist/helpers/sla-request-status.helper.js +0 -36
- package/dist/models/EmbassyEvaluationDepartmentSettingModel.d.ts +0 -14
- package/dist/models/EmbassyEvaluationDepartmentSettingModel.js +0 -56
- package/dist/models/EvaluationMastersModel.d.ts +0 -16
- package/dist/models/EvaluationMastersModel.js +0 -67
- package/dist/models/EvaluationQuestionMasterModel.d.ts +0 -10
- package/dist/models/EvaluationQuestionMasterModel.js +0 -42
- package/dist/models/EvaluationSectionMasterModel.d.ts +0 -7
- package/dist/models/EvaluationSectionMasterModel.js +0 -36
- package/dist/models/EvaluationWorkflowModel.d.ts +0 -60
- package/dist/models/EvaluationWorkflowModel.js +0 -215
- package/dist/models/IneligibleForEvaluationModel.d.ts +0 -8
- package/dist/models/IneligibleForEvaluationModel.js +0 -44
- package/dist/models/MissionTravelClassConfigModel.d.ts +0 -10
- package/dist/models/MissionTravelClassConfigModel.js +0 -50
- package/dist/models/MissionTravelPerdiemModel.d.ts +0 -10
- package/dist/models/MissionTravelPerdiemModel.js +0 -54
- package/dist/models/UuidAuditModel.d.ts +0 -9
- package/dist/models/UuidAuditModel.js +0 -41
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
import type { EntityManager } from 'typeorm';
|
|
2
|
-
import { EmployeeEvaluationAnswers } from '../models/EmployeeEvaluationAnswerModel';
|
|
3
|
-
import { EmployeeEvaluationPersonScore } from '../models/EmployeeEvaluationPersonScoreModel';
|
|
4
|
-
import { EmployeeEvaluationRequests } from '../models/EmployeeEvaluationRequestModel';
|
|
5
|
-
import { EvaluationEligibilitySetting } from '../models/EvaluationEligibilitySettingModel';
|
|
6
|
-
import { EvaluationFormQuestion } from '../models/EvaluationFormQuestionModel';
|
|
7
|
-
import { isCalendarMonthInEligibilityRange } from './evaluation-eligibility.utils';
|
|
8
|
-
|
|
9
|
-
export const DEFAULT_MAX_EMPLOYEES_PER_REQUEST = 50;
|
|
10
|
-
|
|
11
|
-
export type EmployeeEvaluationSubmitAnswer = {
|
|
12
|
-
section_id: number;
|
|
13
|
-
question_id: number;
|
|
14
|
-
score: number;
|
|
15
|
-
remarks?: string | null;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type EmployeeEvaluationSubmitEmployee = {
|
|
19
|
-
user_id: number;
|
|
20
|
-
is_rca?: boolean;
|
|
21
|
-
answers: EmployeeEvaluationSubmitAnswer[];
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type NormalizedEmployeeSubmission = EmployeeEvaluationSubmitEmployee;
|
|
25
|
-
|
|
26
|
-
export function normalizeEmployeeSubmissions(raw: unknown): {
|
|
27
|
-
employees: NormalizedEmployeeSubmission[];
|
|
28
|
-
error?: string;
|
|
29
|
-
} {
|
|
30
|
-
if (!Array.isArray(raw) || raw.length === 0) {
|
|
31
|
-
return { employees: [], error: 'employees must be a non-empty array' };
|
|
32
|
-
}
|
|
33
|
-
const seen = new Set<number>();
|
|
34
|
-
const employees: NormalizedEmployeeSubmission[] = [];
|
|
35
|
-
for (const item of raw) {
|
|
36
|
-
if (item == null || typeof item !== 'object') {
|
|
37
|
-
return { employees: [], error: 'Each employee entry must be an object' };
|
|
38
|
-
}
|
|
39
|
-
const o = item as Record<string, unknown>;
|
|
40
|
-
const user_id = Number(o.user_id ?? o.employee_id);
|
|
41
|
-
if (!Number.isFinite(user_id) || user_id <= 0) {
|
|
42
|
-
return { employees: [], error: 'Each employee must have a valid user_id' };
|
|
43
|
-
}
|
|
44
|
-
if (seen.has(user_id)) {
|
|
45
|
-
return { employees: [], error: `Duplicate user_id ${user_id} in employees list` };
|
|
46
|
-
}
|
|
47
|
-
seen.add(user_id);
|
|
48
|
-
const answersRaw = o.answers;
|
|
49
|
-
if (!Array.isArray(answersRaw) || answersRaw.length === 0) {
|
|
50
|
-
return { employees: [], error: `Employee ${user_id} must include a non-empty answers array` };
|
|
51
|
-
}
|
|
52
|
-
const answers: EmployeeEvaluationSubmitAnswer[] = [];
|
|
53
|
-
const qSeen = new Set<number>();
|
|
54
|
-
for (const a of answersRaw) {
|
|
55
|
-
if (a == null || typeof a !== 'object') {
|
|
56
|
-
return { employees: [], error: `Invalid answer for employee ${user_id}` };
|
|
57
|
-
}
|
|
58
|
-
const ar = a as Record<string, unknown>;
|
|
59
|
-
const section_id = Number(ar.section_id);
|
|
60
|
-
const question_id = Number(ar.question_id);
|
|
61
|
-
const score = Number(ar.score);
|
|
62
|
-
if (!Number.isFinite(section_id) || !Number.isFinite(question_id)) {
|
|
63
|
-
return { employees: [], error: `section_id and question_id required for employee ${user_id}` };
|
|
64
|
-
}
|
|
65
|
-
if (!Number.isFinite(score) || score < 0) {
|
|
66
|
-
return { employees: [], error: `score must be a non-negative number for employee ${user_id}, question ${question_id}` };
|
|
67
|
-
}
|
|
68
|
-
if (qSeen.has(question_id)) {
|
|
69
|
-
return { employees: [], error: `Duplicate question_id ${question_id} for employee ${user_id}` };
|
|
70
|
-
}
|
|
71
|
-
qSeen.add(question_id);
|
|
72
|
-
answers.push({
|
|
73
|
-
section_id,
|
|
74
|
-
question_id,
|
|
75
|
-
score,
|
|
76
|
-
remarks: ar.remarks != null ? String(ar.remarks) : null,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
employees.push({
|
|
80
|
-
user_id,
|
|
81
|
-
is_rca: o.is_rca !== undefined ? Boolean(o.is_rca) : false,
|
|
82
|
-
answers,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return { employees };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** Resolve max employees from active exception cycle for the evaluation month. */
|
|
89
|
-
export async function resolveMaxEmployeesPerRequest(
|
|
90
|
-
manager: EntityManager,
|
|
91
|
-
month: number
|
|
92
|
-
): Promise<number> {
|
|
93
|
-
const rows = await manager
|
|
94
|
-
.getRepository(EvaluationEligibilitySetting)
|
|
95
|
-
.createQueryBuilder('s')
|
|
96
|
-
.where('s.is_deleted = false')
|
|
97
|
-
.andWhere('s.is_active = true')
|
|
98
|
-
.orderBy('s.id', 'DESC')
|
|
99
|
-
.getMany();
|
|
100
|
-
const setting =
|
|
101
|
-
rows.find((s) => isCalendarMonthInEligibilityRange(s.from_month, s.to_month, month)) ?? null;
|
|
102
|
-
const max = setting?.max_employees_per_request;
|
|
103
|
-
if (max != null && Number.isFinite(Number(max)) && Number(max) > 0) {
|
|
104
|
-
return Math.floor(Number(max));
|
|
105
|
-
}
|
|
106
|
-
return DEFAULT_MAX_EMPLOYEES_PER_REQUEST;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export async function persistEmployeeEvaluationScores(
|
|
110
|
-
manager: EntityManager,
|
|
111
|
-
opts: {
|
|
112
|
-
requestId: number;
|
|
113
|
-
formId: number;
|
|
114
|
-
createdBy: string;
|
|
115
|
-
employees: NormalizedEmployeeSubmission[];
|
|
116
|
-
}
|
|
117
|
-
): Promise<{ totalScore: number; averageScore: number; employeeCount: number }> {
|
|
118
|
-
const { requestId, formId, createdBy, employees } = opts;
|
|
119
|
-
let requestTotal = 0;
|
|
120
|
-
|
|
121
|
-
for (const emp of employees) {
|
|
122
|
-
let personTotal = 0;
|
|
123
|
-
for (const ans of emp.answers) {
|
|
124
|
-
const qMeta = await manager.findOne(EvaluationFormQuestion, {
|
|
125
|
-
where: { id: ans.question_id, is_deleted: false },
|
|
126
|
-
});
|
|
127
|
-
const questionSectionId = qMeta?.form_section_id;
|
|
128
|
-
if (!qMeta || questionSectionId == null || questionSectionId !== ans.section_id) {
|
|
129
|
-
throw new Error(`Invalid question ${ans.question_id} for section ${ans.section_id}`);
|
|
130
|
-
}
|
|
131
|
-
if (qMeta.max_score != null && ans.score > qMeta.max_score) {
|
|
132
|
-
throw new Error(
|
|
133
|
-
`score ${ans.score} exceeds max_score ${qMeta.max_score} for question ${ans.question_id}`
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
personTotal += ans.score;
|
|
137
|
-
await manager.save(
|
|
138
|
-
EmployeeEvaluationAnswers,
|
|
139
|
-
manager.create(EmployeeEvaluationAnswers, {
|
|
140
|
-
request_id: requestId,
|
|
141
|
-
user_id: emp.user_id,
|
|
142
|
-
form_id: formId,
|
|
143
|
-
section_id: ans.section_id,
|
|
144
|
-
question_id: ans.question_id,
|
|
145
|
-
score: ans.score,
|
|
146
|
-
remarks: ans.remarks ?? null,
|
|
147
|
-
created_by: createdBy,
|
|
148
|
-
is_deleted: false,
|
|
149
|
-
})
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
await manager.save(
|
|
154
|
-
EmployeeEvaluationPersonScore,
|
|
155
|
-
manager.create(EmployeeEvaluationPersonScore, {
|
|
156
|
-
request_id: requestId,
|
|
157
|
-
user_id: emp.user_id,
|
|
158
|
-
is_rca: Boolean(emp.is_rca),
|
|
159
|
-
us_feedback: null,
|
|
160
|
-
total_score: personTotal,
|
|
161
|
-
created_by: createdBy,
|
|
162
|
-
is_deleted: false,
|
|
163
|
-
})
|
|
164
|
-
);
|
|
165
|
-
requestTotal += personTotal;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const employeeCount = employees.length;
|
|
169
|
-
const averageScore = employeeCount ? requestTotal / employeeCount : 0;
|
|
170
|
-
await manager.update(EmployeeEvaluationRequests, { id: requestId }, {
|
|
171
|
-
total_score: requestTotal,
|
|
172
|
-
average_score: averageScore,
|
|
173
|
-
employee_count: employeeCount,
|
|
174
|
-
updated_by: createdBy,
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
return { totalScore: requestTotal, averageScore, employeeCount };
|
|
178
|
-
}
|
|
1
|
+
import type { EntityManager } from 'typeorm';
|
|
2
|
+
import { EmployeeEvaluationAnswers } from '../models/EmployeeEvaluationAnswerModel';
|
|
3
|
+
import { EmployeeEvaluationPersonScore } from '../models/EmployeeEvaluationPersonScoreModel';
|
|
4
|
+
import { EmployeeEvaluationRequests } from '../models/EmployeeEvaluationRequestModel';
|
|
5
|
+
import { EvaluationEligibilitySetting } from '../models/EvaluationEligibilitySettingModel';
|
|
6
|
+
import { EvaluationFormQuestion } from '../models/EvaluationFormQuestionModel';
|
|
7
|
+
import { isCalendarMonthInEligibilityRange } from './evaluation-eligibility.utils';
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_MAX_EMPLOYEES_PER_REQUEST = 50;
|
|
10
|
+
|
|
11
|
+
export type EmployeeEvaluationSubmitAnswer = {
|
|
12
|
+
section_id: number;
|
|
13
|
+
question_id: number;
|
|
14
|
+
score: number;
|
|
15
|
+
remarks?: string | null;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type EmployeeEvaluationSubmitEmployee = {
|
|
19
|
+
user_id: number;
|
|
20
|
+
is_rca?: boolean;
|
|
21
|
+
answers: EmployeeEvaluationSubmitAnswer[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type NormalizedEmployeeSubmission = EmployeeEvaluationSubmitEmployee;
|
|
25
|
+
|
|
26
|
+
export function normalizeEmployeeSubmissions(raw: unknown): {
|
|
27
|
+
employees: NormalizedEmployeeSubmission[];
|
|
28
|
+
error?: string;
|
|
29
|
+
} {
|
|
30
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
31
|
+
return { employees: [], error: 'employees must be a non-empty array' };
|
|
32
|
+
}
|
|
33
|
+
const seen = new Set<number>();
|
|
34
|
+
const employees: NormalizedEmployeeSubmission[] = [];
|
|
35
|
+
for (const item of raw) {
|
|
36
|
+
if (item == null || typeof item !== 'object') {
|
|
37
|
+
return { employees: [], error: 'Each employee entry must be an object' };
|
|
38
|
+
}
|
|
39
|
+
const o = item as Record<string, unknown>;
|
|
40
|
+
const user_id = Number(o.user_id ?? o.employee_id);
|
|
41
|
+
if (!Number.isFinite(user_id) || user_id <= 0) {
|
|
42
|
+
return { employees: [], error: 'Each employee must have a valid user_id' };
|
|
43
|
+
}
|
|
44
|
+
if (seen.has(user_id)) {
|
|
45
|
+
return { employees: [], error: `Duplicate user_id ${user_id} in employees list` };
|
|
46
|
+
}
|
|
47
|
+
seen.add(user_id);
|
|
48
|
+
const answersRaw = o.answers;
|
|
49
|
+
if (!Array.isArray(answersRaw) || answersRaw.length === 0) {
|
|
50
|
+
return { employees: [], error: `Employee ${user_id} must include a non-empty answers array` };
|
|
51
|
+
}
|
|
52
|
+
const answers: EmployeeEvaluationSubmitAnswer[] = [];
|
|
53
|
+
const qSeen = new Set<number>();
|
|
54
|
+
for (const a of answersRaw) {
|
|
55
|
+
if (a == null || typeof a !== 'object') {
|
|
56
|
+
return { employees: [], error: `Invalid answer for employee ${user_id}` };
|
|
57
|
+
}
|
|
58
|
+
const ar = a as Record<string, unknown>;
|
|
59
|
+
const section_id = Number(ar.section_id);
|
|
60
|
+
const question_id = Number(ar.question_id);
|
|
61
|
+
const score = Number(ar.score);
|
|
62
|
+
if (!Number.isFinite(section_id) || !Number.isFinite(question_id)) {
|
|
63
|
+
return { employees: [], error: `section_id and question_id required for employee ${user_id}` };
|
|
64
|
+
}
|
|
65
|
+
if (!Number.isFinite(score) || score < 0) {
|
|
66
|
+
return { employees: [], error: `score must be a non-negative number for employee ${user_id}, question ${question_id}` };
|
|
67
|
+
}
|
|
68
|
+
if (qSeen.has(question_id)) {
|
|
69
|
+
return { employees: [], error: `Duplicate question_id ${question_id} for employee ${user_id}` };
|
|
70
|
+
}
|
|
71
|
+
qSeen.add(question_id);
|
|
72
|
+
answers.push({
|
|
73
|
+
section_id,
|
|
74
|
+
question_id,
|
|
75
|
+
score,
|
|
76
|
+
remarks: ar.remarks != null ? String(ar.remarks) : null,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
employees.push({
|
|
80
|
+
user_id,
|
|
81
|
+
is_rca: o.is_rca !== undefined ? Boolean(o.is_rca) : false,
|
|
82
|
+
answers,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return { employees };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Resolve max employees from active exception cycle for the evaluation month. */
|
|
89
|
+
export async function resolveMaxEmployeesPerRequest(
|
|
90
|
+
manager: EntityManager,
|
|
91
|
+
month: number
|
|
92
|
+
): Promise<number> {
|
|
93
|
+
const rows = await manager
|
|
94
|
+
.getRepository(EvaluationEligibilitySetting)
|
|
95
|
+
.createQueryBuilder('s')
|
|
96
|
+
.where('s.is_deleted = false')
|
|
97
|
+
.andWhere('s.is_active = true')
|
|
98
|
+
.orderBy('s.id', 'DESC')
|
|
99
|
+
.getMany();
|
|
100
|
+
const setting =
|
|
101
|
+
rows.find((s) => isCalendarMonthInEligibilityRange(s.from_month, s.to_month, month)) ?? null;
|
|
102
|
+
const max = setting?.max_employees_per_request;
|
|
103
|
+
if (max != null && Number.isFinite(Number(max)) && Number(max) > 0) {
|
|
104
|
+
return Math.floor(Number(max));
|
|
105
|
+
}
|
|
106
|
+
return DEFAULT_MAX_EMPLOYEES_PER_REQUEST;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export async function persistEmployeeEvaluationScores(
|
|
110
|
+
manager: EntityManager,
|
|
111
|
+
opts: {
|
|
112
|
+
requestId: number;
|
|
113
|
+
formId: number;
|
|
114
|
+
createdBy: string;
|
|
115
|
+
employees: NormalizedEmployeeSubmission[];
|
|
116
|
+
}
|
|
117
|
+
): Promise<{ totalScore: number; averageScore: number; employeeCount: number }> {
|
|
118
|
+
const { requestId, formId, createdBy, employees } = opts;
|
|
119
|
+
let requestTotal = 0;
|
|
120
|
+
|
|
121
|
+
for (const emp of employees) {
|
|
122
|
+
let personTotal = 0;
|
|
123
|
+
for (const ans of emp.answers) {
|
|
124
|
+
const qMeta = await manager.findOne(EvaluationFormQuestion, {
|
|
125
|
+
where: { id: ans.question_id, is_deleted: false },
|
|
126
|
+
});
|
|
127
|
+
const questionSectionId = qMeta?.form_section_id;
|
|
128
|
+
if (!qMeta || questionSectionId == null || questionSectionId !== ans.section_id) {
|
|
129
|
+
throw new Error(`Invalid question ${ans.question_id} for section ${ans.section_id}`);
|
|
130
|
+
}
|
|
131
|
+
if (qMeta.max_score != null && ans.score > qMeta.max_score) {
|
|
132
|
+
throw new Error(
|
|
133
|
+
`score ${ans.score} exceeds max_score ${qMeta.max_score} for question ${ans.question_id}`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
personTotal += ans.score;
|
|
137
|
+
await manager.save(
|
|
138
|
+
EmployeeEvaluationAnswers,
|
|
139
|
+
manager.create(EmployeeEvaluationAnswers, {
|
|
140
|
+
request_id: requestId,
|
|
141
|
+
user_id: emp.user_id,
|
|
142
|
+
form_id: formId,
|
|
143
|
+
section_id: ans.section_id,
|
|
144
|
+
question_id: ans.question_id,
|
|
145
|
+
score: ans.score,
|
|
146
|
+
remarks: ans.remarks ?? null,
|
|
147
|
+
created_by: createdBy,
|
|
148
|
+
is_deleted: false,
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
await manager.save(
|
|
154
|
+
EmployeeEvaluationPersonScore,
|
|
155
|
+
manager.create(EmployeeEvaluationPersonScore, {
|
|
156
|
+
request_id: requestId,
|
|
157
|
+
user_id: emp.user_id,
|
|
158
|
+
is_rca: Boolean(emp.is_rca),
|
|
159
|
+
us_feedback: null,
|
|
160
|
+
total_score: personTotal,
|
|
161
|
+
created_by: createdBy,
|
|
162
|
+
is_deleted: false,
|
|
163
|
+
})
|
|
164
|
+
);
|
|
165
|
+
requestTotal += personTotal;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const employeeCount = employees.length;
|
|
169
|
+
const averageScore = employeeCount ? requestTotal / employeeCount : 0;
|
|
170
|
+
await manager.update(EmployeeEvaluationRequests, { id: requestId }, {
|
|
171
|
+
total_score: requestTotal,
|
|
172
|
+
average_score: averageScore,
|
|
173
|
+
employee_count: employeeCount,
|
|
174
|
+
updated_by: createdBy,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
return { totalScore: requestTotal, averageScore, employeeCount };
|
|
178
|
+
}
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Evaluation exception cycle dates are stored as MM-DD strings (e.g. 01-01, 05-31, 04-12).
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export type MmDdInterval = { start: number; end: number };
|
|
6
|
-
|
|
7
|
-
/** Validate and normalize MM-DD (e.g. 1-1 → 01-01). */
|
|
8
|
-
export function parseMonthDay(value: unknown): string | null {
|
|
9
|
-
if (value == null || value === '') return null;
|
|
10
|
-
const s = String(value).trim();
|
|
11
|
-
const m = /^(\d{1,2})-(\d{1,2})$/.exec(s);
|
|
12
|
-
if (!m) return null;
|
|
13
|
-
const month = parseInt(m[1], 10);
|
|
14
|
-
const day = parseInt(m[2], 10);
|
|
15
|
-
if (month < 1 || month > 12 || day < 1 || day > 31) return null;
|
|
16
|
-
return `${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function parseMmDdParts(mmDd: string): { month: number; day: number } | null {
|
|
20
|
-
const normalized = parseMonthDay(mmDd);
|
|
21
|
-
if (!normalized) return null;
|
|
22
|
-
const [month, day] = normalized.split('-').map(Number);
|
|
23
|
-
return { month, day };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Sortable key for MM-DD overlap checks (month * 100 + day). */
|
|
27
|
-
export function mmDdSortKey(mmDd: string): number {
|
|
28
|
-
const parts = parseMmDdParts(mmDd);
|
|
29
|
-
if (!parts) return 0;
|
|
30
|
-
return parts.month * 100 + parts.day;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function expandMmDdWindow(startMmDd: string, endMmDd: string): MmDdInterval[] {
|
|
34
|
-
const start = mmDdSortKey(startMmDd);
|
|
35
|
-
const end = mmDdSortKey(endMmDd);
|
|
36
|
-
if (start <= end) return [{ start, end }];
|
|
37
|
-
return [
|
|
38
|
-
{ start, end: 1231 },
|
|
39
|
-
{ start: 101, end },
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function linearIntervalsOverlap(a: MmDdInterval, b: MmDdInterval): boolean {
|
|
44
|
-
return a.start <= b.end && b.start <= a.end;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** True when two MM-DD windows share any calendar period. */
|
|
48
|
-
export function mmDdWindowsOverlap(
|
|
49
|
-
startA: string,
|
|
50
|
-
endA: string,
|
|
51
|
-
startB: string,
|
|
52
|
-
endB: string
|
|
53
|
-
): boolean {
|
|
54
|
-
const intervalsA = expandMmDdWindow(startA, endA);
|
|
55
|
-
const intervalsB = expandMmDdWindow(startB, endB);
|
|
56
|
-
for (const ia of intervalsA) {
|
|
57
|
-
for (const ib of intervalsB) {
|
|
58
|
-
if (linearIntervalsOverlap(ia, ib)) return true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Whether calendar month (1–12) falls within the inclusive MM-DD window. */
|
|
65
|
-
export function isCalendarMonthInEligibilityRange(
|
|
66
|
-
fromMmDd: string,
|
|
67
|
-
toMmDd: string,
|
|
68
|
-
calendarMonth: number
|
|
69
|
-
): boolean {
|
|
70
|
-
const from = parseMmDdParts(fromMmDd);
|
|
71
|
-
const to = parseMmDdParts(toMmDd);
|
|
72
|
-
if (!from || !to || calendarMonth < 1 || calendarMonth > 12) return false;
|
|
73
|
-
const fm = from.month;
|
|
74
|
-
const tm = to.month;
|
|
75
|
-
if (fm <= tm) return calendarMonth >= fm && calendarMonth <= tm;
|
|
76
|
-
return calendarMonth >= fm || calendarMonth <= tm;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Whether HOD submissions are still open for the active cycle on the reference date.
|
|
81
|
-
* Uses the day component of `evaluationEndMmDd` as the last submission day of each month in range.
|
|
82
|
-
*/
|
|
83
|
-
export function isEvaluationEligibilityWindowOpen(
|
|
84
|
-
fromMmDd: string,
|
|
85
|
-
toMmDd: string,
|
|
86
|
-
evaluationEndMmDd: string,
|
|
87
|
-
referenceDate: Date = new Date()
|
|
88
|
-
): boolean {
|
|
89
|
-
const month = referenceDate.getMonth() + 1;
|
|
90
|
-
const day = referenceDate.getDate();
|
|
91
|
-
if (!isCalendarMonthInEligibilityRange(fromMmDd, toMmDd, month)) return false;
|
|
92
|
-
const endParts = parseMmDdParts(evaluationEndMmDd);
|
|
93
|
-
if (!endParts) return false;
|
|
94
|
-
return day <= endParts.day;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function parseEligibilityDateRange(
|
|
98
|
-
fromInput: unknown,
|
|
99
|
-
toInput: unknown
|
|
100
|
-
): { from_month: string; to_month: string } | null {
|
|
101
|
-
const from_month = parseMonthDay(fromInput);
|
|
102
|
-
const to_month = parseMonthDay(toInput);
|
|
103
|
-
if (!from_month || !to_month) return null;
|
|
104
|
-
return { from_month, to_month };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** @deprecated Use parseMonthDay for MM-DD strings. */
|
|
108
|
-
export function parseEvaluationEndDay(input: unknown): number | null {
|
|
109
|
-
const mmDd = parseMonthDay(input);
|
|
110
|
-
if (!mmDd) return null;
|
|
111
|
-
const parts = parseMmDdParts(mmDd);
|
|
112
|
-
return parts?.day ?? null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/** @deprecated Use parseEligibilityDateRange for MM-DD strings. */
|
|
116
|
-
export function parseMonthRange(
|
|
117
|
-
fromInput: unknown,
|
|
118
|
-
toInput: unknown
|
|
119
|
-
): { from_month: number; to_month: number } | null {
|
|
120
|
-
const range = parseEligibilityDateRange(fromInput, toInput);
|
|
121
|
-
if (!range) return null;
|
|
122
|
-
const from = parseMmDdParts(range.from_month);
|
|
123
|
-
const to = parseMmDdParts(range.to_month);
|
|
124
|
-
if (!from || !to) return null;
|
|
125
|
-
return { from_month: from.month, to_month: to.month };
|
|
126
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation exception cycle dates are stored as MM-DD strings (e.g. 01-01, 05-31, 04-12).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type MmDdInterval = { start: number; end: number };
|
|
6
|
+
|
|
7
|
+
/** Validate and normalize MM-DD (e.g. 1-1 → 01-01). */
|
|
8
|
+
export function parseMonthDay(value: unknown): string | null {
|
|
9
|
+
if (value == null || value === '') return null;
|
|
10
|
+
const s = String(value).trim();
|
|
11
|
+
const m = /^(\d{1,2})-(\d{1,2})$/.exec(s);
|
|
12
|
+
if (!m) return null;
|
|
13
|
+
const month = parseInt(m[1], 10);
|
|
14
|
+
const day = parseInt(m[2], 10);
|
|
15
|
+
if (month < 1 || month > 12 || day < 1 || day > 31) return null;
|
|
16
|
+
return `${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function parseMmDdParts(mmDd: string): { month: number; day: number } | null {
|
|
20
|
+
const normalized = parseMonthDay(mmDd);
|
|
21
|
+
if (!normalized) return null;
|
|
22
|
+
const [month, day] = normalized.split('-').map(Number);
|
|
23
|
+
return { month, day };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Sortable key for MM-DD overlap checks (month * 100 + day). */
|
|
27
|
+
export function mmDdSortKey(mmDd: string): number {
|
|
28
|
+
const parts = parseMmDdParts(mmDd);
|
|
29
|
+
if (!parts) return 0;
|
|
30
|
+
return parts.month * 100 + parts.day;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function expandMmDdWindow(startMmDd: string, endMmDd: string): MmDdInterval[] {
|
|
34
|
+
const start = mmDdSortKey(startMmDd);
|
|
35
|
+
const end = mmDdSortKey(endMmDd);
|
|
36
|
+
if (start <= end) return [{ start, end }];
|
|
37
|
+
return [
|
|
38
|
+
{ start, end: 1231 },
|
|
39
|
+
{ start: 101, end },
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function linearIntervalsOverlap(a: MmDdInterval, b: MmDdInterval): boolean {
|
|
44
|
+
return a.start <= b.end && b.start <= a.end;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** True when two MM-DD windows share any calendar period. */
|
|
48
|
+
export function mmDdWindowsOverlap(
|
|
49
|
+
startA: string,
|
|
50
|
+
endA: string,
|
|
51
|
+
startB: string,
|
|
52
|
+
endB: string
|
|
53
|
+
): boolean {
|
|
54
|
+
const intervalsA = expandMmDdWindow(startA, endA);
|
|
55
|
+
const intervalsB = expandMmDdWindow(startB, endB);
|
|
56
|
+
for (const ia of intervalsA) {
|
|
57
|
+
for (const ib of intervalsB) {
|
|
58
|
+
if (linearIntervalsOverlap(ia, ib)) return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Whether calendar month (1–12) falls within the inclusive MM-DD window. */
|
|
65
|
+
export function isCalendarMonthInEligibilityRange(
|
|
66
|
+
fromMmDd: string,
|
|
67
|
+
toMmDd: string,
|
|
68
|
+
calendarMonth: number
|
|
69
|
+
): boolean {
|
|
70
|
+
const from = parseMmDdParts(fromMmDd);
|
|
71
|
+
const to = parseMmDdParts(toMmDd);
|
|
72
|
+
if (!from || !to || calendarMonth < 1 || calendarMonth > 12) return false;
|
|
73
|
+
const fm = from.month;
|
|
74
|
+
const tm = to.month;
|
|
75
|
+
if (fm <= tm) return calendarMonth >= fm && calendarMonth <= tm;
|
|
76
|
+
return calendarMonth >= fm || calendarMonth <= tm;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether HOD submissions are still open for the active cycle on the reference date.
|
|
81
|
+
* Uses the day component of `evaluationEndMmDd` as the last submission day of each month in range.
|
|
82
|
+
*/
|
|
83
|
+
export function isEvaluationEligibilityWindowOpen(
|
|
84
|
+
fromMmDd: string,
|
|
85
|
+
toMmDd: string,
|
|
86
|
+
evaluationEndMmDd: string,
|
|
87
|
+
referenceDate: Date = new Date()
|
|
88
|
+
): boolean {
|
|
89
|
+
const month = referenceDate.getMonth() + 1;
|
|
90
|
+
const day = referenceDate.getDate();
|
|
91
|
+
if (!isCalendarMonthInEligibilityRange(fromMmDd, toMmDd, month)) return false;
|
|
92
|
+
const endParts = parseMmDdParts(evaluationEndMmDd);
|
|
93
|
+
if (!endParts) return false;
|
|
94
|
+
return day <= endParts.day;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function parseEligibilityDateRange(
|
|
98
|
+
fromInput: unknown,
|
|
99
|
+
toInput: unknown
|
|
100
|
+
): { from_month: string; to_month: string } | null {
|
|
101
|
+
const from_month = parseMonthDay(fromInput);
|
|
102
|
+
const to_month = parseMonthDay(toInput);
|
|
103
|
+
if (!from_month || !to_month) return null;
|
|
104
|
+
return { from_month, to_month };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** @deprecated Use parseMonthDay for MM-DD strings. */
|
|
108
|
+
export function parseEvaluationEndDay(input: unknown): number | null {
|
|
109
|
+
const mmDd = parseMonthDay(input);
|
|
110
|
+
if (!mmDd) return null;
|
|
111
|
+
const parts = parseMmDdParts(mmDd);
|
|
112
|
+
return parts?.day ?? null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** @deprecated Use parseEligibilityDateRange for MM-DD strings. */
|
|
116
|
+
export function parseMonthRange(
|
|
117
|
+
fromInput: unknown,
|
|
118
|
+
toInput: unknown
|
|
119
|
+
): { from_month: number; to_month: number } | null {
|
|
120
|
+
const range = parseEligibilityDateRange(fromInput, toInput);
|
|
121
|
+
if (!range) return null;
|
|
122
|
+
const from = parseMmDdParts(range.from_month);
|
|
123
|
+
const to = parseMmDdParts(range.to_month);
|
|
124
|
+
if (!from || !to) return null;
|
|
125
|
+
return { from_month: from.month, to_month: to.month };
|
|
126
|
+
}
|