сделал постраничное отображение пациентов
This commit is contained in:
parent
55687c6925
commit
cb3860297a
@ -5,6 +5,7 @@ import { useAuth } from "../AuthContext.jsx";
|
|||||||
import getAllPatients from "../api/GetAllPatients.jsx";
|
import getAllPatients from "../api/GetAllPatients.jsx";
|
||||||
import PatientListCard from "../components/PatientListCard.jsx";
|
import PatientListCard from "../components/PatientListCard.jsx";
|
||||||
|
|
||||||
|
const { Search } = Input;
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
const PatientsPage = () => {
|
const PatientsPage = () => {
|
||||||
@ -14,6 +15,9 @@ const PatientsPage = () => {
|
|||||||
const [patients, setPatients] = useState([]);
|
const [patients, setPatients] = useState([]);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
|
|
||||||
|
const [current, setCurrent] = useState(1);
|
||||||
|
const [pageSize, setPageSize] = useState(10);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchPatients = async () => {
|
const fetchPatients = async () => {
|
||||||
if (!user || !user.token) return;
|
if (!user || !user.token) return;
|
||||||
@ -45,7 +49,7 @@ const PatientsPage = () => {
|
|||||||
<div style={{ padding: 20 }}>
|
<div style={{ padding: 20 }}>
|
||||||
<Row gutter={[16, 16]} style={{ marginBottom: 20 }}>
|
<Row gutter={[16, 16]} style={{ marginBottom: 20 }}>
|
||||||
<Col xs={24} sm={16}>
|
<Col xs={24} sm={16}>
|
||||||
<Input
|
<Search
|
||||||
placeholder="Поиск пациента"
|
placeholder="Поиск пациента"
|
||||||
onChange={(e) => setSearchText(e.target.value)}
|
onChange={(e) => setSearchText(e.target.value)}
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
@ -71,6 +75,16 @@ const PatientsPage = () => {
|
|||||||
<PatientListCard patient={patient} />
|
<PatientListCard patient={patient} />
|
||||||
</List.Item>
|
</List.Item>
|
||||||
)}
|
)}
|
||||||
|
pagination={{
|
||||||
|
current,
|
||||||
|
pageSize,
|
||||||
|
showSizeChanger: true,
|
||||||
|
pageSizeOptions: ["5", "10", "20", "50"],
|
||||||
|
onChange: (page, newPageSize) => {
|
||||||
|
setCurrent(page);
|
||||||
|
setPageSize(newPageSize);
|
||||||
|
},
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FloatButton
|
<FloatButton
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user