From 1209addadc2dcd483df2de7b5d0d41e15d18822f Mon Sep 17 00:00:00 2001 From: Joaquin Bravo Contreras Date: Tue, 5 Mar 2024 11:04:05 -0600 Subject: [PATCH] feat: allow edit status, project and mentor for applicants on any status --- app/routes/applicants.$applicantId._index.tsx | 97 ++++++++----------- 1 file changed, 43 insertions(+), 54 deletions(-) diff --git a/app/routes/applicants.$applicantId._index.tsx b/app/routes/applicants.$applicantId._index.tsx index d99b6c8..445c1d3 100644 --- a/app/routes/applicants.$applicantId._index.tsx +++ b/app/routes/applicants.$applicantId._index.tsx @@ -1,4 +1,5 @@ import ArrowBack from "@mui/icons-material/ArrowBack"; +import EditSharp from "@mui/icons-material/EditSharp"; import LinkedIn from "@mui/icons-material/LinkedIn"; import { Container, @@ -9,14 +10,14 @@ import { Autocomplete, debounce, Stack, + IconButton, + Typography, + type AutocompleteChangeReason, + Avatar, FormControl, InputLabel, Select, MenuItem, - type SelectChangeEvent, - Typography, - type AutocompleteChangeReason, - Avatar, } from "@mui/material"; import Grid from "@mui/material/Unstable_Grid2"; import { LoaderFunctionArgs } from "@remix-run/node"; @@ -135,8 +136,6 @@ export default function Applicant() { }); const [projectSelected, setProjectSelected] = useState(); - const fetcher = useFetcher(); - const navigation = useNavigation(); useEffect(() => { @@ -174,20 +173,6 @@ export default function Applicant() { ); }; - const changeStatus = async (event: SelectChangeEvent) => { - const body = { - applicantId: applicant.id as unknown as string, - projectId: applicant.projectId as string, - mentorId: applicant.mentorId as string, - status: event.target.value, - }; - - fetcher.submit(body, { - method: "post", - action: `/applicants/${applicant.id}/status`, - }); - }; - const searchProfilesDebounced = debounce(searchProfiles, 500); useEffect(() => { @@ -232,37 +217,25 @@ export default function Applicant() { {" "} - {navigation.state != "loading" && - canEditProject && - applicant.status === "DRAFT" ? ( - <> - - + {canEditProject ? ( + setOpenManageModal(true)} + > + + ) : null} - {canEditProject && applicant.status != "DRAFT" ? ( - - - - Status - - - + + + + Status: {applicant.status} + + + {applicant.projectName ? ( + ) : null} + {applicant.mentorPreferredName ? ( - - ) : null} + ) : null} +
@@ -394,7 +369,7 @@ export default function Applicant() { -

Select project and mentor

+

Edit internship status

- + + + Status + +