Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2874 | Rev 3416 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2874 Rev 2939
Línea 3... Línea 3...
3
import { Search } from '@mui/icons-material'
3
import { Search } from '@mui/icons-material'
Línea 4... Línea 4...
4
 
4
 
5
import { debounce } from '@utils'
5
import { debounce } from '@utils'
Línea 6... Línea -...
6
import { useFetch, useSearchQuery } from '@hooks'
-
 
7
 
6
import { useFetch, useSearchQuery } from '@hooks'
-
 
7
 
8
import TitleSection from '@components/UI/TitleSection'
8
import Input from '@components/UI/inputs/Input'
9
import Input from '@components/UI/inputs/Input'
9
import TitleSection from '@components/UI/TitleSection'
Línea 10... Línea 10...
10
import MyCompaniesList from '@components/company/MyCompaniesList'
10
import MyCompaniesList from '@components/company/MyCompaniesList'
11
import AddCompanyModal from '@components/modals/AddCompanyModal'
11
import AddCompanyModal from '@components/modals/AddCompanyModal'
12
 
12
 
Línea 13... Línea 13...
13
const MyCompanies = () => {
13
const MyCompanies = () => {
14
  const [showCompanyModal, setShowCompanyModal] = useState(false)
14
  const [showCompanyModal, setShowCompanyModal] = useState(false)
15
  const labels = useSelector(({ intl }) => intl.labels)
15
  const labels = useSelector(({ intl }) => intl.labels)
16
 
16
 
17
  const { getParam, setParam } = useSearchQuery()
17
  const { getStringParams, setParam } = useSearchQuery()
18
  const {
18
  const {
Línea 19... Línea 19...
19
    data: companies,
19
    data: companies,
Línea 20... Línea 20...
20
    isLoading,
20
    isLoading,
Línea 21... Línea 21...
21
    refetch
21
    refetch
22
  } = useFetch('/company/my-companies?search=' + getParam('search'))
22
  } = useFetch('/company/my-companies' + getStringParams())
23
 
23
 
24
  const handleSearch = debounce((e) => setParam('search', e.target.value), 500)
24
  const handleSearch = debounce((e) => setParam('search', e.target.value))
25
 
25
 
26
  const toggleShowCompanyModal = () => setShowCompanyModal(!showCompanyModal)
26
  const toggleShowCompanyModal = () => setShowCompanyModal(!showCompanyModal)
27
 
27
 
28
  return (
-
 
29
    <>
28
  return (
30
      <TitleSection
-
 
31
        title={labels.my_companies}
29
    <>
32
        onAdd={toggleShowCompanyModal}
30
      <TitleSection
33
        addLabel={`${labels.add} ${labels.company?.toLowerCase()}`}
31
        title={labels.my_companies}
34
      />
32
        onAdd={toggleShowCompanyModal}
35
 
33
        addLabel={`${labels.add} ${labels.company?.toLowerCase()}`}
36
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
-
 
37
 
34
      />
38
      <MyCompaniesList
35
      <Input icon={<Search />} onChange={handleSearch} variant='search' />
39
        companies={companies}
36
      <MyCompaniesList
40
        loading={isLoading}
37
        companies={companies}
41
        onComplete={refetch}
38
        loading={isLoading}