feat: add generated code
This commit is contained in:
59
frontend/src/App.tsx
Normal file
59
frontend/src/App.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Admin, Resource } from 'react-admin';
|
||||
import { dataProvider } from './dataProvider';
|
||||
import { authProvider } from './authProvider';
|
||||
|
||||
// Equipment resources
|
||||
import { EquipmentList, EquipmentEdit, EquipmentCreate, EquipmentShow } from './resources/equipment';
|
||||
|
||||
// Employee resources
|
||||
import { EmployeeList, EmployeeEdit, EmployeeCreate, EmployeeShow } from './resources/employee';
|
||||
|
||||
// Part resources
|
||||
import { PartList, PartEdit, PartCreate, PartShow } from './resources/part';
|
||||
|
||||
// CategoryResource resources
|
||||
import { CategoryResourceList, CategoryResourceEdit, CategoryResourceCreate, CategoryResourceShow } from './resources/category-resource';
|
||||
|
||||
// RepairOrder resources
|
||||
import { RepairOrderList, RepairOrderEdit, RepairOrderCreate, RepairOrderShow } from './resources/repair-order';
|
||||
|
||||
// ChangeEquipmentStatus resources
|
||||
import { ChangeEquipmentStatusList, ChangeEquipmentStatusEdit, ChangeEquipmentStatusCreate, ChangeEquipmentStatusShow } from './resources/change-equipment-status';
|
||||
|
||||
// ConfirmationDocument resources
|
||||
import { ConfirmationDocumentList, ConfirmationDocumentEdit, ConfirmationDocumentCreate, ConfirmationDocumentShow } from './resources/confirmation-document';
|
||||
|
||||
// ConsumptionRegistration resources
|
||||
import { ConsumptionRegistrationList, ConsumptionRegistrationEdit, ConsumptionRegistrationCreate, ConsumptionRegistrationShow } from './resources/consumption-registration';
|
||||
|
||||
// MaintenancePlanning resources
|
||||
import { MaintenancePlanningList, MaintenancePlanningEdit, MaintenancePlanningCreate, MaintenancePlanningShow } from './resources/maintenance-planning';
|
||||
|
||||
// ResourceNeeds resources
|
||||
import { ResourceNeedsList, ResourceNeedsEdit, ResourceNeedsCreate, ResourceNeedsShow } from './resources/resource-needs';
|
||||
|
||||
// MoneyNeeds resources
|
||||
import { MoneyNeedsList, MoneyNeedsEdit, MoneyNeedsCreate, MoneyNeedsShow } from './resources/money-needs';
|
||||
|
||||
const App = () => (
|
||||
<Admin dataProvider={dataProvider} authProvider={authProvider}>
|
||||
{/* Directories */}
|
||||
<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} />
|
||||
|
||||
{/* Documents */}
|
||||
<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} />
|
||||
|
||||
{/* Reports */}
|
||||
<Resource name="maintenance-planning" list={MaintenancePlanningList} create={MaintenancePlanningCreate} edit={MaintenancePlanningEdit} show={MaintenancePlanningShow} />
|
||||
<Resource name="resource-needs" list={ResourceNeedsList} create={ResourceNeedsCreate} edit={ResourceNeedsEdit} show={ResourceNeedsShow} />
|
||||
<Resource name="money-needs" list={MoneyNeedsList} create={MoneyNeedsCreate} edit={MoneyNeedsEdit} show={MoneyNeedsShow} />
|
||||
</Admin>
|
||||
);
|
||||
|
||||
export default App;
|
||||
15
frontend/src/main.tsx
Normal file
15
frontend/src/main.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import App from './App';
|
||||
import { initKeycloak } from './authProvider';
|
||||
|
||||
// Initialize Keycloak before rendering the app
|
||||
initKeycloak().then(() => {
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
}).catch((error) => {
|
||||
console.error('Failed to initialize Keycloak:', error);
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Create, SimpleForm, ReferenceInput, SelectInput } from 'react-admin';
|
||||
|
||||
export const CategoryResourceCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<ReferenceInput source="partId" reference="part" label="ЗИП/ТМЦ">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="employeeCode" reference="employee" label="Сотрудник">
|
||||
<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" label="ЗИП/ТМЦ">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="employeeCode" reference="employee" label="Сотрудник">
|
||||
<SelectInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
import { List, DataTable, TextField, ReferenceField, EditButton } from 'react-admin';
|
||||
|
||||
export const CategoryResourceList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="partId" label="ЗИП/ТМЦ ID" />
|
||||
<DataTable.Col source="employeeCode" label="Код сотрудника" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Show, SimpleShowLayout, TextField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const CategoryResourceShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<ReferenceField source="partId" reference="part" label="ЗИП/ТМЦ">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<ReferenceField source="employeeCode" reference="employee" label="Сотрудник">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
</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 { CategoryResourceEdit } from './CategoryResourceEdit';
|
||||
export { CategoryResourceCreate } from './CategoryResourceCreate';
|
||||
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" label="Оборудование">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="newStatus" choices={statusChoices} label="Новый статус" />
|
||||
<TextInput source="number" label="Номер" />
|
||||
<TextInput multiline source="comment" label="Комментарий" />
|
||||
<DateInput source="date" label="Дата изменения статуса" />
|
||||
<TextInput source="responsible" label="Ответственный" />
|
||||
<TextInput source="document" label="Документ" />
|
||||
</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" label="ID" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="newStatus" choices={statusChoices} label="Новый статус" />
|
||||
<TextInput source="number" label="Номер" />
|
||||
<TextInput multiline source="comment" label="Комментарий" />
|
||||
<DateInput source="date" label="Дата изменения статуса" />
|
||||
<TextInput source="responsible" label="Ответственный" />
|
||||
<TextInput source="document" label="Документ" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
import { List, DataTable, TextField, DateField, EditButton } from 'react-admin';
|
||||
|
||||
export const ChangeEquipmentStatusList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="equipmentId" label="Оборудование ID" />
|
||||
<DataTable.Col source="newStatus" label="Новый статус" />
|
||||
<DataTable.Col source="number" label="Номер" />
|
||||
<DataTable.Col source="comment" label="Комментарий" />
|
||||
<DataTable.Col source="date" field={DateField} label="Дата изменения статуса" />
|
||||
<DataTable.Col source="responsible" label="Ответственный" />
|
||||
<DataTable.Col source="document" label="Документ" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ChangeEquipmentStatusShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<ReferenceField source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<TextField source="newStatus" label="Новый статус" />
|
||||
<TextField source="number" label="Номер" />
|
||||
<TextField source="comment" label="Комментарий" />
|
||||
<DateField source="date" label="Дата изменения статуса" />
|
||||
<TextField source="responsible" label="Ответственный" />
|
||||
<TextField source="document" label="Документ" />
|
||||
</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 { ChangeEquipmentStatusEdit } from './ChangeEquipmentStatusEdit';
|
||||
export { ChangeEquipmentStatusCreate } from './ChangeEquipmentStatusCreate';
|
||||
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" label="Номер" />
|
||||
<DateInput source="date" label="Дата согласования" />
|
||||
<ReferenceInput source="managerCode" reference="employee" label="Руководитель">
|
||||
<TextInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="orderId" reference="repair-order" label="Заявка">
|
||||
<TextInput optionText="number" />
|
||||
</ReferenceInput>
|
||||
<BooleanInput source="confirmed" label="Согласовано" />
|
||||
</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" label="ID" />
|
||||
<TextInput source="number" label="Номер" />
|
||||
<DateInput source="date" label="Дата согласования" />
|
||||
<ReferenceInput source="managerCode" reference="employee" label="Руководитель">
|
||||
<TextInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<ReferenceInput source="orderId" reference="repair-order" label="Заявка">
|
||||
<TextInput optionText="number" />
|
||||
</ReferenceInput>
|
||||
<BooleanInput source="confirmed" label="Согласовано" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
import { List, DataTable, TextField, DateField, BooleanField, EditButton } from 'react-admin';
|
||||
|
||||
export const ConfirmationDocumentList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="number" label="Номер" />
|
||||
<DataTable.Col source="date" field={DateField} label="Дата согласования" />
|
||||
<DataTable.Col source="managerCode" label="Код руководителя" />
|
||||
<DataTable.Col source="orderId" label="ID заявки" />
|
||||
<DataTable.Col source="confirmed" field={BooleanField} label="Согласовано" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, BooleanField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ConfirmationDocumentShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<TextField source="number" label="Номер" />
|
||||
<DateField source="date" label="Дата согласования" />
|
||||
<ReferenceField source="managerCode" reference="employee" label="Руководитель">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
<ReferenceField source="orderId" reference="repair-order" label="Заявка">
|
||||
<TextField source="number" />
|
||||
</ReferenceField>
|
||||
<BooleanField source="confirmed" label="Согласовано" />
|
||||
</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 { ConfirmationDocumentEdit } from './ConfirmationDocumentEdit';
|
||||
export { ConfirmationDocumentCreate } from './ConfirmationDocumentCreate';
|
||||
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" label="Номер" />
|
||||
<DateInput source="date" label="Дата регистрации" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<TextInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="totalEngineHours" label="Наработка" step={0.01} />
|
||||
<NumberInput source="fuelConsumption" label="Расход топлива" 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" label="ID" />
|
||||
<TextInput source="number" label="Номер" />
|
||||
<DateInput source="date" label="Дата регистрации" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<TextInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="totalEngineHours" label="Наработка" step={0.01} />
|
||||
<NumberInput source="fuelConsumption" label="Расход топлива" step={0.01} />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
import { List, DataTable, TextField, DateField, NumberField, EditButton } from 'react-admin';
|
||||
|
||||
export const ConsumptionRegistrationList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="number" label="Номер" />
|
||||
<DataTable.Col source="date" field={DateField} label="Дата регистрации" />
|
||||
<DataTable.Col source="equipmentId" label="Оборудование ID" />
|
||||
<DataTable.Col source="totalEngineHours" field={NumberField} label="Наработка" />
|
||||
<DataTable.Col source="fuelConsumption" field={NumberField} label="Расход топлива" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, NumberField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const ConsumptionRegistrationShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<TextField source="number" label="Номер" />
|
||||
<DateField source="date" label="Дата регистрации" />
|
||||
<ReferenceField source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<NumberField source="totalEngineHours" label="Наработка" />
|
||||
<NumberField source="fuelConsumption" label="Расход топлива" />
|
||||
</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 { ConsumptionRegistrationEdit } from './ConsumptionRegistrationEdit';
|
||||
export { ConsumptionRegistrationCreate } from './ConsumptionRegistrationCreate';
|
||||
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" label="Табельный номер" />
|
||||
<TextInput source="fullName" label="ФИО" />
|
||||
<SelectInput source="role" choices={roleChoices} label="Роль" />
|
||||
<TextInput source="position" label="Должность" />
|
||||
<ReferenceInput source="bossCode" reference="employee" label="Руководитель">
|
||||
<SelectInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="price" label="Стоимость часа работы" step={0.01} />
|
||||
<NumberInput source="phoneNumber" label="Номер телефона" />
|
||||
</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" label="Табельный номер" />
|
||||
<TextInput source="fullName" label="ФИО" />
|
||||
<SelectInput source="role" choices={roleChoices} label="Роль" />
|
||||
<TextInput source="position" label="Должность" />
|
||||
<ReferenceInput source="bossCode" reference="employee" label="Руководитель">
|
||||
<SelectInput optionText="fullName" />
|
||||
</ReferenceInput>
|
||||
<NumberInput source="price" label="Стоимость часа работы" step={0.01} />
|
||||
<NumberInput source="phoneNumber" label="Номер телефона" />
|
||||
</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" label="Табельный номер" />
|
||||
<DataTable.Col source="fullName" label="ФИО" />
|
||||
<DataTable.Col source="role" label="Роль" />
|
||||
<DataTable.Col source="position" label="Должность" />
|
||||
<DataTable.Col source="bossCode" label="Код руководителя" />
|
||||
<DataTable.Col source="price" field={NumberField} label="Стоимость часа работы" />
|
||||
<DataTable.Col source="phoneNumber" field={NumberField} label="Номер телефона" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
17
frontend/src/resources/employee/EmployeeShow.tsx
Normal file
17
frontend/src/resources/employee/EmployeeShow.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Show, SimpleShowLayout, TextField, NumberField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const EmployeeShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="code" label="Табельный номер" />
|
||||
<TextField source="fullName" label="ФИО" />
|
||||
<TextField source="role" label="Роль" />
|
||||
<TextField source="position" label="Должность" />
|
||||
<ReferenceField source="bossCode" reference="employee" label="Руководитель">
|
||||
<TextField source="fullName" />
|
||||
</ReferenceField>
|
||||
<NumberField source="price" label="Стоимость часа работы" />
|
||||
<NumberField source="phoneNumber" label="Номер телефона" />
|
||||
</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 { EmployeeEdit } from './EmployeeEdit';
|
||||
export { EmployeeCreate } from './EmployeeCreate';
|
||||
export { EmployeeShow } from './EmployeeShow';
|
||||
42
frontend/src/resources/equipment/EquipmentCreate.tsx
Normal file
42
frontend/src/resources/equipment/EquipmentCreate.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
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" label="Название" />
|
||||
<TextInput source="serialNumber" label="Заводской номер" />
|
||||
<TextInput source="inventoryNumber" label="Инвентарный номер" />
|
||||
<SelectInput source="equipmentType" choices={equipmentTypeChoices} label="Тип оборудования" />
|
||||
<DateInput source="dateOfInspection" label="Дата проверки" />
|
||||
<SelectInput source="periodicityTO" choices={periodicityTOChoices} label="Периодичность ТО" />
|
||||
<SelectInput source="status" choices={statusChoices} label="Статус" />
|
||||
<DateInput source="commissionedAt" label="Год изготовления" />
|
||||
<NumberInput source="totalEngineHours" label="Общая наработка, моточасов" step={0.01} />
|
||||
<NumberInput source="engineHoursSinceLastRepair" label="Наработка с последнего ремонта, моточасов" step={0.01} />
|
||||
<DateInput source="lastRepairAt" label="Дата последнего ремонта" />
|
||||
<TextInput multiline source="notes" label="Примечания" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
43
frontend/src/resources/equipment/EquipmentEdit.tsx
Normal file
43
frontend/src/resources/equipment/EquipmentEdit.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
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" label="ID" />
|
||||
<TextInput source="name" label="Название" />
|
||||
<TextInput source="serialNumber" label="Заводской номер" />
|
||||
<TextInput source="inventoryNumber" label="Инвентарный номер" />
|
||||
<SelectInput source="equipmentType" choices={equipmentTypeChoices} label="Тип оборудования" />
|
||||
<DateInput source="dateOfInspection" label="Дата проверки" />
|
||||
<SelectInput source="periodicityTO" choices={periodicityTOChoices} label="Периодичность ТО" />
|
||||
<SelectInput source="status" choices={statusChoices} label="Статус" />
|
||||
<DateInput source="commissionedAt" label="Год изготовления" />
|
||||
<NumberInput source="totalEngineHours" label="Общая наработка, моточасов" step={0.01} />
|
||||
<NumberInput source="engineHoursSinceLastRepair" label="Наработка с последнего ремонта, моточасов" step={0.01} />
|
||||
<DateInput source="lastRepairAt" label="Дата последнего ремонта" />
|
||||
<TextInput multiline source="notes" label="Примечания" />
|
||||
</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" label="Название" />
|
||||
<DataTable.Col source="serialNumber" label="Заводской номер" />
|
||||
<DataTable.Col source="inventoryNumber" label="Инвентарный номер" />
|
||||
<DataTable.Col source="equipmentType" label="Тип оборудования" />
|
||||
<DataTable.Col source="dateOfInspection" field={DateField} label="Дата проверки" />
|
||||
<DataTable.Col source="periodicityTO" label="Периодичность ТО" />
|
||||
<DataTable.Col source="status" label="Статус" />
|
||||
<DataTable.Col source="commissionedAt" field={DateField} label="Год изготовления" />
|
||||
<DataTable.Col source="totalEngineHours" label="Общая наработка, моточасов" />
|
||||
<DataTable.Col source="engineHoursSinceLastRepair" label="Наработка с последнего ремонта, моточасов" />
|
||||
<DataTable.Col source="lastRepairAt" field={DateField} label="Дата последнего ремонта" />
|
||||
<DataTable.Col source="notes" label="Примечания" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
21
frontend/src/resources/equipment/EquipmentShow.tsx
Normal file
21
frontend/src/resources/equipment/EquipmentShow.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, NumberField } from 'react-admin';
|
||||
|
||||
export const EquipmentShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<TextField source="name" label="Название" />
|
||||
<TextField source="serialNumber" label="Заводской номер" />
|
||||
<TextField source="inventoryNumber" label="Инвентарный номер" />
|
||||
<TextField source="equipmentType" label="Тип оборудования" />
|
||||
<DateField source="dateOfInspection" label="Дата проверки" />
|
||||
<TextField source="periodicityTO" label="Периодичность ТО" />
|
||||
<TextField source="status" label="Статус" />
|
||||
<DateField source="commissionedAt" label="Год изготовления" />
|
||||
<NumberField source="totalEngineHours" label="Общая наработка, моточасов" />
|
||||
<NumberField source="engineHoursSinceLastRepair" label="Наработка с последнего ремонта, моточасов" />
|
||||
<DateField source="lastRepairAt" label="Дата последнего ремонта" />
|
||||
<TextField source="notes" label="Примечания" />
|
||||
</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 { EquipmentEdit } from './EquipmentEdit';
|
||||
export { EquipmentCreate } from './EquipmentCreate';
|
||||
export { EquipmentShow } from './EquipmentShow';
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Create, SimpleForm, DateInput, SelectInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
const repairKindChoices = [
|
||||
{ id: 'TO', name: 'Техническое обслуживание' },
|
||||
{ id: 'TR', name: 'Текущий ремонт' },
|
||||
{ id: 'TRE', name: 'Текущий расширенный ремонт' },
|
||||
{ id: 'KR', name: 'Капитальный ремонт' },
|
||||
{ id: 'AR', name: 'Аварийный ремонт' },
|
||||
{ id: 'MP', name: 'Метрологическая поверка' },
|
||||
];
|
||||
|
||||
export const MaintenancePlanningCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<DateInput source="date" label="Запланированная дата" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="repairKind" choices={repairKindChoices} label="Вид ТО/ППР" />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Edit, SimpleForm, DateInput, SelectInput, ReferenceInput } from 'react-admin';
|
||||
|
||||
const repairKindChoices = [
|
||||
{ id: 'TO', name: 'Техническое обслуживание' },
|
||||
{ id: 'TR', name: 'Текущий ремонт' },
|
||||
{ id: 'TRE', name: 'Текущий расширенный ремонт' },
|
||||
{ id: 'KR', name: 'Капитальный ремонт' },
|
||||
{ id: 'AR', name: 'Аварийный ремонт' },
|
||||
{ id: 'MP', name: 'Метрологическая поверка' },
|
||||
];
|
||||
|
||||
export const MaintenancePlanningEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<DateInput source="date" label="Запланированная дата" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="repairKind" choices={repairKindChoices} label="Вид ТО/ППР" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
import { List, DataTable, TextField, DateField, EditButton } from 'react-admin';
|
||||
|
||||
export const MaintenancePlanningList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="date" field={DateField} label="Запланированная дата" />
|
||||
<DataTable.Col source="equipmentId" label="Оборудование ID" />
|
||||
<DataTable.Col source="repairKind" label="Вид ТО/ППР" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const MaintenancePlanningShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<DateField source="date" label="Запланированная дата" />
|
||||
<ReferenceField source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<TextField source="repairKind" label="Вид ТО/ППР" />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/maintenance-planning/index.ts
Normal file
4
frontend/src/resources/maintenance-planning/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { MaintenancePlanningList } from './MaintenancePlanningList';
|
||||
export { MaintenancePlanningEdit } from './MaintenancePlanningEdit';
|
||||
export { MaintenancePlanningCreate } from './MaintenancePlanningCreate';
|
||||
export { MaintenancePlanningShow } from './MaintenancePlanningShow';
|
||||
10
frontend/src/resources/money-needs/MoneyNeedsCreate.tsx
Normal file
10
frontend/src/resources/money-needs/MoneyNeedsCreate.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Create, SimpleForm, NumberInput } from 'react-admin';
|
||||
|
||||
export const MoneyNeedsCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<NumberInput source="employees" label="Стоимость работы сотрудников" step={0.01} />
|
||||
<NumberInput source="part" label="Стоимость ЗИП/ТМЦ" step={0.01} />
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
10
frontend/src/resources/money-needs/MoneyNeedsEdit.tsx
Normal file
10
frontend/src/resources/money-needs/MoneyNeedsEdit.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Edit, SimpleForm, NumberInput } from 'react-admin';
|
||||
|
||||
export const MoneyNeedsEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<NumberInput source="employees" label="Стоимость работы сотрудников" step={0.01} />
|
||||
<NumberInput source="part" label="Стоимость ЗИП/ТМЦ" step={0.01} />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
12
frontend/src/resources/money-needs/MoneyNeedsList.tsx
Normal file
12
frontend/src/resources/money-needs/MoneyNeedsList.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { List, DataTable, TextField, NumberField, EditButton } from 'react-admin';
|
||||
|
||||
export const MoneyNeedsList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="employees" field={NumberField} label="Стоимость работы сотрудников" />
|
||||
<DataTable.Col source="part" field={NumberField} label="Стоимость ЗИП/ТМЦ" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
11
frontend/src/resources/money-needs/MoneyNeedsShow.tsx
Normal file
11
frontend/src/resources/money-needs/MoneyNeedsShow.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Show, SimpleShowLayout, TextField, NumberField } from 'react-admin';
|
||||
|
||||
export const MoneyNeedsShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<NumberField source="employees" label="Стоимость работы сотрудников" />
|
||||
<NumberField source="part" label="Стоимость ЗИП/ТМЦ" />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/money-needs/index.ts
Normal file
4
frontend/src/resources/money-needs/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { MoneyNeedsList } from './MoneyNeedsList';
|
||||
export { MoneyNeedsEdit } from './MoneyNeedsEdit';
|
||||
export { MoneyNeedsCreate } from './MoneyNeedsCreate';
|
||||
export { MoneyNeedsShow } from './MoneyNeedsShow';
|
||||
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" label="Название" />
|
||||
<SelectInput source="categories" choices={categoryChoices} label="Категории" />
|
||||
<NumberInput source="price" label="Стоимость" step={0.01} />
|
||||
<TextInput multiline source="description" label="Описание" />
|
||||
<TextInput source="serialNumber" label="Серийный номер" />
|
||||
</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" label="ID" />
|
||||
<TextInput source="name" label="Название" />
|
||||
<SelectInput source="categories" choices={categoryChoices} label="Категории" />
|
||||
<NumberInput source="price" label="Стоимость" step={0.01} />
|
||||
<TextInput multiline source="description" label="Описание" />
|
||||
<TextInput source="serialNumber" label="Серийный номер" />
|
||||
</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" label="Название" />
|
||||
<DataTable.Col source="categories" label="Категории" />
|
||||
<DataTable.Col source="price" field={NumberField} label="Стоимость" />
|
||||
<DataTable.Col source="description" label="Описание" />
|
||||
<DataTable.Col source="serialNumber" label="Серийный номер" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
14
frontend/src/resources/part/PartShow.tsx
Normal file
14
frontend/src/resources/part/PartShow.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Show, SimpleShowLayout, TextField, NumberField } from 'react-admin';
|
||||
|
||||
export const PartShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<TextField source="name" label="Название" />
|
||||
<TextField source="categories" label="Категории" />
|
||||
<NumberField source="price" label="Стоимость" />
|
||||
<TextField source="description" label="Описание" />
|
||||
<TextField source="serialNumber" label="Серийный номер" />
|
||||
</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 { PartEdit } from './PartEdit';
|
||||
export { PartCreate } from './PartCreate';
|
||||
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" label="Номер заявки" />
|
||||
<DateInput source="date" label="Дата заявки" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="repairKind" choices={repairKindChoices} label="Вид ремонта" />
|
||||
<SelectInput source="status" choices={statusChoices} label="Статус" />
|
||||
<DateInput source="plannedAt" label="Плановая дата начала" />
|
||||
<DateInput source="startedAt" label="Фактическая дата начала" />
|
||||
<DateInput source="completedAt" label="Фактическая дата завершения" />
|
||||
<TextInput source="contractor" label="Подрядная организация" />
|
||||
<NumberInput source="engineHoursAtRepair" label="Наработка на момент ремонта" step={0.01} />
|
||||
<TextInput multiline source="description" label="Описание работ" />
|
||||
<TextInput multiline source="notes" label="Примечания" />
|
||||
<BooleanInput source="confirmed" label="Согласовано" />
|
||||
</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" label="ID" />
|
||||
<TextInput source="number" label="Номер заявки" />
|
||||
<DateInput source="date" label="Дата заявки" />
|
||||
<ReferenceInput source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<SelectInput optionText="name" />
|
||||
</ReferenceInput>
|
||||
<SelectInput source="repairKind" choices={repairKindChoices} label="Вид ремонта" />
|
||||
<SelectInput source="status" choices={statusChoices} label="Статус" />
|
||||
<DateInput source="plannedAt" label="Плановая дата начала" />
|
||||
<DateInput source="startedAt" label="Фактическая дата начала" />
|
||||
<DateInput source="completedAt" label="Фактическая дата завершения" />
|
||||
<TextInput source="contractor" label="Подрядная организация" />
|
||||
<NumberInput source="engineHoursAtRepair" label="Наработка на момент ремонта" step={0.01} />
|
||||
<TextInput multiline source="description" label="Описание работ" />
|
||||
<TextInput multiline source="notes" label="Примечания" />
|
||||
<BooleanInput source="confirmed" label="Согласовано" />
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
23
frontend/src/resources/repair-order/RepairOrderList.tsx
Normal file
23
frontend/src/resources/repair-order/RepairOrderList.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { List, DataTable, TextField, DateField, BooleanField, EditButton } from 'react-admin';
|
||||
|
||||
export const RepairOrderList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col source="number" label="Номер заявки" />
|
||||
<DataTable.Col source="date" field={DateField} label="Дата заявки" />
|
||||
<DataTable.Col source="equipmentId" label="Оборудование ID" />
|
||||
<DataTable.Col source="repairKind" label="Вид ремонта" />
|
||||
<DataTable.Col source="status" label="Статус" />
|
||||
<DataTable.Col source="plannedAt" field={DateField} label="Плановая дата начала" />
|
||||
<DataTable.Col source="startedAt" field={DateField} label="Фактическая дата начала" />
|
||||
<DataTable.Col source="completedAt" field={DateField} label="Фактическая дата завершения" />
|
||||
<DataTable.Col source="contractor" label="Подрядная организация" />
|
||||
<DataTable.Col source="engineHoursAtRepair" label="Наработка на момент ремонта" />
|
||||
<DataTable.Col source="description" label="Описание работ" />
|
||||
<DataTable.Col source="notes" label="Примечания" />
|
||||
<DataTable.Col source="confirmed" field={BooleanField} label="Согласовано" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
24
frontend/src/resources/repair-order/RepairOrderShow.tsx
Normal file
24
frontend/src/resources/repair-order/RepairOrderShow.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Show, SimpleShowLayout, TextField, DateField, BooleanField, NumberField, ReferenceField } from 'react-admin';
|
||||
|
||||
export const RepairOrderShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<TextField source="number" label="Номер заявки" />
|
||||
<DateField source="date" label="Дата заявки" />
|
||||
<ReferenceField source="equipmentId" reference="equipment" label="Оборудование">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<TextField source="repairKind" label="Вид ремонта" />
|
||||
<TextField source="status" label="Статус" />
|
||||
<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="Примечания" />
|
||||
<BooleanField source="confirmed" label="Согласовано" />
|
||||
</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 { RepairOrderEdit } from './RepairOrderEdit';
|
||||
export { RepairOrderCreate } from './RepairOrderCreate';
|
||||
export { RepairOrderShow } from './RepairOrderShow';
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Create, SimpleForm, ReferenceArrayInput, SelectArrayInput } from 'react-admin';
|
||||
|
||||
export const ResourceNeedsCreate = () => (
|
||||
<Create>
|
||||
<SimpleForm>
|
||||
<ReferenceArrayInput source="employees" reference="employee" label="Сотрудники">
|
||||
<SelectArrayInput optionText="fullName" />
|
||||
</ReferenceArrayInput>
|
||||
<ReferenceArrayInput source="parts" reference="part" label="ЗИП/ТМЦ">
|
||||
<SelectArrayInput optionText="name" />
|
||||
</ReferenceArrayInput>
|
||||
</SimpleForm>
|
||||
</Create>
|
||||
);
|
||||
14
frontend/src/resources/resource-needs/ResourceNeedsEdit.tsx
Normal file
14
frontend/src/resources/resource-needs/ResourceNeedsEdit.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Edit, SimpleForm, ReferenceArrayInput, SelectArrayInput } from 'react-admin';
|
||||
|
||||
export const ResourceNeedsEdit = () => (
|
||||
<Edit>
|
||||
<SimpleForm>
|
||||
<ReferenceArrayInput source="employees" reference="employee" label="Сотрудники">
|
||||
<SelectArrayInput optionText="fullName" />
|
||||
</ReferenceArrayInput>
|
||||
<ReferenceArrayInput source="parts" reference="part" label="ЗИП/ТМЦ">
|
||||
<SelectArrayInput optionText="name" />
|
||||
</ReferenceArrayInput>
|
||||
</SimpleForm>
|
||||
</Edit>
|
||||
);
|
||||
10
frontend/src/resources/resource-needs/ResourceNeedsList.tsx
Normal file
10
frontend/src/resources/resource-needs/ResourceNeedsList.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { List, DataTable, TextField, EditButton } from 'react-admin';
|
||||
|
||||
export const ResourceNeedsList = () => (
|
||||
<List>
|
||||
<DataTable>
|
||||
<DataTable.Col source="id" />
|
||||
<DataTable.Col><EditButton /></DataTable.Col>
|
||||
</DataTable>
|
||||
</List>
|
||||
);
|
||||
19
frontend/src/resources/resource-needs/ResourceNeedsShow.tsx
Normal file
19
frontend/src/resources/resource-needs/ResourceNeedsShow.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Show, SimpleShowLayout, TextField, ReferenceArrayField, SingleFieldList, ChipField } from 'react-admin';
|
||||
|
||||
export const ResourceNeedsShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" label="ID" />
|
||||
<ReferenceArrayField source="employees" reference="employee" label="Сотрудники">
|
||||
<SingleFieldList>
|
||||
<ChipField source="fullName" />
|
||||
</SingleFieldList>
|
||||
</ReferenceArrayField>
|
||||
<ReferenceArrayField source="parts" reference="part" label="ЗИП/ТМЦ">
|
||||
<SingleFieldList>
|
||||
<ChipField source="name" />
|
||||
</SingleFieldList>
|
||||
</ReferenceArrayField>
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
4
frontend/src/resources/resource-needs/index.ts
Normal file
4
frontend/src/resources/resource-needs/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { ResourceNeedsList } from './ResourceNeedsList';
|
||||
export { ResourceNeedsEdit } from './ResourceNeedsEdit';
|
||||
export { ResourceNeedsCreate } from './ResourceNeedsCreate';
|
||||
export { ResourceNeedsShow } from './ResourceNeedsShow';
|
||||
Reference in New Issue
Block a user