Enhance ChangeEquipmentStatus forms and EquipmentEdit layout

- Updated ChangeEquipmentStatusCreate and ChangeEquipmentStatusEdit components to include fullWidth properties for better layout consistency.
- Added a required DateInput field for "Дата" in both ChangeEquipmentStatus forms.
- Improved EquipmentEdit component by making fields fullWidth and adding helper text for the serial number input.
- Rearranged fields in EquipmentEdit for improved user experience.
This commit is contained in:
Первов Артем
2026-04-21 13:24:29 +03:00
parent ad245db29f
commit fea773bb15
4 changed files with 39 additions and 18 deletions

View File

@@ -14,17 +14,24 @@ export function ChangeEquipmentStatusCreate() {
return (
<Create>
<SimpleForm>
<RaTextInput source="number" label="Номер" />
<RaTextInput source="number" label="Номер" fullWidth />
<DateInput source="date" label="Дата" required fullWidth />
<ReferenceInput source="equipmentId" reference="equipment">
<AutocompleteInput
label="Оборудование"
optionText={equipmentOptionText}
filterToQuery={(searchText) => ({ q: searchText })}
fullWidth
/>
</ReferenceInput>
<RaTextInput source="responsible" label="Ответственный" />
<DateInput source="date" label="Дата" required />
<SelectInput source="newStatus" label="Новый статус" choices={equipmentStatusChoices} required />
<SelectInput
source="newStatus"
label="Новый статус"
choices={equipmentStatusChoices}
required
fullWidth
/>
<RaTextInput source="responsible" label="Ответственный" fullWidth />
<StatusChangeAttachmentsInput />
</SimpleForm>
</Create>

View File

@@ -14,17 +14,24 @@ export function ChangeEquipmentStatusEdit() {
return (
<Edit>
<SimpleForm>
<RaTextInput source="number" label="Номер" />
<RaTextInput source="number" label="Номер" fullWidth />
<DateInput source="date" label="Дата" fullWidth />
<ReferenceInput source="equipmentId" reference="equipment">
<AutocompleteInput
label="Оборудование"
optionText={equipmentOptionText}
filterToQuery={(searchText) => ({ q: searchText })}
fullWidth
/>
</ReferenceInput>
<RaTextInput source="responsible" label="Ответственный" />
<DateInput source="date" label="Дата" />
<SelectInput source="newStatus" label="Новый статус" choices={equipmentStatusChoices} />
<SelectInput
source="newStatus"
label="Новый статус"
choices={equipmentStatusChoices}
fullWidth
required
/>
<RaTextInput source="responsible" label="Ответственный" fullWidth />
<StatusChangeAttachmentsInput />
</SimpleForm>
</Edit>

View File

@@ -1,4 +1,4 @@
import { Button, Chip, Stack, Typography } from '@mui/material';
import { Button, Stack, Typography } from '@mui/material';
import { useNotify, useRecordContext, useRefresh } from 'react-admin';
import { useCallback, useMemo, useState, type ChangeEvent } from 'react';
import { ensureFreshToken, getAccessToken } from '../../auth/keycloak';
@@ -8,7 +8,6 @@ import { StatusChangeAttachmentLink } from './StatusChangeAttachmentLink';
export type StatusChangeAttachmentValue = {
id: string;
originalFileName?: string | null;
contentType?: string | null;
sizeBytes?: number | null;
}[];
@@ -138,9 +137,6 @@ export function StatusChangeAttachmentsInput() {
/>
</Typography>
<Stack direction="row" spacing={1} alignItems="center">
{att.contentType ? (
<Chip size="small" label={att.contentType} variant="outlined" />
) : null}
{formatBytes(att.sizeBytes) ? (
<Typography variant="caption" color="text.secondary">
{formatBytes(att.sizeBytes)}

View File

@@ -13,11 +13,22 @@ export function EquipmentEdit() {
return (
<Edit>
<SimpleForm>
<DateInput source="dateOfInspection" label={equipmentLabels.dateOfInspection} />
<DateInput source="commissionedAt" label={equipmentLabels.commissionedAt} />
<RaTextInput source="name" label={equipmentLabels.name} />
<RaTextInput source="serialNumber" label={equipmentLabels.serialNumber} />
<SelectInput source="status" label={equipmentLabels.status} choices={equipmentStatusChoices} />
<RaTextInput source="name" label={equipmentLabels.name} fullWidth required />
<RaTextInput
source="serialNumber"
label={equipmentLabels.serialNumber}
fullWidth
helperText="Введите заводской (серийный) номер"
/>
<SelectInput
source="status"
label={equipmentLabels.status}
choices={equipmentStatusChoices}
fullWidth
required
/>
<DateInput source="commissionedAt" label={equipmentLabels.commissionedAt} fullWidth />
<DateInput source="dateOfInspection" label={equipmentLabels.dateOfInspection} fullWidth />
</SimpleForm>
</Edit>
);