diff --git a/epictrack-api/src/api/actions/__init__.py b/epictrack-api/src/api/actions/__init__.py index c8b588725..fa3a7c926 100644 --- a/epictrack-api/src/api/actions/__init__.py +++ b/epictrack-api/src/api/actions/__init__.py @@ -23,3 +23,4 @@ from .set_work_decision_maker import SetWorkDecisionMaker from .set_work_state import SetWorkState from .change_phase_end_event import ChangePhaseEndEvent +from .set_project_state import SetProjectState diff --git a/epictrack-api/src/api/actions/base.py b/epictrack-api/src/api/actions/base.py index 0859ac77d..166c2c1d0 100644 --- a/epictrack-api/src/api/actions/base.py +++ b/epictrack-api/src/api/actions/base.py @@ -32,4 +32,5 @@ def get_additional_params( ActionEnum.SET_WORK_STATE: "SetWorkState", ActionEnum.CHANGE_PHASE_END_EVENT: "ChangePhaseEndEvent", ActionEnum.SET_FEDERAL_INVOLVEMENT: "SetFederalInvolvement", + ActionEnum.SET_PROJECT_STATE: "SetProjectState", } diff --git a/epictrack-api/src/api/actions/set_project_state.py b/epictrack-api/src/api/actions/set_project_state.py index 018ce88ab..7b0253a85 100644 --- a/epictrack-api/src/api/actions/set_project_state.py +++ b/epictrack-api/src/api/actions/set_project_state.py @@ -1,7 +1,7 @@ """Sets the state of the project""" from api.actions.base import ActionFactory from api.models.event import Event -from api.models.project import Project +from api.models.project import Project, ProjectStateEnum class SetProjectState(ActionFactory): @@ -10,5 +10,5 @@ class SetProjectState(ActionFactory): def run(self, source_event: Event, params) -> None: """Sets the federal involvement field to None""" project = Project.find_by_id(source_event.work.project_id) - project.project_state = params.get("project_state") + project.project_state = ProjectStateEnum(params.get("project_state")) project.update(project.as_dict(recursive=False), commit=False) diff --git a/epictrack-api/src/api/templates/event_templates/exemption_request/002_Exemption_Request.xlsx b/epictrack-api/src/api/templates/event_templates/exemption_request/002_Exemption_Request.xlsx index a26ecef8c..6d6c94701 100644 Binary files a/epictrack-api/src/api/templates/event_templates/exemption_request/002_Exemption_Request.xlsx and b/epictrack-api/src/api/templates/event_templates/exemption_request/002_Exemption_Request.xlsx differ diff --git a/epictrack-web/src/components/shared/MasterTrackTable/type.ts b/epictrack-web/src/components/shared/MasterTrackTable/type.ts index b69e9de22..ae72e3e09 100644 --- a/epictrack-web/src/components/shared/MasterTrackTable/type.ts +++ b/epictrack-web/src/components/shared/MasterTrackTable/type.ts @@ -1,4 +1,4 @@ export type ColumnFilter = { - id: string; - value: unknown -} \ No newline at end of file + id: string; + value: unknown; +}; diff --git a/epictrack-web/src/components/workPlan/event/EventForm.tsx b/epictrack-web/src/components/workPlan/event/EventForm.tsx index fdc04cebe..93f44fa40 100644 --- a/epictrack-web/src/components/workPlan/event/EventForm.tsx +++ b/epictrack-web/src/components/workPlan/event/EventForm.tsx @@ -234,15 +234,12 @@ const EventForm = ({ ctx.selectedWorkPhase?.work_phase.legislated && selectedConfiguration?.event_category_id !== EventCategory.EXTENSION ) { - const diff = dayjs(ctx.selectedWorkPhase.work_phase.end_date).diff( - ctx.selectedWorkPhase.work_phase.start_date, - "day" - ); return dayjs(ctx.selectedWorkPhase.work_phase.end_date); } return dayjs(new Date()); }, [ctx.selectedWorkPhase, selectedConfiguration]); - + console.log("Actual Date Min", actualDateMin); + console.log("Actual Date Max", actualDateMax); const methods = useForm({ resolver: yupResolver(schema), defaultValues: event, @@ -757,6 +754,7 @@ const EventForm = ({ isFormFieldsLocked={isFormFieldsLocked} configurationId={selectedConfiguration?.id} decisionMakerPositionId={decisionMakerPositionIds} + decisionMakerId={ctx.work?.decision_by_id} /> { @@ -48,11 +50,18 @@ const DecisionInput = ({ }; const getDecisionMakers = async () => { try { - const result = await staffService.getStaffByPosition( - decisionMakerPositionId.join(",") - ); - if (result.status === 200) { - setDecisionMakers(result.data as Staff[]); + if (decisionMakerId) { + const result = await staffService.getById(String(decisionMakerId)); + if (result.status === 200) { + setDecisionMakers([result.data as Staff]); + } + } else if (decisionMakerPositionId) { + const result = await staffService.getStaffByPosition( + decisionMakerPositionId.join(",") + ); + if (result.status === 200) { + setDecisionMakers(result.data as Staff[]); + } } } catch (e) { showNotification(COMMON_ERROR_MESSAGE, {