Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 7019 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
7015 stevensc 1
import React, { useEffect, useState } from 'react'
2
import { axios } from '../../utils'
3
import { useDispatch, useSelector } from 'react-redux'
4
import { addNotification } from '../../redux/notification/notification.actions'
5
 
6
const KnowledgeAreaPage = ({ allowAdd = true, content_edit = true }) => {
7
  const [knowledges, setKnowledges] = useState([])
8
  const [knowledgesCategories, setKnowledgesCategories] = useState([])
9
  const labels = useSelector(({ intl }) => intl.labels)
10
  const dispatch = useDispatch()
11
 
12
  useEffect(() => {
13
    axios
14
      .get('/knowledge-area', {
15
        headers: {
16
          'Content-Type': 'application/json',
17
        },
18
      })
19
      .then((response) => {
20
        console.log(response.data)
21
      })
22
      .catch((error) => {
23
        dispatch(
24
          addNotification({
25
            style: 'danger',
26
            msg: 'Ha ocurrido un error, por favor intente más tarde.',
27
          })
28
        )
29
        throw new Error(error)
30
      })
31
  }, [])
32
 
33
  return (
34
    <section className="companies-info container px-0">
35
      <div className="company-title">
36
        <h1 className="title mx-auto">{labels.knowledge_area_title}</h1>
37
        {content_edit && allowAdd && (
38
          <h2 className="title cursor-pointer" id="knowledge-add-a">
39
            {labels.knowledge_area_add}
40
          </h2>
41
        )}
42
      </div>
43
 
44
      <div className="row gap-3" id="row-list">
45
        <div className="knowledge-category-list col-12 col-md-3">
46
          <ul>
47
            <li className="knowledge-category-li knowledge-category-li-selected">
48
              <a className="knowledge-category-a" href="">
49
                {labels.knowledge_area_category_all}
50
              </a>
51
            </li>
52
            {knowledgesCategories.map((category, index) => (
53
              <li className="knowledge-category-li" key={index}>
54
                <a className="knowledge-category-a" href="">
55
                  {category.name}
56
                </a>
57
              </li>
58
            ))}
59
          </ul>
60
        </div>
61
 
62
        <div className="col px-0">
63
          <div className="search-box">
64
            <form id="form-filter" name="form-filter">
65
              <input
66
                type="text"
67
                name="search"
68
                id="search"
69
                className="form-control"
70
              />
71
              <button className="btn btn-search">{labels.search}</button>
72
            </form>
73
          </div>
74
 
75
          <div
76
            id="knowledge-record-list"
77
            className="knowledge-record-list mt-3"
78
          ></div>
79
 
80
          <div id="knowledge-record-pagination"></div>
81
        </div>
82
      </div>
83
    </section>
84
  )
85
}
86
 
87
export default KnowledgeAreaPage