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

feat: 지원서 조회 페이지 합불 상태 표시 및 변경 버튼 추가 #212

Closed
wants to merge 8 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,31 @@ import { ApplicantReq } from "@/src/apis/applicant";
import { applicantDataFinder } from "@/src/functions/finder";
import Portfolio from "./Portfolio";
import { getApplicantPassState } from "@/src/functions/formatter";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import {
postApplicantPassState,
PostApplicantPassStateParams,
} from "@/src/apis/passState";
interface ApplicantResourceProps {
data: ApplicantReq[];
postId: string;
}

const ApplicantResource = ({ data, postId }: ApplicantResourceProps) => {
const queryClient = useQueryClient();
const { mutate: updateApplicantPassState } = useMutation({
mutationFn: (params: PostApplicantPassStateParams) =>
postApplicantPassState(params),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: [
"allApplicantsWithPassState",
applicantDataFinder(data, "generation"),
],
});
},
});

return (
<>
<div className="flex flex-col gap-1 mb-2">
Expand All @@ -20,9 +39,37 @@ const ApplicantResource = ({ data, postId }: ApplicantResourceProps) => {
data,
"field"
)}] ${applicantDataFinder(data, "name")}`}</Txt>
<Txt typography="h5" color="light_gray">
{getApplicantPassState(applicantDataFinder(data, "passState"))}
</Txt>
<div className="flex justify-between grow items-center">
<Txt typography="h5" color="light_gray" className="truncate">
{getApplicantPassState(applicantDataFinder(data, "passState")) ||
"에러 발생"}
</Txt>

<div className="flex gap-4">
<button
className="border rounded-lg px-4 py-2 truncate"
onClick={() => {
updateApplicantPassState({
applicantsId: applicantDataFinder(data, "id"),
afterState: "pass",
});
}}
>
합격
</button>
<button
className="border rounded-lg px-4 py-2 truncate"
onClick={() => {
updateApplicantPassState({
applicantsId: applicantDataFinder(data, "id"),
afterState: "non-pass",
});
}}
>
불합격
</button>
</div>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

해당 버튼은 관리자와 회장단에게만 보이는게 좋을 것 같아요 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

아 이부분은 작업은 했으나 push 를 안했었네요..!
반영했습니다!

</div>
</div>
<div className="flex gap-4 mb-8">
Expand Down