Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 7019 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React, { useEffect, useState } from 'react'
import { axios } from '../../utils'
import { useDispatch, useSelector } from 'react-redux'
import { addNotification } from '../../redux/notification/notification.actions'

const KnowledgeAreaPage = ({ allowAdd = true, content_edit = true }) => {
  const [knowledges, setKnowledges] = useState([])
  const [knowledgesCategories, setKnowledgesCategories] = useState([])
  const labels = useSelector(({ intl }) => intl.labels)
  const dispatch = useDispatch()

  useEffect(() => {
    axios
      .get('/knowledge-area', {
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((response) => {
        console.log(response.data)
      })
      .catch((error) => {
        dispatch(
          addNotification({
            style: 'danger',
            msg: 'Ha ocurrido un error, por favor intente más tarde.',
          })
        )
        throw new Error(error)
      })
  }, [])

  return (
    <section className="companies-info container px-0">
      <div className="company-title">
        <h1 className="title mx-auto">{labels.knowledge_area_title}</h1>
        {content_edit && allowAdd && (
          <h2 className="title cursor-pointer" id="knowledge-add-a">
            {labels.knowledge_area_add}
          </h2>
        )}
      </div>

      <div className="row gap-3" id="row-list">
        <div className="knowledge-category-list col-12 col-md-3">
          <ul>
            <li className="knowledge-category-li knowledge-category-li-selected">
              <a className="knowledge-category-a" href="">
                {labels.knowledge_area_category_all}
              </a>
            </li>
            {knowledgesCategories.map((category, index) => (
              <li className="knowledge-category-li" key={index}>
                <a className="knowledge-category-a" href="">
                  {category.name}
                </a>
              </li>
            ))}
          </ul>
        </div>

        <div className="col px-0">
          <div className="search-box">
            <form id="form-filter" name="form-filter">
              <input
                type="text"
                name="search"
                id="search"
                className="form-control"
              />
              <button className="btn btn-search">{labels.search}</button>
            </form>
          </div>

          <div
            id="knowledge-record-list"
            className="knowledge-record-list mt-3"
          ></div>

          <div id="knowledge-record-pagination"></div>
        </div>
      </div>
    </section>
  )
}

export default KnowledgeAreaPage