수요정보 등록 수질 입력 부분 validation check
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import ModalSimilarPage from "@/app/(base-layout)/pages/sdmMng/sdmInfoInsert/modalSimilar/page";
|
||||
import type { FormData } from "@/app/(base-layout)/pages/sdmMng/sdmInfoInsert/page";
|
||||
import { useDmStore } from "@/app/store";
|
||||
import {
|
||||
CANDIDATE,
|
||||
@@ -25,15 +24,16 @@ import SearchInputText from "../common/searhDemandInput/component";
|
||||
import React from "react";
|
||||
import { sanitizeInput } from "../common/utils/utils";
|
||||
import type { DemandCompType } from "@common/business_components/ui/sdmInsertForm/form";
|
||||
import type { SdmInfoFormData } from "@/app/store/sdmMng";
|
||||
|
||||
export interface SdmInfoRegFormProps {
|
||||
form: UseFormReturn<FormData>;
|
||||
form: UseFormReturn<SdmInfoFormData>;
|
||||
onCheckboxChange?: (checked: boolean) => void;
|
||||
facilityName?: string;
|
||||
}
|
||||
|
||||
type FieldComponent = (
|
||||
field: ControllerRenderProps<FormData, keyof FormData>
|
||||
field: ControllerRenderProps<SdmInfoFormData, keyof SdmInfoFormData>
|
||||
) => JSX.Element;
|
||||
|
||||
export function SdmInfoRegForm({
|
||||
@@ -161,7 +161,7 @@ export function SdmInfoRegForm({
|
||||
|
||||
if (defaults) {
|
||||
Object.entries(defaults).forEach(([field, value]) => {
|
||||
form.setValue(field as keyof FormData, value, { shouldDirty: true });
|
||||
form.setValue(field as keyof SdmInfoFormData, value, { shouldDirty: true });
|
||||
});
|
||||
}
|
||||
}, [form.getValues("usePurpose")]);
|
||||
@@ -176,7 +176,7 @@ export function SdmInfoRegForm({
|
||||
);
|
||||
|
||||
const formFields: Array<{
|
||||
name: keyof FormData;
|
||||
name: keyof SdmInfoFormData;
|
||||
label: string;
|
||||
component: FieldComponent | undefined;
|
||||
formIndex: number;
|
||||
@@ -346,9 +346,7 @@ export function SdmInfoRegForm({
|
||||
const normalFields = formFields.filter(
|
||||
(f) => f.formIndex === 0 && f.component
|
||||
);
|
||||
// const groupFields = formFields.filter(
|
||||
// (f) => f.formIndex === 1 && f.component
|
||||
// );
|
||||
|
||||
const candidateFields = formFields.filter(
|
||||
(f) => f.formIndex === 2 && f.component
|
||||
);
|
||||
@@ -363,8 +361,13 @@ export function SdmInfoRegForm({
|
||||
name={name}
|
||||
render={({ field }) =>
|
||||
name === "money" ? (
|
||||
// component(field)
|
||||
<FormUi label={label + "*"}>{component(field)}</FormUi>
|
||||
<div>
|
||||
<Label className="text-black" >
|
||||
희망단가*
|
||||
</Label>
|
||||
{ component(field)}
|
||||
</div>
|
||||
// <FormUi label={label + "*"}>{component(field)}</FormUi>
|
||||
) : (
|
||||
<AccessibleFormField
|
||||
field={field}
|
||||
@@ -769,7 +772,7 @@ export function SdmInfoRegForm({
|
||||
onSelectValue={(val: string | number) => {
|
||||
field.onChange(val.toString());
|
||||
}}
|
||||
value={field.value || "불쾌하지않을것"}
|
||||
value={field.value }
|
||||
readOnly={isDisabled}
|
||||
onBlur={field.onBlur}
|
||||
ref={field.ref}
|
||||
|
||||
Reference in New Issue
Block a user