Skip to content

Commit

Permalink
✨ feat: 최종 서류 작성 완료하기 api 연결 Team-inglo#127
Browse files Browse the repository at this point in the history
  • Loading branch information
naarang committed Nov 25, 2024
1 parent a203394 commit f3dee6b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/api/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export const patchInterviewFinish = async (id: number) => {
return response.data;
};

// 6.12 (유학생) 서류 작성 완료하기
export const patchWritingDocumentFinish = async (id: number) => {
const response = await api.patch(
`/users/user-owner-job-postings/${id}/step-filling-out-documents`,
);
return response.data;
};

// 6.13 (유학생) 유학생 담당자 검토 완료
export const patchContactCoordinator = async (id: number) => {
const response = await api.patch(
Expand Down
6 changes: 4 additions & 2 deletions src/components/ApplicationDetail/ApplicationDetailStep7.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { buttonTypeKeys } from '@/constants/components';
import Button from '@/components/Common/Button';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useParams } from 'react-router-dom';
import { ApplicationStepType } from '@/types/application/applicationItem';
import { APPLICATION_STEP } from '@/constants/application';

Expand All @@ -10,6 +10,8 @@ type ApplicationDetailStep7Props = {

const ApplicationDetailStep7 = ({ result }: ApplicationDetailStep7Props) => {
const navigate = useNavigate();
const { id } = useParams();


return (
<section className="flex flex-col items-center gap-[0.75rem] w-full px-[1.5rem] pt-[0.75rem] pb-[3.125rem]">
Expand All @@ -27,7 +29,7 @@ const ApplicationDetailStep7 = ({ result }: ApplicationDetailStep7Props) => {
fontColor="text-[#F4F4F9]"
isBorder={false}
title="Check the application documents"
onClick={() => navigate('/application-documents')}
onClick={() => navigate(`/application-documents/${id}`)}
/>
</section>
);
Expand Down
15 changes: 15 additions & 0 deletions src/hooks/api/useApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
patchContactCoordinator,
patchApplyHiKorea,
patchHiKoreaResult,
patchWritingDocumentFinish,
} from '@/api/application';
import { useMutation, useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
Expand Down Expand Up @@ -99,6 +100,20 @@ export const usePatchInterviewFinish = () => {
});
};

// 6.12 (유학생) 서류 작성 완료하기 훅
export const usePatchWritingDocumentFinish = (id: number) => {
const navigate = useNavigate();
return useMutation({
mutationFn: patchWritingDocumentFinish,
onSuccess: () => {
navigate(`/application/${id}`);
},
onError: (error) => {
console.error('서류 작성 완료하기 실패', error);
},
});
};

// 6.13 (유학생) 유학생 담당자 검토 완료 훅
export const usePatchContactCoordinator = () => {
return useMutation({
Expand Down
32 changes: 25 additions & 7 deletions src/pages/ApplicationDocuments/ApplicationDocumentsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import BottomButtonPanel from '@/components/Common/BottomButtonPanel';
import Button from '@/components/Common/Button';
import BaseHeader from '@/components/Common/Header/BaseHeader';
import DocumentCardList from '@/components/Document/DocumentCardList';
import { usePatchWritingDocumentFinish } from '@/hooks/api/useApplication';
import { useGetDocumentsEmployee } from '@/hooks/api/useDocument';
import { useCurrentPostIdEmployeeStore } from '@/store/url';
import { DocumentsSummaryResponse } from '@/types/api/document';
Expand All @@ -11,6 +12,9 @@ const ApplicationDocumentsPage = () => {
const navigate = useNavigate();
const { currentPostId } = useCurrentPostIdEmployeeStore();
const { data, isPending } = useGetDocumentsEmployee(Number(currentPostId));
const { mutate: submitDocuments } = usePatchWritingDocumentFinish(
Number(currentPostId),
);
return (
<div>
<BaseHeader
Expand All @@ -25,13 +29,27 @@ const ApplicationDocumentsPage = () => {
documents={data?.data as DocumentsSummaryResponse}
/>
<BottomButtonPanel>
<Button
type="large"
bgColor="bg-[#F4F4F9]"
fontColor="text-[#bdbdbd]"
isBorder={false}
title="Next"
/>
{data?.data.part_time_employment_permits?.status ===
'CONFIRMATION' &&
data?.data.standard_labor_contract?.status === 'CONFIRMATION' &&
data?.data.integrated_application?.hwp_url ? (
<Button
type="large"
bgColor={'bg-[#FEF387]'}
fontColor="text-[#1E1926]"
title="Next"
isBorder={false}
onClick={() => submitDocuments(Number(currentPostId))}
/>
) : (
<Button
type="large"
bgColor="bg-[#F4F4F9]"
fontColor="text-[#bdbdbd]"
isBorder={false}
title="Next"
/>
)}
</BottomButtonPanel>
</>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ApplicationResult/ApplicationResultPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ const ApplicationResultPage = () => {
Contract Feedback
</h3>
<textarea
className="px-[1rem] py-[0.75rem] border border-[#E2E5EB] rounded-[0.75rem] body-2"
className="px-[1rem] py-[0.75rem] border border-[#E2E5EB] rounded-[0.75rem] body-2 focus:outline-none"
placeholder="Write a contract review"
maxLength={200}
value={feedback}
onChange={(e) => setFeedback(e.target.value)}
/>
</section>
<footer className="fixed bottom-0 left-0 pt-[0.75rem] px-[1.5rem] pb-[3.125rem] bg-white">
<footer className="fixed w-full bottom-0 left-0 pt-[0.75rem] px-[1.5rem] pb-[3.125rem] bg-white">
<Button
type={buttonTypeKeys.LARGE}
bgColor={'bg-[#FEF387]'}
Expand Down

0 comments on commit f3dee6b

Please sign in to comment.