feat: add generated code
This commit is contained in:
90
frontend/src/App.tsx
Normal file
90
frontend/src/App.tsx
Normal file
@@ -0,0 +1,90 @@
|
||||
import { Admin, Resource } from 'react-admin';
|
||||
import { dataProvider } from './dataProvider';
|
||||
import { authProvider } from './authProvider';
|
||||
|
||||
// Equipment resources
|
||||
import { EquipmentList, EquipmentCreate, EquipmentEdit, EquipmentShow } from './resources/equipment';
|
||||
|
||||
// Employee resources
|
||||
import { EmployeeList, EmployeeCreate, EmployeeEdit, EmployeeShow } from './resources/employee';
|
||||
|
||||
// Part resources
|
||||
import { PartList, PartCreate, PartEdit, PartShow } from './resources/part';
|
||||
|
||||
// CategoryResource resources
|
||||
import { CategoryResourceList, CategoryResourceCreate, CategoryResourceEdit, CategoryResourceShow } from './resources/category-resource';
|
||||
|
||||
// RepairOrder resources
|
||||
import { RepairOrderList, RepairOrderCreate, RepairOrderEdit, RepairOrderShow } from './resources/repair-order';
|
||||
|
||||
// ChangeEquipmentStatus resources
|
||||
import { ChangeEquipmentStatusList, ChangeEquipmentStatusCreate, ChangeEquipmentStatusEdit, ChangeEquipmentStatusShow } from './resources/change-equipment-status';
|
||||
|
||||
// ConfirmationDocument resources
|
||||
import { ConfirmationDocumentList, ConfirmationDocumentCreate, ConfirmationDocumentEdit, ConfirmationDocumentShow } from './resources/confirmation-document';
|
||||
|
||||
// ConsumptionRegistration resources
|
||||
import { ConsumptionRegistrationList, ConsumptionRegistrationCreate, ConsumptionRegistrationEdit, ConsumptionRegistrationShow } from './resources/consumption-registration';
|
||||
|
||||
const App = () => (
|
||||
<Admin dataProvider={dataProvider} authProvider={authProvider}>
|
||||
<Resource
|
||||
name="equipment"
|
||||
list={EquipmentList}
|
||||
create={EquipmentCreate}
|
||||
edit={EquipmentEdit}
|
||||
show={EquipmentShow}
|
||||
/>
|
||||
<Resource
|
||||
name="employee"
|
||||
list={EmployeeList}
|
||||
create={EmployeeCreate}
|
||||
edit={EmployeeEdit}
|
||||
show={EmployeeShow}
|
||||
/>
|
||||
<Resource
|
||||
name="part"
|
||||
list={PartList}
|
||||
create={PartCreate}
|
||||
edit={PartEdit}
|
||||
show={PartShow}
|
||||
/>
|
||||
<Resource
|
||||
name="category-resource"
|
||||
list={CategoryResourceList}
|
||||
create={CategoryResourceCreate}
|
||||
edit={CategoryResourceEdit}
|
||||
show={CategoryResourceShow}
|
||||
/>
|
||||
<Resource
|
||||
name="repair-order"
|
||||
list={RepairOrderList}
|
||||
create={RepairOrderCreate}
|
||||
edit={RepairOrderEdit}
|
||||
show={RepairOrderShow}
|
||||
/>
|
||||
<Resource
|
||||
name="change-equipment-status"
|
||||
list={ChangeEquipmentStatusList}
|
||||
create={ChangeEquipmentStatusCreate}
|
||||
edit={ChangeEquipmentStatusEdit}
|
||||
show={ChangeEquipmentStatusShow}
|
||||
/>
|
||||
<Resource
|
||||
name="confirmation-document"
|
||||
list={ConfirmationDocumentList}
|
||||
create={ConfirmationDocumentCreate}
|
||||
edit={ConfirmationDocumentEdit}
|
||||
show={ConfirmationDocumentShow}
|
||||
/>
|
||||
<Resource
|
||||
name="consumption-registration"
|
||||
list={ConsumptionRegistrationList}
|
||||
create={ConsumptionRegistrationCreate}
|
||||
edit={ConsumptionRegistrationEdit}
|
||||
show={ConsumptionRegistrationShow}
|
||||
/>
|
||||
</Admin>
|
||||
);
|
||||
|
||||
export default App;
|
||||
19
frontend/src/main.tsx
Normal file
19
frontend/src/main.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { initKeycloak } from './authProvider';
|
||||
import App from './App';
|
||||
|
||||
async function bootstrap() {
|
||||
try {
|
||||
await initKeycloak();
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize Keycloak:', error);
|
||||
}
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Create, SimpleForm, ReferenceInput, SelectInput } from 'react-admin';
|
||||
|
||||
export const CategoryResourceCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<ReferenceInput source="partId" reference="part">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="employeeCode" reference="employee">
|
||||
<SelectInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Edit, SimpleForm, ReferenceInput, SelectInput } from 'react-admin';
|
||||
|
||||
export const CategoryResourceEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<ReferenceInput source="partId" reference="part">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="employeeCode" reference="employee">
|
||||
<SelectInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
import { List, DataTable, TextField, ReferenceField, EditButton } from 'react-admin';
|
||||
|
||||
export const CategoryResourceList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col>
|
||||
<ReferenceField source="partId" reference="part">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
</DataTable.Col>
|
||||
<DataTable.Col>
|
||||
<ReferenceField source="employeeCode" reference="employee">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
</DataTable.Col>
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Show, SimpleShowLayout, TextField, ReferenceField, DateField } from 'react-admin';
|
||||
|
||||
export const CategoryResourceShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<ReferenceField source="partId" reference="part">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<ReferenceField source="employeeCode" reference="employee">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/category-resource/index.ts
Normal file
4
frontend/src/resources/category-resource/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { CategoryResourceList } from './CategoryResourceList';
|
||||
export { CategoryResourceCreate } from './CategoryResourceCreate';
|
||||
export { CategoryResourceEdit } from './CategoryResourceEdit';
|
||||
export { CategoryResourceShow } from './CategoryResourceShow';
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Create, SimpleForm, TextInput, DateInput, SelectInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
const statusChoices = [
|
||||
{ id: 'Active', name: 'В эксплуатации' },
|
||||
{ id: 'Repair', name: 'В ремонте' },
|
||||
{ id: 'Reserve', name: 'В резерве' },
|
||||
{ id: 'WriteOff', name: 'Списано' },
|
||||
];
|
||||
|
||||
export const ChangeEquipmentStatusCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<ReferenceInput source="equipmentId" reference="equipment">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="newStatus" choices={statusChoices} />
|
||||
<TextInput source="number" />
|
||||
<TextInput multiline source="comment" />
|
||||
<DateInput source="date" />
|
||||
<TextInput source="responsible" />
|
||||
<TextInput source="document" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Edit, SimpleForm, TextInput, DateInput, SelectInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
const statusChoices = [
|
||||
{ id: 'Active', name: 'В эксплуатации' },
|
||||
{ id: 'Repair', name: 'В ремонте' },
|
||||
{ id: 'Reserve', name: 'В резерве' },
|
||||
{ id: 'WriteOff', name: 'Списано' },
|
||||
];
|
||||
|
||||
export const ChangeEquipmentStatusEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput disabled source="id" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="newStatus" choices={statusChoices} />
|
||||
<TextInput source="number" />
|
||||
<TextInput multiline source="comment" />
|
||||
<DateInput source="date" />
|
||||
<TextInput source="responsible" />
|
||||
<TextInput source="document" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,21 @@
|
||||
import { List, DataTable, TextField, DateField, EditButton, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ChangeEquipmentStatusList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col>
|
||||
<ReferenceField source="equipmentId" reference="equipment">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
</DataTable.Col>
|
||||
<DataTable.Col source="newStatus" />
|
||||
<DataTable.Col source="number" />
|
||||
<DataTable.Col source="comment" />
|
||||
<DataTable.Col source="date" field={DateField} />
|
||||
<DataTable.Col source="responsible" />
|
||||
<DataTable.Col source="document" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ChangeEquipmentStatusShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<ReferenceField source="equipmentId" reference="equipment">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<TextField source="newStatus" />
|
||||
<TextField source="number" />
|
||||
<TextField source="comment" />
|
||||
<DateField source="date" />
|
||||
<TextField source="responsible" />
|
||||
<TextField source="document" />
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/change-equipment-status/index.ts
Normal file
4
frontend/src/resources/change-equipment-status/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { ChangeEquipmentStatusList } from './ChangeEquipmentStatusList';
|
||||
export { ChangeEquipmentStatusCreate } from './ChangeEquipmentStatusCreate';
|
||||
export { ChangeEquipmentStatusEdit } from './ChangeEquipmentStatusEdit';
|
||||
export { ChangeEquipmentStatusShow } from './ChangeEquipmentStatusShow';
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Create, SimpleForm, TextInput, DateInput, BooleanInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
export const ConfirmationDocumentCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<TextInput source="number" />
|
||||
<DateInput source="date" />
|
||||
<ReferenceInput source="managerCode" reference="employee">
|
||||
<TextInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="repairOrderId" reference="repair-order">
|
||||
<TextInput optionText="number" />
|
||||
</ReferenceInput>
|
||||
<BooleanInput source="confirmed" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Edit, SimpleForm, TextInput, DateInput, BooleanInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
export const ConfirmationDocumentEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput disabled source="id" />
|
||||
<TextInput source="number" />
|
||||
<DateInput source="date" />
|
||||
<ReferenceInput source="managerCode" reference="employee">
|
||||
<TextInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="repairOrderId" reference="repair-order">
|
||||
<TextInput optionText="number" />
|
||||
</ReferenceInput>
|
||||
<BooleanInput source="confirmed" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
import { List, DataTable, TextField, DateField, BooleanField, EditButton, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ConfirmationDocumentList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="number" />
|
||||
<DataTable.Col source="date" field={DateField} />
|
||||
<DataTable.Col>
|
||||
<ReferenceField source="managerCode" reference="employee">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
</DataTable.Col>
|
||||
<DataTable.Col>
|
||||
<ReferenceField source="repairOrderId" reference="repair-order">
|
||||
<TextField source="number" />
|
||||
</ReferenceField>
|
||||
</DataTable.Col>
|
||||
<DataTable.Col source="confirmed" field={BooleanField} />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, BooleanField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ConfirmationDocumentShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<TextField source="number" />
|
||||
<DateField source="date" />
|
||||
<ReferenceField source="managerCode" reference="employee">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
<ReferenceField source="repairOrderId" reference="repair-order">
|
||||
<TextField source="number" />
|
||||
</ReferenceField>
|
||||
<BooleanField source="confirmed" />
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/confirmation-document/index.ts
Normal file
4
frontend/src/resources/confirmation-document/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { ConfirmationDocumentList } from './ConfirmationDocumentList';
|
||||
export { ConfirmationDocumentCreate } from './ConfirmationDocumentCreate';
|
||||
export { ConfirmationDocumentEdit } from './ConfirmationDocumentEdit';
|
||||
export { ConfirmationDocumentShow } from './ConfirmationDocumentShow';
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Create, SimpleForm, TextInput, DateInput, NumberInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
export const ConsumptionRegistrationCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<TextInput source="number" />
|
||||
<DateInput source="date" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment">
|
||||
<TextInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="totalEngineHours" step={0.01} />
|
||||
<NumberInput source="fuelConsumption" step={0.01} />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Edit, SimpleForm, TextInput, DateInput, NumberInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
export const ConsumptionRegistrationEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput disabled source="id" />
|
||||
<TextInput source="number" />
|
||||
<DateInput source="date" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment">
|
||||
<TextInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="totalEngineHours" step={0.01} />
|
||||
<NumberInput source="fuelConsumption" step={0.01} />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,19 @@
|
||||
import { List, DataTable, TextField, DateField, EditButton, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ConsumptionRegistrationList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="number" />
|
||||
<DataTable.Col source="date" field={DateField} />
|
||||
<DataTable.Col>
|
||||
<ReferenceField source="equipmentId" reference="equipment">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
</DataTable.Col>
|
||||
<DataTable.Col source="totalEngineHours" />
|
||||
<DataTable.Col source="fuelConsumption" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ConsumptionRegistrationShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<TextField source="number" />
|
||||
<DateField source="date" />
|
||||
<ReferenceField source="equipmentId" reference="equipment">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<TextField source="totalEngineHours" />
|
||||
<TextField source="fuelConsumption" />
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/consumption-registration/index.ts
Normal file
4
frontend/src/resources/consumption-registration/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { ConsumptionRegistrationList } from './ConsumptionRegistrationList';
|
||||
export { ConsumptionRegistrationCreate } from './ConsumptionRegistrationCreate';
|
||||
export { ConsumptionRegistrationEdit } from './ConsumptionRegistrationEdit';
|
||||
export { ConsumptionRegistrationShow } from './ConsumptionRegistrationShow';
|
||||
23
frontend/src/resources/employee/EmployeeCreate.tsx
Normal file
23
frontend/src/resources/employee/EmployeeCreate.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Create, SimpleForm, TextInput, SelectInput, NumberInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
const roleChoices = [
|
||||
{ id: 'Исполнитель', name: 'Исполнитель' },
|
||||
{ id: 'Подписант', name: 'Подписант' },
|
||||
{ id: 'Пользователь', name: 'Пользователь' },
|
||||
];
|
||||
|
||||
export const EmployeeCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<TextInput source="code" />
|
||||
<TextInput source="fullName" />
|
||||
<SelectInput source="role" choices={roleChoices} />
|
||||
<TextInput source="position" />
|
||||
<ReferenceInput source="bossCode" reference="employee">
|
||||
<SelectInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="price" step={0.01} />
|
||||
<TextInput source="phoneNumber" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
23
frontend/src/resources/employee/EmployeeEdit.tsx
Normal file
23
frontend/src/resources/employee/EmployeeEdit.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Edit, SimpleForm, TextInput, SelectInput, NumberInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
const roleChoices = [
|
||||
{ id: 'Исполнитель', name: 'Исполнитель' },
|
||||
{ id: 'Подписант', name: 'Подписант' },
|
||||
{ id: 'Пользователь', name: 'Пользователь' },
|
||||
];
|
||||
|
||||
export const EmployeeEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput disabled source="code" />
|
||||
<TextInput source="fullName" />
|
||||
<SelectInput source="role" choices={roleChoices} />
|
||||
<TextInput source="position" />
|
||||
<ReferenceInput source="bossCode" reference="employee">
|
||||
<SelectInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="price" step={0.01} />
|
||||
<TextInput source="phoneNumber" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
16
frontend/src/resources/employee/EmployeeList.tsx
Normal file
16
frontend/src/resources/employee/EmployeeList.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { List, DataTable, TextField, NumberField, EditButton } from 'react-admin';
|
||||
|
||||
export const EmployeeList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="code" />
|
||||
<DataTable.Col source="fullName" />
|
||||
<DataTable.Col source="role" />
|
||||
<DataTable.Col source="position" />
|
||||
<DataTable.Col source="bossCode" />
|
||||
<DataTable.Col source="price" field={NumberField} />
|
||||
<DataTable.Col source="phoneNumber" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
19
frontend/src/resources/employee/EmployeeShow.tsx
Normal file
19
frontend/src/resources/employee/EmployeeShow.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Show, SimpleShowLayout, TextField, NumberField, DateField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const EmployeeShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="code" />
|
||||
<TextField source="fullName" />
|
||||
<TextField source="role" />
|
||||
<TextField source="position" />
|
||||
<ReferenceField source="bossCode" reference="employee">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
<NumberField source="price" />
|
||||
<TextField source="phoneNumber" />
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/employee/index.ts
Normal file
4
frontend/src/resources/employee/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { EmployeeList } from './EmployeeList';
|
||||
export { EmployeeCreate } from './EmployeeCreate';
|
||||
export { EmployeeEdit } from './EmployeeEdit';
|
||||
export { EmployeeShow } from './EmployeeShow';
|
||||
43
frontend/src/resources/equipment/EquipmentCreate.tsx
Normal file
43
frontend/src/resources/equipment/EquipmentCreate.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import { Create, SimpleForm, TextInput, DateInput, SelectInput, NumberInput } from 'react-admin';
|
||||
|
||||
const equipmentTypeChoices = [
|
||||
{ id: 'Производственное', name: 'Производственное' },
|
||||
{ id: 'Энергетическое', name: 'Энергетическое' },
|
||||
{ id: 'Насосное', name: 'Насосное' },
|
||||
{ id: 'Компрессорное', name: 'Компрессорное' },
|
||||
];
|
||||
|
||||
const periodicityTOChoices = [
|
||||
{ id: 'Ежедневное', name: 'Ежедневное' },
|
||||
{ id: 'Еженедельное', name: 'Еженедельное' },
|
||||
{ id: 'Ежемесячное', name: 'Ежемесячное' },
|
||||
{ id: 'Полугодовое', name: 'Полугодовое' },
|
||||
{ id: 'Годовое', name: 'Годовое' },
|
||||
];
|
||||
|
||||
const statusChoices = [
|
||||
{ id: 'Active', name: 'В эксплуатации' },
|
||||
{ id: 'Repair', name: 'В ремонте' },
|
||||
{ id: 'Reserve', name: 'В резерве' },
|
||||
{ id: 'WriteOff', name: 'Списано' },
|
||||
];
|
||||
|
||||
export const EquipmentCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<TextInput source="name" />
|
||||
<TextInput source="serialNumber" />
|
||||
<TextInput source="inventoryNumber" />
|
||||
<SelectInput source="equipmentType" choices={equipmentTypeChoices} />
|
||||
<DateInput source="dateOfInspection" />
|
||||
<SelectInput source="periodicityTO" choices={periodicityTOChoices} />
|
||||
<TextInput source="location" />
|
||||
<SelectInput source="status" choices={statusChoices} />
|
||||
<DateInput source="commissionedAt" />
|
||||
<NumberInput source="totalEngineHours" step={0.01} />
|
||||
<NumberInput source="engineHoursSinceLastRepair" step={0.01} />
|
||||
<DateInput source="lastRepairAt" />
|
||||
<TextInput multiline source="notes" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
44
frontend/src/resources/equipment/EquipmentEdit.tsx
Normal file
44
frontend/src/resources/equipment/EquipmentEdit.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Edit, SimpleForm, TextInput, DateInput, SelectInput, NumberInput } from 'react-admin';
|
||||
|
||||
const equipmentTypeChoices = [
|
||||
{ id: 'Производственное', name: 'Производственное' },
|
||||
{ id: 'Энергетическое', name: 'Энергетическое' },
|
||||
{ id: 'Насосное', name: 'Насосное' },
|
||||
{ id: 'Компрессорное', name: 'Компрессорное' },
|
||||
];
|
||||
|
||||
const periodicityTOChoices = [
|
||||
{ id: 'Ежедневное', name: 'Ежедневное' },
|
||||
{ id: 'Еженедельное', name: 'Еженедельное' },
|
||||
{ id: 'Ежемесячное', name: 'Ежемесячное' },
|
||||
{ id: 'Полугодовое', name: 'Полугодовое' },
|
||||
{ id: 'Годовое', name: 'Годовое' },
|
||||
];
|
||||
|
||||
const statusChoices = [
|
||||
{ id: 'Active', name: 'В эксплуатации' },
|
||||
{ id: 'Repair', name: 'В ремонте' },
|
||||
{ id: 'Reserve', name: 'В резерве' },
|
||||
{ id: 'WriteOff', name: 'Списано' },
|
||||
];
|
||||
|
||||
export const EquipmentEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput disabled source="id" />
|
||||
<TextInput source="name" />
|
||||
<TextInput source="serialNumber" />
|
||||
<TextInput source="inventoryNumber" />
|
||||
<SelectInput source="equipmentType" choices={equipmentTypeChoices} />
|
||||
<DateInput source="dateOfInspection" />
|
||||
<SelectInput source="periodicityTO" choices={periodicityTOChoices} />
|
||||
<TextInput source="location" />
|
||||
<SelectInput source="status" choices={statusChoices} />
|
||||
<DateInput source="commissionedAt" />
|
||||
<NumberInput source="totalEngineHours" step={0.01} />
|
||||
<NumberInput source="engineHoursSinceLastRepair" step={0.01} />
|
||||
<DateInput source="lastRepairAt" />
|
||||
<TextInput multiline source="notes" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
22
frontend/src/resources/equipment/EquipmentList.tsx
Normal file
22
frontend/src/resources/equipment/EquipmentList.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { List, DataTable, TextField, DateField, EditButton } from 'react-admin';
|
||||
|
||||
export const EquipmentList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="name" />
|
||||
<DataTable.Col source="serialNumber" />
|
||||
<DataTable.Col source="inventoryNumber" />
|
||||
<DataTable.Col source="equipmentType" />
|
||||
<DataTable.Col source="dateOfInspection" field={DateField} />
|
||||
<DataTable.Col source="periodicityTO" />
|
||||
<DataTable.Col source="location" />
|
||||
<DataTable.Col source="status" />
|
||||
<DataTable.Col source="commissionedAt" field={DateField} />
|
||||
<DataTable.Col source="totalEngineHours" />
|
||||
<DataTable.Col source="engineHoursSinceLastRepair" />
|
||||
<DataTable.Col source="lastRepairAt" field={DateField} />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
24
frontend/src/resources/equipment/EquipmentShow.tsx
Normal file
24
frontend/src/resources/equipment/EquipmentShow.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField } from 'react-admin';
|
||||
|
||||
export const EquipmentShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<TextField source="name" />
|
||||
<TextField source="serialNumber" />
|
||||
<TextField source="inventoryNumber" />
|
||||
<TextField source="equipmentType" />
|
||||
<DateField source="dateOfInspection" />
|
||||
<TextField source="periodicityTO" />
|
||||
<TextField source="location" />
|
||||
<TextField source="status" />
|
||||
<DateField source="commissionedAt" />
|
||||
<TextField source="totalEngineHours" />
|
||||
<TextField source="engineHoursSinceLastRepair" />
|
||||
<DateField source="lastRepairAt" />
|
||||
<TextField source="notes" />
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/equipment/index.ts
Normal file
4
frontend/src/resources/equipment/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { EquipmentList } from './EquipmentList';
|
||||
export { EquipmentCreate } from './EquipmentCreate';
|
||||
export { EquipmentEdit } from './EquipmentEdit';
|
||||
export { EquipmentShow } from './EquipmentShow';
|
||||
20
frontend/src/resources/part/PartCreate.tsx
Normal file
20
frontend/src/resources/part/PartCreate.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Create, SimpleForm, TextInput, SelectInput, NumberInput } from 'react-admin';
|
||||
|
||||
const categoryChoices = [
|
||||
{ id: 'Расходник', name: 'Расходник' },
|
||||
{ id: 'Запчасть', name: 'Запчасть' },
|
||||
{ id: 'Инструмент', name: 'Инструмент' },
|
||||
{ id: 'Спецодежда', name: 'Спецодежда' },
|
||||
];
|
||||
|
||||
export const PartCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<TextInput source="name" />
|
||||
<SelectInput source="categories" choices={categoryChoices} />
|
||||
<NumberInput source="price" step={0.01} />
|
||||
<TextInput multiline source="description" />
|
||||
<TextInput source="serialNumber" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
21
frontend/src/resources/part/PartEdit.tsx
Normal file
21
frontend/src/resources/part/PartEdit.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Edit, SimpleForm, TextInput, SelectInput, NumberInput } from 'react-admin';
|
||||
|
||||
const categoryChoices = [
|
||||
{ id: 'Расходник', name: 'Расходник' },
|
||||
{ id: 'Запчасть', name: 'Запчасть' },
|
||||
{ id: 'Инструмент', name: 'Инструмент' },
|
||||
{ id: 'Спецодежда', name: 'Спецодежда' },
|
||||
];
|
||||
|
||||
export const PartEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput disabled source="id" />
|
||||
<TextInput source="name" />
|
||||
<SelectInput source="categories" choices={categoryChoices} />
|
||||
<NumberInput source="price" step={0.01} />
|
||||
<TextInput multiline source="description" />
|
||||
<TextInput source="serialNumber" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
15
frontend/src/resources/part/PartList.tsx
Normal file
15
frontend/src/resources/part/PartList.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { List, DataTable, TextField, NumberField, EditButton } from 'react-admin';
|
||||
|
||||
export const PartList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="name" />
|
||||
<DataTable.Col source="categories" />
|
||||
<DataTable.Col source="price" field={NumberField} />
|
||||
<DataTable.Col source="description" />
|
||||
<DataTable.Col source="serialNumber" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
16
frontend/src/resources/part/PartShow.tsx
Normal file
16
frontend/src/resources/part/PartShow.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Show, SimpleShowLayout, TextField, NumberField, DateField } from 'react-admin';
|
||||
|
||||
export const PartShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<TextField source="name" />
|
||||
<TextField source="categories" />
|
||||
<NumberField source="price" />
|
||||
<TextField source="description" />
|
||||
<TextField source="serialNumber" />
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/part/index.ts
Normal file
4
frontend/src/resources/part/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { PartList } from './PartList';
|
||||
export { PartCreate } from './PartCreate';
|
||||
export { PartEdit } from './PartEdit';
|
||||
export { PartShow } from './PartShow';
|
||||
40
frontend/src/resources/repair-order/RepairOrderCreate.tsx
Normal file
40
frontend/src/resources/repair-order/RepairOrderCreate.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { Create, SimpleForm, TextInput, DateInput, SelectInput, BooleanInput, ReferenceInput, NumberInput } from 'react-admin';
|
||||
|
||||
const repairKindChoices = [
|
||||
{ id: 'TO', name: 'Техническое обслуживание' },
|
||||
{ id: 'TR', name: 'Текущий ремонт' },
|
||||
{ id: 'TRE', name: 'Текущий расширенный ремонт' },
|
||||
{ id: 'KR', name: 'Капитальный ремонт' },
|
||||
{ id: 'AR', name: 'Аварийный ремонт' },
|
||||
{ id: 'MP', name: 'Метрологическая поверка' },
|
||||
];
|
||||
|
||||
const statusChoices = [
|
||||
{ id: 'Draft', name: 'Черновик' },
|
||||
{ id: 'Approved', name: 'Утверждена' },
|
||||
{ id: 'InWork', name: 'В работе' },
|
||||
{ id: 'Done', name: 'Выполнена' },
|
||||
{ id: 'Cancelled', name: 'Отменена' },
|
||||
];
|
||||
|
||||
export const RepairOrderCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<TextInput source="number" />
|
||||
<DateInput source="date" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="repairKind" choices={repairKindChoices} />
|
||||
<SelectInput source="status" choices={statusChoices} />
|
||||
<DateInput source="plannedAt" />
|
||||
<DateInput source="startedAt" />
|
||||
<DateInput source="completedAt" />
|
||||
<TextInput source="contractor" />
|
||||
<NumberInput source="engineHoursAtRepair" step={0.01} />
|
||||
<TextInput multiline source="description" />
|
||||
<TextInput multiline source="notes" />
|
||||
<BooleanInput source="confirmed" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
41
frontend/src/resources/repair-order/RepairOrderEdit.tsx
Normal file
41
frontend/src/resources/repair-order/RepairOrderEdit.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Edit, SimpleForm, TextInput, DateInput, SelectInput, BooleanInput, ReferenceInput, NumberInput } from 'react-admin';
|
||||
|
||||
const repairKindChoices = [
|
||||
{ id: 'TO', name: 'Техническое обслуживание' },
|
||||
{ id: 'TR', name: 'Текущий ремонт' },
|
||||
{ id: 'TRE', name: 'Текущий расширенный ремонт' },
|
||||
{ id: 'KR', name: 'Капитальный ремонт' },
|
||||
{ id: 'AR', name: 'Аварийный ремонт' },
|
||||
{ id: 'MP', name: 'Метрологическая поверка' },
|
||||
];
|
||||
|
||||
const statusChoices = [
|
||||
{ id: 'Draft', name: 'Черновик' },
|
||||
{ id: 'Approved', name: 'Утверждена' },
|
||||
{ id: 'InWork', name: 'В работе' },
|
||||
{ id: 'Done', name: 'Выполнена' },
|
||||
{ id: 'Cancelled', name: 'Отменена' },
|
||||
];
|
||||
|
||||
export const RepairOrderEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<TextInput disabled source="id" />
|
||||
<TextInput source="number" />
|
||||
<DateInput source="date" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="repairKind" choices={repairKindChoices} />
|
||||
<SelectInput source="status" choices={statusChoices} />
|
||||
<DateInput source="plannedAt" />
|
||||
<DateInput source="startedAt" />
|
||||
<DateInput source="completedAt" />
|
||||
<TextInput source="contractor" />
|
||||
<NumberInput source="engineHoursAtRepair" step={0.01} />
|
||||
<TextInput multiline source="description" />
|
||||
<TextInput multiline source="notes" />
|
||||
<BooleanInput source="confirmed" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
25
frontend/src/resources/repair-order/RepairOrderList.tsx
Normal file
25
frontend/src/resources/repair-order/RepairOrderList.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { List, DataTable, TextField, DateField, BooleanField, EditButton, ReferenceField } from 'react-admin';
|
||||
|
||||
export const RepairOrderList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="number" />
|
||||
<DataTable.Col source="date" field={DateField} />
|
||||
<DataTable.Col>
|
||||
<ReferenceField source="equipmentId" reference="equipment">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
</DataTable.Col>
|
||||
<DataTable.Col source="repairKind" />
|
||||
<DataTable.Col source="status" />
|
||||
<DataTable.Col source="plannedAt" field={DateField} />
|
||||
<DataTable.Col source="startedAt" field={DateField} />
|
||||
<DataTable.Col source="completedAt" field={DateField} />
|
||||
<DataTable.Col source="contractor" />
|
||||
<DataTable.Col source="engineHoursAtRepair" />
|
||||
<DataTable.Col source="confirmed" field={BooleanField} />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
26
frontend/src/resources/repair-order/RepairOrderShow.tsx
Normal file
26
frontend/src/resources/repair-order/RepairOrderShow.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, BooleanField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const RepairOrderShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<TextField source="number" />
|
||||
<DateField source="date" />
|
||||
<ReferenceField source="equipmentId" reference="equipment">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<TextField source="repairKind" />
|
||||
<TextField source="status" />
|
||||
<DateField source="plannedAt" />
|
||||
<DateField source="startedAt" />
|
||||
<DateField source="completedAt" />
|
||||
<TextField source="contractor" />
|
||||
<TextField source="engineHoursAtRepair" />
|
||||
<TextField source="description" />
|
||||
<TextField source="notes" />
|
||||
<BooleanField source="confirmed" />
|
||||
<DateField source="createdAt" showTime />
|
||||
<DateField source="updatedAt" showTime />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/repair-order/index.ts
Normal file
4
frontend/src/resources/repair-order/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { RepairOrderList } from './RepairOrderList';
|
||||
export { RepairOrderCreate } from './RepairOrderCreate';
|
||||
export { RepairOrderEdit } from './RepairOrderEdit';
|
||||
export { RepairOrderShow } from './RepairOrderShow';
|
||||
Reference in New Issue
Block a user