diff --git a/src/pages/Documents/DocumentsTemplate.jsx b/src/pages/Documents/DocumentsTemplate.jsx index 03d57fb..b8b1428 100644 --- a/src/pages/Documents/DocumentsTemplate.jsx +++ b/src/pages/Documents/DocumentsTemplate.jsx @@ -17,8 +17,9 @@ const { Search } = Input export default function DocumentsTemplate({ idCategory, idWell }) { const [page, setPage] = useState(1) - const [dataRange, setDataRange] = useState([]) - const [company, setCompany] = useState([]) + const [filterDataRange, setFilterDataRange] = useState([]) + const [filterCompany, setFilterCompany] = useState([]) + const [filterFileName, setFilterFileName] = useState('') const [pagination, setPagination] = useState(null) const [files, setFiles] = useState([]) const [showLoader, setShowLoader] = useState(false) @@ -45,7 +46,11 @@ export default function DocumentsTemplate({ idCategory, idWell }) { } const hanleCompanySearch = (value, _) => { - setCompany(value) + setFilterCompany(value) + } + + const hanleFileNameSearch = (value, _) => { + setFilterFileName(value) } const columns = [ @@ -89,9 +94,9 @@ export default function DocumentsTemplate({ idCategory, idWell }) { const update = () => { let begin = null let end = null - if (dataRange?.length > 1) { - begin = dataRange[0].toISOString() - end = dataRange[1].toISOString() + if (filterDataRange?.length > 1) { + begin = filterDataRange[0].toISOString() + end = filterDataRange[1].toISOString() } updateFromWebApiWrapperAsync( @@ -115,13 +120,20 @@ export default function DocumentsTemplate({ idCategory, idWell }) { ) } - useEffect(update, [idWell, dataRange, page, idCategory, company]) + useEffect(update, [idWell, idCategory, page, filterDataRange, filterCompany, filterFileName]) const companies = [...new Set(files.map(file=>file.company))] .filter(company=>company) const DataListCompanies = - {companies.map((company, i)=>)} + {companies.map((company)=>)} + + + const filenames = [...new Set(files.map(file=>file.name))] + .filter(name=>name) + + const DataListFileNames = + {filenames.map((name)=>)} return ( @@ -130,7 +142,7 @@ export default function DocumentsTemplate({ idCategory, idWell }) {
Фильтр по дате
- +
  @@ -141,6 +153,15 @@ export default function DocumentsTemplate({ idCategory, idWell }) { placeholder="Фильтр по компании" onSearch={hanleCompanySearch}/> {DataListCompanies} + +   +
+ Фильтр по имени файла + + {DataListFileNames}