Merge commit 'da67f24491a553a1cf019caf9bd89280ce9ad533' into iipbs/wr/dev
iipbs_wr / build (push) Has been cancelled
iipbs_wr / build (push) Has been cancelled
This commit is contained in:
@@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
rainZod,
|
||||
selectClass,
|
||||
TEST_UUID,
|
||||
type customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { DatePicker, FormUi } from "@common/business_components";
|
||||
@@ -70,7 +71,7 @@ export function RainRegForm({
|
||||
function onSubmit(values: z.infer<typeof rainZod>) {
|
||||
|
||||
if (isModal) {
|
||||
// regRainForm.bdstInfoPk = null;
|
||||
|
||||
rainReg(values);
|
||||
} else {
|
||||
rainUpdate(values);
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
import { useEffect } from "react";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
|
||||
export function RswtrRegForm({
|
||||
export function RswtrRegForm({
|
||||
rswtForm,
|
||||
isModal,
|
||||
}: {
|
||||
|
||||
@@ -14,7 +14,7 @@ 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 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} />
|
||||
:<HtdflRegForm htdflForm={rainBdstForm as unknown as customHtdflBdst} isModal={true}></HtdflRegForm>
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { pbnSttHeadList } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn";
|
||||
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 { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
export default function HeadChModal() {
|
||||
const { pbnStt } = useWrStore((state) => state);
|
||||
|
||||
|
||||
|
||||
const items = pbnSttHeadList.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.",
|
||||
}),
|
||||
})
|
||||
|
||||
const form = useForm<z.infer<typeof FormSchema>>({
|
||||
resolver: zodResolver(FormSchema),
|
||||
})
|
||||
|
||||
|
||||
|
||||
const onSubmit = (val : z.infer<typeof FormSchema>) =>{
|
||||
|
||||
console.log(val)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="items"
|
||||
render={() => (
|
||||
<FormItem>
|
||||
<div className="mb-4">
|
||||
<FormLabel className="text-base">Sidebar</FormLabel>
|
||||
<FormDescription>
|
||||
Select the items you want to display in the sidebar.
|
||||
</FormDescription>
|
||||
</div>
|
||||
{items.map((item) => (
|
||||
<FormField
|
||||
key={item.id}
|
||||
control={form.control}
|
||||
name="items"
|
||||
render={({ field }) => {
|
||||
return (
|
||||
<FormItem
|
||||
key={item.id}
|
||||
className="flex flex-row items-start space-x-3 space-y-0"
|
||||
>
|
||||
<FormControl>
|
||||
<Checkbox
|
||||
checked={field.value?.includes(item.id)}
|
||||
onCheckedChange={(checked) => {
|
||||
return checked
|
||||
? field.onChange([...field.value, item.id])
|
||||
: field.onChange(
|
||||
field.value?.filter(
|
||||
(value) => value !== item.id
|
||||
)
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormLabel className="text-sm font-normal">
|
||||
{item.label}
|
||||
</FormLabel>
|
||||
</FormItem>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<Button type="submit">Submit</Button>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user