Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 2511 Rev 5126
Línea 1... Línea 1...
1
import React from "react";
1
/* eslint-disable camelcase */
2
import { useEffect, useState } from "react";
2
import React, { useEffect, useState } from 'react'
3
import { connect } from "react-redux";
3
import { axios } from '../../../utils'
4
import { useForm } from "react-hook-form";
4
import { connect } from 'react-redux'
5
import styled from "styled-components";
-
 
6
import { axios } from "../../../utils";
-
 
7
import { addNotification } from "../../../redux/notification/notification.actions";
5
import { addNotification } from '../../../redux/notification/notification.actions'
8
import Spinner from "../../../shared/loading-spinner/Spinner";
6
import Profile from '../../../components/Profile'
9
import Invitation from "./invitation/Invitation";
-
 
10
import SearchList from "../../../components/SearchList";
7
import SearchList from '../../../components/SearchList'
11
import Profile from "../../../components/Profile";
8
import Spinner from '../../../shared/loading-spinner/Spinner'
12
 
-
 
13
const StyledSpinnerContainer = styled.div`
9
import EmptySection from '../../../shared/empty-section/EmptySection'
14
  position: absolute;
-
 
15
  left: 0;
-
 
16
  top: 0;
-
 
17
  width: 100%;
-
 
18
  height: 100%;
-
 
19
  background: rgba(255, 255, 255, 0.4);
10
import TitleSection from '../../../components/TitleSection'
20
  display: flex;
-
 
21
  justify-content: center;
-
 
22
  align-items: center;
-
 
23
  z-index: 300;
-
 
24
`;
-
 
25
 
11
 
26
const InvitationsSent = (props) => {
12
const InvitationsSent = () => {
27
  // states
-
 
28
  const [sentInvitations, setSentInvitations] = useState([]);
13
  const [sentInvitations, setSentInvitations] = useState([])
29
  const [loading, setLoading] = useState(false);
14
  const [loading, setLoading] = useState(false)
Línea 30... Línea 15...
30
 
15
 
31
  useEffect(() => {
16
  useEffect(() => {
32
    fetchInvitations();
17
    fetchInvitations()
Línea 33... Línea 18...
33
  }, []);
18
  }, [])
34
 
19
 
35
  const fetchInvitations = async (searchValue = '') => {
20
  const fetchInvitations = async (searchValue = '') => {
36
    setLoading(true);
21
    setLoading(true)
37
    await axios
22
    await axios
38
      .get("/connection/invitations-sent?search=" + searchValue)
-
 
39
      .then((response) => {
-
 
40
        const resData = response.data;
23
      .get('/connection/invitations-sent?search=' + searchValue)
41
        if (resData.success) {
-
 
42
          setSentInvitations(resData.data);
24
      .then(({ data: response }) => {
43
        }
25
        if (response.success) setSentInvitations(response.data)
44
      });
26
      })
Línea 45... Línea 27...
45
    setLoading(false);
27
    setLoading(false)
46
  };
28
  }
47
 
-
 
48
  return (
-
 
49
    <section className="companies-info">
29
 
50
      <div className="container">
30
  return (
51
        <SearchList
-
 
52
          title="Invitaciones Enviadas"
-
 
53
          fetchCallback={fetchInvitations}
-
 
54
        />
31
    <section className="companies-info container">
55
 
-
 
56
        <div
-
 
57
          className="companies-list"
-
 
58
          id="profiles-container"
32
      <TitleSection title={LABELS.INVITATIONS_SENT} />
59
          style={{ position: "relative", padding: "0 15px", }}
-
 
60
        >
33
      <SearchList onChange={fetchInvitations} />
61
          {sentInvitations.length > 0 ? (
34
      <div className="companies-list">
-
 
35
        {sentInvitations.length > 0
62
            sentInvitations.map(
36
          ? sentInvitations.map(({ name, image, link_delete, link_view }, id) =>
63
              ({ name, image, link_delete, link_view }, id) => (
37
              <Profile
64
                <Profile
38
                key={id}
65
                  image={image}
39
                image={image}
66
                  name={name}
-
 
67
                  link_delete={link_delete}
40
                name={name}
68
                  link_view={link_view}
41
                link_delete={link_delete}
69
                  key={id}
42
                link_view={link_view}
70
                  fetchCallback={fetchInvitations}
-
 
71
                  btnCancelTitle='Cancelar solicitud'
43
                fetchCallback={fetchInvitations}
72
                />
-
 
73
              )
44
                btnCancelTitle={LABELS.REQUEST_CANCEL}
74
            )
45
              />
75
          ) : (
-
 
76
            <p>No hay resultados</p>
-
 
77
          )}
46
          )
78
          {loading ? (
-
 
79
            <StyledSpinnerContainer>
-
 
80
              <Spinner />
-
 
81
            </StyledSpinnerContainer>
-
 
82
          ) : (
-
 
83
            ""
47
          : <EmptySection align='left' message={LABELS.DATATABLE_SZERORECORDS} />
84
          )}
48
        }
85
        </div>
49
        {loading && <Spinner />}
86
      </div>
50
      </div>
Línea 87... Línea 51...
87
    </section >
51
    </section>
88
  );
52
  )
89
};
53
}
Línea 90... Línea 54...
90
 
54