Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 11066 Rev 11067
Línea 8... Línea 8...
8
 
8
 
Línea 9... Línea 9...
9
const EditModal = ({ closeModal, isOpen, edit_link }) => {
9
const EditModal = ({ closeModal, isOpen, edit_link }) => {
10
 
10
 
11
	//Hooks
-
 
12
	const { register, handleSubmit, watch, errors, setValue, clearErrors } = useForm()
11
	//Hooks
13
	const [fileUrl, setFileUrl] = useState('')
12
	const { register, handleSubmit, watch, errors, setValue, clearErrors } = useForm()
14
	const dispatch = useDispatch()
13
	const dispatch = useDispatch()
-
 
14
    
15
 
15
	//States
16
	//States
16
	const [fileUrl, setFileUrl] = useState('')
17
	const [pointsOptions] = useState([
17
	const [pointsOptions] = useState([
18
		{ label: 'Evaluación', value: 0 },
18
		{ label: 'Evaluación', value: 0 },
19
		{ label: 'Sugerir otro cargo', value: 0 },
19
		{ label: 'Sugerir otro cargo', value: 0 },
Línea 36... Línea 36...
36
		})
36
		})
Línea 37... Línea 37...
37
 
37
 
38
		axios.post(edit_link, submitData)
38
		axios.post(edit_link, submitData)
39
			.then(({ data }) => {
39
			.then(({ data }) => {
40
				if (!data.success) {
40
				if (!data.success) {
41
					dispatch(addNotification({
41
					return dispatch(addNotification({
42
						style: 'danger',
42
						style: 'danger',
43
						msg: 'Ha ocurrido un error'
43
						msg: 'Ha ocurrido un error'
44
					}))
44
					}))
Línea 55... Línea 55...
55
 
55
 
56
	const getData = () => {
56
	const getData = () => {
57
		axios.get(edit_link)
57
		axios.get(edit_link)
58
			.then(({ data }) => {
58
			.then(({ data }) => {
59
				if (!data.success) {
59
				if (!data.success) {
60
					dispatch(addNotification({
60
					return dispatch(addNotification({
61
						style: 'danger',
61
						style: 'danger',
62
						msg: 'Ha ocurrido un error'
62
						msg: 'Ha ocurrido un error'
63
					}))
63
					}))
Línea 64... Línea 64...
64
				}
64
				}
65
 
65
 
66
				Object.keys(data.data).map((key) => register(key))
66
				Object.keys(data.data).map((key) => register(key))
-
 
67
				Object.entries(data.data).map(([key, value]) => setValue(key, value))
67
				Object.entries(data.data).map(([key, value]) => setValue(key, value))
68
				setFileUrl(data.data.file)
68
				setFileUrl(data.data.file)
69
				console.log(data.data)
69
				clearErrors()
70
				clearErrors()
Línea 70... Línea 71...
70
			})
71
			})
Línea 122... Línea 123...
122
							accept='pdf/docx'
123
							accept='pdf/docx'
123
							ref={register}
124
							ref={register}
124
							style={{ height: '2rem' }}
125
							style={{ height: '2rem' }}
125
						/>
126
						/>
126
					</div>
127
					</div>
127
					<a href={fileUrl} type="button" className="btn btn-primary">
128
					<a href={fileUrl} className="btn btn-primary">
128
                        Verificar Email
129
                        Verificar Email
129
					</a>
130
					</a>
130
					<div className='form-group'>
131
					<div className='form-group'>
131
						<label className="form-label">Estatus</label>
132
						<label className="form-label">Estatus</label>
132
						<select className='form-control' name='status' ref={register}>
133
						<select className='form-control' name='status' ref={register}>
Línea 135... Línea 136...
135
									return <option selected={watch('status') === value} key={value} value={value}>{label}</option>
136
									return <option selected={watch('status') === value} key={value} value={value}>{label}</option>
136
								})
137
								})
137
							}
138
							}
138
						</select>
139
						</select>
139
					</div>
140
					</div>
140
 
-
 
141
				</Modal.Body>
141
				</Modal.Body>
142
				<Modal.Footer>
142
				<Modal.Footer>
143
					<Button variant="danger" onClick={closeModal}>
143
					<Button variant="danger" onClick={closeModal}>
144
                        Cancelar
144
                        Cancelar
145
					</Button>
145
					</Button>