feat(LensViewModal): Отображение данных о пациенте для линзы

This commit is contained in:
Андрей Дувакин 2025-07-04 07:41:01 +05:00
parent 551af24be9
commit ac70c09509
2 changed files with 37 additions and 2 deletions

View File

@ -1,10 +1,39 @@
import {Button, Col, Modal, Row, Typography} from "antd";
import {Button, Col, Modal, Result, Row, Typography} from "antd";
import PropTypes from "prop-types";
import {LensPropType} from "../../../../../../../Types/lensPropType.js";
import useLensViewModal from "./useLensViewModal.js";
import LoadingIndicator from "../../../../../../Widgets/LoadingIndicator/LoadingIndicator.jsx";
const {Text, Title} = Typography;
const LensViewModal = ({visible, onCancel, lens}) => {
const {
lensIssue,
isLensIssuesLoading,
isLensIssuesError
} = useLensViewModal(lens, visible);
if (isLensIssuesLoading) {
return (
<Modal>
<LoadingIndicator/>
</Modal>
);
}
if (isLensIssuesError) {
return (
<Modal>
<Result
status="error"
title="Ошибка"
subTitle="Не удалось загрузить данные о выданных линзах"
extra={<Button type="primary" onClick={onCancel}>Закрыть</Button>}
/>
</Modal>
);
}
return (
<Modal
title="Просмотр линзы"
@ -66,6 +95,12 @@ const LensViewModal = ({visible, onCancel, lens}) => {
</div>
</Col>
</Row>
{lensIssue && (
<div style={{marginBottom: 12}}>
<Title level={5}>👨 Пациент</Title>
<Text>{lensIssue?.patient?.last_name} {lensIssue?.patient?.first_name}</Text>
</div>
)}
</Modal>
);
};

View File

@ -11,7 +11,7 @@ const useLensViewModal = (lens, visible) => {
pollingInterval: 60000,
refetchOnMountOrArgChange: true,
});
return {
lensIssue,
isLensIssueLoading,