login für den finanzer

übersicht für den finanzer
finanzer kann ausgleiche hinzufügen

TODO:
der Code sieht ekelhaft aus bis zum gehtnicht mehr ... vltt verbessern?
This commit is contained in:
Tim Gröger 2019-01-15 00:25:42 +01:00
parent 9f796caa8e
commit 4648aa8b0c
9 changed files with 664 additions and 64 deletions

View File

@ -1,11 +1,17 @@
from flask import Flask, g
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
app = Flask(__name__)
app.config['SECRET_KEY'] = '0a657b97ef546da90b2db91862ad4e29'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///site.db'
db = SQLAlchemy(app)
bcrypt = Bcrypt(app)
login_manager = LoginManager(app)
login_manager.login_view = 'login'
login_manager.login_message_category = 'info'
from geruecht import routes

View File

@ -1,5 +1,5 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms import StringField, SubmitField, PasswordField;
from wtforms.validators import DataRequired, Length, ValidationError
from geruecht.model import User
@ -14,3 +14,10 @@ class RegistrationForm(FlaskForm):
if user:
raise ValidationError('Bist du behindert!? Der Name ist vergeben!!')
class FinanzerLogin(FlaskForm):
username = StringField('Name', validators=[DataRequired(), Length(min=2, max=20)])
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Login')

View File

