Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2868 Rev 2873
Línea 1... Línea 1...
1
import React, { useMemo, useRef, useState } from 'react'
1
import React, { useMemo, useRef, useState } from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
3
import { Box, Grid, MenuItem, Select, styled } from '@mui/material'
3
import { Box, Grid, MenuItem, Select, styled } from '@mui/material'
4
import { Search } from '@mui/icons-material'
4
import { Search } from '@mui/icons-material'
Línea 5... Línea 5...
5
 
5
 
6
import { useFetch, useSearchParams } from '@hooks'
6
import { useFetch, useSearchQuery } from '@hooks'
7
import { axios, debounce } from '@utils'
7
import { axios, debounce } from '@utils'
Línea 8... Línea 8...
8
import { addNotification } from '@store/notification/notification.actions'
8
import { addNotification } from '@store/notification/notification.actions'
9
 
9
 
Línea 26... Línea 26...
26
  const [modalShow, setModalShow] = useState(null)
26
  const [modalShow, setModalShow] = useState(null)
27
  const actionUrl = useRef('')
27
  const actionUrl = useRef('')
28
  const labels = useSelector(({ intl }) => intl.labels)
28
  const labels = useSelector(({ intl }) => intl.labels)
29
  const dispatch = useDispatch()
29
  const dispatch = useDispatch()
Línea 30... Línea 30...
30
 
30
 
31
  const { setParams, params } = useSearchParams()
31
  const { getParam, setParam } = useSearchQuery()
32
  const { data: categoriesData } = useFetch(`/my-coach`)
32
  const { data: categoriesData } = useFetch(`/my-coach`)
33
  const { data, refetch } = useFetch(
33
  const { data, refetch } = useFetch(
34
    `/my-coach/questions?search=${params.search}`
34
    '/my-coach/questions?search=' + getParam('search')
Línea 35... Línea 35...
35
  )
35
  )
36
 
36
 
Línea 92... Línea 92...
92
  const closeModal = () => {
92
  const closeModal = () => {
93
    actionUrl.current = ''
93
    actionUrl.current = ''
94
    setModalShow(null)
94
    setModalShow(null)
95
  }
95
  }
Línea 96... Línea 96...
96
 
96
 
Línea 97... Línea 97...
97
  const handleInputChange = debounce((value) => setParams('search', value), 500)
97
  const handleInputChange = debounce((value) => setParam('search', value), 500)
98
 
98
 
99
  return (
99
  return (
100
    <>
100
    <>
Línea 114... Línea 114...
114
          }}
114
          }}
115
        >
115
        >
116
          <SideMenu
116
          <SideMenu
117
            title='Categorias'
117
            title='Categorias'
118
            items={categories}
118
            items={categories}
119
            onChange={(value) => setParams('category_id', value)}
119
            onChange={(value) => setParam('category_id', value)}
120
            current={params.category_id}
120
            current={getParam('category_id')}
121
          />
121
          />
122
        </Grid>
122
        </Grid>
Línea 123... Línea 123...
123
 
123
 
124
        <Grid item xs={12} md={9}>
124
        <Grid item xs={12} md={9}>
Línea 129... Línea 129...
129
          />
129
          />
Línea 130... Línea 130...
130
 
130
 
131
          <Select
131
          <Select
132
            name='categories'
132
            name='categories'
133
            options={categories}
133
            options={categories}
134
            onChange={(e) => setParams('category_id', e.target.value)}
134
            onChange={(e) => setParam('category_id', e.target.value)}
135
            sx={{
135
            sx={{
136
              mt: 1,
136
              mt: 1,
137
              mx: 2,
137
              mx: 2,
138
              display: { md: 'none', xs: 'block' }
138
              display: { md: 'none', xs: 'block' }
Línea 161... Línea 161...
161
              />
161
              />
162
            )}
162
            )}
163
          </QuestionsGrid>
163
          </QuestionsGrid>
Línea 164... Línea 164...
164
 
164
 
165
          <PaginationComponent
165
          <PaginationComponent
166
            onChangePage={(page) => setParams('page', page)}
166
            onChangePage={(page) => setParam('page', page)}
167
            currentActivePage={data.page}
167
            currentActivePage={data.page}
168
            pages={data.total_pages}
168
            pages={data.total_pages}
169
            isRow
169
            isRow
170
          />
170
          />