91 lines
4.0 KiB
TypeScript
91 lines
4.0 KiB
TypeScript
'use client'
|
|
import ContentLayout from '@/components/ui/contentLayout'
|
|
import { SearchDiv, SearchFormLeft, SelectBox, SearchFormRight, Form, UiTable } from '@common/business_components/ui'
|
|
import ListDiv from '@common/business_components/ui/list_div'
|
|
import { Button } from '@common/components/ui'
|
|
import React, { type ReactNode } from 'react'
|
|
type TitleName = {
|
|
mainTitle: string
|
|
firstCardTitle: string
|
|
secondCardTitle: string
|
|
}
|
|
type TableInfoData = {
|
|
headList: { id: string; title: string; align?: string; }[]
|
|
tableData: { [key: string]: string | number | boolean | object }[];
|
|
cellClickFunc: Function
|
|
onPageChangeFunc: Function
|
|
}
|
|
type BaseLayout = {
|
|
children: ReactNode
|
|
titleName: TitleName
|
|
form: any
|
|
onSubmitEvent: Function
|
|
graphBtn: boolean
|
|
tableInfoData: TableInfoData
|
|
}
|
|
// TODO: 나중에 이벤트 추가되면 파라미터 추가 필요 ?
|
|
/**
|
|
*
|
|
* @param children
|
|
* @param titleName : 메인 타이틀, 첫번째 요소 타이틀, 두번째 요소 타이틀
|
|
* @param form : zod 스키마
|
|
* @param onSubmitEvent : 폼 이벤트 처리
|
|
* @param graphBtn : 하단에 그래프 버튼 유무 처리
|
|
* @param tableInfoData : 하단 테이블 관련 props 항목
|
|
* @returns
|
|
*/
|
|
const BaseLayout = ({ children, titleName, form, onSubmitEvent, graphBtn, tableInfoData }: BaseLayout) => {
|
|
return (
|
|
<ContentLayout title={titleName.mainTitle}>
|
|
<SearchDiv>
|
|
<SearchFormLeft>
|
|
<SelectBox className="col-span-3" label='시설검색' selectArray={[{ text: '한강 유역청', val: '1' }]} onSelectValue={(val) => { }} selectClass={undefined} />
|
|
<SelectBox label='' selectArray={[{ text: '경기도', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
|
|
<SelectBox label='' selectArray={[{ text: '양평군', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
|
|
<SelectBox label='' selectArray={[{ text: '양평하수처리장', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
|
|
</SearchFormLeft>
|
|
<SearchFormRight>
|
|
<Button>조회</Button>
|
|
</SearchFormRight>
|
|
</SearchDiv>
|
|
<ListDiv>
|
|
<div className="card-header">
|
|
<h3 className="text-2xl font-medium">{titleName.firstCardTitle}</h3>
|
|
</div>
|
|
<Form {...form}>
|
|
<form onSubmit={form.handleSubmit(onSubmitEvent)}>
|
|
<div className="card !m-[1.2rem]">
|
|
{/* 폼 정보 입력 칸 */}
|
|
{children}
|
|
<div className="flex justify-end mt-1">
|
|
<Button type="submit">자료업로드</Button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</Form>
|
|
</ListDiv>
|
|
<ListDiv>
|
|
<div className="card-header flex items-center justify-between">
|
|
<h3 className="text-2xl font-medium">{titleName.secondCardTitle}</h3>
|
|
<div>
|
|
<Button className="!mr-[1.2rem]">삭제</Button>
|
|
{/* 그래프 있을 시 */}
|
|
{graphBtn ? <Button className="!mr-[1.2rem]">그래프</Button> : null}
|
|
</div>
|
|
</div>
|
|
<UiTable
|
|
headName=''
|
|
headlist={tableInfoData.headList}
|
|
tableData={tableInfoData.tableData}
|
|
total={0}
|
|
pageSize={10}
|
|
children={undefined}
|
|
cellClick={(e) => { tableInfoData.cellClickFunc(e) }}
|
|
onPageChange={(e) => { tableInfoData.onPageChangeFunc(e) }}
|
|
/>
|
|
</ListDiv>
|
|
</ContentLayout>
|
|
)
|
|
}
|
|
|
|
export default BaseLayout |