Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1936 Rev 2331
Línea 1... Línea 1...
1
import React from "react";
1
import React from "react";
2
import { useEffect, useState } from "react";
2
import { useEffect, useState } from "react";
3
import { useForm } from "react-hook-form";
3
import { useForm } from "react-hook-form";
4
import {axios} from "../../../utils";
4
import { axios } from "../../../utils";
5
import Spinner from "../../../shared/loading-spinner/Spinner";
5
import Spinner from "../../../shared/loading-spinner/Spinner";
6
import CompanyTemplate from "./companyTemplate/CompanyTemplate";
6
import CompanyTemplate from "./companyTemplate/CompanyTemplate";
7
import { connect } from "react-redux";
7
import { connect } from "react-redux";
8
import { addNotification } from "../../../redux/notification/notification.actions";
8
import { addNotification } from "../../../redux/notification/notification.actions";
9
import SearchList from "../../../components/SearchList";
9
import SearchList from "../../../components/SearchList";
Línea 24... Línea 24...
24
 
24
 
25
  useEffect(() => {
25
  useEffect(() => {
26
    fetchCompanies();
26
    fetchCompanies();
Línea 27... Línea 27...
27
  }, []);
27
  }, []);
28
 
28
 
29
  const fetchCompanies = async (searchParam='') => {
29
  const fetchCompanies = async (searchParam = '') => {
30
    setLoading(true);
30
    setLoading(true);
31
    await axios
31
    await axios
32
      .get(
32
      .get(
33
        "/company/i-work-with?search="+searchParam)
33
        "/company/i-work-with?search=" + searchParam)
34
      .then((response) => {
34
      .then((response) => {
35
        const resData = response.data;
35
        const resData = response.data;
36
        if (resData.success) {
36
        if (resData.success) {
Línea 45... Línea 45...
45
      <div className="container">
45
      <div className="container">
46
        <SearchList
46
        <SearchList
47
          title="Empresas donde trabajo"
47
          title="Empresas donde trabajo"
48
          fetchCallback={fetchCompanies}
48
          fetchCallback={fetchCompanies}
49
        />
49
        />
50
        <div className="companies-list">
-
 
51
          <div
50
        <div
52
            className="row"
51
          className="companies-list"
53
            id="profiles-container"
52
          id="profiles-container"
54
            style={{
53
          style={{
55
              position: "relative",
54
            position: "relative",
56
            }}
55
          }}
57
          >
56
        >
58
            {companies.length > 0 ? (
57
          {companies.length > 0 ? (
59
              companies.map(({image, link_leave, link_view, name, link_my_company}, id) => (
58
            companies.map(({ image, link_leave, link_view, name, link_my_company }, id) => (
60
                <Profile
59
              <Profile
61
                  key={id}
60
                key={id}
62
                  image={image}
61
                image={image}
63
                  link_admin={link_my_company}
62
                link_admin={link_my_company}
64
                  link_leave={link_leave}
63
                link_leave={link_leave}
65
                  fetchCallback={fetchCompanies}
64
                fetchCallback={fetchCompanies}
66
                  link_view={link_view}
65
                link_view={link_view}
67
                  name={name}
66
                name={name}
68
                />
67
              />
69
              ))
68
            ))
70
            ) : (
69
          ) : (
71
              <div style={{ margin: "auto", textAlign: "center" }}>
70
            <div style={{ margin: "auto", textAlign: "center" }}>
72
                Ningún registro coincidio con su consulta
71
              Ningún registro coincidio con su consulta
73
              </div>
72
            </div>
74
            )}
73
          )}
75
            {loading && (
74
          {loading && (
76
              <div className="spinner-container">
75
            <div className="spinner-container">
77
                <Spinner />
76
              <Spinner />
78
              </div>
77
            </div>
79
            )}
78
          )}
80
          </div>
-
 
81
          {/* <!--product-feed-tab end--> */}
79
          {/* <!--product-feed-tab end--> */}
82
        </div>
80
        </div>
83
      </div>
81
      </div>
84
    </section>
82
    </section>
85
  );
83
  );