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:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user