fix after review
This commit is contained in:
@@ -18,33 +18,33 @@ import {
|
||||
} from 'react-admin';
|
||||
|
||||
const repairKindChoices = [
|
||||
{ id: 'TO', name: 'TO' },
|
||||
{ id: 'TR', name: 'TR' },
|
||||
{ id: 'TRE', name: 'TRE' },
|
||||
{ id: 'KR', name: 'KR' },
|
||||
{ id: 'AR', name: 'AR' },
|
||||
{ id: 'MP', name: 'MP' },
|
||||
{ id: 'TO', name: 'Техническое обслуживание' },
|
||||
{ id: 'TR', name: 'Текущий ремонт' },
|
||||
{ id: 'TRE', name: 'Текущий расширенный ремонт' },
|
||||
{ id: 'KR', name: 'Капитальный ремонт' },
|
||||
{ id: 'AR', name: 'Аварийный ремонт' },
|
||||
{ id: 'MP', name: 'Метрологическая поверка' },
|
||||
];
|
||||
|
||||
const statusChoices = [
|
||||
{ id: 'Draft', name: 'Draft' },
|
||||
{ id: 'Approved', name: 'Approved' },
|
||||
{ id: 'InWork', name: 'InWork' },
|
||||
{ id: 'Done', name: 'Done' },
|
||||
{ id: 'Cancelled', name: 'Cancelled' },
|
||||
{ id: 'Draft', name: 'Черновик' },
|
||||
{ id: 'Approved', name: 'Утверждена' },
|
||||
{ id: 'InWork', name: 'В работе' },
|
||||
{ id: 'Done', name: 'Выполнена' },
|
||||
{ id: 'Cancelled', name: 'Отменена' },
|
||||
];
|
||||
|
||||
const repairOrderFilters = [
|
||||
<TextInput key="q" source="q" label="Поиск" alwaysOn />,
|
||||
<TextInput key="number" source="number" label="number" />,
|
||||
<ReferenceInput key="equipmentId" source="equipmentId" reference="equipment" label="equipmentId">
|
||||
<AutocompleteInput optionText={(record) => record.code ? `${record.code} — ${record.name ?? record.code}` : (record.name ?? record.id)} filterToQuery={(searchText) => ({ q: searchText })} />
|
||||
<TextInput key="number" source="number" label="Номер заявки" />,
|
||||
<ReferenceInput key="equipmentId" source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<AutocompleteInput optionText={(record) => record.inventoryNumber ? `${record.inventoryNumber} — ${record.name ?? record.inventoryNumber}` : (record.name ?? record.id)} filterToQuery={(searchText) => ({ q: searchText })} />
|
||||
</ReferenceInput>,
|
||||
<SelectInput key="repairKind" source="repairKind" label="repairKind" choices={repairKindChoices} emptyText="Все" />,
|
||||
<SelectArrayInput key="status" source="status" label="status" choices={statusChoices} />,
|
||||
<TextInput key="contractor" source="contractor" label="contractor" />,
|
||||
<TextInput key="description" source="description" label="description" />,
|
||||
<TextInput key="notes" source="notes" label="notes" />
|
||||
<SelectInput key="repairKind" source="repairKind" label="Вид ремонта" choices={repairKindChoices} emptyText="Все" />,
|
||||
<SelectArrayInput key="status" source="status" label="Статус" choices={statusChoices} />,
|
||||
<TextInput key="contractor" source="contractor" label="Подрядная организация (если внешний ремонт)" />,
|
||||
<TextInput key="description" source="description" label="Описание работ / дефекта" />,
|
||||
<TextInput key="notes" source="notes" label="Примечания" />
|
||||
];
|
||||
|
||||
const RepairOrderListActions = () => (
|
||||
@@ -56,22 +56,22 @@ const RepairOrderListActions = () => (
|
||||
);
|
||||
|
||||
export const RepairOrderList = () => (
|
||||
<List actions={<RepairOrderListActions />} filters={repairOrderFilters} sort={{ field: 'id', order: 'ASC' }}>
|
||||
<List actions={<RepairOrderListActions />} filters={repairOrderFilters} sort={{ field: 'number', order: 'ASC' }}>
|
||||
<Datagrid rowClick="show">
|
||||
<TextField source="id" label="id" />
|
||||
<TextField source="number" label="number" />
|
||||
<ReferenceField source="equipmentId" reference="equipment" label="equipmentId" link="show">
|
||||
<TextField source="name" />
|
||||
<TextField source="number" label="Номер заявки" />
|
||||
<ReferenceField source="equipmentId" reference="equipment" label="Оборудование" link="show">
|
||||
<TextField source="inventoryNumber" />
|
||||
</ReferenceField>
|
||||
<SelectField source="repairKind" label="repairKind" choices={repairKindChoices} />
|
||||
<SelectField source="status" label="status" choices={statusChoices} />
|
||||
<DateField source="plannedAt" label="plannedAt" />
|
||||
<DateField source="startedAt" label="startedAt" />
|
||||
<DateField source="completedAt" label="completedAt" />
|
||||
<TextField source="contractor" label="contractor" />
|
||||
<NumberField source="engineHoursAtRepair" label="engineHoursAtRepair" />
|
||||
<TextField source="description" label="description" />
|
||||
<TextField source="notes" label="notes" />
|
||||
<SelectField source="repairKind" label="Вид ремонта" choices={repairKindChoices} />
|
||||
<SelectField source="status" label="Статус" choices={statusChoices} />
|
||||
<DateField source="plannedAt" label="Плановая дата начала" />
|
||||
<DateField source="startedAt" label="Фактическая дата начала" />
|
||||
<DateField source="completedAt" label="Фактическая дата завершения" />
|
||||
<TextField source="contractor" label="Подрядная организация (если внешний ремонт)" />
|
||||
<NumberField source="engineHoursAtRepair" label="Наработка на момент ремонта, моточасов" />
|
||||
<TextField source="description" label="Описание работ / дефекта" />
|
||||
<TextField source="notes" label="Примечания" />
|
||||
</Datagrid>
|
||||
</List>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user