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:
@@ -14,17 +14,24 @@ export function ChangeEquipmentStatusCreate() {
|
|||||||
return (
|
return (
|
||||||
<Create>
|
<Create>
|
||||||
<SimpleForm>
|
<SimpleForm>
|
||||||
<RaTextInput source="number" label="Номер" />
|
<RaTextInput source="number" label="Номер" fullWidth />
|
||||||
|
<DateInput source="date" label="Дата" required fullWidth />
|
||||||
<ReferenceInput source="equipmentId" reference="equipment">
|
<ReferenceInput source="equipmentId" reference="equipment">
|
||||||
<AutocompleteInput
|
<AutocompleteInput
|
||||||
label="Оборудование"
|
label="Оборудование"
|
||||||
optionText={equipmentOptionText}
|
optionText={equipmentOptionText}
|
||||||
filterToQuery={(searchText) => ({ q: searchText })}
|
filterToQuery={(searchText) => ({ q: searchText })}
|
||||||
|
fullWidth
|
||||||
/>
|
/>
|
||||||
</ReferenceInput>
|
</ReferenceInput>
|
||||||
<RaTextInput source="responsible" label="Ответственный" />
|
<SelectInput
|
||||||
<DateInput source="date" label="Дата" required />
|
source="newStatus"
|
||||||
<SelectInput source="newStatus" label="Новый статус" choices={equipmentStatusChoices} required />
|
label="Новый статус"
|
||||||
|
choices={equipmentStatusChoices}
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<RaTextInput source="responsible" label="Ответственный" fullWidth />
|
||||||
<StatusChangeAttachmentsInput />
|
<StatusChangeAttachmentsInput />
|
||||||
</SimpleForm>
|
</SimpleForm>
|
||||||
</Create>
|
</Create>
|
||||||
|
|||||||
@@ -14,17 +14,24 @@ export function ChangeEquipmentStatusEdit() {
|
|||||||
return (
|
return (
|
||||||
<Edit>
|
<Edit>
|
||||||
<SimpleForm>
|
<SimpleForm>
|
||||||
<RaTextInput source="number" label="Номер" />
|
<RaTextInput source="number" label="Номер" fullWidth />
|
||||||
|
<DateInput source="date" label="Дата" fullWidth />
|
||||||
<ReferenceInput source="equipmentId" reference="equipment">
|
<ReferenceInput source="equipmentId" reference="equipment">
|
||||||
<AutocompleteInput
|
<AutocompleteInput
|
||||||
label="Оборудование"
|
label="Оборудование"
|
||||||
optionText={equipmentOptionText}
|
optionText={equipmentOptionText}
|
||||||
filterToQuery={(searchText) => ({ q: searchText })}
|
filterToQuery={(searchText) => ({ q: searchText })}
|
||||||
|
fullWidth
|
||||||
/>
|
/>
|
||||||
</ReferenceInput>
|
</ReferenceInput>
|
||||||
<RaTextInput source="responsible" label="Ответственный" />
|
<SelectInput
|
||||||
<DateInput source="date" label="Дата" />
|
source="newStatus"
|
||||||
<SelectInput source="newStatus" label="Новый статус" choices={equipmentStatusChoices} />
|
label="Новый статус"
|
||||||
|
choices={equipmentStatusChoices}
|
||||||
|
fullWidth
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<RaTextInput source="responsible" label="Ответственный" fullWidth />
|
||||||
<StatusChangeAttachmentsInput />
|
<StatusChangeAttachmentsInput />
|
||||||
</SimpleForm>
|
</SimpleForm>
|
||||||
</Edit>
|
</Edit>
|
||||||
|
|||||||
@@ -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 { useNotify, useRecordContext, useRefresh } from 'react-admin';
|
||||||
import { useCallback, useMemo, useState, type ChangeEvent } from 'react';
|
import { useCallback, useMemo, useState, type ChangeEvent } from 'react';
|
||||||
import { ensureFreshToken, getAccessToken } from '../../auth/keycloak';
|
import { ensureFreshToken, getAccessToken } from '../../auth/keycloak';
|
||||||
@@ -8,7 +8,6 @@ import { StatusChangeAttachmentLink } from './StatusChangeAttachmentLink';
|
|||||||
export type StatusChangeAttachmentValue = {
|
export type StatusChangeAttachmentValue = {
|
||||||
id: string;
|
id: string;
|
||||||
originalFileName?: string | null;
|
originalFileName?: string | null;
|
||||||
contentType?: string | null;
|
|
||||||
sizeBytes?: number | null;
|
sizeBytes?: number | null;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
@@ -138,9 +137,6 @@ export function StatusChangeAttachmentsInput() {
|
|||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
<Stack direction="row" spacing={1} alignItems="center">
|
<Stack direction="row" spacing={1} alignItems="center">
|
||||||
{att.contentType ? (
|
|
||||||
<Chip size="small" label={att.contentType} variant="outlined" />
|
|
||||||
) : null}
|
|
||||||
{formatBytes(att.sizeBytes) ? (
|
{formatBytes(att.sizeBytes) ? (
|
||||||
<Typography variant="caption" color="text.secondary">
|
<Typography variant="caption" color="text.secondary">
|
||||||
{formatBytes(att.sizeBytes)}
|
{formatBytes(att.sizeBytes)}
|
||||||
|
|||||||
@@ -13,11 +13,22 @@ export function EquipmentEdit() {
|
|||||||
return (
|
return (
|
||||||
<Edit>
|
<Edit>
|
||||||
<SimpleForm>
|
<SimpleForm>
|
||||||
<DateInput source="dateOfInspection" label={equipmentLabels.dateOfInspection} />
|
<RaTextInput source="name" label={equipmentLabels.name} fullWidth required />
|
||||||
<DateInput source="commissionedAt" label={equipmentLabels.commissionedAt} />
|
<RaTextInput
|
||||||
<RaTextInput source="name" label={equipmentLabels.name} />
|
source="serialNumber"
|
||||||
<RaTextInput source="serialNumber" label={equipmentLabels.serialNumber} />
|
label={equipmentLabels.serialNumber}
|
||||||
<SelectInput source="status" label={equipmentLabels.status} choices={equipmentStatusChoices} />
|
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>
|
</SimpleForm>
|
||||||
</Edit>
|
</Edit>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user