Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make status display actually human-readable statuses #1581

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ export function RecruitmentGangAllApplicantsAdminPage() {
{ content: t(KEY.recruitment_recruiter_status), sortable: true },
];

const getStatusOption = (id: number | undefined): string => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gjerne flytt til en egen globalt tilgjengelig funksjon/hook. Og bruk RecruitmentStatusChoices konstantene istedenfor tall

Copy link
Contributor

@Snorre98 Snorre98 Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Til det siste; kan være verdt å vite at det finnes et issue på å hente choices fra backend og implementere de for dette formålet: #1575

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bruker RecruitmentStatusChoices nå:) @robines

switch (id) {
case 1:
return t(KEY.recruitment_application_status_accepted);
case 2:
return t(KEY.recruitment_application_status_called_rejected);
case 3:
return t(KEY.recruitment_application_status_automatic_rejection);
default:
return t(KEY.recruitment_application_no_status);
}
};

const data = applications.map((application) => {
const applicationURL = reverse({
pattern: ROUTES.frontend.admin_recruitment_applicant,
Expand All @@ -106,7 +119,7 @@ export function RecruitmentGangAllApplicantsAdminPage() {
{ content: <Link url={applicationURL}>{dbT(application.recruitment_position, 'name')}</Link> },
application.interview?.interview_time,
application.interview?.interview_location,
application.recruiter_status,
getStatusOption(application.recruiter_status),
],
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ export function ProcessedApplicants({ data, type, revertStateFunction }: Process
revertStateFunction && { content: '', sortable: false },
];

const getStatusOption = (id: number | undefined): string => {
switch (id) {
case 1:
return t(KEY.recruitment_application_status_accepted);
case 2:
return t(KEY.recruitment_application_status_called_rejected);
case 3:
return t(KEY.recruitment_application_status_automatic_rejection);
default:
return t(KEY.recruitment_application_no_status);
}
};

const rows = data.map((application) => {
const applicantName = `${application.user.first_name} ${application.user.last_name}`;
return {
Expand All @@ -51,7 +64,10 @@ export function ProcessedApplicants({ data, type, revertStateFunction }: Process
{ content: application.user?.email, value: application.user?.email },
{ content: application.interview?.interview_time, value: application.interview?.interview_time },
{ content: application.interview?.interview_location, value: application.interview?.interview_location },
{ content: application.recruiter_status, value: application.recruiter_status },
{
content: getStatusOption(application.recruiter_status),
value: application.recruiter_status,
},
revertStateFunction && {
content: (
<Button
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/i18n/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ export const KEY = {
recruitment_rejected_applications: 'recruitment_rejected_applications',
recruitment_hardtoget_applications: 'recruitment_hardtoget_applications',
recruitment_accepted_applications: 'recruitment_accepted_applications',
recruitment_application_status_accepted: 'recruitment_application_status_accepted',
recruitment_application_status_called_rejected: 'recruitment_application_status_called_rejected',
recruitment_application_status_automatic_rejection: 'recruitment_application_status_automatic_rejection',
recruitment_application_no_status: 'recruitment_application_no_status',
recruitment_rejected_applications_help_text: 'recruitment_rejected_applications_help_text',
recruitment_hardtoget_applications_help_text: 'recruitment_hardtoget_applications_help_text',
recruitment_accepted_applications_help_text: 'recruitment_accepted_applications_help_text',
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/i18n/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ export const nb = prepareTranslations({
[KEY.recruitment_rejected_applications]: 'Søkere som får automatisk avslag',
[KEY.recruitment_hardtoget_applications]: 'Søkere som har takket nei til stillingen',
[KEY.recruitment_accepted_applications]: 'Søkere vi har tatt opp',
[KEY.recruitment_application_status_accepted]: 'Ringt og takket ja',
[KEY.recruitment_application_status_called_rejected]: 'Ringt og takket nei',
[KEY.recruitment_application_status_automatic_rejection]: 'Automatisk avslag',
[KEY.recruitment_application_no_status]: 'Ingen status',
[KEY.recruitment_rejected_applications_help_text]:
'Disse vil få en automatisk epost om avslag dersom de ikke får tilbud om et annet verv.',
[KEY.recruitment_hardtoget_applications_help_text]:
Expand Down Expand Up @@ -814,6 +818,10 @@ export const en = prepareTranslations({
[KEY.recruitment_rejected_applications]: 'Automatically rejected applicants',
[KEY.recruitment_hardtoget_applications]: 'Applicants who declined the position',
[KEY.recruitment_accepted_applications]: 'Applicants we have contacted and accepted',
[KEY.recruitment_application_status_accepted]: 'Called and accepted',
[KEY.recruitment_application_status_called_rejected]: 'Called and rejected',
[KEY.recruitment_application_status_automatic_rejection]: 'Automatic rejection',
[KEY.recruitment_application_no_status]: 'No status',
[KEY.recruitment_rejected_applications_help_text]:
'These will get an automatic rejection email if they are not accepted for a different position',
[KEY.recruitment_hardtoget_applications_help_text]:
Expand Down
Loading