change fields component & handle edit, delete, add data and save & change functional page doctor
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user