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

지원서 년도 드롭다운 추가 #42

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"zustand": "^4.4.7"
},
"scripts": {
"start": "export PORT=4000 && react-scripts start",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
Expand Down
6 changes: 3 additions & 3 deletions src/Apis/Applications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useGetApplicantInfo = (
return useQuery({
queryKey: ['getApplicantInfo', applicationQueryString],
queryFn: async () => {
const { page, application_status, student_name, recruitment_id } =
const { page, application_status, student_name, recruitment_id, year } =
applicationQueryString;
const pageNum = page ? `&page=${page}` : '';
const studentName = student_name
Expand All @@ -27,12 +27,12 @@ export const useGetApplicantInfo = (
: '';
const queryString =
application_status || student_name || recruitment_id || page
? `?application_status=${
? `&application_status=${
application_status ? application_status : ''
}${companyId}${studentName}${pageNum}`
: '';
const { data } = await instance.get<ApplicationResponse>(
`${router}${queryString}`
`${router}?year=${year}${queryString}`
);
return data;
},
Expand Down
1 change: 1 addition & 0 deletions src/Apis/Applications/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ApplicantInfoQueryStringType {
application_status: string | StatusType;
student_name: string;
recruitment_id: string;
year: string;
}

export interface TrainDate {
Expand Down
16 changes: 16 additions & 0 deletions src/Components/ApplicationView/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface PropsType {
export function ApplicationViewSearch({
refetchCompanyRecruitment,
}: PropsType) {
const date = new Date();
const {
applicationViewQueryString,
setDefaultApplicationViewQueryString,
Expand All @@ -24,6 +25,10 @@ export function ApplicationViewSearch({
setTimeout(refetchCompanyRecruitment);
};

const yearArray = Array.from({ length: 10 }, (_, idx) =>
(date.getFullYear() - idx).toString()
);

return (
<_.Container>
<_.Wrapper>
Expand Down Expand Up @@ -63,6 +68,17 @@ export function ApplicationViewSearch({
iconName="Search"
/>
</_.ContentWrapper>
<_.TitleText>년도</_.TitleText>
<_.ContentWrapper width={8.5}>
<DropDown
onChange={(year) =>
applicationViewQueryStringDropDown('year', year)
}
value={applicationViewQueryString.year}
width={95}
option={yearArray}
/>
</_.ContentWrapper>
<_.Btn>
<Button onClick={search}>조회</Button>
<Button
Expand Down
2 changes: 2 additions & 0 deletions src/Pages/PopUp/ApplicationPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import { AttachmentUrlType } from '../../../Apis/Applications/response';
import { useGetApplicantInfo } from '../../../Apis/Applications';

export function ApplicationPopup() {
const date = new Date();
const id = new URLSearchParams(window.location.search).get('id');
const [applicationQueryString] = useState<ApplicantInfoQueryStringType>({
application_status: 'APPROVED',
student_name: '',
recruitment_id: id ? id : '',
year: date.getFullYear().toString(),
});

const {
Expand Down
2 changes: 2 additions & 0 deletions src/Pages/PopUp/RecruitmentRequestPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import { AttachmentUrlType } from '../../../Apis/Applications/response';
import { useGetApplicantInfo } from '../../../Apis/Applications';

export function RecruitmentRequestPopup() {
const date = new Date();
const id = new URLSearchParams(window.location.search).get('id');
const [applicationQueryString] = useState<ApplicantInfoQueryStringType>({
application_status: 'REQUESTED',
student_name: '',
recruitment_id: id ? id : '',
year: date.getFullYear().toString(),
});

const {
Expand Down
2 changes: 2 additions & 0 deletions src/Store/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const useApplicationViewQueryString =
application_status: '',
student_name: '',
recruitment_id: '',
year: date.getFullYear().toString(),
},
applicationViewQueryStringHandler: (e) =>
set((prev) => ({
Expand All @@ -54,6 +55,7 @@ export const useApplicationViewQueryString =
application_status: '',
student_name: '',
recruitment_id: '',
year: date.getFullYear().toString(),
},
}),
setApplicationViewQueryString: (queryString) =>
Expand Down
Loading