Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 11069 Rev 11071
Línea 30... Línea 30...
30
		competency_type_uuid: '',
30
		competency_type_uuid: '',
31
		competency_type_name: '',
31
		competency_type_name: '',
32
		behaviors: []
32
		behaviors: []
33
	}])
33
	}])
34
	const [pointsOptions] = useState([
34
	const [pointsOptions] = useState([
35
		{ label: 'Evaluación', value: null },
-
 
36
		{ label: 'Sugerir otro cargo', value: 0 },
35
		{ label: 'Sugerir otro cargo', value: 0 },
37
		{ label: '25%', value: 1 },
36
		{ label: '25%', value: 1 },
38
		{ label: '50%', value: 2 },
37
		{ label: '50%', value: 2 },
39
		{ label: '75%', value: 3 },
38
		{ label: '75%', value: 3 },
40
		{ label: '100%', value: 4 }
39
		{ label: '100%', value: 4 }
41
	])
40
	])
42
	const [statusOptions] = useState([
41
	const [statusOptions] = useState([
43
		{ label: 'Estatus', value: '' },
-
 
44
		{ label: 'Aceptado', value: 'a' },
42
		{ label: 'Aceptado', value: 'a' },
45
		{ label: 'Rechazado', value: 'r' }
43
		{ label: 'Rechazado', value: 'r' }
46
	])
44
	])
Línea 47... Línea 45...
47
 
45
 
48
	// Hooks
46
	// Hooks
49
	const { setValue, register, watch, handleSubmit } = useForm()
47
	const { setValue, register, watch, handleSubmit } = useForm()
50
	const history = useHistory()
48
	const history = useHistory()
51
	const dispatch = useDispatch()
49
	const dispatch = useDispatch()
Línea 52... Línea 50...
52
	const { action } = useParams()
50
	const { action } = useParams()
Línea 53... Línea -...
53
 
-
 
54
	const onSubmit = (data) => {
51
 
55
 
52
	const onSubmit = () => {
56
		console.log(data)
53
 
57
		const content = []
54
		const content = []
58
		competencies.forEach(competency => competency.behaviors.forEach(behavior => {
55
		competencies.forEach(competency => competency.behaviors.forEach(behavior => {
Línea 72... Línea 69...
72
		submitData.append('status', watch('status'))
69
		submitData.append('status', watch('status'))
Línea 73... Línea 70...
73
 
70
 
74
		axios.post(actionLink, submitData)
71
		axios.post(actionLink, submitData)
75
			.then(({ data }) => {
72
			.then(({ data }) => {
-
 
73
				if (!data.success) {
-
 
74
					typeof data.data === 'string'
76
				if (!data.success) {
75
						?
77
					dispatch(addNotification({
76
						dispatch(addNotification({
-
 
77
							style: 'danger',
-
 
78
							msg: data.data
-
 
79
						}))
-
 
80
						:
-
 
81
						dispatch(addNotification({
78
						style: 'danger',
82
							style: 'danger',
79
						msg: 'Ha ocurrido un error'
83
							msg: 'Ha ocurrido un error'
80
					}))
84
						}))
Línea 81... Línea 85...
81
				}
85
				}
82
 
86
 
83
				history.goBack()
87
				history.goBack()
Línea 93... Línea 97...
93
			axios.get(actionLink)
97
			axios.get(actionLink)
94
				.then(({ data }) => {
98
				.then(({ data }) => {
95
					const resData = data.data
99
					const resData = data.data
Línea 96... Línea 100...
96
 
100
 
97
					if (!data.success) {
101
					if (!data.success) {
98
						dispatch(addNotification({
102
						return dispatch(addNotification({
99
							style: 'danger',
103
							style: 'danger',
100
							msg: 'Ha ocurrido un error'
104
							msg: 'Ha ocurrido un error'
101
						}))
105
						}))
Línea 102... Línea 106...
102
					}
106
					}
103
 
107
 
104
					resData.interview.content.map((behavior) => {
108
					resData.interview.content.map((behavior) => {
105
						register(`${behavior.competencyUuid}_${behavior.behaviorUuid}-comment`)
-
 
106
						register(`${behavior.competencyUuid}_${behavior.behaviorUuid}-points`)
-
 
107
						console.log(`${behavior.competencyUuid}_${behavior.behaviorUuid}-comment`)
-
 
108
						console.log(behavior.comment)
109
						register(`${behavior.competencyUuid}_${behavior.behaviorUuid}-comment`)
109
						setValue('Aaaaaaaaaaa', behavior.comment)
110
						register(`${behavior.competencyUuid}_${behavior.behaviorUuid}-points`)
110
						setValue(`${behavior.competencyUuid}_${behavior.behaviorUuid}-comment`, behavior.comment)
111
						setValue(`${behavior.competencyUuid}_${behavior.behaviorUuid}-comment`, behavior.comment)
111
						setValue(`${behavior.competencyUuid}_${behavior.behaviorUuid}-points`, behavior.evaluation)
112
						setValue(`${behavior.competencyUuid}_${behavior.behaviorUuid}-points`, behavior.evaluation)
112
					})
113
					})
Línea 132... Línea 133...
132
	useEffect(() => {
133
	useEffect(() => {
133
		axios.get(typeOptions.url)
134
		axios.get(typeOptions.url)
134
			.then(({ data }) => {
135
			.then(({ data }) => {
Línea 135... Línea 136...
135
 
136
 
136
				if (!data.success) {
137
				if (!data.success) {
137
					dispatch(addNotification({
138
					return dispatch(addNotification({
138
						style: 'danger',
139
						style: 'danger',
139
						msg: 'Ha ocurrido un error'
140
						msg: 'Ha ocurrido un error'
140
					}))
141
					}))
Línea 150... Línea 151...
150
			axios.get(vacancyUrl)
151
			axios.get(vacancyUrl)
151
				.then(({ data }) => {
152
				.then(({ data }) => {
152
					const resData = data.data
153
					const resData = data.data
Línea 153... Línea 154...
153
 
154
 
154
					if (!data.success) {
155
					if (!data.success) {
155
						dispatch(addNotification({
156
						return dispatch(addNotification({
156
							style: 'danger',
157
							style: 'danger',
157
							msg: 'Ha ocurrido un error'
158
							msg: 'Ha ocurrido un error'
158
						}))
159
						}))