handle change data and update data in dashboard page for all tabs

This commit is contained in:
Ehsan
2025-06-11 16:52:01 +03:30
parent 72ed07071c
commit bf64271d14
26 changed files with 235 additions and 118 deletions
@@ -4,7 +4,9 @@ import { useState } from "react";
import ItemMedication from "./ItemMedication";
import ModalAddMedications from "./modal";
function Medications({ data, changeData }) {
function Medications({ data, changeData, updateData, loading }) {
const { other } = data;
const { medications } = other && other[0];
const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""];
const centerTable = [0];
const [open, setOpen] = useState(false);
@@ -15,16 +17,18 @@ function Medications({ data, changeData }) {
<ModalAddMedications
open={open}
setOpen={setOpen}
loading={loading}
updateData={updateData}
changeData={changeData}
/>
</Head>
{data.medications.length ? (
{medications.length ? (
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{data.medications.map((row, idx) => (
{medications.map((row, idx) => (
<ItemMedication
key={idx}
row={row}