change icon field and handle change value field type number
This commit is contained in:
@@ -9,7 +9,7 @@ import GeneralInformation from "./listMenu/generalInformation";
|
||||
import Step from "./Step";
|
||||
|
||||
function AddDoctorPage() {
|
||||
const [value, setValue] = useState(0);
|
||||
const [value, setValue] = useState(2);
|
||||
const [data, setData] = useState({
|
||||
general: {
|
||||
name: { value: "", placeholder: "احسان احمدی", isEdit: true },
|
||||
|
||||
@@ -6,6 +6,11 @@ import { turnTime, workplace } from "./listSelector";
|
||||
import EditField from "@/app/component/EditField";
|
||||
import { useState } from "react";
|
||||
|
||||
const validate_number_turns = {
|
||||
min: 1,
|
||||
max: 10,
|
||||
};
|
||||
|
||||
function Form({
|
||||
handleClose,
|
||||
isVacation,
|
||||
@@ -25,7 +30,11 @@ function Form({
|
||||
|
||||
const updateNum = (value, type, name) => {
|
||||
const prevData = data;
|
||||
data[parent][dataChange.idx][name].value = +value;
|
||||
const parseValue = +value;
|
||||
const { min, max } = validate_number_turns;
|
||||
const validateValue =
|
||||
parseValue > max ? max : parseValue < min ? min : value;
|
||||
data[parent][dataChange.idx][name].value = validateValue;
|
||||
setUpdate(!update);
|
||||
setData(prevData);
|
||||
};
|
||||
@@ -44,10 +53,7 @@ function Form({
|
||||
placeholder="انتخاب کنید..."
|
||||
name="number_turns"
|
||||
props={{
|
||||
inputProps: {
|
||||
min: 1,
|
||||
max: 10,
|
||||
},
|
||||
inputProps: validate_number_turns,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
|
||||
Reference in New Issue
Block a user