change type field number in all page
This commit is contained in:
@@ -6,7 +6,7 @@ function UserDetail({ data, loading }) {
|
||||
return (
|
||||
<div className="hidden xl:flex min-w-[332px] h-full opacity-page">
|
||||
<div
|
||||
className="min-w-[337px] p-[24px] border-0 border-r border-r-[#EFEFEF] h-full items-start fixed top-0 left-0
|
||||
className="min-w-[332px] p-[24px] border-0 border-r border-r-[#EFEFEF] h-full items-start fixed top-0 left-0
|
||||
g-[#FFF] py-[40px] px-[16px] bg-[#FFF] dark:bg-[#222433] dark:border-transparent"
|
||||
>
|
||||
<Head data={data} loading={loading} />
|
||||
|
||||
@@ -10,6 +10,11 @@ import ArrowLeftPA from "@/components/icons/ArrowLeftPA";
|
||||
import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
|
||||
import { checkAllValues } from "@/helper";
|
||||
|
||||
const validate_medical_number = {
|
||||
min: 1,
|
||||
max: 9999999999,
|
||||
};
|
||||
|
||||
function Form({ setValue, parent, data, setData }) {
|
||||
const changeData = (value, type, name) =>
|
||||
type !== "isEdit" &&
|
||||
@@ -26,6 +31,13 @@ function Form({ setValue, parent, data, setData }) {
|
||||
};
|
||||
});
|
||||
|
||||
const updateNum = (value, type, name) => {
|
||||
const parseValue = +value;
|
||||
const { max } = validate_medical_number;
|
||||
const validateValue = parseValue > max ? data[name].value : value;
|
||||
changeData(validateValue, type, name);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mt-[24px] scroll-mui md:mt-[26px] lg:mt-[28px] grid grid-cols-1 md:grid-cols-2 gap-x-[48px] gap-y-[24px]">
|
||||
@@ -43,10 +55,15 @@ function Form({ setValue, parent, data, setData }) {
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
changeData={updateNum}
|
||||
data={data?.medical_system_number}
|
||||
noDisable={true}
|
||||
type="number"
|
||||
placeholder={data?.medical_system_number.placeholder}
|
||||
name="medical_system_number"
|
||||
props={{
|
||||
inputProps: validate_medical_number,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
<ContentText text="تخصص">
|
||||
@@ -60,6 +77,7 @@ function Form({ setValue, parent, data, setData }) {
|
||||
<ContentText text="مدرک">
|
||||
<AutoCompleteSelect
|
||||
updateData={changeData}
|
||||
type="number"
|
||||
label="انتخاب کنید..."
|
||||
name="degree"
|
||||
list={degree}
|
||||
|
||||
@@ -8,6 +8,11 @@ import AutoCompleteSelect from "@/app/component/element/AutoCompleteSelect";
|
||||
import { useState } from "react";
|
||||
import ModalMap from "./modal";
|
||||
|
||||
const validate_phone_number = {
|
||||
min: 1,
|
||||
max: 9999999999,
|
||||
};
|
||||
|
||||
function Form({ parent, data, setData }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
@@ -29,6 +34,13 @@ function Form({ parent, data, setData }) {
|
||||
};
|
||||
});
|
||||
|
||||
const updateNum = (value, type, name) => {
|
||||
const parseValue = +value;
|
||||
const { max } = validate_phone_number;
|
||||
const validateValue = parseValue > max ? data[name].value : value;
|
||||
changeData(validateValue, type, name);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mt-[24px] grid grid-cols-1 md:grid-cols-2 gap-x-[48px] gap-y-[24px]">
|
||||
@@ -68,31 +80,46 @@ function Form({ parent, data, setData }) {
|
||||
<ContentText text="شماره موبایل">
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
placeholder="شماره موبایل"
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
changeData={updateNum}
|
||||
data={data?.phone}
|
||||
noDisable={true}
|
||||
type="number"
|
||||
placeholder="شماره موبایل"
|
||||
name="phone"
|
||||
props={{
|
||||
inputProps: validate_phone_number,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
<ContentText text="شماره مطب">
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
placeholder="شماره مطب"
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
changeData={updateNum}
|
||||
data={data?.office_number1}
|
||||
noDisable={true}
|
||||
type="number"
|
||||
placeholder="شماره مطب"
|
||||
name="office_number1"
|
||||
props={{
|
||||
inputProps: validate_phone_number,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
<ContentText text="شماره مطب">
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
placeholder="شماره مطب"
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
changeData={updateNum}
|
||||
data={data?.office_number2}
|
||||
noDisable={true}
|
||||
type="number"
|
||||
placeholder="شماره مطب"
|
||||
name="office_number2"
|
||||
props={{
|
||||
inputProps: validate_phone_number,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
</div>
|
||||
|
||||
@@ -30,10 +30,10 @@ function Form({
|
||||
|
||||
const updateNum = (value, type, name) => {
|
||||
const prevData = data;
|
||||
const prevVal = data[parent][dataChange.idx][name].value;
|
||||
const parseValue = +value;
|
||||
const { min, max } = validate_number_turns;
|
||||
const validateValue =
|
||||
parseValue > max ? max : parseValue < min ? min : value;
|
||||
const { max } = validate_number_turns;
|
||||
const validateValue = parseValue > max ? prevVal : value;
|
||||
data[parent][dataChange.idx][name].value = validateValue;
|
||||
setUpdate(!update);
|
||||
setData(prevData);
|
||||
|
||||
@@ -32,7 +32,7 @@ function Cards({ data, loading }) {
|
||||
<ul className="flex lg:grid lg:grid-cols-3 flex-wrap flex-col sm:flex-row items-center justify-center gap-[32px] mx-0 sm:mx-[16px]">
|
||||
{list.map((item, idx) => (
|
||||
<li
|
||||
className="flex min-w-[226px] w-full sm:w-auto flex-col py-[16px] md:py-[18px] px-[12px] gap-[8px] rounded-[8px] border
|
||||
className="flex min-w-[194px] w-full sm:w-auto flex-col py-[16px] md:py-[18px] px-[12px] gap-[8px] rounded-[8px] border
|
||||
border-solid border-[#EFEFEF] bg-[#FFF] dark:bg-[#222433] dark:border-transparent"
|
||||
key={idx}
|
||||
>
|
||||
@@ -41,7 +41,7 @@ function Cards({ data, loading }) {
|
||||
>
|
||||
{item.icon}
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center justify-between gap-[4px]">
|
||||
<p className="text-[#525252] text-[14px] font-normal dark:text-[#D7D8ED]">
|
||||
{item.text}
|
||||
</p>
|
||||
|
||||
@@ -10,6 +10,11 @@ import AddLocationP from "@/components/icons/AddLocationP";
|
||||
import { Button } from "@mui/material";
|
||||
import ArrowLeftButtonP from "@/components/icons/ArrowLeftButtonP";
|
||||
|
||||
const validate_phone_number = {
|
||||
min: 1,
|
||||
max: 9999999999,
|
||||
};
|
||||
|
||||
function Form() {
|
||||
const [data, setData] = useState({
|
||||
name: { value: "احسان احمدی", isEdit: true },
|
||||
@@ -35,6 +40,13 @@ function Form() {
|
||||
},
|
||||
});
|
||||
|
||||
const updateNum = (value, type, name) => {
|
||||
const parseValue = +value;
|
||||
const { max } = validate_phone_number;
|
||||
const validateValue = parseValue > max ? data[name].value : value;
|
||||
changeData(validateValue, type, name);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-start justify-start mt-[24px] md:mt-[28px] lg:mt-[32px] gap-[32px] md:gap-[40px] lg:gap-[48px]">
|
||||
<ul className="grid w-full grid-cols-1 md:grid-cols-2 gap-x-[48px] gap-y-[24px] md:gap-y-[28px] lg:gap-y-[32px]">
|
||||
@@ -51,9 +63,15 @@ function Form() {
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
changeData={updateNum}
|
||||
data={data?.national_code}
|
||||
noDisable={true}
|
||||
type="number"
|
||||
placeholder="کد ملی"
|
||||
name="national_code"
|
||||
props={{
|
||||
inputProps: validate_phone_number,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
<ContentText text="استان">
|
||||
@@ -86,24 +104,34 @@ function Form() {
|
||||
<ContentText text="شماره موبایل">
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
placeholder="شماره موبایل"
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
changeData={updateNum}
|
||||
data={data?.phone}
|
||||
noDisable={true}
|
||||
type="number"
|
||||
placeholder="شماره موبایل"
|
||||
name="phone"
|
||||
props={{
|
||||
inputProps: validate_phone_number,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
<ContentText text="شماره حساب">
|
||||
<EditField
|
||||
isTransparent={true}
|
||||
placeholder="شماره حساب"
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
changeData={updateNum}
|
||||
data={data?.account_number}
|
||||
noDisable={true}
|
||||
type="number"
|
||||
placeholder="شماره حساب"
|
||||
name="account_number"
|
||||
props={{
|
||||
inputProps: validate_phone_number,
|
||||
}}
|
||||
/>
|
||||
</ContentText>
|
||||
<ContentText text="شهر">
|
||||
<ContentText text="بانک">
|
||||
<AutoCompleteSelect
|
||||
updateData={updateSelect}
|
||||
label="انتخاب کنید..."
|
||||
|
||||
Reference in New Issue
Block a user