- Added detailed descriptions for search parameters and API functionalities in survey-sales routes. - Improved documentation for inquiry-related hooks and types, enhancing clarity on their usage. - Refactored comments for better readability and consistency across the codebase.
82 lines
2.3 KiB
TypeScript
82 lines
2.3 KiB
TypeScript
'use client'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
import { SurveyBasicInfo } from '@/types/Survey'
|
|
|
|
export default function DataTable({ surveyDetail }: { surveyDetail: SurveyBasicInfo }) {
|
|
const router = useRouter()
|
|
|
|
/** 제출 상태 처리 */
|
|
const submitStatus = () => {
|
|
const { submissionTargetNm, submissionTargetId } = surveyDetail ?? {}
|
|
|
|
if (!submissionTargetNm) {
|
|
return null
|
|
}
|
|
|
|
if (!submissionTargetId) {
|
|
return <div>{submissionTargetNm}</div>
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
({submissionTargetNm} - {submissionTargetId})
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<div className="sale-data-table-wrap">
|
|
<table className="sale-data-table">
|
|
<colgroup>
|
|
<col style={{ width: '80px' }} />
|
|
<col />
|
|
</colgroup>
|
|
<tbody>
|
|
<tr>
|
|
<th>登録番号</th>
|
|
{surveyDetail?.srlNo?.startsWith('一時保存') ? (
|
|
<td>
|
|
<span className="text-red-500">仮保存</span>
|
|
</td>
|
|
) : (
|
|
<td>{surveyDetail?.srlNo}</td>
|
|
)}
|
|
</tr>
|
|
<tr>
|
|
<th>登録日</th>
|
|
<td>{surveyDetail?.regDt ? new Date(surveyDetail.regDt).toLocaleString() : ''}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>更新日時</th>
|
|
<td>{surveyDetail?.uptDt ? new Date(surveyDetail.uptDt).toLocaleString() : ''}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>提出可否</th>
|
|
<td>
|
|
{surveyDetail?.submissionStatus && surveyDetail?.submissionDate ? (
|
|
<>
|
|
<div>{new Date(surveyDetail.submissionDate).toLocaleString()}</div>
|
|
{submitStatus()}
|
|
</>
|
|
) : (
|
|
'-'
|
|
)}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>ダウンロード</th>
|
|
<td>
|
|
<button className="data-down" onClick={() => router.push(`/pdf/survey-sale/${surveyDetail.id}`)}>
|
|
HWJ現地調査票確認<i className="down-icon"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|