iipbs_cs #9

Merged
chanii8 merged 141 commits from iipbs_cs into main 2025-03-17 18:51:48 +09:00
12 changed files with 402 additions and 267 deletions
Showing only changes of commit 6528151aea - Show all commits
+90
View File
@@ -0,0 +1,90 @@
"use client";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
import {
Form,
FormField,
FormUi,
ScrollArea,
SelectBox,
} from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import { CoRegForm } from "@/components/ui/matDmd/coRegForm/component";
import toast from "react-hot-toast";
import Link from "next/link";
import { useRouter } from "next/navigation";
const formSchema = z.object({
ctpv: z.string(),
sgg: z.string(),
coNm: z.string().min(1).max(20),
bznmNo: z.string().min(1).min(9).max(12),
addr: z.string().min(1).min(6).max(20),
telNo: z.string().min(8).max(12),
});
export default function MyForm() {
const router = useRouter();
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
coNm:'',
bznmNo:'',
addr:'',
telNo:'',
},
});
function onSubmit(values: z.infer<typeof formSchema>) {
try {
console.log(values);
toast(
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(values, null, 2)}</code>
</pre>
);
router.push('./dmdReg')
// <Link href='matMng/matDmd/dmdReg'></Link>
} catch (error) {
console.error("Form submission error", error);
toast.error("Failed to submit the form. Please try again.");
}
}
return (
<>
<div className="grid h-40 grid-cols-3 place-content-center">
<h1 className=" col-start-2 col-span-1 text-4xl underline">
수요처 정보입력
</h1>
</div>
<div className="grid grid-cols-5 gap-4 overflow-hidden">
<div className="col-span-1 "/>
<div className="col-span-3 ">
<div>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8 max-w-3xl mx-auto"
>
<CoRegForm>{form}</CoRegForm>
{/* <WqForm> {form}</WqForm> */}
<Button type="submit">수요처등록</Button>
</form>
</Form>
</div>
</div>
<div className="col-span-1 " />
</div>
</>
);
}
+99
View File
@@ -0,0 +1,99 @@
"use client";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
import {
Form,
} from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import { DmdRegForm } from "@/components/ui/matDmd/dmdRegform/component";
import toast from "react-hot-toast";
const formSchema = z.object({
dmdSel: z.string().min(1).min(0),
dmdTmng: z.coerce.date(),
dmdWq: z.string().min(1).optional(),
useUsgCd: z.string(),
wntUntprc: z.string().min(1),
grssClfg: z.string().min(1),
tn: z.string().min(1).optional(),
combResdch: z.string().min(1).optional(),
tp: z.string().min(1).optional(),
trbt: z.string().min(1).optional(),
ph: z.string().min(1).optional(),
bod: z.string().min(1).optional(),
clIonQnt: z.string().min(1).optional(),
smll: z.string().min(1).optional(),
cdtnv: z.string().min(1).optional(),
crmty: z.string().min(1).optional(),
rmrk: z.string().min(1).optional(),
});
export default function MyForm() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
dmdTmng: new Date(),
dmdWq: '',
useUsgCd: '',
wntUntprc: '',
grssClfg: '',
tn: '',
combResdch: '',
tp: '',
trbt:'',
ph: '',
bod: '',
clIonQnt: '',
smll: '',
cdtnv: '',
crmty: '',
rmrk: '',
},
});
function onSubmit(values: z.infer<typeof formSchema>) {
try {
console.log(values);
toast(
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(values, null, 2)}</code>
</pre>
);
} catch (error) {
console.error("Form submission error", error);
// toast.error("Failed to submit the form. Please try again.");
}
}
return (
<>
<div className="grid h-40 grid-cols-3 place-content-center">
<h1 className=" col-start-2 col-span-1 text-4xl underline">
수요 신청정보입력
</h1>
</div>
<div className="grid grid-cols-5 gap-4 overflow-hidden">
<div className="col-span-1 "/>
<div className="col-span-3 max-h-[78vh] overflow-y-scroll ">
<div>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8 max-w-3xl mx-auto"
>
<DmdRegForm> {form}</DmdRegForm>
<Button type="submit"> 수요신청</Button>
</form>
</Form>
</div>
</div>
<div className="col-span-1 " />
</div>
</>
);
}
-96
View File
@@ -1,96 +0,0 @@
"use client"
import {
useForm
} from "react-hook-form"
import {
zodResolver
} from "@hookform/resolvers/zod"
import * as z from "zod"
import {
Calendar as CalendarIcon
} from "lucide-react"
import { Form, FormField, FormUi, ScrollArea, SelectBox } from "@common/business_components/ui"
import { Button, Input } from "@common/components/ui"
import { BaseForm } from "@/components/ui/matDmd/baseForm/component"
import { WqForm } from "@/components/ui/matDmd/wqForm/component"
const formSchema = z.object({
ctpv: z.string(),
sgg: z.string(),
coNm: z.string().min(1).min(0).max(20),
bznmNo: z.string().min(1).min(9).max(12),
name_5973331634: z.string().min(1).min(6).max(20),
telNo: z.string().min(8).max(12),
dmdSel: z.string().min(1).min(0),
dmdTmng: z.coerce.date(),
dmdWq: z.string().min(1).optional(),
useUsgCd: z.string(),
wntUntprc: z.string().min(1),
grssClfg: z.string().min(1),
tn: z.string().min(1).optional(),
combResdch: z.string().min(1),
tp: z.string().min(1),
trbt: z.string().min(1).optional(),
ph: z.string().min(1),
bod: z.string().min(1).optional(),
clIonQnt: z.string().min(1),
smll: z.string().min(1).optional(),
cdtnv: z.string().min(1).optional(),
crmty: z.string().min(1).optional(),
rmrk: z.string().min(1)
});
export default function MyForm() {
const form = useForm < z.infer < typeof formSchema >> ({
resolver: zodResolver(formSchema),
defaultValues: {
"dmdTmng": new Date()
},
})
function onSubmit(values: z.infer < typeof formSchema > ) {
try {
console.log(values);
/*
toast(
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(values, null, 2)}</code>
</pre>
);*/
} catch (error) {
console.error("Form submission error", error);
// toast.error("Failed to submit the form. Please try again.");
}
}
return (
<>
<div>
<h1 className="pl-3 text-4xl" >수요처 정보 등록 </h1>
</div>
<div>
<div>
<h1 className="space-y-8 max-w-3xl mx-auto py-1 text-2xl" >정보입력 </h1>
</div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8 max-w-3xl mx-auto py-10">
<ScrollArea>
<BaseForm >{form} </BaseForm>
<WqForm> {form}</WqForm>
<Button type="submit">Submit</Button>
</ScrollArea>
</form>
</Form>
</div>
</>
)
}
+1 -1
View File
@@ -18,7 +18,7 @@ export default function Home() {
</Button>
<Button className='place-self-auto'>
<Link href="matMng/matDmd">수요처 등록</Link>
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
</Button>
</div>
</>
@@ -10,7 +10,6 @@ import { useWrStore } from '../../../store';
export default function PublicReuseFaciltyInsert() {
const {pubFac} = useWrStore((state) => state);
const { pubFacHeadList, publicReuseFacilityData, selectLabel} = pubFac;
console.log(pubFacHeadList)
const searchDiv = '하수재이용시설 '
const selectBox = [{ text: '서울하수처리시설', val: "1" }, { text: '서울1하수처리시설', val: "2" }, { text: '서울2하수처리시설', val: "3" }]
const headName = () => {
+2 -2
View File
@@ -5,12 +5,12 @@ import type { selectArray } from "../rainReuseFacilityInsert";
const selectSido = [
{ text: '서울', val: "1" },
{ text: "인천", val: "2" },
{ text: "부산", val: "2" },
{ text: "부산", val: "3" },
];
const selectSgg = [
{ text: '종로구', val: "1" },
{ text: "성북구", val: "2" },
{ text: "강남구", val: "2" },
{ text: "강남구", val: "3" },
];
const selectUsg = [
{ text: '민간', val: "1" },
@@ -85,6 +85,8 @@ export type selectArray ={
val:string
}
export const selectClass ="w-full h-full text-2xl";
const selectHomeWater = [
{ text: '집수면', val: "1" },
{ text: "종류", val: "2" },
@@ -1,162 +0,0 @@
import { useWrStore } from "@/app/store";
import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components";
import { Input } from "@common/components";
import { useState } from "react";
export function BaseForm(form:any){
const { dmd } = useWrStore((state) => state);
const [dmdDate, setDmdDate] = useState(new Date())
const onChangeDate=(val:Date|undefined)=>{
if(val)setDmdDate(val);
}
return(
<>
<FormField
control={form.control}
name="ctpv"
render={({ field }) => (
<FormUi label="시도">
<SelectBox selectClass={''} label={""} selectArray={dmd.selectSido} onSelectValue={field.onChange} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="sgg"
render={({ field }) => (
<FormUi label="시군구">
<SelectBox selectClass={''} label={""} selectArray={dmd.selectSgg} onSelectValue={field.onChange} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="coNm"
render={({ field }) => (
<FormUi label="회사명">
<Input placeholder="스타벅스" type="text"{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="bznmNo"
render={({ field }) => (
<FormUi label="사업자번호">
<Input
placeholder="a0123456789"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="name_5973331634"
render={({ field }) => (
<FormUi label="주소">
<Input
placeholder="성북로24길 16"
type=""
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="telNo"
render={({ field }) => (
<FormUi label="전화번호">
<Input
placeholder="01033332222"
type=""
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="dmdSel"
render={({ field }) => (
<FormUi label="수요처명">
<Input
placeholder="수요처명 검색"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="dmdTmng"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>요구시기</FormLabel>
<DatePicker mode={"single"} field={{ value: dmdDate, onChange: onChangeDate }} />
</FormItem>
)}
/>
<FormField
control={form.control}
name="dmdWq"
render={({ field }) => (
<FormUi label="요구수질">
<Input
placeholder="55.22"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="useUsgCd"
render={({ field }) => (
<FormUi label="사용용도">
<SelectBox selectClass={''} label={""} selectArray={dmd.selectUsg} onSelectValue={field.onChange} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="wntUntprc"
render={({ field }) => (
<FormUi label="희망단가">
<Input
placeholder="1000000000000000"
type="text"
{...field} />
</FormUi>
)}
/>
</>
)
}
@@ -0,0 +1,91 @@
import { useWrStore } from "@/app/store";
import { selectClass } from "@/app/store/rainReuseFacilityInsert";
import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components";
import { Button, Input } from "@common/components";
import { useState } from "react";
export function CoRegForm(form:any){
const { dmd } = useWrStore((state) => state);
return(
<>
<FormField
control={form.control}
name="ctpv"
render={({ field }) => (
<FormUi label="시도">
<SelectBox selectClass={selectClass} label={""} selectArray={dmd.selectSido} onSelectValue={field.onChange} className={""} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="sgg"
render={({ field }) => (
<FormUi label="시군구">
<SelectBox selectClass={selectClass} label={""} selectArray={dmd.selectSgg} onSelectValue={field.onChange} className={""} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="coNm"
render={({ field }) => (
<FormUi label="회사명">
<Input placeholder="" type="text" {...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="bznmNo"
render={({ field }) => (
<FormUi label="사업자번호">
<Input
placeholder="a0123456789"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="addr"
render={({ field }) => (
<FormUi label="주소">
<Input
placeholder="성북로24길 16"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="telNo"
render={({ field }) => (
<FormUi label="전화번호">
<Input
placeholder="01033332222"
type="text"
{...field} />
</FormUi>
)}
/>
</>
)
}
@@ -1,10 +1,94 @@
import { FormField, FormUi } from "@common/business_components";
import { Input } from "@common/components";
import { useWrStore } from "@/app/store";
import { selectClass } from "@/app/store/rainReuseFacilityInsert";
import { DatePicker, FormField, FormItem, FormLabel, FormUi, SelectBox } from "@common/business_components";
import { Input } from "@common/components";
import { useState } from "react";
export function WqForm(form: any) {
export function DmdRegForm(form: any) {
const { dmd } = useWrStore((state) => state);
const [dmdDate, setDmdDate] = useState(new Date())
const onChangeDate = (val: Date|undefined) => {
if(val)setDmdDate(val)
}
return (
<>
<FormField
control={form.control}
name="dmdSel"
render={({ field }) => (
<FormUi label="수요처명">
<Input
placeholder="수요처명 검색"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="dmdTmng"
render={({ field }) => (
<FormItem className="flex flex-col">
<FormLabel>요구시기</FormLabel>
<DatePicker mode={"single"} field={{ value: dmdDate, onChange: onChangeDate }} />
</FormItem>
)}
/>
<FormField
control={form.control}
name="dmdWq"
render={({ field }) => (
<FormUi label="요구수질">
<Input
placeholder="55.22"
type="text"
{...field} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="useUsgCd"
render={({ field }) => (
<FormUi label="사용용도">
<SelectBox selectClass={selectClass} label={""} selectArray={dmd.selectUsg} onSelectValue={field.onChange} className={""} />
</FormUi>
)}
/>
<FormField
control={form.control}
name="wntUntprc"
render={({ field }) => (
<FormUi label="희망단가">
<Input
placeholder="1000000000000000"
type="text"
{...field} />
</FormUi>
)}
/>
<div className="grid grid-cols-5">
<h1 className=" col-start-3 col-span-1 pl-5 text-2xl">
요구수질
</h1>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
@@ -159,6 +243,34 @@ export function WqForm(form: any) {
/>
</div>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-6">
<FormField
control={form.control}
name="crmty"
render={({ field }) => (
<FormUi label="색도">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
<div className="col-span-6">
<FormField
control={form.control}
name="rmrk"
render={({ field }) => (
<FormUi label="비고">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</div>
</div>
</>
);
}
@@ -11,6 +11,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
import { FormUi } from "@common/business_components";
import { useWrStore } from "@/app/store";
import { selectClass } from "@/app/store/rainReuseFacilityInsert";
const formSchema = z.object({
username: z.string().min(2).max(50),
@@ -39,7 +40,6 @@ export function RainReuseFaciltyInsertForm() {
console.log(val)
}
const selectClass ="w-full h-full text-2xl";
return (
<div className="">
<Form {...form}>
@@ -16,6 +16,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { useWrStore } from "@/app/store";
import { selectClass } from "@/app/store/rainReuseFacilityInsert";
const formSchema = z.object({
username: z.string().min(2).max(50),
@@ -44,7 +45,6 @@ export function RswtrReuseFaciltyInsertForm() {
console.log(val)
}
const selectClass ="w-full h-full text-2xl";
return (
<div className="">
<Form {...form}>