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