Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3042 Rev 3043
Línea 23... Línea 23...
23
  const { data: degrees } = useFetchHelper('degrees')
23
  const { data: degrees } = useFetchHelper('degrees')
24
  const labels = useSelector(({ intl }) => intl.labels)
24
  const labels = useSelector(({ intl }) => intl.labels)
Línea 25... Línea 25...
25
 
25
 
26
  const {
26
  const {
-
 
27
    control,
27
    control,
28
    formState: { errors },
28
    handleSubmit,
29
    handleSubmit,
29
    setValue,
30
    setValue,
30
    register,
31
    register,
31
    watch,
32
    watch,
32
    reset,
-
 
33
    formState: { errors }
33
    reset
34
  } = useForm({
34
  } = useForm({
35
    defaultValues: {
35
    defaultValues: {
36
      university: '',
36
      university: '',
37
      degree_id: '',
37
      degree_id: '',
Línea 44... Línea 44...
44
      description: ''
44
      description: ''
45
    },
45
    },
46
    values: currentEducation
46
    values: currentEducation
47
  })
47
  })
48
  const isCurrent = watch('is_current', 'n') === 'y'
48
  const isCurrent = watch('is_current', 'n') === 'y'
-
 
49
  const watchAddress = watch('formatted_address')
Línea 49... Línea 50...
49
 
50
 
50
  const handleAddress = (address) => {
51
  const handleAddress = (address) => {
51
    Object.entries(address).forEach(([key, value]) => {
52
    Object.entries(address).forEach(([key, value]) => {
52
      if (value) {
53
      if (value) {
Línea 75... Línea 76...
75
      ({ name }) => name === currentEducation.degree
76
      ({ name }) => name === currentEducation.degree
76
    )
77
    )
77
    if (currentDegree) setValue('degree_id', currentDegree.value)
78
    if (currentDegree) setValue('degree_id', currentDegree.value)
78
  }, [currentEducation, degrees])
79
  }, [currentEducation, degrees])
Línea 79... Línea -...
79
 
-
 
80
  useEffect(() => {
-
 
81
    if (isCurrent) setValue('to_year', '')
-
 
82
  }, [isCurrent])
-
 
83
 
80
 
84
  return (
81
  return (
85
    <Modal
82
    <Modal
86
      title={labels.education}
83
      title={labels.education}
87
      show={show}
84
      show={show}
Línea 117... Línea 114...
117
 
114
 
118
      <UbicationInput
115
      <UbicationInput
119
        onGetAddress={handleAddress}
116
        onGetAddress={handleAddress}
120
        error={errors.formatted_address?.message}
117
        error={errors.formatted_address?.message}
-
 
118
        placeholder='Ubicación'
121
        placeholder='Ubicación'
119
        settedQuery={watchAddress}
122
      />
120
      />
123
      {errors.formatted_address && (
121
      {errors.formatted_address && (
124
        <FormErrorFeedback>
122
        <FormErrorFeedback>
125
          {errors.formatted_address.message}
123
          {errors.formatted_address.message}