update dashboard data and design and change req from ssr to csr & change design and data doctor and clinic item
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Content from "./Content";
|
||||
import DateBirthday from "./DateBirthday";
|
||||
import Field from "./Field";
|
||||
import AutoSelector from "./component/AutoSelector";
|
||||
import Field from "./component/Field";
|
||||
import {
|
||||
gender,
|
||||
blood_group,
|
||||
@@ -8,14 +9,22 @@ import {
|
||||
education,
|
||||
job,
|
||||
} from "./listSelector";
|
||||
import AutoSelector from "@/app/component/element/AutoSelector";
|
||||
|
||||
function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
function Form({
|
||||
data,
|
||||
userInfo,
|
||||
insurance,
|
||||
errors,
|
||||
prevInfo,
|
||||
changeData,
|
||||
prevData,
|
||||
}) {
|
||||
const findVal = (list, name) =>
|
||||
data && list && list.length && list.find((g) => g.id === data[name]);
|
||||
console.log(errors);
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-[24px]">
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-[24px] gap-y-[10px]">
|
||||
<Content title="شماره موبایل" isConfirmed={true}>
|
||||
<Field
|
||||
type="number"
|
||||
@@ -27,18 +36,21 @@ function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
data={userInfo?.username}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="کد ملی" isConfirmed={false}>
|
||||
<Content error={errors?.national_code} title="کد ملی" isConfirmed={false}>
|
||||
<Field
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
error={errors?.national_code}
|
||||
type="number"
|
||||
iconGray={true}
|
||||
name="national_code"
|
||||
isTransparent={true}
|
||||
changeData={changeData}
|
||||
data={data?.national_code}
|
||||
name="national_code"
|
||||
disable={prevInfo && prevInfo.national_code}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="نام و نام خانوادگی" isConfirmed={false}>
|
||||
<Content error={errors?.name} title="نام" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.name}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
@@ -46,8 +58,19 @@ function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
name="name"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="جنسیت">
|
||||
<Content error={errors?.family} title="نام خانوادگی" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.family}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={data?.family}
|
||||
name="family"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.gender} title="جنسیت">
|
||||
<AutoSelector
|
||||
error={errors?.gender}
|
||||
updateData={(name, data) =>
|
||||
changeData(data === "زن" ? "female" : "male", "value", name)
|
||||
}
|
||||
@@ -57,15 +80,17 @@ function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
list={gender}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تاریخ تولد">
|
||||
<Content error={errors?.birthday} title="تاریخ تولد">
|
||||
<DateBirthday
|
||||
error={errors?.birthday}
|
||||
data={data?.birthday}
|
||||
isConfirmed={false}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="نام پدر" isConfirmed={false}>
|
||||
<Content error={errors?.fathers_name} title="نام پدر" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.fathers_name}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
@@ -87,18 +112,26 @@ function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
list={insurance}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="شماره بیمه" isConfirmed={false}>
|
||||
<Content
|
||||
error={errors?.insurance_id}
|
||||
title="شماره بیمه"
|
||||
isConfirmed={false}
|
||||
>
|
||||
<Field
|
||||
error={errors?.insurance_id}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
type="number"
|
||||
changeData={changeData}
|
||||
data={data?.supplementary_insurance}
|
||||
name="supplementary_insurance"
|
||||
data={data?.insurance_id}
|
||||
name="insurance_id"
|
||||
// data={data?.supplementary_insurance}
|
||||
// name="supplementary_insurance"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="گروه خونی">
|
||||
<Content error={errors?.blood_type} title="گروه خونی">
|
||||
<AutoSelector
|
||||
error={errors?.blood_type}
|
||||
updateData={(name, value) =>
|
||||
changeData(
|
||||
blood_group.find((g) => g.label === value).id,
|
||||
@@ -112,8 +145,9 @@ function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
list={blood_group}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="وضعیت تاهل">
|
||||
<Content error={errors?.marital_status} title="وضعیت تاهل">
|
||||
<AutoSelector
|
||||
error={errors?.marital_status}
|
||||
updateData={(name, value) =>
|
||||
changeData(value === "متاهل" ? "married" : "single", "value", name)
|
||||
}
|
||||
@@ -133,8 +167,9 @@ function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
name="home_phone"
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تحصیلات">
|
||||
<Content error={errors?.education} title="تحصیلات">
|
||||
<AutoSelector
|
||||
error={errors?.education}
|
||||
updateData={(name, value) =>
|
||||
changeData(
|
||||
education.find((g) => g.label === value).id,
|
||||
@@ -148,8 +183,9 @@ function Form({ data, userInfo, insurance, changeData, prevData }) {
|
||||
list={education}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="شغل">
|
||||
<Content error={errors?.job} title="شغل">
|
||||
<AutoSelector
|
||||
error={errors?.job}
|
||||
updateData={(name, value) =>
|
||||
changeData(value === "آزاد" ? "azad" : "dolati", "value", name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user