update design and request pages dashboards & doctors & doctor item & clinics & clinic item and layout
This commit is contained in:
@@ -3,10 +3,19 @@ import TextLoading from "@/app/component/loading/Text";
|
||||
import { Switch, TableCell, TableRow } from "@mui/material";
|
||||
import Head from "@/components/dashboard/userAccount/components/Head";
|
||||
import UpdateBtn from "@/components/dashboard/userAccount/components/UpdateBtn";
|
||||
import { useState } from "react";
|
||||
import { dieses } from "../information/dieses";
|
||||
|
||||
function Disease({ data, changeData }) {
|
||||
function Disease() {
|
||||
const tableHead = ["ردیف", "اسم", "وضعیت", ""];
|
||||
const [data, setData] = useState(dieses);
|
||||
const centerTable = [0];
|
||||
const changeData = (id, payload) => {
|
||||
const updatedData = data.map((item, index) =>
|
||||
index === id ? { ...item, status: payload } : item
|
||||
);
|
||||
setData(updatedData);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="opacity-page">
|
||||
@@ -18,7 +27,7 @@ function Disease({ data, changeData }) {
|
||||
tableHead={tableHead}
|
||||
centerTable={centerTable}
|
||||
>
|
||||
{data.disease.map((row, idx) => (
|
||||
{data.map((row, idx) => (
|
||||
<TableRow
|
||||
key={idx}
|
||||
className="!border-0 !border-b !border-[#DBDBDB] dark:!border-transparent"
|
||||
@@ -41,9 +50,7 @@ function Disease({ data, changeData }) {
|
||||
<Switch
|
||||
defaultChecked={row.status === "true"}
|
||||
onChange={(e) => {
|
||||
const newData = row;
|
||||
newData.status = JSON.stringify(e.target.checked);
|
||||
changeData("update", "disease", idx, newData);
|
||||
changeData(idx, JSON.stringify(e.target.checked));
|
||||
}}
|
||||
/>
|
||||
</TextLoading>
|
||||
|
||||
Reference in New Issue
Block a user