Skip to content

Commit

Permalink
Merge pull request #56 from Team-inglo/feat/IGW-34/42-2
Browse files Browse the repository at this point in the history
Feat/igw 34/42 - 학력 생성, 수정 페이지 작업
  • Loading branch information
hyeona01 authored Oct 27, 2024
2 parents bb674bb + 7e00261 commit a50817f
Show file tree
Hide file tree
Showing 19 changed files with 804 additions and 115 deletions.
13 changes: 13 additions & 0 deletions src/api/resumes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,16 @@ export const deleteEtcLanguageLevel = async (id: number) => {
return response.data;
};

// 9.1 (유학생) 학교 검색하기
export const getSearchSchools = async ({
search,
page,
size
}:{
search: string;
page: string;
size: string;
}) => {
const response = await api.get(`/api/v1/users/schools/brief?search=${search}&page=${page}&size=${size}`);
return response.data;
};
4 changes: 4 additions & 0 deletions src/assets/icons/ManageResume/GraySearchIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 0 additions & 11 deletions src/components/ManageResume/ResumeEditSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ const ResumeEditSection = ({
// 삭제 핸들러 (데이터 삭제 시 해당 API 호출)
const handleDeleteIntroduction = () => {
deleteIntroductionMutation.mutate(undefined, {
onSuccess: () => {
console.log('Introduction 삭제');
// 필요 시 상태 업데이트나 추가 로직 실행
},
onError: (error) => {
console.error('Introduction 삭제 실패', error);
},
Expand All @@ -53,9 +49,6 @@ const ResumeEditSection = ({

const handleDeleteEducation = (id: number) => {
deleteEducationMutation.mutate(id, {
onSuccess: () => {
console.log(`Education 삭제: ${id}`);
},
onError: (error) => {
console.error(`Education 삭제 실패: ${id}`, error);
},
Expand All @@ -64,10 +57,6 @@ const ResumeEditSection = ({

const handleDeleteWorkExperience = (id: number) => {
deleteWorkExperienceMutation.mutate(id, {
onSuccess: () => {
console.log(`Work experience 삭제: ${id}`);
// 필요 시 상태 업데이트나 추가 로직 실행
},
onError: (error) => {
console.error(`Work experience 삭제 실패: ${id}`, error);
},
Expand Down
1 change: 0 additions & 1 deletion src/components/Profile/EditProfilePicture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const EditProfilePicture = ({
// 파일이 이미지 형식인지 확인
if (file && file.type.startsWith('image/')) {
onImageUpdate(file);
// console.log('components : ' + file);

const objectUrl = URL.createObjectURL(file); // 이미지 미리보기 URL 생성
setImagePreviewUrl(objectUrl); // 미리보기 URL 업데이트
Expand Down
157 changes: 157 additions & 0 deletions src/components/SetEducation/EducationPatch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import { InputType } from '@/types/common/input';
import Input from '@/components/Common/Input';
import Dropdown from '@/components/Common/Dropdown';
import { PostEducationType } from '@/types/postResume/postEducation';
import { EducationLevels } from '@/constants/manageResume';
import GraySearchIcon from '@/assets/icons/ManageResume/GraySearchIcon.svg?react';
import { useState } from 'react';
import SearchSchools from '@/components/SetEducation/SearchSchools';
import { School } from '@/types/api/document';

type EducationPatchProps = {
educationData: PostEducationType;
setEducationData: React.Dispatch<React.SetStateAction<PostEducationType>>;
schoolData: School;
};

const EducationPatch = ({
educationData,
setEducationData,
schoolData,
}: EducationPatchProps) => {
const [searchOpen, setSearchOpen] = useState<boolean>(false);
const [school, setSchool] = useState<School>(schoolData);

const handleSchoolChange = (school: School) => {
setSchool(school);
};

const handleInputChange = (
field: keyof PostEducationType,
value: string | number,
) => {
setEducationData((prev) => ({ ...prev, [field]: value }));
};

const handleDateChange = (
field: 'start_date' | 'end_date',
value: string,
) => {
handleInputChange(field, value.replace(/\//g, '-'));
};

return (
<>
{searchOpen && (
<SearchSchools
setSchool={handleSchoolChange}
setSearchOpen={setSearchOpen}
handleInputChange={handleInputChange}
/>
)}
<div className="p-6 flex flex-col gap-3">
<div className="head-1 mb-6 text-[#1E1926]">Modify Education</div>
{/* 교육 기관 타입 선택 */}
<div className="relative">
<p className="body-3 text-[#1E1926] px-1 py-2">
Education Levels<span className="text-[#EE4700] body-1">*</span>
</p>
<div className="absolute">
<Dropdown
value={educationData.education_level}
placeholder="2-Year university"
options={EducationLevels}
setValue={(value) => handleInputChange('education_level', value)}
/>
</div>
<div className="h-11" /> {/* absolute 만큼의 공간 차지 */}
</div>
{/* 학교명 선택 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Name Of School<span className="text-[#EE4700] body-1">*</span>
</p>
<div
className="w-full py-2.5 px-4 flex items-center gap-2.5 border border-solid border-[#EBEEF1] rounded-xl"
onClick={() => setSearchOpen(true)}
>
<GraySearchIcon />
{/* 선택되었다면, 선택한 학교명 */}
<p
className={`body-2 ${school ? 'text-[#1E1926]' : 'text-[#BDBDBD]'}`}
>
{school ? school.name : 'Search Name of school'}
</p>
</div>
</div>
{/* 전공 입력 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Department (major)<span className="text-[#EE4700] body-1">*</span>
</p>
<Input
inputType={InputType.TEXT}
placeholder="Education Title"
value={educationData.major}
onChange={(value) => handleInputChange('major', value)}
canDelete={false}
/>
</div>
{/* 학년 입력 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Grade<span className="text-[#EE4700] body-1">*</span>
</p>
<Input
inputType={InputType.TEXT}
placeholder="Grade"
value={String(educationData.grade)}
onChange={(value) => handleInputChange('grade', value)}
canDelete={false}
/>
</div>
{/* 학점 입력 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Credit<span className="text-[#EE4700] body-1">*</span>
</p>
<Input
inputType={InputType.TEXT}
placeholder="0.0"
value={String(educationData.gpa)}
onChange={(value) => handleInputChange('gpa', value)}
canDelete={false}
/>
</div>
{/* 입학 날짜 입력 */}
<div className="w-full">
<p className="body-3 text-[#1E1926] px-1 py-2">
Entrance Date <span className="text-[#EE4700] body-1">*</span>
</p>
<Dropdown
value={educationData.start_date.replace(/-/g, '/')}
placeholder="Select Date"
options={[]}
isCalendar={true}
setValue={(value) => handleDateChange('start_date', value)}
/>
</div>
{/* 졸업 날짜 입력 */}
<div className="w-full">
<p className="body-3 text-[#1E1926] px-1 py-2">
Graduation Date <span className="text-[#EE4700] body-1">*</span>
</p>
<Dropdown
value={educationData.end_date?.replace(/-/g, '/')}
placeholder="Select Date"
options={[]}
isCalendar={true}
setValue={(value) => handleDateChange('end_date', value)}
/>
</div>
</div>
</>
);
};

export default EducationPatch;
155 changes: 155 additions & 0 deletions src/components/SetEducation/EducationPost.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import { InputType } from '@/types/common/input';
import Input from '@/components/Common/Input';
import Dropdown from '@/components/Common/Dropdown';
import { InitailEducationType } from '@/types/postResume/postEducation';
import { EducationLevels } from '@/constants/manageResume';
import GraySearchIcon from '@/assets/icons/ManageResume/GraySearchIcon.svg?react';
import { useState } from 'react';
import SearchSchools from '@/components/SetEducation/SearchSchools';
import { School } from '@/types/api/document';

type EducationPostProps = {
educationData: InitailEducationType;
setEducationData: React.Dispatch<React.SetStateAction<InitailEducationType>>;
};

const EducationPost = ({
educationData,
setEducationData,
}: EducationPostProps) => {
const [searchOpen, setSearchOpen] = useState<boolean>(false);
const [school, setSchool] = useState<School>();

const handleSchoolChange = (school: School) => {
setSchool(school);
};

const handleInputChange = (
field: keyof InitailEducationType,
value: string | number,
) => {
setEducationData((prev) => ({ ...prev, [field]: value }));
};

const handleDateChange = (
field: 'start_date' | 'end_date',
value: string,
) => {
handleInputChange(field, value.replace(/\//g, '-'));
};

return (
<>
{searchOpen && (
<SearchSchools
setSchool={handleSchoolChange}
setSearchOpen={setSearchOpen}
handleInputChange={handleInputChange}
/>
)}
<div className="p-6 flex flex-col gap-3">
<div className="head-1 mb-6 text-[#1E1926]">Add Education</div>
{/* 교육 기관 타입 선택 */}
<div className="relative">
<p className="body-3 text-[#1E1926] px-1 py-2">
Education Levels<span className="text-[#EE4700] body-1">*</span>
</p>
<div className="absolute">
<Dropdown
value={educationData.education_level}
placeholder="2-Year university"
options={EducationLevels}
setValue={(value) => handleInputChange('education_level', value)}
/>
</div>
<div className="h-11" /> {/* absolute 만큼의 공간 차지 */}
</div>
{/* 학교명 선택 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Name Of School<span className="text-[#EE4700] body-1">*</span>
</p>
<div
className="w-full py-2.5 px-4 flex items-center gap-2.5 border border-solid border-[#EBEEF1] rounded-xl"
onClick={() => setSearchOpen(true)}
>
<GraySearchIcon />
{/* 선택되었다면, 선택한 학교명 */}
<p
className={`body-2 ${school ? 'text-[#1E1926]' : 'text-[#BDBDBD]'}`}
>
{school ? school.name : 'Search Name of school'}
</p>
</div>
</div>
{/* 전공 입력 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Department (major)<span className="text-[#EE4700] body-1">*</span>
</p>
<Input
inputType={InputType.TEXT}
placeholder="Education Title"
value={educationData.major}
onChange={(value) => handleInputChange('major', value)}
canDelete={false}
/>
</div>
{/* 학년 입력 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Grade<span className="text-[#EE4700] body-1">*</span>
</p>
<Input
inputType={InputType.TEXT}
placeholder="Grade"
value={String(educationData.grade)}
onChange={(value) => handleInputChange('grade', value)}
canDelete={false}
/>
</div>
{/* 학점 입력 */}
<div>
<p className="body-3 text-[#1E1926] px-1 py-2">
Credit<span className="text-[#EE4700] body-1">*</span>
</p>
<Input
inputType={InputType.TEXT}
placeholder="0.0"
value={String(educationData.gpa)}
onChange={(value) => handleInputChange('gpa', value)}
canDelete={false}
/>
</div>
{/* 입학 날짜 입력 */}
<div className="w-full">
<p className="body-3 text-[#1E1926] px-1 py-2">
Entrance Date <span className="text-[#EE4700] body-1">*</span>
</p>
<Dropdown
value={educationData.start_date.replace(/-/g, '/')}
placeholder="Select Date"
options={[]}
isCalendar={true}
setValue={(value) => handleDateChange('start_date', value)}
/>
</div>
{/* 졸업 날짜 입력 */}
<div className="w-full">
<p className="body-3 text-[#1E1926] px-1 py-2">
Graduation Date <span className="text-[#EE4700] body-1">*</span>
</p>
<Dropdown
value={educationData.end_date?.replace(/-/g, '/')}
placeholder="Select Date"
options={[]}
isCalendar={true}
setValue={(value) => handleDateChange('end_date', value)}
/>
</div>
</div>
</>
);
};

export default EducationPost;
Loading

0 comments on commit a50817f

Please sign in to comment.