Merge commit '7e626b2566b8e31bd9afe03c934533d70ad032bc' into iipbs/wr/dev
iipbs_wr / build (push) Has been cancelled
iipbs_wr / build (push) Has been cancelled
This commit is contained in:
@@ -4,7 +4,7 @@ import { DEV_URL_FO, DEV_URL_WR } from "../config/";
|
||||
|
||||
|
||||
|
||||
export const getFectch = async( type:string , url: string) => {
|
||||
export const getFetch = async( type:string , url: string) => {
|
||||
const div = type === 'common' ? DEV_URL_FO : DEV_URL_WR
|
||||
const response = await fetch( div+url , {
|
||||
method: "GET",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { comCodeState, selectArray } from "@/app/store/common/code";
|
||||
import type { bdstAll } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { selectArray } from "@/app/store/common/code";
|
||||
import { selectClass, type bdstAll } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { getCity } from "@/components/lib/func/commom";
|
||||
import type { objSearchType } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import { FormField, FormUi, DatePicker, SelectBox } from "@common/business_components";
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import { useEffect } from "react";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
|
||||
export function HtdflRegForm({
|
||||
export default function HtdflRegForm({
|
||||
htdflForm,
|
||||
isModal,
|
||||
}: {
|
||||
@@ -35,7 +35,7 @@ export function HtdflRegForm({
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
function onSubmit(values: z.infer<typeof hdtflZod>) {
|
||||
const onSubmit=(values: z.infer<typeof hdtflZod>)=> {
|
||||
if (isModal) {
|
||||
htdflReg(values);
|
||||
} else {
|
||||
@@ -47,7 +47,7 @@ export function HtdflRegForm({
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
function cleanHtdflData(raw: any): z.infer<typeof hdtflZod> {
|
||||
const cleanHtdflData=(raw: any): z.infer<typeof hdtflZod> =>{
|
||||
return {
|
||||
...raw,
|
||||
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null),
|
||||
@@ -71,6 +71,10 @@ export function HtdflRegForm({
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
@@ -87,7 +91,7 @@ export function HtdflRegForm({
|
||||
<div>
|
||||
<div className="grid grid-cols-12">
|
||||
<h1 className="pl-3 text-xl col-span-10">○온배수 시설 정보</h1>
|
||||
<Button type="submit" className="mr-4 rounded-lg col-span-2">
|
||||
<Button size={"sm"} type="submit" className="col-start-12 col-span-1">
|
||||
저장
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -16,24 +16,9 @@ const formSchema = z.object({
|
||||
facilityName: z.string().min(2).max(50),
|
||||
});
|
||||
|
||||
|
||||
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
return (<>
|
||||
<TableRow>{
|
||||
upHeadList.map((head: TableUpperProps) =>
|
||||
(!head.upSequnce ? <TableHead rowSpan={2} key={head.id}>{head.title}</TableHead> :
|
||||
head.upName === 'upChangeRe' && head.upSequnce === 1 ? <TableHead key={head.id} rowSpan={1} colSpan={2}>{'운영대행기간'}</TableHead> : null))}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
(head.upName === 'upChangeRe' ? <TableHead key={head.id}>{head.title}</TableHead> : null))}
|
||||
</TableRow>
|
||||
</>)
|
||||
}
|
||||
export function PbnstBuseForm() {
|
||||
const { pubFac } = useWrStore((state) => state);
|
||||
const { pubMngUpHeadList, erctUswtrCd,cyclCd,seCd,buseCd,rprcsCd,buseMet,rprcLoCd} = pubFac;
|
||||
const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
const { code ,pubFac } = useWrStore((state) => state);
|
||||
const { pubMngUpHeadList} = pubFac;
|
||||
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
@@ -79,7 +64,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
name="name_1486273033"
|
||||
render={({ field }) => (
|
||||
<FormUi label=''>
|
||||
<SelectBox label='' selectArray={cyclCd} className={""} selectClass={selectClass} onSelectValue={onSelectValue } {...field}></SelectBox>
|
||||
<SelectBox label='' selectArray={code.yn} className={""} selectClass={selectClass} onSelectValue={() =>{} } {...field}></SelectBox>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -103,7 +88,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
name="name_8928357542"
|
||||
render={({ field }) => (
|
||||
<FormUi label="구분">
|
||||
<SelectBox selectArray={seCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue} />
|
||||
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={()=>{} } />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -115,7 +100,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
name="name_9484942814"
|
||||
render={({ field }) => (
|
||||
<FormUi label="사업방식">
|
||||
<SelectBox selectArray={buseMet} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue}/>
|
||||
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={()=>{} }/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -276,7 +261,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
name="name_5139286452"
|
||||
render={({ field }) => (
|
||||
<FormUi label="재처리방식">
|
||||
<SelectBox selectArray={rprcsCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue }/>
|
||||
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={() =>{} }/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -288,7 +273,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
name="name_7233630277"
|
||||
render={({ field }) => (
|
||||
<FormUi label="위치(처리장 내외)">
|
||||
<SelectBox selectArray={rprcLoCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue}/>
|
||||
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={()=>{} }/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -355,7 +340,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
name="name_5139286452"
|
||||
render={({ field }) => (
|
||||
<FormUi label="눙축수처리방식">
|
||||
<SelectBox selectArray={erctUswtrCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue}/>
|
||||
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={() =>{}}/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
type TableUpperProps,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { fcltOperInfoType, ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
|
||||
import { PbnstMngModal } from "@/components/ui/modal/pbnstMng/component";
|
||||
|
||||
const formSchema = z.object({
|
||||
fcltNm: z.string().min(2).max(50),
|
||||
@@ -33,9 +32,8 @@ const formSchema = z.object({
|
||||
|
||||
|
||||
export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
|
||||
const { pubFac, pubMng } = useWrStore((state) => state);
|
||||
const { pubFac } = useWrStore((state) => state);
|
||||
const { pubMngUpHeadList, isInit } = pubFac;
|
||||
const { fcltOperInfo } = pubMng;
|
||||
const [ruseOperData, setRuseOperData] = useState<fcltOperInfoType[]>();
|
||||
const [files, setFiles] = useState(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
@@ -58,11 +56,7 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
|
||||
const selectOptions = data?.map((item) => ({text: item.fcltNm, val: item.pbnstRuseFcltPk})) || [{text:'없음', val:'1'}];
|
||||
|
||||
const onSelectValue = (val: string) => {
|
||||
const selectedData = data?.find((item) => item.pbnstRuseFcltPk === val);
|
||||
if (selectedData) {
|
||||
form.reset(selectedData);
|
||||
setRuseOperData(fcltOperInfo.filter((item) => item.pbnstRuseFcltPk === val));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -128,7 +122,7 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
|
||||
selectArray={selectOptions}
|
||||
className={""}
|
||||
selectClass={selectClass}
|
||||
onSelectValue={onSelectValue}
|
||||
onSelectValue={()=>{}}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
@@ -177,13 +171,14 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
|
||||
</div>
|
||||
<div className="h-[200px] overflow-y-auto">
|
||||
<UiTable
|
||||
tableData={ruseOperData?ruseOperData:[]}
|
||||
tableData={[]}
|
||||
headlist={pubMngUpHeadList}
|
||||
pageSize={100}
|
||||
total={-1}
|
||||
headName={""}
|
||||
cellClick={() => {}}
|
||||
>
|
||||
cellClick={() => { } } onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} } >
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
|
||||
@@ -12,11 +12,11 @@ import { Form, FormField, SelectBox } from "@common/business_components/ui";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm, type UseFormReturn } from "react-hook-form";
|
||||
import { useForm, useWatch, type UseFormReturn } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
|
||||
export function RainRegForm({
|
||||
export default function RainRegForm({
|
||||
rainForm,
|
||||
isModal,
|
||||
}: {
|
||||
@@ -25,7 +25,6 @@ export function RainRegForm({
|
||||
}) {
|
||||
const { code, rainReg, rainUpdate, rain } = useWrStore((state) => state);
|
||||
const { rainFcltCd } = code;
|
||||
|
||||
const defaultValues: z.infer<typeof rainZod> = rainZod.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof rainZod>>({
|
||||
@@ -33,11 +32,13 @@ export function RainRegForm({
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
const [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctYn] = form.watch([
|
||||
"reuseBuilding.0.grntchBdstCertYn",
|
||||
"reuseBuilding.0.instlCstSprtYn",
|
||||
"reuseBuilding.0.rainyObj.filtrTrtmfctYn",
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
function cleanRainData(raw: any): z.infer<typeof rainZod> {
|
||||
const cleanRainData =(raw: any): z.infer<typeof rainZod> =>{
|
||||
return {
|
||||
...raw,
|
||||
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt||null),
|
||||
@@ -56,7 +57,19 @@ export function RainRegForm({
|
||||
};
|
||||
}
|
||||
|
||||
useEffect(() =>{
|
||||
if(grntchBdstCertYn ==='N'){
|
||||
form.setValue('reuseBuilding.0.grntchBdstCertYr' ,"" )
|
||||
form.setValue('reuseBuilding.0.grntchBdstCertNo' ,"" )
|
||||
form.setValue('reuseBuilding.0.grntchBdstCertGrd' ,"" )
|
||||
|
||||
}else if(instlCstSprtYn ==='N'){
|
||||
form.setValue('reuseBuilding.0.instlCstSprtAmt' ,0 )
|
||||
}else if(filtrTrtmfctYn ==='N'){
|
||||
form.setValue('reuseBuilding.0.rainyObj.filtrTrtmfctCpct' ,0 )
|
||||
form.setValue('reuseBuilding.0.rainyObj.filtrTrtmfctPrs' ,"" )
|
||||
}
|
||||
},[grntchBdstCertYn,instlCstSprtYn ,filtrTrtmfctYn])
|
||||
|
||||
|
||||
// form 값이 변경될 때마다 로그 출력
|
||||
@@ -65,23 +78,21 @@ export function RainRegForm({
|
||||
return () => subscription.unsubscribe();
|
||||
}, [form]);
|
||||
|
||||
|
||||
|
||||
|
||||
function onSubmit(values: z.infer<typeof rainZod>) {
|
||||
|
||||
if (isModal) {
|
||||
|
||||
rainReg(values);
|
||||
} else {
|
||||
rainUpdate(values);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
|
||||
|
||||
|
||||
|
||||
const onSubmit =(values: z.infer<typeof rainZod>)=> {
|
||||
if (isModal) {
|
||||
rainReg(values);
|
||||
} else {
|
||||
rainUpdate(values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if(rainZod)
|
||||
@@ -89,6 +100,9 @@ export function RainRegForm({
|
||||
}, [rainForm]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className="">
|
||||
<Form {...form}>
|
||||
@@ -147,7 +161,7 @@ export function RainRegForm({
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
type="number"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value === "" ? "" : Number(e.target.value));
|
||||
@@ -195,7 +209,7 @@ export function RainRegForm({
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
type="number"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
@@ -236,9 +250,10 @@ export function RainRegForm({
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
type="number"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
readOnly={filtrTrtmfctYn!=='Y'}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -257,6 +272,7 @@ export function RainRegForm({
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
readOnly={filtrTrtmfctYn!=='Y'}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -285,6 +301,7 @@ export function RainRegForm({
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -299,12 +316,13 @@ export function RainRegForm({
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
type="number"
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
field.onChange(value === "" ? "" : Number(value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
readOnly={instlCstSprtYn!=='Y'}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -341,7 +359,9 @@ export function RainRegForm({
|
||||
render={({ field }) => (
|
||||
<FormUi label="인증년도">
|
||||
<Input className="" placeholder="2024" type="" value={field.value ?? ""}
|
||||
onChange={field.onChange} />
|
||||
onChange={field.onChange}
|
||||
|
||||
readOnly={grntchBdstCertYn!=='Y'}/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -358,6 +378,7 @@ export function RainRegForm({
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
readOnly={grntchBdstCertYn!=='Y'}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -370,7 +391,9 @@ export function RainRegForm({
|
||||
render={({ field }) => (
|
||||
<FormUi label="인증등급">
|
||||
<Input className="" placeholder="A" type="" value={field.value ?? ""}
|
||||
onChange={field.onChange}/>
|
||||
onChange={field.onChange}
|
||||
readOnly={grntchBdstCertYn!=='Y'}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
} from "@common/business_components/ui";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useFieldArray, useForm } from "react-hook-form";
|
||||
import { number, z } from "zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
import { useEffect } from "react";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
|
||||
export function RswtrRegForm({
|
||||
export default function RswtrRegForm({
|
||||
rswtForm,
|
||||
isModal,
|
||||
}: {
|
||||
@@ -39,29 +39,20 @@ export function RswtrRegForm({
|
||||
|
||||
})
|
||||
|
||||
// 2. Define a submit handler.
|
||||
async function onSubmit(values: z.infer<typeof rswtZod>) {
|
||||
// Do something with the form values.
|
||||
// ✅ This will be type-safe and validated.
|
||||
console.log(values);
|
||||
|
||||
const [grntchBdstCertYn, instlCstSprtYn,filtrTrtmfctProcs] = form.watch([
|
||||
"reuseBuilding.0.grntchBdstCertYn",
|
||||
"reuseBuilding.0.instlCstSprtYn",
|
||||
"reuseBuilding.0.rswtrObj.filtrTrtmfctProcs",
|
||||
]);
|
||||
|
||||
const onSubmit =(values: z.infer<typeof rswtZod>) => {
|
||||
if (isModal) {
|
||||
// regRainForm.bdstInfoPk = null;
|
||||
await rswtReg(values);
|
||||
rswtReg(values);
|
||||
} else {
|
||||
rswtUpdate(values);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const onSelectValue = (val: string | number) => {
|
||||
console.log(val);
|
||||
|
||||
};
|
||||
|
||||
|
||||
function cleanRswtData(raw: any): z.infer<typeof rswtZod> {
|
||||
const cleanRswtData = (raw: any): z.infer<typeof rswtZod> =>{
|
||||
return {
|
||||
...raw,
|
||||
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt||null),
|
||||
@@ -81,9 +72,29 @@ export function RswtrRegForm({
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
|
||||
console.log("filtrTrtmfctProcs ", filtrTrtmfctProcs)
|
||||
if(grntchBdstCertYn ==='N'){
|
||||
form.setValue('reuseBuilding.0.grntchBdstCertYr' ,"" )
|
||||
form.setValue('reuseBuilding.0.grntchBdstCertNo' ,"" )
|
||||
form.setValue('reuseBuilding.0.grntchBdstCertGrd' ,"" )
|
||||
}else if(instlCstSprtYn ==='N'){
|
||||
form.setValue('reuseBuilding.0.instlCstSprtAmt' ,0 )
|
||||
}
|
||||
},[grntchBdstCertYn,instlCstSprtYn,filtrTrtmfctProcs ])
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if(rswtZod)
|
||||
console.log("rswtForm", rswtForm);
|
||||
form.reset( cleanRswtData(rswtForm))
|
||||
}, [rswtForm]);
|
||||
|
||||
@@ -98,7 +109,7 @@ useEffect(() => {
|
||||
<h1 className="pl-3 text-xl col-span-10">
|
||||
○ 중수도 시설 정보
|
||||
</h1>
|
||||
<Button type="submit" className="mr-4 rounded-lg col-span-2">
|
||||
<Button size={"sm"} type="submit" className="col-start-12 col-span-1">
|
||||
저장
|
||||
</Button>
|
||||
</div>
|
||||
@@ -151,7 +162,7 @@ useEffect(() => {
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
type="number"
|
||||
value={field.value ?? ""}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
@@ -170,7 +181,7 @@ useEffect(() => {
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
type="number"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
@@ -188,7 +199,7 @@ useEffect(() => {
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
type="number"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
@@ -277,11 +288,12 @@ useEffect(() => {
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
type="number"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
readOnly={instlCstSprtYn!=='Y'}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -320,10 +332,11 @@ useEffect(() => {
|
||||
<Input
|
||||
className=""
|
||||
placeholder="2024"
|
||||
type=""
|
||||
type="text"
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
readOnly={grntchBdstCertYn!=='Y'}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -341,6 +354,8 @@ useEffect(() => {
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
readOnly={grntchBdstCertYn!=='Y'}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -358,6 +373,8 @@ useEffect(() => {
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
readOnly={grntchBdstCertYn!=='Y'}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
|
||||
@@ -8,13 +8,13 @@ import {
|
||||
import { ScrollArea, SelectBox, UiTable } from "@common/business_components";
|
||||
import { Button, Input, Label } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import { RainRegForm } from "../../form/fcltReg/rainReg/rainRegForm";
|
||||
import RainRegForm from "../../form/fcltReg/rainReg/rainRegForm";
|
||||
import { type selectArray } from "@/app/store/common/code";
|
||||
import { getCity, tableData } from "@/components/lib/func/commom";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import { HtdflRegForm } from "../../form/fcltReg/htdflReg/htdflRegForm";
|
||||
import HtdflRegForm from "../../form/fcltReg/htdflReg/htdflRegForm";
|
||||
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import {RswtrRegForm} from "../../form/fcltReg/rswtrReg/rswtrRegForm";
|
||||
import RswtrRegForm from "../../form/fcltReg/rswtrReg/rswtrRegForm";
|
||||
|
||||
export type objSearchType = {
|
||||
sgg: string|number;
|
||||
@@ -144,7 +144,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
|
||||
{ moType === 'RNB'?
|
||||
<RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={true} />
|
||||
:moType==='RST'
|
||||
? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={true} />
|
||||
? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={true}></RswtrRegForm>
|
||||
:<HtdflRegForm htdflForm={rainBdstForm as unknown as customHtdflBdst} isModal={true}></HtdflRegForm>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,43 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { pbnSttHeadList } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn";
|
||||
import type { TableProps } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
|
||||
import type { TableTripleProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@common/business_components/ui";
|
||||
import { Button, Checkbox } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useEffect } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
export default function HeadChModal() {
|
||||
const { pbnStt } = useWrStore((state) => state);
|
||||
export default function HeadChModal({type }:{type: string }) {
|
||||
const { sttnCommon ,chSttnHead} = useWrStore((state) => state);
|
||||
|
||||
|
||||
|
||||
const items = pbnSttHeadList.map(item => ({id:item.id, label:item.title}));
|
||||
|
||||
const { rainSttHeadList,pbnSttHeadList } =sttnCommon;
|
||||
let items = rainSttHeadList.map(item => ({id:item.id, label:item.title}));
|
||||
|
||||
|
||||
|
||||
const FormSchema = z.object({
|
||||
items: z.array(z.string()).refine((value) => value.some((item) => item), {
|
||||
message: "You have to select at least one item.",
|
||||
data: z.array(z.string()).refine((value) => value.some((item) => item), {
|
||||
message: "최소한 하나를 선택해주시길 바랍니다.",
|
||||
|
||||
}),
|
||||
})
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
})
|
||||
defaultValues: {
|
||||
data: [],
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
const onSubmit = (val : z.infer<typeof FormSchema>) =>{
|
||||
|
||||
console.log(val)
|
||||
if(val?.data.length > 0)
|
||||
chSttnHead(val?.data, 'rain')
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -40,21 +47,20 @@ export default function HeadChModal() {
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="items"
|
||||
name="data"
|
||||
render={() => (
|
||||
<FormItem>
|
||||
<div className="mb-4">
|
||||
<FormLabel className="text-base">Sidebar</FormLabel>
|
||||
<FormDescription>
|
||||
Select the items you want to display in the sidebar.
|
||||
</FormDescription>
|
||||
<FormLabel className="text-2xl"> 조회항목 설정</FormLabel>
|
||||
|
||||
</div>
|
||||
{items.map((item) => (
|
||||
<FormField
|
||||
key={item.id}
|
||||
control={form.control}
|
||||
name="items"
|
||||
render={({ field }) => {
|
||||
name="data"
|
||||
render={({ field }) =>
|
||||
{
|
||||
return (
|
||||
<FormItem
|
||||
key={item.id}
|
||||
@@ -63,7 +69,9 @@ export default function HeadChModal() {
|
||||
<FormControl>
|
||||
<Checkbox
|
||||
checked={field.value?.includes(item.id)}
|
||||
onCheckedChange={(checked) => {
|
||||
onCheckedChange={(checked) =>
|
||||
|
||||
{
|
||||
return checked
|
||||
? field.onChange([...field.value, item.id])
|
||||
: field.onChange(
|
||||
@@ -71,10 +79,12 @@ export default function HeadChModal() {
|
||||
(value) => value !== item.id
|
||||
)
|
||||
);
|
||||
}}
|
||||
}
|
||||
|
||||
}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormLabel className="text-sm font-normal">
|
||||
<FormLabel className="text-xl">
|
||||
{item.label}
|
||||
</FormLabel>
|
||||
</FormItem>
|
||||
@@ -86,7 +96,7 @@ export default function HeadChModal() {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<Button type="submit">Submit</Button>
|
||||
<Button type="submit">항목 표출 변경</Button>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user