import { List, DataTable, TextField, DateField, EditButton, ShowButton, ReferenceField } from 'react-admin';
import { SelectField } from 'react-admin';

const equipmentStatusChoices = [
  { id: 'Active', name: 'В эксплуатации' },
  { id: 'Repair', name: 'В ремонте' },
  { id: 'Reserve', name: 'В резерве' },
  { id: 'WriteOff', name: 'Списано' },
];

export const ChangeEquipmentStatusList = () => (
  <List>
    <DataTable>
      <DataTable.Col source="equipmentId" field={<ReferenceField source="equipmentId" reference="equipment" />} />
      <DataTable.Col source="newStatus" field={<SelectField choices={equipmentStatusChoices} />} />
      <DataTable.Col source="number" />
      <DataTable.Col source="date" field={DateField} />
      <DataTable.Col source="responsible" />
      <DataTable.Col source="createdAt" field={DateField} />
      <DataTable.Col>
        <ShowButton />
        <EditButton />
      </DataTable.Col>
    </DataTable>
  </List>
);