fix: Исправление UI и API

Исправлены ошибки UI, API и добавлены улучшения.
This commit is contained in:
Андрей Дувакин 2025-06-10 08:37:49 +05:00
parent 76b72dce1c
commit 7574b08b25
6 changed files with 23 additions and 21 deletions

View File

@ -44,7 +44,7 @@ export const lensesApi = createApi({
method: 'POST', method: 'POST',
body: lens body: lens
}), }),
invalidatesTags: ['Lens'] invalidatesTags: ['Lenses']
}), }),
updateLens: builder.mutation({ updateLens: builder.mutation({
query: ({id, ...lens}) => ({ query: ({id, ...lens}) => ({
@ -52,14 +52,14 @@ export const lensesApi = createApi({
method: 'PUT', method: 'PUT',
body: lens body: lens
}), }),
invalidatesTags: ['Lens'] invalidatesTags: ['Lenses']
}), }),
deleteLens: builder.mutation({ deleteLens: builder.mutation({
query: (id) => ({ query: (id) => ({
url: `/lenses/${id}/`, url: `/lenses/${id}/`,
method: 'DELETE' method: 'DELETE'
}), }),
invalidatesTags: ['Lens'] invalidatesTags: ['Lenses']
}), }),
}), }),
}); });

View File

@ -23,7 +23,7 @@ export const patientsApi = createApi({
url: '/patients/', url: '/patients/',
params: { all_params: true }, params: { all_params: true },
}), }),
providesTags: ['Patient'], providesTags: ['Patients'],
transformResponse: (response) => { transformResponse: (response) => {
if (!response || !Array.isArray(response.patients)) { if (!response || !Array.isArray(response.patients)) {
console.warn('Unexpected patients API response:', response); console.warn('Unexpected patients API response:', response);
@ -38,7 +38,7 @@ export const patientsApi = createApi({
method: 'POST', method: 'POST',
body: patient body: patient
}), }),
invalidatesTags: ['Patient'] invalidatesTags: ['Patients']
}), }),
updatePatient: builder.mutation({ updatePatient: builder.mutation({
query: ({id, ...patient}) => ({ query: ({id, ...patient}) => ({
@ -46,14 +46,14 @@ export const patientsApi = createApi({
method: 'PUT', method: 'PUT',
body: patient body: patient
}), }),
invalidatesTags: ['Patient'] invalidatesTags: ['Patients']
}), }),
deletePatient: builder.mutation({ deletePatient: builder.mutation({
query: (id) => ({ query: (id) => ({
url: `/patients/${id}/`, url: `/patients/${id}/`,
method: 'DELETE' method: 'DELETE'
}), }),
invalidatesTags: ['Patient'] invalidatesTags: ['Patients']
}), }),
}), }),
}); });

View File

@ -229,6 +229,7 @@ const AppointmentFormModal = () => {
const ConfirmStep = useMemo(() => { const ConfirmStep = useMemo(() => {
const values = appointmentFormModalUI.form.getFieldsValue(); const values = appointmentFormModalUI.form.getFieldsValue();
const formValues = appointmentFormModalUI.formValues;
const patient = appointmentFormModalData.patients.find((p) => p.id === values.patient_id); const patient = appointmentFormModalData.patients.find((p) => p.id === values.patient_id);
const appointmentType = appointmentFormModalData.appointmentTypes.find((t) => t.id === values.type_id); const appointmentType = appointmentFormModalData.appointmentTypes.find((t) => t.id === values.type_id);
@ -251,7 +252,7 @@ const AppointmentFormModal = () => {
<p> <p>
<b>Результаты приема:</b> <b>Результаты приема:</b>
</p> </p>
<div dangerouslySetInnerHTML={{__html: values.results || "Не указаны"}}/> <div dangerouslySetInnerHTML={{__html: formValues.results || "Не указаны"}}/>
<p> <p>
<b>Прикрепленные файлы:</b> <b>Прикрепленные файлы:</b>
</p> </p>

View File

@ -422,6 +422,7 @@ const useAppointmentFormModalUI = (createAppointment, patients, cancelAppointmen
screenXS, screenXS,
direction, direction,
isDrawerVisible, isDrawerVisible,
formValues,
showDrawer, showDrawer,
closeDrawer, closeDrawer,
isLoadingPreviousAppointments, isLoadingPreviousAppointments,

View File

@ -51,7 +51,7 @@ const MainLayout = () => {
collapsible={!mainLayoutUI.screens.xs} collapsible={!mainLayoutUI.screens.xs}
collapsed={mainLayoutUI.collapsed} collapsed={mainLayoutUI.collapsed}
onCollapse={mainLayoutUI.setCollapsed} onCollapse={mainLayoutUI.setCollapsed}
style={{height: "100vh", position: "fixed", left: 0}} style={{height: "100vh", position: "fixed", left: 0, overflow: "auto"}}
> >
<div style={{display: "flex", justifyContent: "center", padding: 16}}> <div style={{display: "flex", justifyContent: "center", padding: 16}}>
<img <img

View File

@ -150,7 +150,7 @@ const PatientsPage = () => {
{patientsData.isLoading ? <LoadingIndicator/> : patientsData.viewMode === "tile" ? ( {patientsData.isLoading ? <LoadingIndicator/> : patientsData.viewMode === "tile" ? (
<List <List
grid={{gutter: 16, column: 3}} grid={{ gutter: 16, xs: 1, sm: 1, md: 2, lg: 3, xl: 4 }}
dataSource={patientsData.filteredPatients} dataSource={patientsData.filteredPatients}
renderItem={patient => ( renderItem={patient => (
<List.Item> <List.Item>