Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15511 Rev 15530
Línea 9... Línea 9...
9
	title = 'Indusrias',
9
	title = 'Indusrias',
10
	url = '',
10
	url = '',
11
	isOpen = false,
11
	isOpen = false,
12
	currentItem = null,
12
	currentItem = null,
13
	onClose = function () { },
13
	onClose = function () { },
14
	onComplete= function () { }
14
	onComplete = function () { }
15
}) => {
15
}) => {
16
	const [isActive, setIsActive] = useState(currentItem?.status === 'a' ? true : false)
16
	const [isActive, setIsActive] = useState(currentItem?.status === 'a' ? true : false)
17
	const {register,handleSubmit,getValues,setValue,clearErrors,formState: { errors }} = useForm({
17
	const { register, handleSubmit, getValues, setValue, clearErrors, formState: { errors } } = useForm({
18
		defaultValues: {
18
		defaultValues: {
19
			description: '',
19
			description: '',
20
		}
20
		}
21
	})
21
	})
Línea 22... Línea 22...
22
 
22
 
23
	const onSubmit = (data) => {
23
	const onSubmit = (data) => {
Línea 24... Línea 24...
24
		const formData = new FormData()
24
		const formData = new FormData()
25
 
25
 
Línea 26... Línea 26...
26
		Object.entries(data).forEach(([key, value])=> formData.append(key, value))
26
		Object.entries(data).forEach(([key, value]) => formData.append(key, value))
27
		formData.append('status', isActive === true ? 'a' : 'i')
27
		formData.append('status', isActive === true ? 'a' : 'i')
28
 
28
 
Línea 73... Línea 73...
73
								clearErrors('description')
73
								clearErrors('description')
74
							}
74
							}
75
						}}
75
						}}
76
						onInstanceReady={(e) => currentItem && e.editor.setData(currentItem.name)}
76
						onInstanceReady={(e) => currentItem && e.editor.setData(currentItem.name)}
77
						config={CKEDITOR_OPTIONS}
77
						config={CKEDITOR_OPTIONS}
78
						name="description"
-
 
79
					/>
78
					/>
80
					{errors.description && <p>Este campo es requerido</p>}
79
					{errors.description && <p>Este campo es requerido</p>}
81
					<ToggleComponent currentValue={isActive} setValue={(value)=> setIsActive(value)}/>
80
					<ToggleComponent currentValue={isActive} setValue={(value) => setIsActive(value)} />
82
				</Modal.Body>
81
				</Modal.Body>
83
				<Modal.Footer>
82
				<Modal.Footer>
84
					<Button variant="primary" type="submit">
83
					<Button variant="primary" type="submit">
85
                        Enviar
84
						Enviar
86
					</Button>
85
					</Button>
87
					<Button variant="danger" onClick={onClose}>
86
					<Button variant="danger" onClick={onClose}>
88
                        Cancelar
87
						Cancelar
89
					</Button>
88
					</Button>
90
				</Modal.Footer>
89
				</Modal.Footer>
91
			</form>
90
			</form>
92
		</Modal >
91
		</Modal >
93
	)
92
	)