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,8 +5,7 @@ import ItemMedication from "./ItemMedication";
import ModalAddMedications from "./modal";
function Medications({ data, changeData, updateData, loading }) {
const medications =
data && data.other && data.other[0] && data.other[0].medications;
const medications = data && data.other && data.other.medications;
const tableHead = ["ردیف", "نام دارو", "دوز مصرفی", "تعداد و زمان مصرف", ""];
const centerTable = [0];
const [open, setOpen] = useState(false);
@@ -22,13 +21,13 @@ function Medications({ data, changeData, updateData, loading }) {
changeData={changeData}
/>
</Head>
{medications.length ? (
{medications?.length ? (
<CustomTable
zeroRadius={true}
tableHead={tableHead}
centerTable={centerTable}
>
{medications.map((row, idx) => (
{medications?.map((row, idx) => (
<ItemMedication
key={idx}
row={row}