Commit 877b3926 by Luciano Barletta

first try

1 parent e4cf6fdd
function ArmarForm(data) {
function ArmarForm(m) {
document.getElementById("ArmarFormContainer").style.display="none";
document.getElementById("FormularioResultante").style.display="block";
let m = data.length;
for (let n = 0; n < m; n++) {
let padreBotones = document.getElementById("BotonesContainer");
let padreTabs = document.getElementById("TabsContainer");
......
......@@ -54,9 +54,41 @@ def login():
"token" : None
})
@app.route('/', methods = ['GET'])
@app.route('/', methods = ['GET', 'POST'])
def main():
return render_template("generate.html")
data = [
{
"title" : "first",
"fields" : [
{
"title" : "first",
"type" : "number",
"placeholder" : "999",
},
{
"title" : "second",
"type" : "text",
"required" : True
}
]
},
{
"title" : "second",
"fields" : [
{
"title" : "first",
"type" : "select",
"placeholder" : "999",
"options" : [
"first",
"second",
"third"
]
},
]
}
]
return render_template("form.html",tabs=data)
if __name__ == "__main__":
app.run("0.0.0.0")
\ No newline at end of file
{% macro field(title,type,placeholder="",options=[],required=False) %}
{{ title }}
{% if type == "select" %}
<select {% if required %} required {% endif %}>
<option selected disabled hidden value="">{{ placeholder }}</option>
{% for option in options %}
<option value="{{ option }}">{{ option }}</option>
{% endfor %}
</select>
{% else %}
<input type="{{ type }}" placeholder="{{ placeholder }}" {% if required %} required {% endif %}>
{% endif %}
{% endmacro %}
\ No newline at end of file
<html lang="en">
<head>
<script src="{{url_for('static',filename='Scripts/construct.js')}}"></script>
<script src="{{url_for('static',filename='Scripts/ArmadoDeForm.js')}}"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="{{url_for('static',filename='Style/Templates.css')}}">
<link rel="stylesheet" href="{{url_for('static',filename='Style/ArmadoDeForm.css')}}">
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">
<title>Generador de Formularios</title>
<link rel="icon" href="{{url_for('static',filename='Assets/ICONO ANACSOFT 48 SIN TRASNSF.png')}}" type="image/png">
</head>
<body>
<h1 style="margin: 2% 0% 2% 0;"> Su Formulario Ya Esta Listo!</h1>
<section id="BotonesContainer" class="BotonesContainer">
{% for i in range(2) %}
<input id="Boton{{i}}" type="button" class="Botones" style="width: {{ (100 - (0.2 * 2)) / 2 }}%;">
{% endfor %}
</section>
<section id="TabsContainer">
{% from "tab.html" import tab %}
{% for i in range(2) %}
<div id="Tab{{i}}" class="Tabs">
{{ tab(title=tabs[i]['title'], fields=tabs[i]['fields']) }}
</div>
{% endfor %}
</section>
</body>
</html>
\ No newline at end of file
{% macro tab(title,fields) %}
{{ title }}
<br>
{% from "field.html" import field %}
{% for f in fields %}
{{ field(title=f['title'], type=f['type'], placeholder=f['placeholder'], options=f['options'], required=f['required']) }}
<br>
{% endfor %}
<input type="button", value="Back">
<input type="button", value="Next">
{% endmacro %}
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!