diff --git a/src/components/Table/index.ts b/src/components/Table/index.ts index fe5fe21..ff22c51 100644 --- a/src/components/Table/index.ts +++ b/src/components/Table/index.ts @@ -92,6 +92,15 @@ export const makeStringSorter = (key: string) => (a: any, b: any) => return 0 } +export const makeDateSorter = (key: string) => (a: any, b: any) => { + const date = new Date(a[key]) + + if(Number.isNaN(date.getTime())) + throw new Error('Date column contains not date formatted string(s)') + + return date.getTime() - new Date(b[key]).getTime() +} + export const makeGroupColumn = (title: string, children: object[]) => ({ title: title, children: children, diff --git a/src/pages/Cluster/ClusterWells.jsx b/src/pages/Cluster/ClusterWells.jsx index dd54110..26a8da8 100644 --- a/src/pages/Cluster/ClusterWells.jsx +++ b/src/pages/Cluster/ClusterWells.jsx @@ -74,10 +74,6 @@ export default function ClusterWells({ clusterData }) { } }, [selectedWellId]); - const closeModal = () => { - setIsModalVisible(false) - } - calcAndUpdateStatsBySections(wellsStat ?? [], [ "factStart", "factEnd", @@ -168,9 +164,9 @@ export default function ClusterWells({ clusterData }) { title='TVD' centered visible={isModalVisible} - onOk={closeModal} - onCancel={closeModal} + onCancel={() => setIsModalVisible(false)} width={1500} + footer={null} > Number.isNaN(value.toFixed(2)) ? "-" : value.toFixed(2) +}, numericColumnOptions) + + export const WellOperationsEditor = ({idWell, idType}) => { const [pageNumAndPageSize, setPageNumAndPageSize] = useState({current:1, pageSize:basePageSize}) const [paginationTotal, setPaginationTotal] = useState(0) @@ -31,7 +47,9 @@ export const WellOperationsEditor = ({idWell, idType}) => { async () => { const skip = ((pageNumAndPageSize.current - 1) * pageNumAndPageSize.pageSize) || 0 const take = pageNumAndPageSize.pageSize - const paginatedOperations = await WellOperationService.getOperations(idWell, idType, undefined, undefined, undefined, undefined, undefined, undefined, skip, take ) + const paginatedOperations = await WellOperationService.getOperations(idWell, + idType, undefined, undefined, undefined, undefined, + undefined, undefined, skip, take ) const operations = paginatedOperations?.items ?? [] setOperations(operations) const total = paginatedOperations.count?? paginatedOperations.items?.length ?? 0 @@ -57,14 +75,15 @@ export const WellOperationsEditor = ({idWell, idType}) => { render:(_, record)=>getByKeyOrReturnKey(dictionaryOperationCategory, record.idCategory) }), makeColumn('Доп. инфо','categoryInfo', {editable:true, width:300, input: