diff --git a/src/pages/Cluster/ClusterWells.jsx b/src/pages/Cluster/ClusterWells.jsx index 604a10a..498de12 100755 --- a/src/pages/Cluster/ClusterWells.jsx +++ b/src/pages/Cluster/ClusterWells.jsx @@ -1,7 +1,7 @@ import { Link, useLocation } from 'react-router-dom' import { useState, useEffect, memo, useMemo } from 'react' import { Tag, Button, Modal } from 'antd' -import { LineChartOutlined, ProfileOutlined } from '@ant-design/icons' +import { LineChartOutlined, ProfileOutlined, TeamOutlined } from '@ant-design/icons' import { makeTextColumn, @@ -27,6 +27,7 @@ import { import Tvd from '@pages/WellOperations/Tvd' import WellOperationsTable from './WellOperationsTable' +import CompaniesTable from "@pages/Cluster/CompaniesTable"; const filtersMinMax = [ { text: 'min', value: 'min' }, @@ -44,7 +45,9 @@ const ClusterWells = memo(({ statsWells }) => { const [selectedWellId, setSelectedWellId] = useState(0) const [isTVDModalVisible, setIsTVDModalVisible] = useState(false) const [isOpsModalVisible, setIsOpsModalVisible] = useState(false) + const [isCompaniesModalVisible, setIsCompaniesModalVisible] = useState(false) const [wellOperations, setWellOperations] = useState([]) + const [companies, setCompanies] = useState([]) const [tableData, setTableData] = useState([]) const [showLoader, setShowLoader] = useState(false) @@ -66,6 +69,17 @@ const ClusterWells = memo(({ statsWells }) => { ) }, [selectedWellId, isOpsModalVisible]) + useEffect(() => { + if (!isCompaniesModalVisible || selectedWellId <= 0) { + setCompanies([]) + return + } + + const selectedCompanies = statsWells.find(well => well.id === selectedWellId)?.companies; + setCompanies(selectedCompanies ? selectedCompanies : []); + + }, [selectedWellId, isCompaniesModalVisible]) + useEffect(() => { let data = statsWells?.map((well) => { if (!filtersWellsType.some((el) => el.text === well.wellType)) @@ -140,13 +154,9 @@ const ClusterWells = memo(({ statsWells }) => { makeColumn('Операции', 'operations', { align: 'center', render: (_, value) => (