Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 332 | Rev 337 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
306 geraldo 1
import React from "react";
2
import Section from "./section/Section";
3
import Spinner from "../../../shared/loading-spinner/Spinner";
4
 
5
const Test = (props) => {
6
 
7
    // get props
8
    const { backendVars, test, loading, setTest } = props;
9
 
10
    const formSubmit = (event) => {
336 geraldo 11
 
12
        test.map((section)=>{
13
            section.questions.map((q)=>{
14
                if(!q.response){
15
                    alert(`Debe ingresar una respuesta en la pregunta ${q.position+1} de la sección ${section.name}` );
16
                    return false;
17
                }
18
            })
19
        })
306 geraldo 20
    }
21
 
22
    return (
23
        <div>
24
            {loading ? (
25
                <div className="row">
26
                    <Spinner />
27
                </div>
28
            ) : (
311 geraldo 29
                <div className="row test-section">
306 geraldo 30
                    <form onSubmit={formSubmit}>
307 geraldo 31
                        <div className="col-md-12 col-sm-12 col-xs-12">
312 geraldo 32
                            <div className="company-title">
33
                                <div className="section_admin_title_buttons">
34
                                    <h1 className="title">{test.name}</h1>
307 geraldo 35
                                </div>
36
                            </div>
37
                            <div
38
                                dangerouslySetInnerHTML={{ __html: test.text }}
309 geraldo 39
                                className="description company-title"
307 geraldo 40
                            ></div>
306 geraldo 41
                        </div>
42
                        <div className="col-md-12 col-sm-12 col-xs-12">
312 geraldo 43
                            <div className="company-title">
44
                                {test.content.map((section, key) => {
332 geraldo 45
                                    return <Section
46
                                        section={section}
47
                                        key={key}
48
                                        backendVars={backendVars} />
312 geraldo 49
                                })}
308 geraldo 50
                            </div>
306 geraldo 51
                        </div>
307 geraldo 52
                        <div className="col-md-12 col-sm-12 col-xs-12">
312 geraldo 53
                            <div className="company-title">
327 geraldo 54
                                <button type="button" className="btn btn-danger" onClick={() => setTest(null)}>{backendVars.LBL_CANCEL}</button>
312 geraldo 55
                                <button type="submit" className="btn btn-success">{backendVars.LBL_SAVE}</button>
307 geraldo 56
                            </div>
57
                        </div>
306 geraldo 58
                    </form>
59
                </div>
60
            )}
61
        </div>
62
    )
63
}
64
 
65
export default Test;