fix after review

This commit is contained in:
MaKarin
2026-03-24 12:49:23 +03:00
parent 5b8d8a85c4
commit b9b936c9ea
18 changed files with 461 additions and 246 deletions

View File

@@ -1,29 +1,29 @@
import { Edit, SimpleForm, TextInput, SelectInput, ReferenceInput, AutocompleteInput } from 'react-admin';
import { Edit, SimpleForm, TextInput, NumberInput, DateInput, SelectInput, ReferenceInput, AutocompleteInput } from 'react-admin';
const statusChoices = [
{ id: 'Active', name: 'Active' },
{ id: 'Repair', name: 'Repair' },
{ id: 'Reserve', name: 'Reserve' },
{ id: 'WriteOff', name: 'WriteOff' },
{ id: 'Active', name: 'В эксплуатации' },
{ id: 'Repair', name: 'В ремонте' },
{ id: 'Reserve', name: 'В резерве' },
{ id: 'WriteOff', name: 'Списано' },
];
export const EquipmentEdit = () => (
<Edit>
<SimpleForm>
<TextInput source="id" label="id" disabled />
<TextInput source="inventoryNumber" label="inventoryNumber" isRequired />
<TextInput source="serialNumber" label="serialNumber" />
<TextInput source="name" label="name" isRequired />
<ReferenceInput source="equipmentTypeCode" reference="equipment-types" label="equipmentTypeCode">
<AutocompleteInput optionText={(record) => record.code ? `${record.code}${record.name ?? record.code}` : (record.name ?? record.id)} filterToQuery={(searchText) => ({ q: searchText })} />
<TextInput source="inventoryNumber" label="Инвентарный номер" isRequired />
<TextInput source="serialNumber" label="Заводской (серийный) номер" />
<TextInput source="name" label="Наименование единицы оборудования" isRequired />
<ReferenceInput source="equipmentTypeCode" reference="equipment-types">
<AutocompleteInput label="Вид оборудования" optionText={(record) => record.code ? `${record.code}${record.name ?? record.code}` : (record.name ?? record.id)} filterToQuery={(searchText) => ({ q: searchText })} />
</ReferenceInput>
<SelectInput source="status" label="status" choices={statusChoices} emptyText="Не выбрано" />
<TextInput source="location" label="location" />
<TextInput source="commissionedAt" label="commissionedAt" />
<TextInput source="totalEngineHours" label="totalEngineHours" />
<TextInput source="engineHoursSinceLastRepair" label="engineHoursSinceLastRepair" />
<TextInput source="lastRepairAt" label="lastRepairAt" />
<TextInput source="notes" label="notes" />
<SelectInput source="status" label="Текущий статус" choices={statusChoices} emptyText="Не выбрано" />
<TextInput source="location" label="Место эксплуатации / скважина / куст" />
<DateInput source="commissionedAt" label="Дата ввода в эксплуатацию" />
<NumberInput source="totalEngineHours" label="Общая наработка, моточасов" />
<NumberInput source="engineHoursSinceLastRepair" label="Наработка с последнего ремонта, моточасов" />
<DateInput source="lastRepairAt" label="Дата последнего ремонта" />
<TextInput source="notes" label="Примечания" />
</SimpleForm>
</Edit>
);