Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 276 Rev 282
Línea 2... Línea 2...
2
import { axios } from '../../utils';
2
import { axios } from '../../utils';
3
import CardTest from "./card-test/CardTest";
3
import CardTest from "./card-test/CardTest";
4
import Spinner from "../../shared/loading-spinner/Spinner";
4
import Spinner from "../../shared/loading-spinner/Spinner";
Línea 5... Línea 5...
5
 
5
 
-
 
6
const SelfEvaluation = (props) => {
-
 
7
     
-
 
8
    // get props
-
 
9
    const { backendVars } = props;
6
const SelfEvaluation = (props) => {
10
    
7
    /**
11
    /**
8
     * Init States
12
     * Init States
9
     */
13
     */
10
    const [rows, setRows] = useState([]);
14
    const [rows, setRows] = useState([]);
Línea 11... Línea 15...
11
    const [loading, setLoading] = useState(true);
15
    const [loading, setLoading] = useState(true);
12
 
16
 
13
    /**
17
    /**
14
     * Get All self evaluation tests
18
     * Get All self evaluation tests
-
 
19
     */
-
 
20
    const fetchData = async (searchParam = '') => {
15
     */
21
 
16
    const getData = async () => {
22
        setLoading(true);
17
        const fecth = await axios.get('/profile/self-evaluation')
23
        const fecth = await axios.get(`/profile/self-evaluation?search=${searchParam}`);
18
        if (fecth.data.data) {
24
        if (fecth.data.data) {
19
            setRows(fecth.data.data)
25
            setRows(fecth.data.data)
20
        }
26
        }
-
 
27
        setLoading(false);
-
 
28
    }
-
 
29
 
-
 
30
    /**
-
 
31
     * Search rows 
-
 
32
     * @param {*} e 
-
 
33
     */
21
        setLoading(false);
34
    const handleSearch = async (e) => fetchData(e);
22
    }
35
 
23
    /**
36
    /**
24
     * componentDidMount
37
     * componentDidMount
25
     */
38
     */
26
    useEffect(() => {
39
    useEffect(() => {
Línea 27... Línea 40...
27
        getData();
40
        fetchData();
28
    }, []);
41
    }, []);
29
 
42
 
30
    return (
43
    return (
31
        <section className="companies-info">
44
        <section className="companies-info">
32
            <div className="container">
45
            <div className="container">
33
                <div className="company-title">
46
                <div className="company-title">
34
                    <div className="section_admin_title_buttons">
47
                    <div className="section_admin_title_buttons">
35
                        <h1 className="title">
48
                        <h1 className="title">
36
                            {props.backendVars.LBL_SELF_EVALUATION}
49
                            {backendVars.LBL_SELF_EVALUATION}
Línea 37... Línea 50...
37
                        </h1>
50
                        </h1>
38
                    </div>
51
                    </div>
39
                </div>
52
                </div>
40
 
53
 
41
                <div className="company-title">
54
                <div className="company-title">
42
                    <div className="section_admin_title_buttons">
55
                    <div className="section_admin_title_buttons">
43
                        <div className="form-group">
56
                        <div className="form-group">
-
 
57
                            <input
44
                            <input
58
                                className="form-group"
45
                                className="form-group"
59
                                type="text"
46
                                type="text"
60
                                placeholder="{backendVars.LABEL_DATATABLE_SSEARCH}"
47
                                placeholder="{props.backendVars.LABEL_DATATABLE_SSEARCH}"
61
                                onChange={e => handleSearch(e.target.value)}
Línea 57... Línea 71...
57
                        </div>
71
                        </div>
58
                    ) : (
72
                    ) : (
59
                        <div className="row">
73
                        <div className="row">
60
                            {rows.length <= 0 ? (
74
                            {rows.length <= 0 ? (
61
                                <div className="col-md-12 col-sm-12 col-xs-12">
75
                                <div className="col-md-12 col-sm-12 col-xs-12">
62
                                    {props.backendVars.LABEL_DATATABLE_SZERORECORDS}
76
                                    {backendVars.LABEL_DATATABLE_SZERORECORDS}
63
                                </div>
77
                                </div>
64
                            ) : (
78
                            ) : (
65
                                <div className="col-md-12 col-sm-12 col-xs-12">
79
                                <div className="col-md-12 col-sm-12 col-xs-12">
66
                                    {rows.map((test, key) => {
80
                                    {rows.map((test, key) => {
67
                                        return  <CardTest key={key} test={test} />
81
                                        return <CardTest
-
 
82
                                            key={key}
-
 
83
                                            test={test}
-
 
84
                                            backendVars={backendVars} />
68
                                    })}
85
                                    })}
69
                                </div>
86
                                </div>
70
                            )}
87
                            )}
71
                        </div>
88
                        </div>
72
                    )}
89
                    )}