fix bug dashboard bugs & handle request update data in user profile & change design button in home page

This commit is contained in:
Ehsan
2025-06-13 22:12:58 +03:30
parent eea8737778
commit 891b0e8273
9 changed files with 23 additions and 24 deletions
@@ -9,7 +9,7 @@ function ButtonFilter({ selected, setOpen }) {
return (
<div>
<Button
className="!border-none hover:!bg-transparent !py-[11.5px] !min-w-fit !px-[7px] sm:!py-3 sm:!px-[9px] md:!px-[11px] lg:!px-[12px] !rounded-3"
className="!border-none hover:!bg-transparent !shadow-none !py-[11.5px] !min-w-fit !px-[7px] sm:!py-3 sm:!px-[9px] md:!px-[11px] lg:!px-[12px] !rounded-3"
onClick={handleOpen}
variant="contained"
color="secondary"
@@ -5,8 +5,8 @@ import ItemAllergie from "./ItemAllergie";
import ModalAddAlergie from "./modal";
function Allergies({ data, changeData, updateData, loading }) {
const { other } = data;
const { allergies } = other && other[0];
const allergies =
data && data.other && data.other[0] && data.other[0].allergies;
const tableHead = ["ردیف", "ماده آلرژی‌زا", "واکنش", "شدت", ""];
const centerTable = [0];
const [open, setOpen] = useState(false);
@@ -5,8 +5,7 @@ import Head from "@/components/dashboard/userAccount/components/Head";
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
function Disease({ data, setData, updateData, loading }) {
const { other } = data;
const { disease } = other && other[0];
const disease = data && data.other && data.other[0] && data.other[0].disease;
const tableHead = ["ردیف", "اسم", "وضعیت", ""];
const centerTable = [0];
@@ -5,8 +5,8 @@ import ModalAddHistory from "./modal";
import ItemHistory from "./ItemHistory";
function FamilyHistory({ data, changeData, loading, updateData }) {
const { other } = data;
const { family_history } = other && other[0];
const family_history =
data && data.other && data.other[0] && data.other[0].family_history;
const tableHead = ["ردیف", "بیماری", "نسبت خانوادگی", ""];
const centerTable = [0];
const [open, setOpen] = useState(false);
@@ -19,14 +19,12 @@ function Information({
const [insurance, setInsurance] = useState();
useEffect(() => {
request
.getInsuranceType()
.then((res) => {
if (res && res.data) {
setInsurance(res.data);
}
})
// .catch((err) => {});
request.getInsuranceType().then((res) => {
if (res && res.data) {
setInsurance(res.data);
}
});
// .catch((err) => {});
}, []);
const changeData = (value, type, name) => {
@@ -39,17 +37,19 @@ function Information({
const sendReq = () => {
setLoading(true);
console.log(data);
request[dataUser ? "patchUserProfile" : "postUserProfile"](
data,
dataUser ? dataUser.uuid : Cookies.get("uuid")
)
.then((res) => {
.then(() => {
if (!dataUser) {
updateDataUser();
}
setLoading(false);
})
.catch((err) => {
.catch(() => {
setLoading(false);
});
};
@@ -5,8 +5,8 @@ import ItemMedication from "./ItemMedication";
import ModalAddMedications from "./modal";
function Medications({ data, changeData, updateData, loading }) {
const { other } = data;
const { medications } = other && other[0];
const medications =
data && data.other && data.other[0] && data.other[0].medications;
const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""];
const centerTable = [0];
const [open, setOpen] = useState(false);
@@ -5,8 +5,8 @@ import ModalAddRelatives from "./modal";
import ItemRelatives from "./ItemRelatives";
function Relatives({ data, changeData, loading, updateData }) {
const { other } = data;
const { relatives } = other && other[0];
const relatives =
data && data.other && data.other[0] && data.other[0].relatives;
const tableHead = ["ردیف", "نام", "نسبت", "شماره تماس", "آدرس", ""];
const centerTable = [0];
const [open, setOpen] = useState(false);
@@ -5,8 +5,8 @@ import ItemSurgeries from "./ItemSurgeries";
import ModalAddSurgeries from "./modal";
function Surgeries({ data, changeData, loading, updateData }) {
const { other } = data;
const { surgeries } = other && other[0];
const surgeries =
data && data.other && data.other[0] && data.other[0].surgeries;
const tableHead = [
"ردیف",
"نوع جراحی",
+1 -1
View File
@@ -3,7 +3,7 @@ import Image from "next/image";
function Head({ user }) {
const userInfo = Cookies.get("userInfo");
const parsedInfo = JSON.parse(userInfo);
const parsedInfo = userInfo && JSON.parse(userInfo);
return (
<div className="w-full flex flex-row md:flex-col items-center justify-center md:justify-start gap-[12px] md:gap-[4px]">