Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7044 Rev 7045
Línea 11... Línea 11...
11
  show,
11
  show,
12
  categories = [],
12
  categories = [],
13
  url,
13
  url,
14
  onComplete,
14
  onComplete,
15
  onClose,
15
  onClose,
-
 
16
  isEdit,
16
}) => {
17
}) => {
17
  const [loading, setLoading] = useState(false)
18
  const [loading, setLoading] = useState(false)
18
  const labels = useSelector(({ intl }) => intl.labels)
19
  const labels = useSelector(({ intl }) => intl.labels)
19
  const dispatch = useDispatch()
20
  const dispatch = useDispatch()
Línea 56... Línea 57...
56
  useEffect(() => {
57
  useEffect(() => {
57
    register('description', { required: true })
58
    register('description', { required: true })
58
  }, [])
59
  }, [])
Línea 59... Línea 60...
59
 
60
 
60
  useEffect(() => {
61
  useEffect(() => {
Línea 61... Línea 62...
61
    if (!url) return
62
    if (!url || !show || !isEdit) return
62
 
63
 
Línea 63... Línea 64...
63
    axios.get(url).then((response) => {
64
    axios.get(url).then((response) => {
Línea 78... Línea 79...
78
 
79
 
79
      setValue('category_id', data.category_id)
80
      setValue('category_id', data.category_id)
80
      setValue('description', data.description)
81
      setValue('description', data.description)
81
      setValue('title', data.title)
82
      setValue('title', data.title)
82
    })
83
    })
Línea 83... Línea 84...
83
  }, [url])
84
  }, [url, show])
84
 
85
 
85
  useEffect(() => {
86
  useEffect(() => {
86
    if (!show) {
87
    if (!show) {
Línea 134... Línea 135...
134
          />
135
          />
135
          {errors.description && (
136
          {errors.description && (
136
            <FormErrorFeedback>{labels.error_field_empty}</FormErrorFeedback>
137
            <FormErrorFeedback>{labels.error_field_empty}</FormErrorFeedback>
137
          )}
138
          )}
Línea -... Línea 139...
-
 
139
 
-
 
140
          <Form.Group>
-
 
141
            <Form.File
-
 
142
              label={labels.image}
-
 
143
              name="image"
-
 
144
              ref={register({ required: true })}
-
 
145
            />
-
 
146
            {errors.image && (
-
 
147
              <FormErrorFeedback>{labels.error_field_empty}</FormErrorFeedback>
-
 
148
            )}
-
 
149
          </Form.Group>
-
 
150
 
-
 
151
          <Form.Group>
-
 
152
            <Form.File
-
 
153
              label={labels.attachment}
-
 
154
              name="attachment"
-
 
155
              ref={register}
-
 
156
            />
-
 
157
          </Form.Group>
138
 
158
 
139
          <Button className="mt-3 mr-2" variant="primary" type="submit">
159
          <Button className="mt-3 mr-2" variant="primary" type="submit">
140
            {labels.accept}
160
            {labels.accept}
141
          </Button>
161
          </Button>
142
          <Button className="btn-secondary mt-3" onClick={onClose}>
162
          <Button className="btn-secondary mt-3" onClick={onClose}>