diff --git a/frontend_reactjs/src/components/modals/CreateUserModal.tsx b/frontend_reactjs/src/components/modals/CreateUserModal.tsx index cdeb670..040afb9 100644 --- a/frontend_reactjs/src/components/modals/CreateUserModal.tsx +++ b/frontend_reactjs/src/components/modals/CreateUserModal.tsx @@ -58,7 +58,6 @@ export default function CreateUserModal({ aria-describedby="modal-modal-description" >
- Создание пользователя diff --git a/frontend_reactjs/src/pages/Documents.tsx b/frontend_reactjs/src/pages/Documents.tsx index bb7adaf..c94ab33 100644 --- a/frontend_reactjs/src/pages/Documents.tsx +++ b/frontend_reactjs/src/pages/Documents.tsx @@ -1,16 +1,71 @@ -import React, { useEffect, useState } from 'react' +import React, { useState } from 'react' import DocumentService from '../services/DocumentService' -import { Box, Button } from '@mui/material' +import { Box, Button, Typography } from '@mui/material' +import { GridColDef } from '@mui/x-data-grid' +import DataTable from '../components/DataTable' export default function Documents() { - const [data, setData] = useState() + const [companies, setCompanies] = useState() + const [departments, setDepartments] = useState() + const [organizations, setOrganizations] = useState() + const [banks, setBanks] = useState() + + const [documents, setDocuments] = useState() const fetchData = async () => { + await DocumentService.getCompanies().then(response => { + setCompanies(response.data) + }) + + await DocumentService.getOrganizations().then(response => { + setOrganizations(response.data) + }) + + await DocumentService.getDepartments().then(response => { + setDepartments(response.data) + }) + + await DocumentService.getBanks().then(response => { + setBanks(response.data) + }) + } + + const fetchDocuments = async () => { await DocumentService.getDocuments().then(response => { - setData(response.data) + setDocuments(response.data) }) } + const organizationColumns: GridColDef[] = [ + { field: 'id', headerName: 'ID', type: "number", width: 90 }, + { field: 'id_1c', headerName: 'ID 1C', type: "string", width: 90 }, + { field: 'name', headerName: 'Наименование', type: "string", width: 90 }, + { field: 'full_name', headerName: 'Полное наименование', type: "string", width: 90 }, + { field: 'inn', headerName: 'ИНН', type: "string", width: 70 }, + { field: 'ogrn', headerName: 'ОГРН', width: 130 }, + { field: 'kpp', headerName: 'КПП', width: 130 }, + { field: 'okopf', headerName: 'ОКОПФ', width: 90 }, + { field: 'legal_address', headerName: 'Юридический адрес', width: 90 }, + { field: 'actual_address', headerName: 'Фактический адрес', width: 90 }, + { field: 'mail_address', headerName: 'Почтовый адрес', type: "string", width: 90 }, + { field: 'id_budget', headerName: 'Активен', type: "number", width: 90 }, + { field: 'fio_dir', headerName: 'Активен', type: "string", width: 90 }, + { field: 'phone', headerName: 'Телефон', type: "string", width: 90 }, + { field: 'email', headerName: 'Email', type: "string", width: 90 }, + { field: 'comment', headerName: 'Комментарий', type: "string", width: 90 }, + { field: 'id_bank', headerName: 'Банк', type: "string", width: 90 }, + { field: 'active', headerName: 'Активен', type: "boolean", width: 90 }, + ]; + + const bankColumns: GridColDef[] = [ + { field: 'id', headerName: 'ID', type: "number", width: 90 }, + { field: 'id_1c', headerName: 'ID 1C', type: "string", width: 90 }, + { field: 'name', headerName: 'Наименование', type: "string", width: 90 }, + { field: 'bik', headerName: 'БИК', type: "string", width: 90 }, + { field: 'corschet', headerName: 'Кор. счет', type: "string", width: 70 }, + { field: 'activ', headerName: 'Активен', type: "boolean", width: 130 }, + ]; + return (
- {JSON.stringify(data)} + + Companies + + {JSON.stringify(companies)} + + + + Organizations + + {organizations && + + } + + + + + Departments + + {JSON.stringify(departments)} + + + + + Get banks + + {banks && + + } + + + + + + {JSON.stringify(documents)}
) } \ No newline at end of file diff --git a/frontend_reactjs/src/pages/Users.tsx b/frontend_reactjs/src/pages/Users.tsx index a1e47bf..c159044 100644 --- a/frontend_reactjs/src/pages/Users.tsx +++ b/frontend_reactjs/src/pages/Users.tsx @@ -15,24 +15,19 @@ export default function Users() { const columns: GridColDef[] = [ { field: 'id', headerName: 'ID', type: "number", width: 70 }, - { field: 'email', headerName: 'Email', width: 130, editable: true}, + { field: 'email', headerName: 'Email', width: 130, editable: true }, { field: 'login', headerName: 'Логин', width: 130, editable: true }, { field: 'phone', headerName: 'Телефон', width: 90, editable: true }, { field: 'name', headerName: 'Имя', width: 90, editable: true }, { field: 'surname', headerName: 'Фамилия', width: 90, editable: true }, - { field: 'is_active', headerName: 'Активен', type: "boolean", width: 90, editable: true}, + { field: 'is_active', headerName: 'Активен', type: "boolean", width: 90, editable: true }, { field: 'role_id', headerName: 'Роль', - valueGetter: (value, row) => { - if (roles) { - const roleName = roles.find((role: IRole) => role.id === value).name - return roleName - } else { - return value - } - }, - width: 90 + valueOptions: roles ? roles.map((role: IRole) => ({ label: role.name, value: role.id })) : [], + type: 'singleSelect', + width: 90, + editable: true }, ]; diff --git a/frontend_reactjs/src/services/DocumentService.ts b/frontend_reactjs/src/services/DocumentService.ts index 20801f0..a1e1ba8 100644 --- a/frontend_reactjs/src/services/DocumentService.ts +++ b/frontend_reactjs/src/services/DocumentService.ts @@ -100,7 +100,7 @@ export default class DocumentService { // Upload Files static async uploadFiles(folder_id: number, files: any) { - return await axiosInstance.post(`/info//documents/upload/${folder_id}`, files) + return await axiosInstance.post(`/info/documents/upload/${folder_id}`, files) } // Download Doc @@ -149,7 +149,7 @@ export default class DocumentService { } // Get Banks - static async getBanks(bank_id: string, search?: string, limit?: number, offset?: number) { + static async getBanks(bank_id?: string, search?: string, limit?: number, offset?: number) { return await axiosInstance.get(`/info/organization/banks`, { params: { bank_id: bank_id,