|
|
@@ -14,8 +14,6 @@ import {
|
|
|
import { Service } from '../../Utils/HTTP';
|
|
|
import useAuth from '../../Auth/useAuth';
|
|
|
|
|
|
-import { departamentos } from '../Password/Rows'
|
|
|
-
|
|
|
export default function Edit(props) {
|
|
|
|
|
|
const NewPlazaSchema = Yup.object().shape({
|
|
|
@@ -43,7 +41,7 @@ export default function Edit(props) {
|
|
|
const auth = useAuth();
|
|
|
const token = auth.getToken();
|
|
|
|
|
|
- let {onClose, puesto : { data }, Complete, visible } = props
|
|
|
+ let {onClose, puesto : { data }, Complete, visible, categorias } = props
|
|
|
|
|
|
const formik = useFormik({
|
|
|
initialValues: {
|
|
|
@@ -55,7 +53,6 @@ export default function Edit(props) {
|
|
|
notas:data? data.notas :"",
|
|
|
},
|
|
|
onSubmit: ( fields, { resetForm } ) => {
|
|
|
- console.log('pre update',fields)
|
|
|
setOpen(true)
|
|
|
fields['fecha'] = new Date(fields.fecha).toISOString();
|
|
|
|
|
|
@@ -81,7 +78,6 @@ export default function Edit(props) {
|
|
|
const { errors, touched, handleSubmit, getFieldProps, setValues} = formik;
|
|
|
|
|
|
useEffect(() => {
|
|
|
- console.log(data);
|
|
|
setValues({
|
|
|
id: data? data.id:"",
|
|
|
nombrepuesto: data? data.nombrepuesto:"",
|
|
|
@@ -137,12 +133,14 @@ export default function Edit(props) {
|
|
|
{...getFieldProps('aredepto')}
|
|
|
error={Boolean(touched.aredepto && errors.aredepto)} >
|
|
|
{
|
|
|
- departamentos.map( ( nivel, index ) => {
|
|
|
- return (
|
|
|
- <MenuItem key={index} value={index}>{nivel}</MenuItem>
|
|
|
- )
|
|
|
- })
|
|
|
- }
|
|
|
+ categorias ?
|
|
|
+ categorias.map( cate => {
|
|
|
+ return (
|
|
|
+ <MenuItem key={cate.id} value={cate.id}>{cate.nombre}</MenuItem>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ : <MenuItem>Null</MenuItem>
|
|
|
+ }
|
|
|
</Select>
|
|
|
</FormControl>
|
|
|
|