Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6632 Rev 6680
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react'
2
import { Link } from 'react-router-dom'
2
import TableFilters from "../components/TableFilters"
-
 
3
 
-
 
4
const JobsTableView = ({ allowAdd, allowEdit, allowDelete, link_table, link_add }) => {
-
 
5
 
-
 
6
    const [companyData, setCompanyData] = useState({});
-
 
7
    const [showModal, setShowModal] = useState(false);
-
 
8
    const [showDeleteModal, setShowDeleteModal] = useState(false);
-
 
9
    const [actionLink, setActionLink] = useState(link_add);
-
 
10
    const headers = [
-
 
11
        { key: "last_date_of_application", label: "Último día de aplicación", isSorteable: true },
-
 
12
        { key: "title", label: "Título", isSorteable: true },
-
 
13
        { key: "details", label: "Detalles", isSorteable: true },
-
 
14
        { key: "actions", label: "Acciones", isSorteable: false }
-
 
15
    ]
-
 
16
 
-
 
17
    const getData = (search, start, length) => {
-
 
18
        axios.get(
-
 
19
            link_table,
-
 
20
            {
-
 
21
                params: {
-
 
22
                    search: search,
-
 
23
                    start: start,
-
 
24
                    length: length
-
 
25
                }
-
 
26
            })
-
 
27
            .then(({ data }) => {
-
 
28
                if (data.success) {
-
 
29
                    setCompanyData(data.data)
-
 
30
 
-
 
31
                    return data.data
-
 
32
                }
-
 
33
            })
-
 
34
            .catch((err) => console.log(err))
-
 
35
    }
-
 
36
 
-
 
37
    const closeModal = () => {
-
 
38
        setShowModal(false)
-
 
39
        setActionLink(link_add)
-
 
40
    }
-
 
41
 
-
 
42
    const closeDeleteModal = () => {
-
 
43
        setShowDeleteModal(false)
-
 
44
        setActionLink(link_add)
-
 
45
    }
-
 
46
 
-
 
47
    const deleteItem = (item) => {
-
 
48
        setActionLink(item.actions.link_delete);
-
 
49
        setShowDeleteModal(true);
-
 
50
    }
-
 
51
 
-
 
52
    const addItem = () => {
-
 
53
        setActionLink(link_add)
-
 
54
        setShowModal(true);
-
 
55
    }
Línea 3... Línea -...
3
 
-
 
4
const JobsTableView = () => {
56
 
5
    return (
57
    return (
6
        <>
58
        <>
7
            <section className="content-header">
59
            <section className="content-header">
8
                <div className="container-fluid">
60
                <div className="container-fluid">
9
                    <div className="row mb-2">
61
                    <div className="row mb-2">
10
                        <div className="col-sm-12">
-
 
11
                            <Link to='/jobs/edit'>
62
                        <div className="col-sm-12">
12
                                <h1>Empleos</h1>
-
 
13
                            </Link>
63
                            <h1>Empleos</h1>
14
                        </div>
64
                        </div>
15
                    </div>
65
                    </div>
16
                </div>
66
                </div>
-
 
67
            </section>
-
 
68
            <TableFilters
-
 
69
                data={companyData}
-
 
70
                getData={getData}
-
 
71
                onDelete={deleteItem}
-
 
72
                onAdd={addItem}
-
 
73
                headers={headers}
-
 
74
                allowAdd={allowAdd}
-
 
75
                allowEdit={allowEdit}
-
 
76
                allowDelete={allowDelete}
-
 
77
            />
-
 
78
            <DeleteModal
-
 
79
                isOpen={showDeleteModal}
-
 
80
                closeModal={closeDeleteModal}
-
 
81
                url={actionLink}
-
 
82
                action={getData}
17
            </section>
83
            />
18
        </>
84
        </>
19
    )
85
    )
Línea 20... Línea 86...
20
}
86
}
21
 
87