-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create overview of users without interviews (#664)
* Create overview of users without interviews
- Loading branch information
Showing
17 changed files
with
168 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
.../PagesAdmin/RecruitmentUsersWithoutInterview/RecruitmentUsersWithoutInterview.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.table_container { | ||
margin-top: 1.5em; | ||
} |
64 changes: 64 additions & 0 deletions
64
...tend/src/PagesAdmin/RecruitmentUsersWithoutInterview/RecruitmentUsersWithoutInterview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { InputField } from '~/Components'; | ||
import { Table } from '~/Components/Table'; | ||
import { getApplicantsWithoutInterviews } from '~/api'; | ||
import { RecruitmentUserDto } from '~/dto'; | ||
import { KEY } from '~/i18n/constants'; | ||
import { ROUTES } from '~/routes'; | ||
import { AdminPageLayout } from '../AdminPageLayout/AdminPageLayout'; | ||
import styles from './RecruitmentUsersWithoutInterview.module.scss'; | ||
|
||
export function RecruitmentUsersWithoutInterview() { | ||
const [users, setUsers] = useState<RecruitmentUserDto[]>([]); | ||
const [showSpinner, setShowSpinner] = useState<boolean>(true); | ||
const [searchQuery, setSearchQuery] = useState<string>(''); | ||
const { t } = useTranslation(); | ||
|
||
useEffect(() => { | ||
getApplicantsWithoutInterviews('1').then((response) => { | ||
setUsers(response.data); | ||
setShowSpinner(false); | ||
}); | ||
}, []); | ||
|
||
const tableColumns = [ | ||
{ content: t(KEY.common_username), sortable: true }, | ||
{ content: t(KEY.common_firstname), sortable: true }, | ||
{ content: t(KEY.common_lastname), sortable: true }, | ||
{ content: t(KEY.recruitment_number_of_applications), sortable: true }, | ||
]; | ||
|
||
function filterUsers(): RecruitmentUserDto[] { | ||
if (searchQuery === '') return users; | ||
const keywords = searchQuery.split(' '); | ||
return users.filter((user) => { | ||
const fieldsToSearch = [user.username, user.first_name, user.last_name].join(' ').toLowerCase(); | ||
for (const kw of keywords) { | ||
if (!fieldsToSearch.includes(kw.toLowerCase())) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}); | ||
} | ||
|
||
function userToTableRow(user: RecruitmentUserDto) { | ||
console.log(user.recruitment_admission_ids); | ||
return [ | ||
user.username, | ||
user.first_name, | ||
user.last_name, | ||
user.recruitment_admission_ids ? user.recruitment_admission_ids.length : 0, | ||
]; | ||
} | ||
|
||
return ( | ||
<AdminPageLayout title={'Test'} backendUrl={ROUTES.backend.samfundet__user} header={'Test'} loading={showSpinner}> | ||
<InputField icon="mdi:search" onChange={setSearchQuery} /> | ||
<div className={styles.table_container}> | ||
<Table columns={tableColumns} data={filterUsers().map((user) => userToTableRow(user))} /> | ||
</div> | ||
</AdminPageLayout> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
frontend/src/PagesAdmin/RecruitmentUsersWithoutInterview/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { RecruitmentUsersWithoutInterview } from './RecruitmentUsersWithoutInterview'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters