-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
170 additions
and
45 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...n/kotlin/com/example/cmc_be/domain/generation/repository/GenerationWeeksInfoRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {GetByGeneration} from "../types/user/GetByGeneration"; | ||
import {PageRequest, PageResponse} from "../../components/Table/type"; | ||
import {setSearchParams} from "../core/setSearchParams"; | ||
import request from "../core"; | ||
|
||
export const generationWeekApi = { | ||
|
||
getAllGenerationWeeksByGeneration: async (payload: GetByGeneration & PageRequest) => { | ||
const url = setSearchParams(`/admin/generations/date/page`, payload); | ||
return await request.get<PageResponse<GenerationWeekDTO>>(url); | ||
}, | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/webapp/src/apis/types/generationWeek/GenerationWeekDTO.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
interface GenerationWeekDTO { | ||
id: string; | ||
generation: string; | ||
week: string; | ||
hour: string; | ||
date: string; | ||
isOffline: string; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface GetByGeneration { | ||
generation: number; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
src/main/webapp/src/pages/generationWeek/GenerationWeekList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import {CButton, CFormInput} from '@coreui/react'; | ||
import {Column} from '@coreui/react/dist/components/table/types'; | ||
import {FlexBox} from 'components/FlexBox'; | ||
import Section from 'components/Section'; | ||
import useSelectSize from 'components/Select/useSelectSize'; | ||
import useQueryString from 'hooks/useQueryString'; | ||
import React, {Fragment, useState} from 'react'; | ||
import useQueryStringEffect from "../../hooks/useQueryStringEffect"; | ||
import {useInput} from "../../hooks/useInput"; | ||
import {useQuery} from "@tanstack/react-query"; | ||
import Table from "../../components/Table"; | ||
import {getTableResponseType} from "../../utils/getTableResponseType"; | ||
import Row from "../../components/Row"; | ||
import {generationWeekApi} from "../../apis/handlers/generationWeek"; | ||
|
||
const GENERATION_WEEK_COLUMNS: Column[] = [ | ||
{label: 'id', key: 'id'}, | ||
{label: '기수', key: 'generation'}, | ||
{label: '주차', key: 'week'}, | ||
{label: '날짜', key: 'date'}, | ||
// {label: '오프라인 유무', key: 'isOffline'}, | ||
]; | ||
|
||
const GenerationWeekList = () => { | ||
|
||
const {get} = useQueryString(); | ||
const [page, setPage] = useState(Number(get('page') || 0)); | ||
const [size, SizeSelect] = useSelectSize(() => setPage(0)); | ||
const [generation, onChangeGeneration, setGeneration] = useInput(get('searchValue') || '15'); | ||
|
||
const { | ||
data, | ||
status: httpStatus, | ||
refetch, | ||
} = useQuery( | ||
[page, size], | ||
() => | ||
generationWeekApi.getAllGenerationWeeksByGeneration( | ||
{ | ||
generation: parseInt(generation), | ||
page: page, | ||
size: size | ||
} | ||
), | ||
); | ||
|
||
useQueryStringEffect( | ||
{ | ||
page, | ||
size, | ||
}, | ||
[page, size], | ||
); | ||
|
||
return ( | ||
<> | ||
<Section | ||
body={ | ||
<> | ||
<Row.Custom label={'기수'}> | ||
<CFormInput | ||
placeholder='기수를 입력해주세요.' | ||
value={generation} | ||
type={'number'} | ||
onChange={onChangeGeneration} | ||
/> | ||
</Row.Custom> | ||
</> | ||
} | ||
footer={ | ||
<FlexBox gap={10}> | ||
<CButton onClick={() => refetch()}>검색</CButton> | ||
</FlexBox> | ||
} | ||
/> | ||
<Section | ||
body={ | ||
<Fragment> | ||
<Table | ||
column={GENERATION_WEEK_COLUMNS} | ||
paginationState={[page, setPage]} | ||
size={size} | ||
data={getTableResponseType({src: data?.contents, totalCnt: data?.totalCnt, page})} | ||
/> | ||
</Fragment> | ||
} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default GenerationWeekList; |