@ -1,45 +1,341 @@
from geruecht import db
from geruecht import db, login_manager
from threading import Timer
from flask_login import UserMixin
from datetime import date
@login_manager.user_loader
def load_finanzer(finanzer_id):
return Finanzer.query.get(int(finanzer_id))
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(20), unique=True, nullable=False)
sum = db.Column(db.Float, nullable=False, default=0.0)
jan = db.Column(db.Float, nullable=False, default=0)
jan_sub = db.Column(db.Float, nullable=False, default=0)
jan_year = db.Column(db.Integer, nullable=False, default=date.today().year)
feb = db.Column(db.Float, nullable=False, default=0)
feb_sub = db.Column(db.Float, nullable=False, default=0)
feb_year = db.Column(db.Integer, nullable=False, default=date.today().year)
maer = db.Column(db.Float, nullable=False, default=0)
maer_sub = db.Column(db.Float, nullable=False, default=0)
maer_year = db.Column(db.Integer, nullable=False, default=date.today().year)
apr = db.Column(db.Float, nullable=False, default=0)
apr_sub = db.Column(db.Float, nullable=False, default=0)
apr_year = db.Column(db.Integer, nullable=False, default=date.today().year)
mai = db.Column(db.Float, nullable=False, default=0)
mai_sub = db.Column(db.Float, nullable=False, default=0)
mai_year = db.Column(db.Integer, nullable=False, default=date.today().year)
jun = db.Column(db.Float, nullable=False, default=0)
jun_sub = db.Column(db.Float, nullable=False, default=0)
jun_year = db.Column(db.Integer, nullable=False, default=date.today().year)
jul = db.Column(db.Float, nullable=False, default=0)
jul_sub = db.Column(db.Float, nullable=False, default=0)
jul_year = db.Column(db.Integer, nullable=False, default=date.today().year)
aug = db.Column(db.Float, nullable=False, default=0)
aug_sub = db.Column(db.Float, nullable=False, default=0)
aug_year = db.Column(db.Integer, nullable=False, default=date.today().year)
sep = db.Column(db.Float, nullable=False, default=0)
sep_sub = db.Column(db.Float, nullable=False, default=0)
sep_year = db.Column(db.Integer, nullable=False, default=date.today().year)
okt = db.Column(db.Float, nullable=False, default=0)
okt_sub = db.Column(db.Float, nullable=False, default=0)
okt_year = db.Column(db.Integer, nullable=False, default=date.today().year)
nov = db.Column(db.Float, nullable=False, default=0)
nov_sub = db.Column(db.Float, nullable=False, default=0)
nov_year = db.Column(db.Integer, nullable=False, default=date.today().year)
dez = db.Column(db.Float, nullable=False, default=0)
dez_sub = db.Column(db.Float, nullable=False, default=0)
dez_year = db.Column(db.Integer, nullable=False, default=date.today().year)
def getsum(self):
jan = self.jan - self.jan_sub
feb = self.feb - self.feb_sub
maer = self.maer - self.maer_sub
apr = self.apr - self.apr_sub
mai = self.mai - self.mai_sub
jun = self.jun - self.jun_sub
jul = self.jul - self.jul_sub
aug = self.aug - self.aug_sub
sep = self.sep - self.sep_sub
okt = self.okt - self.okt_sub
nov = self.nov - self.nov_sub
dez = self.dez - self.dez_sub
result = jan + feb + maer + apr + mai + jun + jul + aug + sep + okt + nov + dez
return result
def add_sub(self, value):
year = date.today().year
month = date.today().month
if month == 1:
if year == self.jan_year:
self.jan_sub += value
else:
self.jan = 0
self.jan_sub = value
self.jan_year = year;
elif month == 2:
if year == self.feb_year:
self.feb_sub += value
else:
self.feb = 0
self.feb_sub = value
self.feb_year = year
elif month == 3:
if year == self.maer_year:
self.maer_sub += value
else:
self.maer = 0
self.maer_sub = value
self.maer_year = year
elif month == 4:
if year == self.apr_year:
self.apr_sub += value
else:
self.apr = 0
self.apr_sub = value
self.apr_year = year
elif month == 5:
if year == self.mai_year:
self.mai_sub += value
else:
self.mai = 0
self.mai_sub = value
self.mai_year = year
elif month == 6:
if year == self.jun_year:
self.jun_sub += value
else:
self.jun = 0
self.jun_sub = value
self.jun_year = year
elif month == 7:
if year == self.jul_year:
self.jul_sub += value
else:
self.jul = 0
self.jul_sub = value
self.jul_year = year
elif month == 8:
if year == self.aug_year:
self.aug_sub += value
else:
self.aug = 0
self.aug_sub = value
self.aug_year = year
elif month == 9:
if year == self.sep_year:
self.sep_sub += value
else:
self.sep = 0
self.sep_sub = value
self.sep_year = year
elif month == 10:
if year == self.okt_year:
self.okt_sub += value
else:
self.okt = 0
self.okt_sub = value
self.okt_year = year
elif month == 11:
if year == self.nov_year:
self.nov_sub += value
else:
self.nov = 0
self.nov_sub = value
self.nov_year = year
elif month == 12:
if year == self.dez_year:
self.dez_sub += value
else:
self.dez = 0
self.dez_sub = value
self.dez_year = year
else:
raise IndexError('Mehr monate gibt es nicht')
def add(self, value):
self.sum += value
def storner(self, value):
self.sum = self.sum - value
year = date.today().year
month = date.today().month
if month == 1 :
if year == self.jan_year:
self.jan += value
else:
self.jan = value
self.jan_sub = 0
self.jan_year = year
elif month == 2:
if year == self.feb_year:
self.feb += value
else:
self.feb = value
self.feb_sub = 0
self.feb_year = year
elif month == 3:
if year == self.maer_year:
self.maer += value
else:
self.maer = value
self.mear_sub = 0
self.mear_year = year
elif month == 4:
if year == self.apr_year:
self.apr += value
else:
self.apr = value
self.apr_sub = 0
self.apr_year = year
elif month == 5:
if year == self.mai_year:
self.mai += value
else:
self.mai = value
self.mai_sub = 0
self.mai_year = year
elif month == 6:
if year == self.jun_year:
self.jun += value
else:
self.jun = value
self.jun_sub = 0
self.jun_year = year
elif month == 7:
if year == self.jul_year:
self.jul += value
else:
self.jul = value
self.jul_sub = 0
self.jul_year = year
elif month == 8:
if year == self.aug_year:
self.aug += value
else:
self.aug = value
self.aug_sub = 0
self.aug_year = year
elif month == 9:
if year == self.sep_year:
self.sep += value
else:
self.sep = value
self.sep_sub = 0
self.sep_year = year
elif month == 10:
if year == self.okt_year:
self.okt += value
else:
self.okt = value
self.okt_sub = 0
self.okt_year = year
elif month == 11:
if year == self.nov_year:
self.nov += value
else:
self.nov = value
self.nov_sub = 0
self.nov_year = year
elif month == 12:
if year == self.dez_year:
self.dez += value
else:
self.dez = value
self.dez_sub = 0
self.dez_year = year
else:
raise IndexError('Mehr monate gibt es nicht')
def storner(self, value, month):
if month == 1:
self.jan = self.jan - value
elif month == 2:
self.feb = self.feb - value
elif month == 3:
self.maer = self.maer - value
elif month == 4:
self.apr = self.apr - value
elif month == 5:
self.mai = self.mai - value
elif month == 6:
self.jun = self.jun - value
elif month == 7:
self.jul = self.jul - value
elif month == 8:
self.aug = self.aug - value
elif month == 9:
self.sep = self.sep - value
elif month == 10:
self.okt = self.okt - value
elif month == 11:
self.nov = self.nov - value
elif month == 12:
self.dez = self.dez - value
else:
raise IndexError('Mehr monate gibt es nicht')
def __repr__(self):
return f"User('{self.username}', '{self.sum}')"
class Finanzer(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(20), unique=True, nullable=False)
password = db.Column(db.String(60), nullable=False)
def __repr__(self):
return f"Finanzer('{self.username}')"
class History:
history = []
user = None
def __init__(self, history, user, value):
self.history=history
self.history = history
self.history.append(self)
self.user = user
self.month = date.today().month
self.value = value
self.timer = Timer(60, self.kill)
self.timer.start()
def exec(self):
self.timer.cancel()
User.query.filter_by(username=self.user.username).first().storner(self.value)
User.query.filter_by(username=self.user.username).first().storner(self.value, self.month)
self.kill()
def kill(self):
print("{} deledet from history".format(self.user))
self.history.remove(self)
print(self.history)
'''
def __repr__(self):
print(f'self:{self}, history:{self.history}, user:{self.user}, value:{self.value}')
def __str__(self):
print(f'self:{self}, history:{self.history}, user:{self.user}, value:{self.value}')
'''
'''

View File

@ -1,7 +1,8 @@
from flask import render_template, url_for, redirect, flash, jsonify, g
from geruecht import app, db
from geruecht.forms import RegistrationForm
from geruecht.model import User, History
from flask import render_template, url_for, redirect, flash, jsonify, g, request
from flask_login import login_user, current_user, logout_user, login_required
from geruecht import app, db, bcrypt
from geruecht.forms import RegistrationForm, FinanzerLogin
from geruecht.model import User, History, Finanzer
import flask_sijax
import os, sys
@ -36,7 +37,7 @@ def home():
print(history)
obj_response.html('div#flash', f'{user_2.username} wurde {"%.2f"%value} € hinzugefügt')
obj_response.attr('div#flash', "class", "alert alert-success")
obj_response.html(f'#{user_2.id}-sum', str("%.2f" % user_2.sum + ""))
obj_response.html(f'#{user_2.id}-sum', str("%.2f" % user_2.getsum() + ""))
def storner(obj_response):
try:
@ -49,7 +50,7 @@ def home():
db.session.commit()
obj_response.html('div#flash', f'{"%.2f"%obj.value} wurden von {user_2.username} storniert')
obj_response.attr('div#flash', "class", "alert alert-success")
obj_response.html(f'#{user_2.id}-sum', str("%.2f" % user_2.sum + ""))
obj_response.html(f'#{user_2.id}-sum', str("%.2f" % user_2.getsum() + ""))
except IndexError:
print("history: {} is empty".format(history))
@ -70,10 +71,85 @@ def home():
return redirect(url_for('home'))
return render_template('home.html', users=User.query.all(), form=form)
@flask_sijax.route(app, "/return")
def to_home():
return home()
@app.route("/login", methods=['GET', 'POST'])
def login():
if current_user.is_authenticated:
return redirect(url_for('home'))
login_form = FinanzerLogin()
if login_form.validate_on_submit():
user = Finanzer.query.filter_by(username=login_form.username.data).first()
if user:
if user and bcrypt.check_password_hash(user.password, login_form.password.data):
login_user(user)
next_page = request.args.get('next')
return redirect(next_page) if next_page else redirect(url_for('home'))
else:
flash('Passwort ist falsch', 'error')
else:
flash('nur der finanzer kann sich einloggen !!', 'error')
return render_template('login.html', title='Login', form=login_form)
@app.route("/logout")
def logout():
logout_user()
return redirect(url_for('home'))
@flask_sijax.route(app, "/uebersicht")
def finanzen():
def supply(obj_response, arg1, arg2):
list = zip(arg1, arg2)
try:
for value in arg2:
if value:
float(value)
for user_id, value in list:
if user_id and value:
user_ = User.query.get(user_id)
user_.add_sub(float(value))
db.session.commit()
obj_response.attr(f'#{user_id}-input', 'value', '')
obj_response.html('div#flash', "Alle Werte wurden übernommen")
obj_response.attr('div#flash', 'class', "alert alert-success")
for user_ in User.query.all():
obj_response.html(f'p#{user_.id}-jan-sub', "%.2f"%user_.jan_sub + "")
obj_response.html(f'p#{user_.id}-feb-sub', "%.2f"%user_.feb_sub + "")
obj_response.html(f'p#{user_.id}-maer-sub', "%.2f"%user_.maer_sub + "")
obj_response.html(f'p#{user_.id}-apr-sub', "%.2f"%user_.apr_sub + "")
obj_response.html(f'p#{user_.id}-mai-sub', "%.2f"%user_.mai_sub + "")
obj_response.html(f'p#{user_.id}-jun-sub', "%.2f"%user_.jun_sub + "")
obj_response.html(f'p#{user_.id}-jul-sub', "%.2f"%user_.jul_sub + "")
obj_response.html(f'p#{user_.id}-aug-sub', "%.2f"%user_.aug_sub + "")
obj_response.html(f'p#{user_.id}-sep-sub', "%.2f"%user_.sep_sub + "")
obj_response.html(f'p#{user_.id}-okt-sub', "%.2f"%user_.okt_sub + "")
obj_response.html(f'p#{user_.id}-nov-sub', "%.2f"%user_.nov_sub + "")
obj_response.html(f'p#{user_.id}-dez-sub', "%.2f"%user_.dez_sub + "")
obj_response.html(f'p#{user_.id}-sum', "%.2f"%user_.getsum() + "")
except ValueError:
obj_response.html('div#flash',
"Du hast irgendwo keine Zahl eingegeb!!")
obj_response.attr('div#flash', "class", "alert alert-error")
if g.sijax.is_sijax_request:
g.sijax.register_callback('supply', supply)
return g.sijax.process_request()
return render_template('finanzer.html', users=User.query.all())
@flask_sijax.route(app, "/about")
def about():
return render_template('about.html', title='about')

View File

@ -13,10 +13,10 @@ body {
background-color: #055288;
text-align: center;
padding: 5px 5px;
margin: 17px 17px;
margin: 7px 17px;
text-decoration: none;
font-size: 17px;
border: 0px solid white;
border: 5px solid #055288;
border-style: solid;
border-radius: 10px;
transition-duration: 0.4s;
@ -33,6 +33,7 @@ body {
.blue-button:hover {
background: white;
border: 5px solid #055288;
color: black;
}
@ -58,6 +59,17 @@ body {
transform: translateY(4px)
}
.logo-nav img {
position: absolute;
transition-duration: 0.4s;
}
.logo-nav img.main-logo:hover {
opacity: 0;
}
.geruecht {
margin: 5px auto;
display: table;
@ -78,28 +90,44 @@ body {
width: 20%;
}
.auto-width {
width:6.66%;
}
.width-auto {
width:80%;
}
.g-item p {
font-size: 15px;
}
.button {
width: 70px;
heigt: 30px;
border-radius: 10px;
border: 5px solid green;
background: green;
color: white;
transition-duration: 0.4s;
}
.button:hover {
color: green;
background: white;
}
.button:active {
transform: translateY(4px);
}
.bottombar {
background-color: #077BCB;
overflow: hidden;
overflow: scroll;
position: fixed;
bottom: 0;
width: 100%;
height: 62px;
display: table;
}
@ -152,3 +180,15 @@ body {
border-radius: 5px;
padding: 6px;
}
.container {
margin-bottom: 50%;
}
.schulden {
color: red;
}
.bezahlt {
color: green;
}

View File

@ -0,0 +1,119 @@
{% extends 'layout.html' %}
{% block content %}
<div class="geruecht">
<div class="g-item auto-width">
<b>Username</b>
</div>
<div class="g-item auto-width">
<b>Januar</b>
</div>
<div class="g-item auto-width">
<b>Februar</b>
</div>
<div class="g-item auto-width">
<b>März</b>
</div>
<div class="g-item auto-width">
<b>April</b>
</div>
<div class="g-item auto-width">
<b>Mai</b>
</div>
<div class="g-item auto-width">
<b>Juni</b>
</div>
<div class="g-item auto-width">
<b>July</b>
</div>
<div class="g-item auto-width">
<b>August</b>
</div>
<div class="g-item auto-width">
<b>September</b>
</div>
<div class="g-item auto-width">
<b>Oktober</b>
</div>
<div class="g-item auto-width">
<b>November</b>
</div>
<div class="g-item auto-width">
<b>Dezember</b>
</div>
<div class="g-item auto-width">
<b>Schulden</b>
</div>
<div class="g-item auto-width">
<b>Ausgleich</b>
</div>
</div>
{% for user in users %}
<div class="geruecht">
<div class="g-item auto-width">
<p>{{ user.username }}</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-jan" class="schulden">{{ "%.2f"%user.jan }} €</p>
<p id="{{ user.id }}-jan-sub" class="bezahlt">{{ "%.2f"%user.jan_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-feb" class="schulden">{{ "%.2f"%user.feb }} €</p>
<p id="{{ user.id }}-feb-sub" class="bezahlt">{{ "%.2f"%user.feb_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-maer" class="schulden">{{ "%.2f"%user.maer }} €</p>
<p id="{{ user.id }}-maer-sub" class="bezahlt">{{ "%.2f"%user.maer_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-apr" class="schulden">{{ "%.2f"%user.apr }} €</p>
<p id="{{ user.id }}-apr-sub" class="bezahlt">{{ "%.2f"%user.apr_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-mai" class="schulden">{{ "%.2f"%user.mai }} €</p>
<p id="{{ user.id }}-mai-sub" class="bezahlt">{{ "%.2f"%user.mai_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-jun" class="schulden">{{ "%.2f"%user.jun }} €</p>
<p id="{{ user.id }}-jun-sub" class="bezahlt">{{ "%.2f"%user.jun_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-jul" class="schulden">{{ "%.2f"%user.jul }} €</p>
<p id="{{ user.id }}-jul-sub" class="bezahlt">{{ "%.2f"%user.jul_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-aug" class="schulden">{{ "%.2f"%user.aug }} €</p>
<p id="{{ user.id }}-aug-sub" class="bezahlt">{{ "%.2f"%user.aug_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-sep" class="schulden">{{ "%.2f"%user.sep }} €</p>
<p id="{{ user.id }}-sep-sub" class="bezahlt">{{ "%.2f"%user.sep_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-okt" class="schulden">{{ "%.2f"%user.okt }} €</p>
<p id="{{ user.id }}-okt-sub" class="bezahlt">{{ "%.2f"%user.okt_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-nov" class="schulden">{{ "%.2f"%user.nov }} €</p>
<p id="{{ user.id }}-nov-sub" class="bezahlt">{{ "%.2f"%user.nov_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-dez" class="schulden">{{ "%.2f"%user.dez }} €</p>
<p id="{{ user.id }}-dez-sub" class="bezahlt">{{ "%.2f"%user.dez_sub }} €</p>
</div>
<div class="g-item auto-width">
<p id="{{ user.id }}-sum">{{ "%.2f"%user.getsum() }} €</p>
</div>
<div class="g-item auto-width">
<input class="g-item width-auto" type="text" id="{{ user.id }}-input">
</div>
</div>
{% endfor %}
{% endblock %}
{% block bottombar %} <!-- , [[{% for user in users %} {{ user.id }}, {% endfor %} None], [{% for user in users %} $('#{{ user.id }}-input').attr('value'), {% endfor %} None]] -->
<!-- document.getElementById('1-input').value -->
<div id="btn" class="right blue-button buttombar-element" textref="javascript://" onclick="Sijax.request('supply', [[{% for user in users %} {{ user.id }}, {% endfor %} null], [{% for user in users %}document.getElementById('{{ user.id }}-input').value, {% endfor %} null]]);">
Anwenden
</div>
{% endblock %}

View File

@ -6,27 +6,48 @@
<p>{{ user.username }}</p>
</div>
<div class="g-item button" id="{{ user.id }}-2" href="javascript://" onclick="Sijax.request('add', ['{{ user.username }}', 2]);">
<p>+2 &euro;</p>
+2 &euro;
</div>
<div class="g-item button" id="{{ user.it }}-1" href="javascript://" onclick="Sijax.request('add', ['{{ user.username }}', 1]);">
<p>+1 &euro;</p>
+1 &euro;
</div>
<div class="g-item button" id="{{ user.id }}-050" href="javascript://" onclick="Sijax.request('add', ['{{ user.username }}', 0.5]);">
<p>+0,5 &euro;</p>
+0,5 &euro;
</div>
<div class="g-item button" id="{{ user.id }}-040" href="javascript://" onclick="Sijax.request('add', ['{{ user.username }}', 0.4]);">
<p>+0,4 &euro;</p>
+0,4 &euro;
</div>
<div class="g-item button" id="{{ user.id }}-020" href="javascript://" onclick="Sijax.request('add', ['{{ user.username }}', 0.2]);">
<p>+0,2 &euro;</p>
+0,2 &euro;
</div>
<div class="g-item button" id="{{ user.id }}-010" href="javascript://" onclick="Sijax.request('add', ['{{ user.username }}', 0.1]);">
<p>+0,1 &euro;</p>
+0,1 &euro;
</div>
<div class="g-item">
<p id="{{ user.id }}-sum">{{ "%.2f"%user.sum }} €</p>
<p id="{{ user.id }}-sum">{{ "%.2f"%user.getsum() }} €</p>
</div>
</div>
{% endfor %}
{% endblock %}
{% block bottombar %}
<div class="bottombar-element">
{% if form %}
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group">
<!-- <legend class="reg-label">neue Person hinzufügen</legend> -->
<div class="form-group">
{{ form.username.label(class="reg-label") }}
{{ form.username() }}
</div>
</fieldset>
<div class="form-group m">
{{ form.submit(class="blue-button no-mg") }}
</div>
</form>
{% endif %}
</div>
<div class="right blue-button buttombar-element" href="javascript://" onclick="Sijax.request('storner');">
Stornieren
</div>
{% endblock %}

View File

@ -19,24 +19,20 @@
<script type="text/javascript">
{{ g.sijax.get_js()|safe }}
</script>
<script type="text/JavaScript">
function hover(element) {
element.setAttribute('src', "{{ url_for('static', filename='img/logo_selected.png') }}");
}
function unhover(element) {
element.setAttribute('src', "{{ url_for('static', filename='img/logo.png') }}");
}
</script>
</head>
<body>
<div class="topnav">
<a href="{{ url_for('to_home') }}">
<img class="logo-nav first" src="{{ url_for('static', filename='img/logo.png') }}" onmouseover="hover(this);" onmouseout="unhover(this);">
<a class="logo-nav first" href="{{ url_for('to_home') }}">
<img class="logo-nav background-logo" src="{{ url_for('static', filename='img/logo_selected.png')}}">
<img class="logo-nav main-logo" src="{{ url_for('static', filename='img/logo.png') }}">
</a>
<!--<div class="logo-nav first"></div>-->
<a class="last blue-button" href="{{ url_for('to_home') }}">Finanzer</a>
{% if current_user.is_authenticated %}
<a class="last blue-button" href="{{ url_for('logout') }}">Logout</a>
<a class="last blue-button" href="{{ url_for('finanzen') }}">Übersicht</a>
{% else %}
<a class="last blue-button" href="{{ url_for('login') }}">Finanzer</a>
{% endif %}
</div>
<div class="container">
{% block content %}
@ -44,6 +40,9 @@
{% endblock %}
</div>
<div class="bottombar">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
@ -53,38 +52,33 @@
</div>
{% endfor %}
{% endif %}
{% if form.username.errors %}
{% for error in form.username.errors %}
<div class="alert alert-error">
<span>{{ error }}</span>
</div>
{% endfor %}
{% if form %}
{% if form.username.errors %}
{% for error in form.username.errors %}
<div class="alert alert-error">
<span>{{ error }}</span>
</div>
{% endfor %}
{% endif %}
{% if form.password %}
{% if form.password.errors %}
{% for error in form.password.errors %}
<div class="alert alert-error">
<span>{{ error }}</span>
</div>
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% endwith %}
<div id="flash"></div>
<div class="bottombar-element">
{% if form %}
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group">
<!-- <legend class="reg-label">neue Person hinzufügen</legend> -->
<div class="form-group">
{{ form.username.label(class="reg-label") }}
{{ form.username() }}
</div>
</fieldset>
<div class="form-group m">
{{ form.submit(class="blue-button no-mg") }}
</div>
</form>
{% endif %}
</div>
<div class="right blue-button buttombar-element no-mg no-pd" href="javascript://" onclick="Sijax.request('storner');">
<p>Stornieren</p>
</div>
{% block bottombar %}
{% endblock %}
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

View File

@ -0,0 +1,41 @@
{% extends "layout.html" %}
{% block content %}
<div class="login-content">
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="login-group">
<legend class="">Log In</legend>
<div class="login-group">
{{ form.username.label(class="") }}
{% if form.username.errors %}
{{ form.username(class="") }}
<div class="">
{% for error in form.username.error %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.username(class="") }}
{% endif %}
</div>
<div class="login-group">
{{ form.password.label(class="") }}
{% if form.password.errors %}
{{ form.password(class="") }}
<div class="">
{% for error in form.password.error %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.password(class="") }}
{% endif %}
</div>
</fieldset>
<div class="login-group">
{{ form.submit(class="") }}
</div>
</form>
</div>
{% endblock %}