diff --git a/src/pages/Well/WellCase/HistoryTable.jsx b/src/pages/Well/WellCase/HistoryTable.jsx index dd9ce30..8bbb56a 100644 --- a/src/pages/Well/WellCase/HistoryTable.jsx +++ b/src/pages/Well/WellCase/HistoryTable.jsx @@ -23,7 +23,7 @@ export const HistoryTable = memo(({ category }) => { async () => { const result = await WellFinalDocumentsService.getFilesHistoryByIdCategory(well.id, category.idCategory) if (!result) return - const files = result.file + const files = result.files files.sort((a, b) => moment(a.uploadDate) - moment(b.uploadDate)) const fileSource = files.map((file) => ({ file, diff --git a/src/pages/Well/WellCase/index.jsx b/src/pages/Well/WellCase/index.jsx index 1eb9709..db08348 100644 --- a/src/pages/Well/WellCase/index.jsx +++ b/src/pages/Well/WellCase/index.jsx @@ -1,5 +1,6 @@ import { memo, useCallback, useEffect, useMemo, useState } from 'react' -import { Alert, Button } from 'antd' +import { NotificationOutlined } from '@ant-design/icons' +import { Alert, Button, Popconfirm } from 'antd' import { useWell } from '@asb/context' import { UserView } from '@components/views' @@ -42,6 +43,17 @@ const WellCase = memo(() => { ) }, [well]) + const notifyPublisher = useCallback((category) => { + invokeWebApiWrapperAsync( + async () => { + await fetch(`/api/WellFinalDocuments/${well.id}/reNotifyPublishers?idCategory=${category.idCategory}`) + }, + setIsLoading, + `Не удалось повторно оповестить ответственного по "${category.nameCategory}"`, + { actionName: `Повторное оповещение ответственного по "${category.nameCategory}"`, well }, + ) + }, [well]) + const columns = useMemo(() => [ makeTextColumn('Категория', 'nameCategory', undefined, undefined, undefined, { width: 300 }), makeColumn('Файл', 'file', { @@ -49,14 +61,25 @@ const WellCase = memo(() => {
{file ? : Файл не загружен} - {category.permissionToUpload && ( - setIsLoading(true)} - onUploadComplete={updateTable} - onUploadError={() => setIsLoading(false)} - /> - )} +
+ {!file && canEdit && ( + notifyPublisher(category)} + title={'Повторно оповестить ответственного о необходимости подгрузки документа'} + > + + + )} + + {category.permissionToUpload && ( + setIsLoading(true)} + onUploadComplete={updateTable} + onUploadError={() => setIsLoading(false)} + /> + )} +
), width: 300, @@ -66,7 +89,7 @@ const WellCase = memo(() => { render: (publishers) => publishers?.map((user, i) => ), width: 200, }), - ], [well, updateTable]) + ], [well, canEdit, updateTable]) const onEditClose = useCallback((changed = false) => { setShowEdit(false)