Skip to content

Commit

Permalink
[Fix] 테이블에러 수정 #1388
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangmin Park authored and Sangmin Park committed Apr 15, 2024
1 parent 42c09f4 commit 9de099c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function RecruitmentFilterOptions({ recruitId }: { recruitId: number }) {
useEffect(() => {
setAnswers(
recruitUserData.applicationResults.reduce((acc, recruit) => {
recruit.form?.forEach((formItem) => {
recruit.forms?.forEach((formItem) => {
if (formItem.inputType !== 'TEXT') {
formItem.checkedList?.forEach((item) => {
if (!acc.some((answer) => answer.checkId === item.checkId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ const ExpandableTableRow: React.FC<ExpandableTableRowProps> = ({
};

function renderTableCells(recruit: IrecruitUserTable, questions: string[]) {
console.log(recruit);
const answers = questions.map((question) => {
const formItem = recruit.form.find((form) => form.question === question);
const formItem = recruit.forms.find((form) => form.question === question);
if (!formItem) return 'N/A';

switch (formItem.inputType) {
Expand All @@ -62,19 +61,32 @@ function renderTableCells(recruit: IrecruitUserTable, questions: string[]) {
}
});

if (recruit.status === 'PASS') recruit.status = '합격';
else if (recruit.status === 'INTERVIEW_FAIL') {
recruit.status = '면접 불합격';
} else if (recruit.status === 'APPLICATION_FAIL') {
recruit.status = '지원서 불합격';
} else if (recruit.status === 'PROGRESS_DOCS') {
recruit.status = '면접 시간 발표 전';
} else if (recruit.status === 'INTERVIEW') {
recruit.status = '면접 시간 공개';
} else {
recruit.status = '심사중';
}

return (
<ExpandableTableRow
key={recruit.applicationId}
expandComponent={
<div style={{ padding: '16px' }}>
<div className={styles.expandableTableRow}>
<div>
<strong>intraId:</strong> {recruit.intraId}
</div>
<div>
<strong>status:</strong> {recruit.status}
</div>
{recruit.form &&
recruit.form.map((form, index) => (
{recruit.forms &&
recruit.forms.map((form, index) => (
<div key={index}>
<strong>{form.question}</strong>:{' '}
{form.answer
Expand Down
14 changes: 7 additions & 7 deletions hooks/recruitments/useRecruitmentUserFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ const useRecruitmentUserFilter = (recruitId: number) => {
// }
// );
const res = await instance.get(
`/admin/recruitments/${recruitId}/applicants`,
`/admin/recruitments/${recruitId}/applications`,
{
params: {
page: 1,
size: 20,
// question: questions,
checks: checklistIds.map((check) => check).join(','),
search: searchString,
// question: '',
// checks: checklistIds.map((check) => check).join(','),
// search: searchString,
},
}
);
Expand Down Expand Up @@ -73,9 +73,9 @@ const useRecruitmentUserFilter = (recruitId: number) => {
}, [searchString, checklistIds]);

const questions = recruitUserData.applicationResults.reduce(
(acc: string[], application: { form: { question: string }[] }) => {
if (application.form) {
application.form.forEach(({ question }) => {
(acc: string[], application: { forms: { question: string }[] }) => {
if (application.forms) {
application.forms.forEach(({ question }) => {
if (acc.indexOf(question) === -1) {
acc.push(question);
}
Expand Down
17 changes: 10 additions & 7 deletions styles/admin/recruitments/RecruitmentsUser.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
width: 100px;
margin: auto;
overflow-x: scroll;

.table {
width: max-content;
min-width: 100%;
Expand All @@ -28,14 +27,14 @@
&:nth-child(even) {
background-color: #fff;
}
.tableBodyItem {
padding: 10px;
font-size: $small-font;
line-height: 150%;
text-align: center;
}
}
}
.tableBodyItem {
padding: 10px;
font-size: $small-font;
line-height: 150%;
text-align: center;
}
}
}
.searchWrap {
Expand Down Expand Up @@ -64,6 +63,10 @@
}
}

.expandableTableRow {
padding: 16px;
}

.interview {
display: flex;
justify-content: center;
Expand Down
4 changes: 2 additions & 2 deletions types/admin/adminRecruitmentsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export interface IuserFormResponse {
export interface IrecruitUserTable {
applicationId: number;
intraId: string;
status?: '합격' | '불합격' | '심사중';
form: IuserFormResponse[];
status?: string;
forms: IuserFormResponse[];
}

export interface IrecruitArrayTable {
Expand Down

0 comments on commit 9de099c

Please sign in to comment.