Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 6024 Rev 7774
Línea 1... Línea 1...
1
import React from 'react'
1
import React, { useState } from 'react'
-
 
2
import LocationModal from './LocationModal'
Línea 2... Línea 3...
2
 
3
 
Línea -... Línea 4...
-
 
4
const Location = ({ locations = [], googleApiKey, locationsAddUrl }) => {
-
 
5
 
-
 
6
    const [actionUrl, setActionUrl] = useState(locationsAddUrl)
3
const Location = ({ locations = [] }) => {
7
    const [showModal, setShowModal] = useState(false)
-
 
8
 
-
 
9
    const editLocation = (url) => {
-
 
10
        setShowModal(true)
-
 
11
        setActionUrl(url)
-
 
12
    }
Línea 4... Línea 13...
4
 
13
 
Línea 5... Línea 14...
5
    const editLocation = (url) => { }
14
    const closeModal = () => setShowModal(false)
-
 
15
 
6
 
16
    const deleteLocation = (url) => { }
7
    const deleteLocation = (url) => { }
17
 
8
 
18
    return (
9
    return (
19
        <>
10
        <div className="user-profile-extended-ov st2">
20
            <div className="user-profile-extended-ov st2">
11
            <h3>
21
                <h3>
12
                Ubicaciones
22
                    Ubicaciones
13
                <button className="btn btn-location-add">
23
                    <button className="btn btn-location-add">
14
                    <i className="fa fa-plus-square" />
24
                        <i className="fa fa-plus-square" />
15
                </button>
25
                    </button>
16
            </h3>
26
                </h3>
17
            <span id="locations-records">
27
                <span id="locations-records">
18
                {
28
                    {
19
                    locations.map((location, index) => (
29
                        locations.map((location, index) => (
20
                        <>
30
                            <>
21
                            <p key={index}>
31
                                <p key={index}>
22
                                {location.formatted_address}
32
                                    {location.formatted_address}
23
                                {location.is_main === 'y' ? " (Principal)" : ""}
33
                                    {location.is_main === 'y' ? " (Principal)" : ""}
24
                                <button
34
                                    <button
25
                                    onClick={() => editLocation(location.link_edit)}
35
                                        onClick={() => editLocation(location.link_edit)}
26
                                    className="btn btn-location-edit"
36
                                        className="btn btn-location-edit"
27
                                    style={{ padding: '.3rem' }}
37
                                        style={{ padding: '.3rem' }}
28
                                >
38
                                    >
29
                                    <i className="fa fa-pencil" />
39
                                        <i className="fa fa-pencil" />
30
                                </button>
40
                                    </button>
31
                                <button
41
                                    <button
32
                                    onClick={() => deleteLocation(location.link_delete)}
42
                                        onClick={() => deleteLocation(location.link_delete)}
33
                                    className="btn btn-location-delete"
43
                                        className="btn btn-location-delete"
34
                                    style={{ padding: '.3rem' }}
44
                                        style={{ padding: '.3rem' }}
35
                                >
45
                                    >
36
                                    <i className="fa fa-trash" />
46
                                        <i className="fa fa-trash" />
-
 
47
                                    </button>
37
                                </button>
48
                                </p>
38
                            </p>
49
                                {
39
                            {
50
                                    locations[index + 1] && <hr />
-
 
51
                                }
-
 
52
                            </>
-
 
53
                        ))
-
 
54
                    }
40
                                locations[index + 1] && <hr />
55
                </span>
-
 
56
            </div >
-
 
57
            {
-
 
58
                showModal
-
 
59
                &&
-
 
60
                <LocationModal
41
                            }
61
                    closeModal={closeModal}
-
 
62
                    dataLink={actionUrl}
42
                        </>
63
                    googleApiKey={googleApiKey}
43
                    ))
64
 
44
                }
65
                />
Línea 45... Línea 66...
45
            </span>
66
            }
46
        </div >
67
        </>