95 lines
5.1 KiB
TypeScript
95 lines
5.1 KiB
TypeScript
'use client'
|
|
import { SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, Title, UiTable } from '@common/business_components/ui'
|
|
import { Button, DatePicker, Input, Label } from '@common/components/ui'
|
|
import React, { useState } from 'react'
|
|
import FileUploadForm from '../../components/ui/fileUploadForm'
|
|
import ListDiv from '@common/business_components/ui/list_div'
|
|
import ContentLayout from '@/components/ui/contentLayout'
|
|
import { tableData } from '../oldPp/page'
|
|
import { getData } from '@/components/lib/api'
|
|
import { searchData } from '@/components/lib/common/apiHelpers'
|
|
import { tableHeadlist } from '..'
|
|
const formatDate = (date: Date): string => {
|
|
if(!date) return '';
|
|
const isoString = date.toISOString();
|
|
return isoString ? isoString.split('T')[0] || '' : '';
|
|
};
|
|
const Page = () => {
|
|
const [fromDate, setFromDate] = useState(new Date())
|
|
const [toDate, setToDate] = useState(new Date())
|
|
const [manageYear, setManageYear] = useState('')
|
|
const [mngQu, setMngQu] = useState('')
|
|
const [usr, setUsr] = useState('')
|
|
const [pjNm, setpjNm] = useState('')
|
|
// TODO: 초기값 세팅필요
|
|
return (
|
|
<ContentLayout title='도시침수 예방사업'>
|
|
<SearchDiv>
|
|
<SearchFormLeft>
|
|
<div className='flex items-center gap-4'>
|
|
<div className='flex items-center gap-2'>
|
|
<Label className="w-20 text-xl text-gray-600">등록기간</Label>
|
|
<DatePicker mode={'single'}
|
|
selected={fromDate}
|
|
onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} />
|
|
<span>~</span>
|
|
<DatePicker mode={'single'}
|
|
selected={toDate}
|
|
onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} />
|
|
</div>
|
|
<div className='flex items-center'>
|
|
<Label className="w-20 text-xl text-gray-600">관리년도</Label>
|
|
<Input
|
|
className='w-[100px]'
|
|
value={manageYear}
|
|
onChange={(e) => setManageYear(e.target.value)}
|
|
/>
|
|
<span>~</span>
|
|
<Input
|
|
className='w-[100px]'
|
|
value={mngQu}
|
|
onChange={(e) => setMngQu(e.target.value)}
|
|
/>
|
|
</div>
|
|
<div className='flex items-center'>
|
|
<Label className="w-20 text-xl text-gray-600">등록자</Label>
|
|
<Input
|
|
className='w-[100px]'
|
|
value={usr}
|
|
onChange={(e) => setUsr(e.target.value)}
|
|
/>
|
|
</div>
|
|
<div className='flex items-center'>
|
|
<Label className="w-20 text-xl text-gray-600">파일명</Label>
|
|
<Input
|
|
className='w-[100px]'
|
|
value={pjNm}
|
|
onChange={(e) => setpjNm(e.target.value)}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</SearchFormLeft>
|
|
<SearchFormRight>
|
|
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" onClick={()=>{searchData('v1/sbmrgPrevnt', {fromRegDt:formatDate(fromDate),fromMngYr:manageYear,toMngYr:mngQu,toRegDt:formatDate(toDate),atflNm:pjNm,rgtrNm:usr,page: '0',size: '10'})}} >조회</Button>
|
|
</SearchFormRight>
|
|
</SearchDiv>
|
|
<ListDiv className="mt-4">
|
|
<div className="card-header flex items-center justify-between">
|
|
<h3 className="text-2xl font-medium">사업정보 등록현황</h3>
|
|
<div>
|
|
<Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" >파일 다운로드</Button>
|
|
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" >삭제</Button>
|
|
</div>
|
|
</div>
|
|
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={10} children={undefined} cellClick={() => { }} onPageChange={function (page: number): void {
|
|
throw new Error('Function not implemented.')
|
|
}}></UiTable>
|
|
</ListDiv>
|
|
<ListDiv className="mt-4">
|
|
<FileUploadForm title='도시침수 예방사업 사업추진현황 등록' />
|
|
</ListDiv>
|
|
</ContentLayout>
|
|
)
|
|
}
|
|
|
|
export default Page |