import { Input, Select, List, FloatButton, Row, Col, Table, Button, Popconfirm, Typography, Result, Tooltip } from "antd"; import { BuildOutlined, PlusOutlined, SortAscendingOutlined, SortDescendingOutlined, TableOutlined, TeamOutlined } from "@ant-design/icons"; import PatientListCard from "../../Dummies/PatientListCard.jsx"; import PatientFormModal from "../../Dummies/PatientFormModal/PatientFormModal.jsx"; import SelectViewMode from "../../Widgets/SelectViewMode.jsx"; import LoadingIndicator from "../../Widgets/LoadingIndicator.jsx"; import usePatients from "./usePatients.js"; import usePatientsUI from "./usePatientsUI.js"; const {Option} = Select; const {Title} = Typography; const PatientsPage = () => { const patientsData = usePatients(); const patientsUI = usePatientsUI(patientsData.patients); const columns = [ { title: "Фамилия", dataIndex: "last_name", key: "last_name", sorter: (a, b) => a.last_name.localeCompare(b.last_name), sortDirections: ["ascend", "descend"], }, { title: "Имя", dataIndex: "first_name", key: "first_name", sorter: (a, b) => a.first_name.localeCompare(b.first_name), sortDirections: ["ascend", "descend"], }, { title: "Отчество", dataIndex: "patronymic", key: "patronymic", sortDirections: ["ascend", "descend"], }, { title: "Дата рождения", dataIndex: "birthday", sorter: (a, b) => new Date(a.birthday).getTime() - new Date(b.birthday).getTime(), sortDirections: ["ascend", "descend"], render: patientsUI.formatDate, }, { title: "Телефон", dataIndex: "phone", }, { title: "Email", dataIndex: "email", }, { title: "Действия", fixed: 'right', render: (_, record) => ( patientsData.handleDeletePatient(record.id)} okText="Да, удалить" cancelText="Отмена" > ), }, ]; const viewModes = [ { value: "tile", label: "Плитка", icon: }, { value: "table", label: "Таблица", icon: } ]; if (patientsData.isError) return ( ); return (
<TeamOutlined/> Пациенты patientsUI.handleSetSearchText(e.target.value)} style={patientsUI.formItemStyle} allowClear /> {patientsUI.viewMode === "tile" && ( )} {patientsData.isLoading ? : patientsUI.viewMode === "tile" ? ( ( )} pagination={patientsUI.pagination} /> ) : ( )} } type="primary" onClick={patientsUI.handleAddPatient} tooltip="Добавить пациента" /> ); }; export default PatientsPage;