|
@@ -14,8 +14,6 @@ import {
|
14
|
14
|
import { Service } from '../../Utils/HTTP';
|
15
|
15
|
import useAuth from '../../Auth/useAuth';
|
16
|
16
|
|
17
|
|
-import { departamentos } from '../Password/Rows'
|
18
|
|
-
|
19
|
17
|
export default function Edit(props) {
|
20
|
18
|
|
21
|
19
|
const NewPlazaSchema = Yup.object().shape({
|
|
@@ -43,7 +41,7 @@ export default function Edit(props) {
|
43
|
41
|
const auth = useAuth();
|
44
|
42
|
const token = auth.getToken();
|
45
|
43
|
|
46
|
|
- let {onClose, puesto : { data }, Complete, visible } = props
|
|
44
|
+ let {onClose, puesto : { data }, Complete, visible, categorias } = props
|
47
|
45
|
|
48
|
46
|
const formik = useFormik({
|
49
|
47
|
initialValues: {
|
|
@@ -55,7 +53,6 @@ export default function Edit(props) {
|
55
|
53
|
notas:data? data.notas :"",
|
56
|
54
|
},
|
57
|
55
|
onSubmit: ( fields, { resetForm } ) => {
|
58
|
|
- console.log('pre update',fields)
|
59
|
56
|
setOpen(true)
|
60
|
57
|
fields['fecha'] = new Date(fields.fecha).toISOString();
|
61
|
58
|
|
|
@@ -81,7 +78,6 @@ export default function Edit(props) {
|
81
|
78
|
const { errors, touched, handleSubmit, getFieldProps, setValues} = formik;
|
82
|
79
|
|
83
|
80
|
useEffect(() => {
|
84
|
|
- console.log(data);
|
85
|
81
|
setValues({
|
86
|
82
|
id: data? data.id:"",
|
87
|
83
|
nombrepuesto: data? data.nombrepuesto:"",
|
|
@@ -137,12 +133,14 @@ export default function Edit(props) {
|
137
|
133
|
{...getFieldProps('aredepto')}
|
138
|
134
|
error={Boolean(touched.aredepto && errors.aredepto)} >
|
139
|
135
|
{
|
140
|
|
- departamentos.map( ( nivel, index ) => {
|
141
|
|
- return (
|
142
|
|
- <MenuItem key={index} value={index}>{nivel}</MenuItem>
|
143
|
|
- )
|
144
|
|
- })
|
145
|
|
- }
|
|
136
|
+ categorias ?
|
|
137
|
+ categorias.map( cate => {
|
|
138
|
+ return (
|
|
139
|
+ <MenuItem key={cate.id} value={cate.id}>{cate.nombre}</MenuItem>
|
|
140
|
+ )
|
|
141
|
+ })
|
|
142
|
+ : <MenuItem>Null</MenuItem>
|
|
143
|
+ }
|
146
|
144
|
</Select>
|
147
|
145
|
</FormControl>
|
148
|
146
|
|