Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15261 Rev 15279
Línea 2... Línea 2...
2
import { useState } from 'react'
2
import { useState } from 'react'
3
import SearchLocationInput from '../../../shared/SearchLocationInput'
3
import SearchLocationInput from '../../../shared/SearchLocationInput'
4
import { addNotification } from '../../../redux/notification/notification.actions'
4
import { addNotification } from '../../../redux/notification/notification.actions'
5
import axios from 'axios'
5
import axios from 'axios'
6
import { useDispatch } from 'react-redux'
6
import { useDispatch } from 'react-redux'
7
import { Button, Modal } from 'react-bootstrap'
7
import { Modal } from 'react-bootstrap'
Línea 8... Línea 8...
8
 
8
 
9
const LocationModal = ({
9
const LocationModal = ({
10
	closeModal,
10
	closeModal,
11
	dataLink,
11
	dataLink,
Línea 15... Línea 15...
15
}) => {
15
}) => {
Línea 16... Línea 16...
16
 
16
 
17
	const [isActive, setIsActive] = useState((defaultData.is_main === 'y') ? true : false)
17
	const [isActive, setIsActive] = useState((defaultData.is_main === 'y') ? true : false)
18
	const [value, setValue] = useState(defaultData.formatted_address)
18
	const [value, setValue] = useState(defaultData.formatted_address)
19
	const [data, setData] = useState({})
-
 
20
	const [loading, setLoading] = useState(false)
19
	const [data, setData] = useState({})
Línea 21... Línea 20...
21
	const dispatch = useDispatch()
20
	const dispatch = useDispatch()
22
 
-
 
23
	const onSubmit = () => {
21
 
Línea 24... Línea 22...
24
		setLoading(true)
22
	const onSubmit = () => {
25
		const values = Object.values(data)
23
		const values = Object.values(data)
26
 
24
 
Línea 62... Línea 60...
62
					msg: 'Registro actualizado'
60
					msg: 'Registro actualizado'
63
				}))
61
				}))
64
				closeModal()
62
				closeModal()
65
			})
63
			})
66
			.catch((err) => console.log(err))
64
			.catch((err) => console.log(err))
67
			.finally(() => setLoading(false))
-
 
68
	}
65
	}
Línea 69... Línea 66...
69
 
66
 
70
	return (
67
	return (
71
		<Modal size="md" show onHide={closeModal}>
68
		<Modal size="md" show onHide={closeModal}>
Línea 98... Línea 95...
98
						</div>
95
						</div>
99
					</div>
96
					</div>
100
				</div>
97
				</div>
101
			</Modal.Body>
98
			</Modal.Body>
102
			<Modal.Footer>
99
			<Modal.Footer>
103
				<Button
100
				<button
104
					disabled={loading}
101
					className="btn btn-primary"
105
					variant="primary"
102
					type="submit"
106
					onClick={onSubmit}
103
					onClick={onSubmit}
107
				>
104
				>
108
					Enviar
105
					Enviar
109
				</Button>
106
				</button>
-
 
107
				<button
-
 
108
					className='btn btn-tertiary'
110
				<Button variant="danger" onClick={closeModal}>
109
					onClick={closeModal}
-
 
110
				>
111
					Cancelar
111
					Cancelar
112
				</Button>
112
				</button>
113
			</Modal.Footer>
113
			</Modal.Footer>
114
		</Modal >
114
		</Modal >
115
	)
115
	)
116
}
116
}
117
export default LocationModal
117
export default LocationModal
118
118