diff --git a/frontend/src/PagesAdmin/InterviewNotesAdminPage/InterviewNotesAdminPage.tsx b/frontend/src/PagesAdmin/InterviewNotesAdminPage/InterviewNotesAdminPage.tsx index 2c9e54062..43495eeef 100644 --- a/frontend/src/PagesAdmin/InterviewNotesAdminPage/InterviewNotesAdminPage.tsx +++ b/frontend/src/PagesAdmin/InterviewNotesAdminPage/InterviewNotesAdminPage.tsx @@ -14,27 +14,27 @@ export function InterviewNotesPage() { const recruitmentId = useParams().recruitmentId; const gangId = useParams().gangId; const positionId = useParams().positionId; + const userId = useParams().userId; const [editingMode, setEditingMode] = useState(false); const [recruitmentAdmission, setRecruitmentAdmission] = useState([]); + const [nameUser, setNameUser] = useState(''); const { t } = useTranslation(); + useEffect(() => { - if (positionId && recruitmentId && gangId) { + if (positionId && recruitmentId && gangId && userId) { getRecruitmentAdmissionsForGang(gangId, recruitmentId).then((response) => { const recruitmentAdmissions = response.data; const admission = recruitmentAdmissions.filter( - (admission) => admission.id.toString() === positionId && admission.interview && admission.interview.notes, + (admission) => + admission.id.toString() === positionId && admission.interview && userId === admission.user.id.toString(), ); setRecruitmentAdmission(admission); + setNameUser(admission[0].user.first_name + ' ' + admission[0].user.last_name); }); } - }, [recruitmentId, positionId, gangId]); + }, [recruitmentId, positionId, gangId, userId]); async function handleEditSave() { - if (recruitmentAdmission[0] === undefined) { - console.log('no interview notes found'); - toast.error(t(KEY.common_something_went_wrong)); - return; - } if (editingMode) { const updatedAdmission = { ...recruitmentAdmission[0], @@ -44,11 +44,9 @@ export function InterviewNotesPage() { }, }; try { - console.log('Saving this data:', updatedAdmission); - const response = await putRecruitmentAdmissionForGang(recruitmentAdmission[0].id.toString(), updatedAdmission); - console.log('Saved data response:', response); + await putRecruitmentAdmissionForGang(recruitmentAdmission[0].id.toString(), updatedAdmission); + toast.success(t(KEY.common_save_successful)); } catch (error) { - console.error('Error saving notes:', error); toast.error(t(KEY.common_something_went_wrong)); } } @@ -59,7 +57,7 @@ export function InterviewNotesPage() {
= { [KEY.common_long_description]: 'Lang beskrivelse', [KEY.common_short_description]: 'Kort beskrivelse', [KEY.common_back_to_samfundet]: 'Tilbake til samfundet.no', + [KEY.common_save_successful]: 'Lagring var vellykket', [KEY.common_delete_successful]: 'Slettingen var vellykket', [KEY.common_update_successful]: 'Oppdateringen var vellykket', [KEY.common_see_in_django_admin]: 'Se i django admin-panel', @@ -321,6 +322,7 @@ export const en: Record = { [KEY.common_long_description]: 'Long description', [KEY.common_short_description]: 'Short description', [KEY.common_back_to_samfundet]: 'Back to samfundet.no', + [KEY.common_save_successful]: 'Saving was successful', [KEY.common_delete_successful]: 'Deletion was successful', [KEY.common_update_successful]: 'The update was successful', [KEY.common_see_in_django_admin]: 'See in django admin-panel', diff --git a/frontend/src/routes/frontend.ts b/frontend/src/routes/frontend.ts index 759999c48..77a59dcee 100644 --- a/frontend/src/routes/frontend.ts +++ b/frontend/src/routes/frontend.ts @@ -67,7 +67,7 @@ export const ROUTES_FRONTEND = { admin_recruitment_gang_position_applicants_overview: '/control-panel/recruitment/:recruitmentId/gang/:gangId/position/:positionId', admin_recruitment_gang_position_applicants_interview_notes: - '/control-panel/recruitment/:recruitmentId/gang/:gangId/position/:positionId/interview-notes', + '/control-panel/recruitment/:recruitmentId/gang/:gangId/position/:positionId/interview-notes/:userId', // ==================== // // Development // // ==================== //