import type { DoctorListResData } from "@/features/doctors/lib/data"; import formatPhone from "@/shared/lib/formatPhone"; import { Badge } from "@/shared/ui/badge"; import { Button } from "@/shared/ui/button"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/shared/ui/table"; import { Eye, Loader2, Pencil, Trash2 } from "lucide-react"; import type { Dispatch, SetStateAction } from "react"; interface Props { setDetail: Dispatch>; setEditingPlan: Dispatch>; setDialogOpen: Dispatch>; setDetailDialog: Dispatch>; doctor: DoctorListResData[] | []; isLoading: boolean; isError: boolean; isFetching: boolean; handleDelete: (user: DoctorListResData) => void; } const TableDoctor = ({ doctor, setDetail, setDetailDialog, isError, setEditingPlan, isLoading, setDialogOpen, handleDelete, isFetching, }: Props) => { return (
{(isLoading || isFetching) && (
)} {isError && (
Ma'lumotlarni olishda xatolik yuz berdi.
)} {!isLoading && !isError && ( # Shifokor Ism Familiyasi Telefon raqami Tuman Obyekt Ish joyi Sohasi Kim qo'shgan Amallar {doctor.length > 0 ? ( doctor.map((item, index) => ( {index + 1} {item.first_name} {item.last_name} {formatPhone(item.phone_number)} {item.district.name} {item.place.name} {item.work_place} {item.sphere} {item.user.first_name} {item.user.last_name} )) ) : ( Shifokor topilmadi. )}
)}
); }; export default TableDoctor;