generated from kookmin-sw/cap-template
-
Notifications
You must be signed in to change notification settings - Fork 7
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
9 changed files
with
24,011 additions
and
1,932 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
5 changes: 5 additions & 0 deletions
5
front-end/timepay-manager/src/pages/InquiryPage/InquiryDetail.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,5 @@ | ||
import React from 'react'; | ||
|
||
export function InquiryDetail() { | ||
return <div>TransferPage</div>; | ||
} |
152 changes: 152 additions & 0 deletions
152
front-end/timepay-manager/src/pages/InquiryPage/InquiryPage.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,152 @@ | ||
import React from 'react'; | ||
import axios from 'axios'; | ||
import moment from 'moment'; | ||
|
||
import { useState, useEffect} from 'react'; | ||
import { Select, Table, Card } from 'antd'; | ||
import { ColumnsType } from 'antd/es/table'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { PATH } from '../../constants/path'; | ||
import './inquiry_main.css' | ||
|
||
|
||
type QNA = { | ||
"inquiryid": string, | ||
"title": string, | ||
"content": string, | ||
"inquiryDate": string, | ||
"replyStatus": string, | ||
"userId": string | ||
} | ||
|
||
export function InquiryPage() { | ||
const navigate = useNavigate(); | ||
|
||
const [qnaResponse, setQnaResponse] = useState<QNA[]>([]); | ||
const [filteredQnaResponse, setFilteredQnaResponse] = useState<QNA[]>([]); | ||
|
||
const [filteringStatus, setFilteringStatus] = useState("") | ||
const [filteringTitle, setFilteringTitle] = useState(""); | ||
|
||
const columns: ColumnsType<QNA> = [ | ||
{ | ||
title: '답변 상태', | ||
dataIndex: 'replyStatus', | ||
key: 'replyStatus', | ||
align: 'center', | ||
render: (text:string) =>{ | ||
let content = ''; | ||
let color = ''; | ||
|
||
if (text === 'PENDING') { | ||
content = '답변대기'; | ||
color = '#F1AF23'; | ||
} | ||
else { | ||
content = '답변완료'; | ||
color = '#C7C7C7'; | ||
} | ||
return <span style={{color}}>{content}</span> | ||
} | ||
}, | ||
{ | ||
title: '제목', | ||
dataIndex: 'title', | ||
key: 'title', | ||
align: 'center', | ||
}, | ||
{ | ||
title: '작성자', | ||
dataIndex: 'userId', | ||
key: 'userId', | ||
align: 'center', | ||
}, | ||
{ | ||
title: '작성일시', | ||
dataIndex: 'inquiryDate', | ||
key: 'inquiryDate', | ||
align: 'center', | ||
render: (date:string) => moment(date).format('YYYY-MM-DD HH:mm:ss') | ||
}, | ||
{ | ||
title: '문의번호', | ||
dataIndex: 'inquiryid', | ||
key: 'inquiryid', | ||
align: 'center', | ||
}, | ||
]; | ||
|
||
const status = [ | ||
{id:'', value: '전체'}, | ||
{id:'PENDING', value: '답변 대기',}, | ||
{id:'ANSWERED', value: '답변 완료',}, | ||
]; | ||
|
||
const getQnas = () => { | ||
axios.get<QNA[]>(PATH.SERVER + `api/v1/inquiries`, { | ||
}). | ||
then(response => { | ||
//console.log(response.data); | ||
setQnaResponse(response.data); | ||
setFilteredQnaResponse(response.data); | ||
}). | ||
catch(function(error){ | ||
console.log(error)}) | ||
}; | ||
|
||
|
||
useEffect(() => { | ||
getQnas(); | ||
}, []); | ||
|
||
const filterQnas = (searchText: string, searchStatus: string) => { | ||
|
||
let status = ''; | ||
if (searchStatus === '답변 대기') status = 'PENDING'; | ||
else if (searchStatus === '답변 완료') status = 'ANSWERED'; | ||
|
||
let filteredData = qnaResponse; | ||
|
||
// 상태가 입력된 경우 | ||
if (status !== '') { | ||
filteredData = filteredData.filter(qna => qna.replyStatus === status); | ||
} | ||
|
||
// 검색어가 입력된 경우 | ||
if (searchText !== '') { | ||
filteredData = filteredData.filter(qna => | ||
qna.title.toLowerCase().includes(searchText.toLowerCase()) || | ||
qna.content.toLowerCase().includes(searchText.toLowerCase()) | ||
|
||
); | ||
} | ||
|
||
|
||
setFilteredQnaResponse(filteredData); | ||
|
||
} | ||
|
||
const handleClick = (record : QNA) =>{ | ||
navigate(`/inquiries/${record.inquiryid}`); | ||
} | ||
|
||
return ( | ||
<div className='background'> | ||
<Card size = 'small' className='searchBox'> | ||
<Select options = {status} size = 'small' dropdownStyle={{textAlign : 'center'}} onChange={(e)=>setFilteringStatus(e)} defaultValue="상태" className="status"></Select> | ||
<span>검색어</span> | ||
<input onChange={(e) => setFilteringTitle(e.target.value)} className="inputbox" placeholder='제목, 내용, 혹은 작성자 입력'></input> | ||
<button onClick={() => filterQnas(filteringTitle, filteringStatus)} className="searchButton">검색</button> | ||
</Card> | ||
|
||
<Table columns={columns} dataSource={filteredQnaResponse} rowKey="inquiryid" size="middle" className='table' rowClassName={() => 'pointer'} | ||
onRow={(record, rowIndex) => { | ||
return { | ||
onDoubleClick: () => {handleClick(record)}, | ||
}; | ||
}} | ||
/> | ||
</div> | ||
); | ||
} |
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 @@ | ||
export { InquiryPage } from './InquiryPage'; |
76 changes: 76 additions & 0 deletions
76
front-end/timepay-manager/src/pages/InquiryPage/inquiry_main.css
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,76 @@ | ||
.background { | ||
background-color: #FFFFFF; | ||
|
||
position:relative; | ||
|
||
width:100%; | ||
height:100%; | ||
|
||
} | ||
|
||
.searchBox { | ||
position:absolute; | ||
top: 5%; | ||
left: 5%; | ||
|
||
width: 90%; | ||
|
||
} | ||
|
||
.searchBox .status{ | ||
position: relative; | ||
left: 0%; | ||
margin-right:3%; | ||
|
||
width: 15%; | ||
text-align: center; | ||
} | ||
|
||
.searchBox .inputbox{ | ||
margin-left:2%; | ||
|
||
width: 55%; | ||
height: 24px; | ||
} | ||
|
||
.searchBox .searchButton{ | ||
position: relative; | ||
margin-left:3%; | ||
|
||
width: 15%; | ||
height: 24px; | ||
|
||
border: 0px; | ||
border-radius: 5px; | ||
background-color: #444444; | ||
|
||
font-size: 12px; | ||
font-weight: 600; | ||
color: #FFFFFF; | ||
|
||
cursor:pointer; | ||
} | ||
|
||
.table { | ||
position: absolute; | ||
top:15%; | ||
left:5%; | ||
|
||
width:90%; | ||
height: 80%; | ||
|
||
/* font */ | ||
font-family: 'Lato'; | ||
font-style: normal; | ||
font-weight: 700; | ||
font-size: 10px; | ||
line-height: 100%; | ||
text-align: center; | ||
text-transform: uppercase; | ||
color: #000000; | ||
|
||
} | ||
|
||
.pointer { | ||
cursor: pointer; | ||
} |
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
Oops, something went wrong.