change fields component & handle edit, delete, add data and save & change functional page doctor

This commit is contained in:
Ehsan
2025-07-02 01:58:44 +03:30
parent 43eb9c2b78
commit 04d3e38859
22 changed files with 290 additions and 313 deletions
@@ -5,23 +5,21 @@ import Head from "@/components/dashboard/userAccount/components/Head";
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
function Disease({ data, setData, updateData, loading }) {
const disease = data && data.other && data.other[0] && data.other[0].disease;
const disease = data && data.other && data.other.disease;
const tableHead = ["ردیف", "اسم", "وضعیت", ""];
const centerTable = [0];
const changeData = (id, payload) => {
const newDisease = data.other[0].disease?.map((item, index) =>
const newDisease = data.other.disease?.map((item, index) =>
index === id ? { ...item, status: payload } : item
);
const newData = {
...data,
other: [
{
...data.other[0],
disease: newDisease,
},
],
other: {
...data.other,
disease: newDisease,
},
};
setData(newData);