change design and data list in doctor-item & handle component appointment in doctor-item & handle functionality date-picker & fix bug appointment page & add req get appointment list
This commit is contained in:
@@ -13,6 +13,7 @@ import FamilyHistory from "./familyHistory";
|
||||
import Relatives from "./relatives";
|
||||
import { removeAdditionalKeysDashboard } from "@/helper";
|
||||
import Cookies from "js-cookie";
|
||||
import LoadingComponent from "@/app/component/LoadingComponent";
|
||||
|
||||
function DetailUser({ user, isTurnsDetails, setIsTurnsDetails }) {
|
||||
const [tab, setTab] = useState(0);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ArrowLeftWhiteD from "@/components/icons/ArrowLeftWhiteD";
|
||||
import {
|
||||
convertJalaliTimestamp,
|
||||
changeDateType,
|
||||
handleTimeExpiresToken,
|
||||
removeAdditionalKeysDashboard,
|
||||
} from "@/helper";
|
||||
@@ -24,25 +24,9 @@ function ButtonSendData({
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const changeDateType = (data) => {
|
||||
const newData = data;
|
||||
const splitedDate = newData.birthday.split("/");
|
||||
newData.birthday = convertJalaliTimestamp(
|
||||
{
|
||||
jy: Number(splitedDate[0]),
|
||||
jm: Number(splitedDate[1]),
|
||||
jd: Number(splitedDate[2]),
|
||||
},
|
||||
true
|
||||
);
|
||||
return newData;
|
||||
};
|
||||
|
||||
const postData = () => {
|
||||
console.log(changeDateType(information));
|
||||
|
||||
request
|
||||
.postUserProfile(information)
|
||||
.postUserProfile(changeDateType(information, false))
|
||||
.then((response) => {
|
||||
if (response.uuid) {
|
||||
const formData = new URLSearchParams();
|
||||
@@ -84,11 +68,10 @@ function ButtonSendData({
|
||||
|
||||
const patchData = () => {
|
||||
const usedKays = removeAdditionalKeysDashboard(information);
|
||||
console.log(changeDateType(information));
|
||||
|
||||
request
|
||||
.patchUserProfile(
|
||||
usedKays,
|
||||
changeDateType(usedKays, true),
|
||||
information?.uuid,
|
||||
Cookies.get("access_token")
|
||||
)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
function Content({ isConfirmed, children, title, error }) {
|
||||
function Content({ isConfirmed, children, title, error, req }) {
|
||||
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>
|
||||
<p className="text-[#525252] text-[14px] font-medium">
|
||||
{title} {req && "*"}
|
||||
</p>
|
||||
{isConfirmed && (
|
||||
<p
|
||||
className="py-[4px] md:py-[2px] px-[5px] bg-[#05BA58] rounded-[40px] text-[#FFF]
|
||||
|
||||
@@ -20,8 +20,6 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
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}>
|
||||
@@ -35,8 +33,14 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
data={parsedUserInfo?.username}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.national_code} title="کد ملی" isConfirmed={false}>
|
||||
<Content
|
||||
req={true}
|
||||
error={errors?.national_code}
|
||||
title="کد ملی"
|
||||
isConfirmed={false}
|
||||
>
|
||||
<Field
|
||||
req={true}
|
||||
error={errors?.national_code}
|
||||
type="number"
|
||||
iconGray={true}
|
||||
@@ -47,7 +51,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
disable={information?.prev_data}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.name} title="نام" isConfirmed={false}>
|
||||
<Content req={true} error={errors?.name} title="نام" isConfirmed={false}>
|
||||
<Field
|
||||
error={errors?.name}
|
||||
isTransparent={true}
|
||||
@@ -57,7 +61,12 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
name="name"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.family} title="نام خانوادگی" isConfirmed={false}>
|
||||
<Content
|
||||
req={true}
|
||||
error={errors?.family}
|
||||
title="نام خانوادگی"
|
||||
isConfirmed={false}
|
||||
>
|
||||
<Field
|
||||
error={errors?.family}
|
||||
isTransparent={true}
|
||||
@@ -67,7 +76,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
name="family"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.gender} title="جنسیت">
|
||||
<Content req={true} error={errors?.gender} title="جنسیت">
|
||||
<AutoSelector
|
||||
error={errors?.gender}
|
||||
updateData={(name, data) =>
|
||||
@@ -79,7 +88,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
list={gender}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.birthday} title="تاریخ تولد">
|
||||
<Content req={true} error={errors?.birthday} title="تاریخ تولد">
|
||||
<DateBirthday
|
||||
error={errors?.birthday}
|
||||
data={information?.birthday}
|
||||
@@ -87,7 +96,12 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
changeData={changeData}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.fathers_name} title="نام پدر" isConfirmed={false}>
|
||||
<Content
|
||||
req={true}
|
||||
error={errors?.fathers_name}
|
||||
title="نام پدر"
|
||||
isConfirmed={false}
|
||||
>
|
||||
<Field
|
||||
error={errors?.fathers_name}
|
||||
isTransparent={true}
|
||||
@@ -97,7 +111,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
name="fathers_name"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.basic_insurance} title="نوع بیمه">
|
||||
<Content req={true} error={errors?.basic_insurance} title="نوع بیمه">
|
||||
<AutoSelector
|
||||
error={errors?.basic_insurance}
|
||||
updateData={(name, val) => {
|
||||
@@ -121,6 +135,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
isConfirmed={false}
|
||||
>
|
||||
<Field
|
||||
req={true}
|
||||
error={errors?.insurance_id}
|
||||
isTransparent={true}
|
||||
iconGray={true}
|
||||
@@ -130,7 +145,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
name="insurance_id"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.blood_type} title="گروه خونی">
|
||||
<Content req={true} error={errors?.blood_type} title="گروه خونی">
|
||||
<AutoSelector
|
||||
error={errors?.blood_type}
|
||||
updateData={(name, value) =>
|
||||
@@ -142,7 +157,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
list={blood_group}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.marital_status} title="وضعیت تاهل">
|
||||
<Content req={true} error={errors?.marital_status} title="وضعیت تاهل">
|
||||
<AutoSelector
|
||||
error={errors?.marital_status}
|
||||
updateData={(name, value) =>
|
||||
@@ -164,7 +179,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
name="home_phone"
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.education} title="تحصیلات">
|
||||
<Content req={true} error={errors?.education} title="تحصیلات">
|
||||
<AutoSelector
|
||||
error={errors?.education}
|
||||
updateData={(name, value) =>
|
||||
@@ -176,7 +191,7 @@ function Form({ insurance, errors, changeData, information }) {
|
||||
list={education}
|
||||
/>
|
||||
</Content>
|
||||
<Content error={errors?.job} title="شغل">
|
||||
<Content req={true} error={errors?.job} title="شغل">
|
||||
<AutoSelector
|
||||
error={errors?.job}
|
||||
updateData={(name, value) =>
|
||||
|
||||
@@ -2,13 +2,15 @@ import { useEffect, useState } from "react";
|
||||
import Form from "./form";
|
||||
import { request } from "@/services/response";
|
||||
import ButtonSendData from "./ButtonSendData";
|
||||
import { getParsedUserInfo } from "@/helper";
|
||||
import { changeDateType, getParsedUserInfo } from "@/helper";
|
||||
import { disease } from "./form/disease";
|
||||
import LoadingComponent from "@/app/component/LoadingComponent";
|
||||
|
||||
function Information({ information, setInformation }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [insurance, setInsurance] = useState();
|
||||
const [errors, setErrors] = useState({});
|
||||
const [loadingInfo, setLoadingInfo] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const parsedUserInfo = getParsedUserInfo();
|
||||
@@ -23,12 +25,17 @@ function Information({ information, setInformation }) {
|
||||
request
|
||||
.getUserProfile(parsedUserInfo.uuid)
|
||||
.then((res) => {
|
||||
const changedData = res;
|
||||
setLoadingInfo(false);
|
||||
let changedData = res;
|
||||
|
||||
changedData.basic_insurance = [Number(res?.basic_insurance?.id)];
|
||||
changedData.prev_data = true;
|
||||
changedData = changeDateType(changedData, false);
|
||||
|
||||
setInformation(changedData);
|
||||
})
|
||||
.catch((err) => {
|
||||
setLoadingInfo(false);
|
||||
if (err?.response?.data === "Entity not found") {
|
||||
setInformation({
|
||||
prev_data: false,
|
||||
@@ -43,6 +50,8 @@ function Information({ information, setInformation }) {
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setLoadingInfo(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -60,22 +69,24 @@ function Information({ information, setInformation }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
<Form
|
||||
errors={errors}
|
||||
insurance={insurance}
|
||||
changeData={changeData}
|
||||
information={information}
|
||||
/>
|
||||
<ButtonSendData
|
||||
setInformation={setInformation}
|
||||
information={information}
|
||||
setLoading={setLoading}
|
||||
setErrors={setErrors}
|
||||
loading={loading}
|
||||
errors={errors}
|
||||
/>
|
||||
</div>
|
||||
<LoadingComponent loading={loadingInfo}>
|
||||
<div className="opacity-page">
|
||||
<Form
|
||||
errors={errors}
|
||||
insurance={insurance}
|
||||
changeData={changeData}
|
||||
information={information}
|
||||
/>
|
||||
<ButtonSendData
|
||||
setInformation={setInformation}
|
||||
information={information}
|
||||
setLoading={setLoading}
|
||||
setErrors={setErrors}
|
||||
loading={loading}
|
||||
errors={errors}
|
||||
/>
|
||||
</div>
|
||||
</LoadingComponent>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ function Relatives({ data, changeData, loading, updateData }) {
|
||||
const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "آدرس", ""];
|
||||
const centerTable = [0];
|
||||
const [open, setOpen] = useState(false);
|
||||
console.log(relatives);
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
|
||||
@@ -24,7 +24,6 @@ function ModalAddRelatives({ open, setOpen, changeData, loading, updateData }) {
|
||||
setNewItem(contentItem);
|
||||
handleClose();
|
||||
};
|
||||
console.log(newItem);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user