| @ -0,0 +1 @@ | |||||
| python -m flask --app padel run --port 8000 --debug | |||||
| @ -0,0 +1,12 @@ | |||||
| from flask import Flask | |||||
| from padel import paginas, reservas | |||||
| def create_app(): | |||||
| app = Flask(__name__) | |||||
| app.register_blueprint(paginas.bp) | |||||
| app.register_blueprint(reservas.bp) | |||||
| return app | |||||
| @ -0,0 +1,14 @@ | |||||
| from flask import Blueprint, render_template, request, redirect, url_for | |||||
| from datetime import datetime | |||||
| bp = Blueprint("paginas", __name__) | |||||
| reservas = [] | |||||
| @bp.route("/") | |||||
| def inicio(): | |||||
| return render_template("paginas/inicio.html") | |||||
| @bp.route("/acerca") | |||||
| def acerca(): | |||||
| return render_template("paginas/acerca.html") | |||||
| @ -0,0 +1,18 @@ | |||||
| from flask import Blueprint, render_template | |||||
| bp = Blueprint("reservas", __name__) | |||||
| @bp.route("/misreservas") | |||||
| def misreservas(): | |||||
| reservas = [] | |||||
| return render_template("reservas/misreservas.html", reservas=reservas) | |||||
| @bp.route("/reservar", methods=['GET', 'POST']) | |||||
| def reservar(): | |||||
| return render_template("reservas/reservar.html") | |||||
| # Ruta para eliminar una reserva | |||||
| #@bp.route('/eliminar_reserva/<int:index>', methods=['POST']) | |||||
| #def eliminar_reserva(index): | |||||
| # del reservas[index] | |||||
| # return redirect(url_for('index')) | |||||
| @ -0,0 +1,34 @@ | |||||
| * { | |||||
| box-sizing: border-box; | |||||
| } | |||||
| body { | |||||
| font-family: sans-serif; | |||||
| font-size: 20px; | |||||
| margin: 0 auto; | |||||
| text-align: center; | |||||
| } | |||||
| a, | |||||
| a:visited { | |||||
| color: #007bff; | |||||
| } | |||||
| a:hover { | |||||
| color: #0056b3; | |||||
| } | |||||
| nav ul { | |||||
| list-style-type: none; | |||||
| padding: 0; | |||||
| } | |||||
| nav ul li { | |||||
| display: inline; | |||||
| margin: 0 5px; | |||||
| } | |||||
| main { | |||||
| width: 80%; | |||||
| margin: 0 auto; | |||||
| } | |||||
| @ -0,0 +1,8 @@ | |||||
| <nav> | |||||
| <ul> | |||||
| <li><a href="{{ url_for('paginas.inicio') }}">Inicio</a></li> | |||||
| <li><a href="{{ url_for('paginas.acerca') }}">Acerca de...</a></li> | |||||
| <li><a href="{{ url_for('reservas.misreservas') }}">Mis reservas</a></li> | |||||
| <li><a href="{{ url_for('reservas.reservar') }}">Reservar</a></li> | |||||
| </ul> | |||||
| </nav> | |||||
| @ -0,0 +1,32 @@ | |||||
| <!DOCTYPE html> | |||||
| <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |||||
| <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |||||
| <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |||||
| <!--[if gt IE 8]> <html class="no-js"> <!--<![endif]--> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="utf-8"> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||||
| <title>Reservas de padel - {% block title %}{% endblock title %}</title> | |||||
| <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}"> | |||||
| <meta name="description" content=""> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |||||
| <link rel="stylesheet" href=""> | |||||
| </head> | |||||
| <body> | |||||
| <!--[if lt IE 7]> | |||||
| <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p> | |||||
| <![endif]--> | |||||
| <h1>Reservas de padel</h1> | |||||
| {% include("_navegacion.html") %} | |||||
| <section> | |||||
| <header> | |||||
| {% block header %}{% endblock header %} | |||||
| </header> | |||||
| <main> | |||||
| {% block content %}<p>No messages.</p>{% endblock content %} | |||||
| </main> | |||||
| <script src="" async defer></script> | |||||
| </section> | |||||
| </body> | |||||
| </html> | |||||
| @ -0,0 +1,9 @@ | |||||
| {% extends 'base.html' %} | |||||
| {% block header %} | |||||
| <h2>{% block title %}Acerca de...{% endblock title %}</h2> | |||||
| {% endblock header %} | |||||
| {% block content %} | |||||
| <p>This is a message board for friendly messages.</p> | |||||
| {% endblock content %} | |||||
| @ -0,0 +1,11 @@ | |||||
| {% extends 'base.html' %} | |||||
| {% block header %} | |||||
| <h2>{% block title %}Inicio{% endblock title %}</h2> | |||||
| {% endblock header %} | |||||
| {% block content %} | |||||
| <p> | |||||
| Learn more about this project by visiting the <a href="{{ url_for('paginas.acerca') }}">About page</a>. | |||||
| </p> | |||||
| {% endblock content %} | |||||
| @ -0,0 +1,17 @@ | |||||
| {% extends 'base.html' %} | |||||
| {% block header %} | |||||
| <h2>{% block title %}Reservas de padel{% endblock title %}</h2> | |||||
| {% endblock header %} | |||||
| {% block content %} | |||||
| <ul> | |||||
| {% for reserva in reservas %} | |||||
| <li>{{ reserva.nombre }} - {{ reserva.fecha }} - {{ reserva.hora }} | |||||
| <form action="{{ url_for('paginas.eliminar_reserva', index=loop.index0) }}" method="post" style="display: inline;"> | |||||
| <button type="submit">Eliminar</button> | |||||
| </form> | |||||
| </li> | |||||
| {% endfor %} | |||||
| </ul> | |||||
| {% endblock content %} | |||||
| @ -0,0 +1,18 @@ | |||||
| {% extends 'base.html' %} | |||||
| {% block header %} | |||||
| <h2>{% block title %}Reservas de padel{% endblock title %}</h2> | |||||
| {% endblock header %} | |||||
| {% block content %} | |||||
| <h2>Hacer una nueva reserva</h2> | |||||
| <form action="/reservar" method="post"> | |||||
| <label for="nombre">Nombre:</label> | |||||
| <input type="text" id="nombre" name="nombre" required><br> | |||||
| <label for="fecha">Fecha:</label> | |||||
| <input type="date" id="fecha" name="fecha" required><br> | |||||
| <label for="hora">Hora:</label> | |||||
| <input type="time" id="hora" name="hora" required><br> | |||||
| <button type="submit">Reservar</button> | |||||
| </form> | |||||
| {% endblock content %} | |||||