change date type for req & design and fields & add requests & fix bug appointment and dashboard
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
function Content({ isConfirmed, children, title, error }) {
|
||||
return (
|
||||
<div className="flex w-full flex-col items-start justify-start gap-[8px] sm:gap-[3px] md:gap-[7px] lg:gap-[9px]">
|
||||
<div className="flex min-h-[32px] items-center justify-start gap-[8px] md:gap-[6px] lg:gap-[4px]">
|
||||
<p className="text-[#525252] text-[14px] font-medium">{title}</p>
|
||||
{isConfirmed && (
|
||||
<p
|
||||
className="py-[4px] md:py-[2px] px-[5px] bg-[#05BA58] rounded-[40px] text-[#FFF]
|
||||
text-[10px] md:text-[12px] font-normal h-[26px] grid place-items-center"
|
||||
>
|
||||
تایید شده
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col w-full items-start justify-start gap-1">
|
||||
{children}
|
||||
<p className="text-red-600 text-[12px]">{error || ""}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Content;
|
||||
@@ -0,0 +1,72 @@
|
||||
import CalendarEdit from "@/components/icons/CalendarEdit";
|
||||
import { convertToJalali } from "@/helper";
|
||||
import { Button, Popover } from "@mui/material";
|
||||
import { DatePicker } from "jalaali-react-date-picker";
|
||||
import { useState } from "react";
|
||||
|
||||
function DateBirthday({ data, changeData, error }) {
|
||||
const [anchorEl, setAnchorEl] = useState(null);
|
||||
|
||||
const handleClick = (event) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
const open = Boolean(anchorEl);
|
||||
const id = open ? "simple-popover" : undefined;
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<div
|
||||
className={`relative w-full border cursor-pointer py-[15px] px-[16px] border-solid
|
||||
rounded-[8px] h-[48px]
|
||||
${error ? "border-[#ff0000]" : "border-[#D7D7D7]"}
|
||||
`}
|
||||
onClick={handleClick}
|
||||
>
|
||||
<p className="text-[#7E7E7E] text-[14px] font-normal cursor-pointer">
|
||||
{data}
|
||||
</p>
|
||||
<Button className="!absolute !left-[8px] !top-1/2 !-translate-y-1/2 !min-w-fit !p-1">
|
||||
<CalendarEdit />
|
||||
</Button>
|
||||
</div>
|
||||
<Popover
|
||||
id={id}
|
||||
open={open}
|
||||
anchorEl={anchorEl}
|
||||
onClose={handleClose}
|
||||
anchorOrigin={{
|
||||
vertical: "bottom",
|
||||
horizontal: "right",
|
||||
}}
|
||||
transformOrigin={{
|
||||
vertical: "top",
|
||||
horizontal: "right",
|
||||
}}
|
||||
sx={{
|
||||
"& .MuiPaper-root": {
|
||||
padding: "12px",
|
||||
background: "#FAFAFA !important",
|
||||
borderRadius: "16px",
|
||||
border: "1px solid #E9ECEF",
|
||||
boxShadow: "0px 2px 28.4px 0px rgba(112, 112, 112, 0.28)",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DatePicker
|
||||
locale="fa"
|
||||
onChange={(e) => {
|
||||
changeData(convertToJalali(e._d), "birthday");
|
||||
handleClose();
|
||||
}}
|
||||
/>
|
||||
</Popover>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DateBirthday;
|
||||
@@ -0,0 +1,152 @@
|
||||
export const disease = [
|
||||
{
|
||||
id: 1,
|
||||
name: "فشار خون",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "دیابت",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "آسم",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: "بیماری قلبی عروقی",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: "سرطان",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: "آلزایمر",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: "پارکینسون",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: "بیماری کلیوی",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "بیماری کبدی",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: "سکته مغزی",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: "افسردگی",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
name: "اضطراب مزمن",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
name: "میگرن",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
name: "کمکاری تیروئید",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
name: "پرکاری تیروئید",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 16,
|
||||
name: "سل",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 17,
|
||||
name: "هپاتیت B",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 18,
|
||||
name: "هپاتیت C",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 19,
|
||||
name: "HIV / ایدز",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
name: "COVID-19",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 21,
|
||||
name: "لوپوس",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 22,
|
||||
name: "اماس (MS)",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 23,
|
||||
name: "آرتریت روماتوئید",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 24,
|
||||
name: "پسوریازیس",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 25,
|
||||
name: "صرع",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 26,
|
||||
name: "بیماری سلیاک",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 27,
|
||||
name: "عدم تحمل لاکتوز",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 28,
|
||||
name: "چربی خون بالا",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 29,
|
||||
name: "کمخونی",
|
||||
status: "false",
|
||||
},
|
||||
{
|
||||
id: 30,
|
||||
name: "هموفیلی",
|
||||
status: "false",
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,205 @@
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import Content from "./Content";
|
||||
import DateBirthday from "./DateBirthday";
|
||||
import AutoSelector from "../component/AutoSelector";
|
||||
import Field from "../component/Field";
|
||||
import {
|
||||
gender,
|
||||
blood_group,
|
||||
marital_status,
|
||||
education,
|
||||
job,
|
||||
} from "./listSelector";
|
||||
|
||||
function Form({ insurance, errors, changeData, information }) {
|
||||
const findVal = (list, name) =>
|
||||
list &&
|
||||
list.length &&
|
||||
information &&
|
||||
information[name] &&
|
||||
list.find((g) => g.id === information[name]);
|
||||
const parsedUserInfo = getParsedUserInfo();
|
||||
|
||||
console.log(information);
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-[24px] gap-y-[10px]">
|
||||
<Content title="شماره موبایل" isConfirmed={true}>
|
||||
<Field
|
||||
type="number"
|
||||
disable={true}
|
||||
iconGray={true}
|
||||
name="work_phone"
|
||||
isTransparent={true}
|
||||
changeData={changeData}
|
||||
data={parsedUserInfo?.username}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.national_code} title="کد ملی" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.national_code}
|
||||
type="number"
|
||||
iconGray={true}
|
||||
name="national_code"
|
||||
isTransparent={true}
|
||||
changeData={changeData}
|
||||
data={information?.national_code}
|
||||
disable={information?.prev_data}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.name} title="نام" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.name}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={information?.name}
|
||||
name="name"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.family} title="نام خانوادگی" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.family}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={information?.family}
|
||||
name="family"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.gender} title="جنسیت">
|
||||
<AutoSelector
|
||||
error={errors?.gender}
|
||||
updateData={(name, data) =>
|
||||
changeData(data === "زن" ? "female" : "male", name)
|
||||
}
|
||||
value={findVal(gender, "gender")}
|
||||
label="جنسیت"
|
||||
name="gender"
|
||||
list={gender}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.birthday} title="تاریخ تولد">
|
||||
<DateBirthday
|
||||
error={errors?.birthday}
|
||||
data={information?.birthday}
|
||||
isConfirmed={false}
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.fathers_name} title="نام پدر" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.fathers_name}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={information?.fathers_name}
|
||||
name="fathers_name"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.basic_insurance} title="نوع بیمه">
|
||||
<AutoSelector
|
||||
error={errors?.basic_insurance}
|
||||
updateData={(name, val) => {
|
||||
changeData([Number(val.id)], name);
|
||||
}}
|
||||
value={insurance?.find(
|
||||
(g) =>
|
||||
Number(g.id) ===
|
||||
(information?.basic_insurance
|
||||
? information?.basic_insurance[0]
|
||||
: false)
|
||||
)}
|
||||
name="basic_insurance"
|
||||
label="نوع بیمه"
|
||||
list={insurance}
|
||||
/>
|
||||
</Content>
|
||||
<Content
|
||||
error={errors?.insurance_id}
|
||||
title="شماره بیمه"
|
||||
isConfirmed={false}
|
||||
>
|
||||
<Field
|
||||
error={errors?.insurance_id}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
type="number"
|
||||
changeData={changeData}
|
||||
data={information?.insurance_id}
|
||||
name="insurance_id"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.blood_type} title="گروه خونی">
|
||||
<AutoSelector
|
||||
error={errors?.blood_type}
|
||||
updateData={(name, value) =>
|
||||
changeData(blood_group.find((g) => g.label === value).id, name)
|
||||
}
|
||||
value={findVal(blood_group, "blood_type")}
|
||||
label="گروه خونی"
|
||||
name="blood_type"
|
||||
list={blood_group}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.marital_status} title="وضعیت تاهل">
|
||||
<AutoSelector
|
||||
error={errors?.marital_status}
|
||||
updateData={(name, value) =>
|
||||
changeData(value === "متاهل" ? "married" : "single", name)
|
||||
}
|
||||
value={findVal(marital_status, "marital_status")}
|
||||
label="وضعیت تاهل"
|
||||
name="marital_status"
|
||||
list={marital_status}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تلفن منزل" isConfirmed={false}>
|
||||
<Field
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
type="number"
|
||||
changeData={changeData}
|
||||
data={information?.home_phone}
|
||||
name="home_phone"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.education} title="تحصیلات">
|
||||
<AutoSelector
|
||||
error={errors?.education}
|
||||
updateData={(name, value) =>
|
||||
changeData(education.find((g) => g.label === value).id, name)
|
||||
}
|
||||
value={findVal(education, "education")}
|
||||
label="تحصیلات"
|
||||
name="education"
|
||||
list={education}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.job} title="شغل">
|
||||
<AutoSelector
|
||||
error={errors?.job}
|
||||
updateData={(name, value) =>
|
||||
changeData(value === "آزاد" ? "azad" : "dolati", name)
|
||||
}
|
||||
value={findVal(job, "job")}
|
||||
label="شغل"
|
||||
name="job"
|
||||
list={job}
|
||||
/>
|
||||
</Content>
|
||||
<Content title="تلفن محل کار" isConfirmed={false}>
|
||||
<Field
|
||||
isTransparent={true}
|
||||
type="number"
|
||||
iconGray={true}
|
||||
changeData={changeData}
|
||||
data={information?.work_phone}
|
||||
name="work_phone"
|
||||
/>
|
||||
</Content>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Form;
|
||||
@@ -0,0 +1,33 @@
|
||||
export const gender = [
|
||||
{ label: "مرد", id: "male" },
|
||||
{ label: "زن", id: "female" },
|
||||
];
|
||||
|
||||
export const blood_group = [
|
||||
{ label: "A+", id: "a_positive" },
|
||||
{ label: "A-", id: "a_negative" },
|
||||
{ label: "B+", id: "b_positive" },
|
||||
{ label: "B-", id: "b_negative" },
|
||||
{ label: "O+", id: "o_positive" },
|
||||
{ label: "O-", id: "o_negative" },
|
||||
{ label: "AB+", id: "ab_positive" },
|
||||
{ label: "AB-", id: "ab_negative" },
|
||||
];
|
||||
|
||||
export const marital_status = [
|
||||
{ label: "متاهل", id: "married" },
|
||||
{ label: "مجرد", id: "single" },
|
||||
];
|
||||
|
||||
export const education = [
|
||||
{ label: "دیپلم", id: "diploma" },
|
||||
{ label: "دیپلم تحصیلات تکمیلی", id: "postgraduate_diploma" },
|
||||
{ label: "لیسانس", id: "bachelor_s_degree" },
|
||||
{ label: "کارشناسی ارشد", id: "master_s_degree" },
|
||||
{ label: "دکترا", id: "doctorate" },
|
||||
];
|
||||
|
||||
export const job = [
|
||||
{ label: "آزاد", id: "azad" },
|
||||
{ label: "دولتی", id: "dolati" },
|
||||
];
|
||||
Reference in New Issue
Block a user