change icon field and handle change value field type number

This commit is contained in:
Ehsan
2024-10-22 01:56:42 +03:30
parent cee4abcfbf
commit ee9fc998dd
7 changed files with 55 additions and 18 deletions
+30
View File
@@ -0,0 +1,30 @@
function ClockField() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
>
<path
d="M18.3337 10.0003C18.3337 14.6003 14.6003 18.3337 10.0003 18.3337C5.40033 18.3337 1.66699 14.6003 1.66699 10.0003C1.66699 5.40033 5.40033 1.66699 10.0003 1.66699C14.6003 1.66699 18.3337 5.40033 18.3337 10.0003Z"
stroke="#525252"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
className="dark:!fill-[#222433] dark:!stroke-[#A1A1A1]"
/>
<path
d="M13.0914 12.6505L10.5081 11.1088C10.0581 10.8421 9.69141 10.2005 9.69141 9.67546V6.25879"
stroke="#525252"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
className="dark:!fill-[#222433] dark:!stroke-[#A1A1A1]"
/>
</svg>
);
}
export default ClockField;
+1 -1
View File
@@ -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>