Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 13069 Rev 13070
Línea 246... Línea 246...
246
				return currentSection
246
				return currentSection
247
			})
247
			})
248
		)
248
		)
249
	}
249
	}
Línea -... Línea 250...
-
 
250
 
-
 
251
	const editOption = (option) => {
-
 
252
 
-
 
253
		setContent(current =>
-
 
254
			current.map(currentSection => {
-
 
255
				if (currentSection.slug_section === sectionSelected.slug_section) {
-
 
256
 
-
 
257
					return {
-
 
258
						...currentSection,
-
 
259
						questions: currentSection.questions.map(currentQuestion => {
-
 
260
							if (currentQuestion.slug_question === questionSelected.slug_question) {
-
 
261
 
-
 
262
								return {
-
 
263
									...currentQuestion,
-
 
264
									options: currentQuestion.options.map(currentOption => {
-
 
265
										if (currentOption.slug_option === option.slug_option) {
-
 
266
											return option
-
 
267
										}
-
 
268
 
-
 
269
										return currentOption
-
 
270
									})
-
 
271
								}
-
 
272
							}
-
 
273
 
-
 
274
							return currentQuestion
-
 
275
						})
-
 
276
					}
-
 
277
				}
-
 
278
				return currentSection
-
 
279
			})
-
 
280
		)
-
 
281
	}
250
 
282
 
251
	const deleteOption = (slug) => {
283
	const deleteOption = (slug) => {
252
		setContent(current =>
284
		setContent(current =>
253
			current.map(currentSection => {
285
			current.map(currentSection => {
Línea 469... Línea 501...
469
																												showQuestionModal(question, 'edit')
501
																												showQuestionModal(question, 'edit')
470
																											}}>
502
																											}}>
471
																												<i className="fa fa-edit" /> Editar Pregunta
503
																												<i className="fa fa-edit" /> Editar Pregunta
472
																											</button>
504
																											</button>
473
																											<button className="btn btn-default" onClick={() => {
505
																											<button className="btn btn-default" onClick={() => {
-
 
506
																												setSectionSelected(section)
474
																												setQuestionSelected(question)
507
																												setQuestionSelected(question)
475
																												setDeleteType('question')
508
																												setDeleteType('question')
476
																												setShowDeleteModal(true)
509
																												setShowDeleteModal(true)
477
																											}}>
510
																											}}>
478
																												<i className="fa fa-ban" /> Borrar Pregunta
511
																												<i className="fa fa-ban" /> Borrar Pregunta
Línea 506... Línea 539...
506
																													}}>
539
																													}}>
507
																														<i className="fa fa-edit" /> Editar opción
540
																														<i className="fa fa-edit" /> Editar opción
508
																													</button>
541
																													</button>
509
																													<button className="btn btn-default" onClick={() => {
542
																													<button className="btn btn-default" onClick={() => {
510
																														setOptionSelected(option)
543
																														setOptionSelected(option)
-
 
544
																														setSectionSelected(section)
511
																														setQuestionSelected(question)
545
																														setQuestionSelected(question)
512
																														setDeleteType('option')
546
																														setDeleteType('option')
513
																														setShowDeleteModal(true)
547
																														setShowDeleteModal(true)
514
																													}}>
548
																													}}>
515
																														<i className="fa fa-ban" /> Borrar opción
549
																														<i className="fa fa-ban" /> Borrar opción
Línea 563... Línea 597...
563
			<OptionModal
597
			<OptionModal
564
				show={isShowOption}
598
				show={isShowOption}
565
				optionType={optionType}
599
				optionType={optionType}
566
				option={optionSelected}
600
				option={optionSelected}
567
				closeModal={closeOptionModal}
601
				closeModal={closeOptionModal}
568
				onSubmit={optionType === 'add' ? addOption : editQuestion}
602
				onSubmit={optionType === 'add' ? addOption : editOption}
569
			/>
603
			/>
570
			<DeleteModal
604
			<DeleteModal
571
				isOpen={showDeleteModal}
605
				isOpen={showDeleteModal}
572
				closeModal={() => setShowDeleteModal(false)}
606
				closeModal={() => setShowDeleteModal(false)}
573
				onComplete={() => deleteHandler(deleteType, deleteSlugsOptions[deleteType])}
607
				onComplete={() => deleteHandler(deleteType, deleteSlugsOptions[deleteType])}