Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3088 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3088 Rev 3719
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react';
2
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form';
3
 
3
 
4
import Modal from '@components/UI/modal/Modal'
4
import Modal from '@components/UI/modal/Modal';
5
import Select from '@components/UI/inputs/Select'
5
import Select from '@components/UI/inputs/Select';
6
 
6
 
7
export default function ApplyModal({
7
export default function ApplyModal({ show, profiles, onConfirm, onClose = function () {} }) {
8
  show,
-
 
9
  profiles,
-
 
10
  onConfirm,
-
 
11
  onClose = function () {}
-
 
12
}) {
-
 
13
  const {
8
  const {
14
    control,
9
    control,
15
    formState: { errors, isSubmitting },
10
    formState: { errors, isSubmitting },
16
    handleSubmit
11
    handleSubmit
17
  } = useForm()
12
  } = useForm();
18
 
13
 
19
  const onSubmit = handleSubmit((data) => onConfirm(data))
14
  const onSubmit = handleSubmit((data) => onConfirm(data));
20
 
15
 
21
  return (
16
  return (
22
    <Modal
17
    <Modal
23
      title='Perfil de Applicación'
18
      title='Perfil de Applicación'
24
      show={show}
19
      show={show}
25
      onClose={onClose}
20
      onClose={onClose}
26
      onAccept={onSubmit}
21
      onAccept={onSubmit}
27
      loading={isSubmitting}
22
      loading={isSubmitting}
28
    >
23
    >
29
      <Select
24
      <Select
30
        name='user_profile_id'
25
        name='user_profile_id'
31
        control={control}
26
        control={control}
32
        rules={{ required: 'Por favor seleccione un perfil' }}
27
        rules={{ required: 'Por favor seleccione un perfil' }}
33
        error={errors?.user_profile_id?.message}
28
        error={errors?.user_profile_id?.message}
34
        options={Object.entries(profiles).map(([value, name]) => ({
29
        options={Object.entries(profiles).map(([value, name]) => ({
35
          name,
30
          name,
36
          value
31
          value
37
        }))}
32
        }))}
38
      />
33
      />
39
    </Modal>
34
    </Modal>
40
  )
35
  );
41
}
36
}