master
Kerem Yollu 9 months ago
parent 081d496de9
commit f98037c7bb

Binary file not shown.

@ -57,6 +57,7 @@ def create_app():
from minibase.blueprints.geography.routes import geography
from minibase.blueprints.sensor.routes import sensor
from minibase.blueprints.database.routes import database
#from minibase.blueprints.item.routes import item
# (BLUEPRINTS) Registering the blueprints.
# Giving them theie ulr_prefixes that will define their links on the webBrowser.

@ -5,20 +5,13 @@ from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationE
import minibase.blueprints.company.utils as companyUtils
import minibase.blueprints.geography.utils as geoUtils
import minibase.blueprints.main.utils as mainUtils
import minibase.blueprints.database.utils as dbUtils
import minibase.theme as theme
from wtforms_alchemy import ModelForm
from minibase.blueprints.company.models import Companies
from minibase.blueprints.sensor.models import nbiotDevice
from minibase.blueprints.user.models import Users
fields = {
"city_id": SelectField(
'City',
validators=[DataRequired()],
render_kw={"hx-get": "/geography/get_states", "hx-target": "#state_id"}
),
}
class companyForm(FlaskForm): # Defines the form class to be used for the user update
name = StringField('Name', validators=[DataRequired(), Length(min=3, max=100)])
website = URLField('Website', validators=[DataRequired(), Length(min=3, max=100)])
@ -34,11 +27,10 @@ class companyForm(FlaskForm): # Defines the form class to be used for the user
relation_id = SelectField('Relation', validators=[DataRequired()])
status_id = SelectField('Status', validators=[DataRequired()])
comment = StringField('Comment', validators=[DataRequired(), Length(min=3, max=400)])
image_file = FileField('Update company Picture', validators=[FileAllowed(['jpg', 'png'])])
submit = SubmitField()
def populate_for_updating(self, company):
self.originalModel = company
self.submit.label.text = "Update"
@ -52,7 +44,7 @@ class companyForm(FlaskForm): # Defines the form class to be used for the user
self.city_id.choices = [(row.id, row.name) for row in geoUtils.queryCityNamesWithCountryIdWithDefault(company.city_id, company.country_id)]
self.state_id.choices = [(row.id, row.name) for row in geoUtils.queryStateNamesWithCountryIdWithDefault(company.state_id, company.country_id)]
self.industry_id.choices = [(row.id, row.name) for row in mainUtils.queryIndustryNamesWithDefault(company.industry_id)]
self.industry_id.choices = [(row.id, row.name) for row in dbUtils.queryWithDefaultAttrOrderBy(Companies, Companies.industry_id,company.industry_id)]
self.legal_entity_id.choices = [(row.id, row.name) for row in companyUtils.queryLegalEntityNamesWithDefault(company.legal_entity_id)]
self.type_id.choices = [(row.id, row.name) for row in companyUtils.queryTypeNamesWithDefault(company.type_id)]
self.relation_id.choices = [(row.id, row.name) for row in companyUtils.queryRelationNamesWithDefault(company.relation_id)]
@ -82,6 +74,6 @@ class companyForm(FlaskForm): # Defines the form class to be used for the user
#custom validators specific naming convention: validate_<fieldname>. This is how Flask-WTF knows which field the validator is associated with.
def validate_name(self, input):
if input.data != self.originalModel.name:
if (Companies.query.filter(Companies.name.ilike(f'%{input.data}%')).first()):
raise ValidationError('This Company already registered')
if (dbUtils.queryIlikeFromTable(Companies, Companies.name, input.data)):
raise ValidationError(f'This {self.name.name} already exists.')

@ -12,7 +12,7 @@ class Companies(db.Model):
last_update_date= db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
#Own Fields
name = db.Column(db.String(100), nullable=False)
name = db.Column(db.String(100), nullable=False, unique=True)
website = db.Column(db.String(100), nullable=True, default='')
street = db.Column(db.String(100), nullable=False)
street_no = db.Column(db.Integer, nullable=False)

@ -4,6 +4,7 @@ import minibase.theme as theme
from minibase.blueprints.company.models import Companies
import minibase.blueprints.database.utils as dbUtils
import minibase.blueprints.main.utils as mainUtils
import minibase.blueprints.main.forms as NoteForm
from minibase.blueprints.company.forms import companyForm
# Declaring a blueprint
@ -13,7 +14,7 @@ company = Blueprint('company', __name__, template_folder='templates')
@company.route("/list", methods=['GET', 'POST'])
def list():
page=request.args.get('page', 1, type=int)
table=dbUtils.table_printable_paginate(Companies, page, 20, 'account/', 'id')
table=dbUtils.table_printable_paginate(Companies, page, 5, 'account/', 'id')
return(render_template('view.html', theme=theme, table=table, title="Companies"))
@ -24,6 +25,7 @@ def account(companyId):
company = Companies.query.get_or_404(companyId)
form = companyForm()
form.populate_for_updating(company)
_accountInfo = mainUtils.accountInfo(
title=company.name,
description=company.legal_entity.name,
@ -45,7 +47,9 @@ def account(companyId):
elif request.method == 'GET':
mainUtils.populate_form(form, company)
return render_template('account.html', theme=theme, accountInfo=_accountInfo, form=form)
return render_template('account.html', theme=theme,
accountInfo=_accountInfo,
form=form)
else:
flash('You need to select a company id', 'alarm')
return redirect(url_for('company.list'))

@ -19,20 +19,44 @@ class table_printable_paginate:
self.item_to_be_linked = item_to_be_linked
self.paginate = 1
def queryNameWithDefaultId(table,defId):
choices = table.query.order_by(case((table.id == defId, 0),else_=1),table.name.asc())
return choices
return table.query.order_by(case((table.id == defId, 0),else_=1),table.name.asc())
def queryWithDefaultAttrOrderBy(table, attribute, default, order_by):
return table.query.order_by(case((attribute == default, 0),else_=1),order_by.asc())
def queryItemWithId(table,defId):
choices = table.query.order_by(case((table.id == defId, 0),else_=1),table.name.asc())
return choices
return table.query.order_by(case((table.id == defId, 0),else_=1),table.name.asc())
def queryIlikeFromTable(table, attribute, data):
return table.query.filter(attribute.ilike(f'%{data}%')).first()
# Queries Items from table using an attribute, and ordered by the attribute, ascenting or descending
def queryWithAttrOrder(table, attribute, desc=0):
if desc:
return table.query.order_by(attribute.desc()).all()
else:
return table.query.order_by(attribute.asc()).all()
#return table.query.filter_by(attribute=data).order_by(order_by.asc()).all()
def queryItemFromTableDateDesc(table, attribute):
return table.query.order_by(attribute.asc())
def dbAdd(dbClass):
db.session.add(dbClass)
def dbCommit():
db.session.commit()
def dbAddAndCommit(dbClass):
db.session.add(dbClass)
db.session.commit()

@ -0,0 +1,33 @@
from minibase.app import db
from datetime import datetime
# End of the line model for CORE.
class item(db.Model):
__tablename__ = 'item'
id = db.Column(db.Integer, primary_key=True)
created = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
updated = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# Foreign Keys
user_creator_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
user_update_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
category_id = db.Column(db.Integer, db.ForeignKey('itemCategory.id'), nullable=False)
# item_id = db.Column(db.Integer, db.ForeignKey('item.id'), nullable=False) #DefinedByUser
class itemCategory(db.Model):
__tablename__ = 'itemCategory'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), nullable=False, unique=True)
level = db.Column(db.Integer, nullable=False, unique=True)
description = db.Column(db.String(250), nullable=True, unique=True)
created = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
updated = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# Foreign Keys
user_creator_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
user_update_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
user_responsible_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

@ -0,0 +1,8 @@
from flask_wtf import FlaskForm
from wtforms import SubmitField, TextAreaField
from wtforms.validators import DataRequired, Length
class NoteForm(FlaskForm):
content = TextAreaField('Content', validators=[DataRequired(), Length(min=1, max=5000)])
submit = SubmitField('Add Note')

@ -23,7 +23,7 @@ class Notes(db.Model):
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
company_id = db.Column(db.Integer, db.ForeignKey('companies.id'), nullable=False)
company_id = db.Column(db.Integer, db.ForeignKey('companies.id'), nullable=True)
class Todos(db.Model):

@ -28,6 +28,7 @@ def populate_form(form, cur_model):
item.data = formFill(item, cur_model)
#Fills the form with
def formFill(item, cur_model):
if item.type not in ["SubmitField", "CSRFTokenField"]:
# Cheking if the arrtibute exitst, otherwise ignoring
@ -35,13 +36,15 @@ def formFill(item, cur_model):
return getattr(cur_model, item.name)
# Fills the model with the data from the Form, if an attribute doesn't exist, the value of that
# Attribute will be filled with the existing data (May be an extra step, overkill?)
def modelFill(cur_model, item):
if hasattr(cur_model, item.name):
if item.type not in ["SubmitField", "CSRFTokenField"]:
if item.type == "FileField":
if item.data == "None":
print(f"File field found with no data -> item name {item.name}")
print(f"It will be filled with the existin tbale data -> item name {getattr(cur_model, item.name)}")
print(f"It will be filled with the existin table data -> item name {getattr(cur_model, item.name)}")
setattr(cur_model, item.name, getattr(cur_model, item.name))
else:
setattr(cur_model, item.name, item.data)
@ -91,9 +94,7 @@ def send_sensor_email(email, data):
# QUERIES
def queryIndustryNames():
choices = Industries.query.order_by(Industries.name.asc())
return choices
return dbUtils.queryWithAttrOrder(Industries, Industries.name, 1)
def queryIndustryNamesWithDefault(defId):
choices = dbUtils.queryNameWithDefaultId(Industries,defId)
return choices
return dbUtils.queryNameWithDefaultId(Industries,defId)

@ -6,6 +6,7 @@ from minibase.blueprints.sensor.models import nbiotDevice
import minibase.blueprints.company.utils as companyUtils
import minibase.blueprints.user.utils as userUtils
import minibase.blueprints.sensor.utils as sensorUtils
import minibase.blueprints.database.utils as dbUtils
from datetime import date
class nbiotDeviceForm(FlaskForm): # Defines the self class to be used for the user update
@ -70,25 +71,25 @@ class nbiotDeviceForm(FlaskForm): # Defines the self class to be used for the u
#custom validators specific naming convention: validate_<fieldname>. This is how Flask-WTF knows which field the validator is associated with.
def validate_name(self, input):
if input.data != self.originalModel.name:
if (nbiotDevice.query.filter(nbiotDevice.name.ilike(f'%{input.data}%')).first()):
raise ValidationError('This Name already exists. Please choose a different one.')
if (dbUtils.queryIlikeFromTable(nbiotDevice, nbiotDevice.name, input.data)):
raise ValidationError(f'This {self.name.name} already exists.')
def validate_serial_no(self, input):
if input.data != self.originalModel.serial_no:
if (nbiotDevice.query.filter(nbiotDevice.serial_no.ilike(f'%{input.data}%')).first()):
raise ValidationError('This Serial Number is already registered.')
if (dbUtils.queryIlikeFromTable(nbiotDevice, nbiotDevice.serial_no, input.data)):
raise ValidationError(f'This {self.serial_no.name} already exists.')
def validate_imsi(self, input):
if input.data != self.originalModel.imsi:
if (nbiotDevice.query.filter(nbiotDevice.imsi.ilike(f'%{input.data}%')).first()):
raise ValidationError('This IMSI no is already registered.')
if (dbUtils.queryIlikeFromTable(nbiotDevice, nbiotDevice.imsi, input.data)):
raise ValidationError(f'This {self.imsi.name} already exists.')
def validate_iccid(self, input):
if input.data != self.originalModel.iccid:
if (nbiotDevice.query.filter(nbiotDevice.iccid.ilike(f'%{input.data}%')).first()):
raise ValidationError('This ICCID no is already registered.')
if (dbUtils.queryIlikeFromTable(nbiotDevice, nbiotDevice.iccid, input.data)):
raise ValidationError(f'This {self.iccid.name} already exists.')
def validate_ip(self, input):
if input.data != self.originalModel.ip:
if (nbiotDevice.query.filter(nbiotDevice.ip.ilike(f'%{input.data}%')).first()):
raise ValidationError('A devie already has this IP')
if (dbUtils.queryIlikeFromTable(nbiotDevice, nbiotDevice.ip, input.data)):
raise ValidationError(f'This {self.ip.name} already exists.')

@ -5,30 +5,33 @@ class nbiotDevice(db.Model):
__tablename__ = 'nbiotDevice'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), nullable=False)
name = db.Column(db.String(50), nullable=False, unique=True)
model = db.Column(db.String(50), nullable=False)
serial_no = db.Column(db.String(50), nullable=False)
device_id = db.Column(db.String(30), nullable=False)
imsi = db.Column(db.String(30), nullable=False)
iccid = db.Column(db.String(50), nullable=False)
ip = db.Column(db.String(20), nullable=True)
serial_no = db.Column(db.String(50), nullable=False, unique=True)
device_id = db.Column(db.String(30), nullable=False, unique=True)
imsi = db.Column(db.String(30), nullable=False, unique=True)
iccid = db.Column(db.String(50), nullable=False, unique=True)
ip = db.Column(db.String(20), nullable=True, unique=True)
port = db.Column(db.String(20), nullable=True)
registration_date = db.Column(db.DateTime, nullable=True)
activation_date = db.Column(db.DateTime, nullable=True)
deactivation_date = db.Column(db.DateTime, nullable=True)
image_file = db.Column(db.String(20), nullable=False, default='def_sensor.png')
created = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
updated = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# Foreign Keys
status_id = db.Column(db.Integer, db.ForeignKey('nbiotDeviceStatus.id'), nullable=False)
type_id = db.Column(db.Integer, db.ForeignKey('nbiotDeviceType.id'), nullable=False)
area_id = db.Column(db.Integer, db.ForeignKey('nbiotDeviceArea.id'), nullable=False)
# Foreign Keys
company_manufacturer_id = db.Column(db.Integer, db.ForeignKey('companies.id'))
company_owner_id = db.Column(db.Integer, db.ForeignKey('companies.id'))
device_user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
device_owner_id = db.Column(db.Integer, db.ForeignKey('users.id'))
item_id = db.Column(db.Integer, db.ForeignKey('item.id'), nullable=False) #DefinedByUser
# Relationships
company_manufacturer = db.relationship("Companies", foreign_keys=[company_manufacturer_id], back_populates="manufactured_devices")

@ -53,7 +53,7 @@ def callback():
sensor = sensorUtils.queryByImsi(src_imsi)
mail=userUtils.queryMailById(sensor.device_user_id)
print(f"Sensor Model: {sensor.model}, user e-mail: {mail}")
#mainUtils.send_sensor_email(mail, data)
#mainUtils.send_sensor_email(mail, response_data)
return jsonify(response_data), 200

@ -5,14 +5,14 @@ from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationE
from flask_login import current_user
from minibase.blueprints.user.models import Users, User_Roles
import minibase.blueprints.geography.utils as geoUtils
import minibase.blueprints.database.utils as dbUtils
class registrationForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
username = StringField('User Name', validators=[DataRequired(), Length(min=4, max=20)])
username = StringField('User Name', validators=[DataRequired(), Length(min=4, max=20)], unique=True)
name = StringField('Name', validators=[DataRequired(), Length(min=4, max=20)])
surname = StringField('Surname', validators=[DataRequired(), Length(min=4, max=20)])
email_account = StringField('Email: Account', validators=[DataRequired(), Email()])
email_account = StringField('Email: Account', validators=[DataRequired(), Email()], unique=True)
email_comm = StringField('Email: Communication', validators=[DataRequired(), Email()])
street = StringField('Street', validators=[DataRequired()])
street_no = IntegerField('No', validators=[DataRequired()])
@ -40,14 +40,14 @@ class registrationForm(FlaskForm): # Defines the form class to be used for the
# Queries to be made in order to validate the form : If username exists
def validate_username(self, input):
if input.data != self.originalModel.username:
if (Users.query.filter(Users.username.ilike(f'%{input.data}%')).first()):
raise ValidationError('This User Name is alredy registered')
if (dbUtils.queryIlikeFromTable(Users, Users.username, input.data)):
raise ValidationError(f'This {self.username.name} already exists.')
# Queries to be made in order to validate the form : If username exists
def validate_email_account(self, input):
if input.data != self.originalModel.email_account:
if (Users.query.filter(Users.email_account.ilike(f'%{input.data}%')).first()):
raise ValidationError('This E-mail is alredy registered')
if (dbUtils.queryIlikeFromTable(Users, Users.email_account, input.data)):
raise ValidationError(f'This {self.email_account.name} already exists.')
class accountUpdateForm(FlaskForm): # Defines the form class to be used for the user registretion
@ -84,53 +84,31 @@ class accountUpdateForm(FlaskForm): # Defines the form class to be used for the
# Queries to be made in order to validate the form : If username exists
def validate_username(self, input):
if input.data != self.originalModel.username:
if (Users.query.filter(Users.username.ilike(f'%{input.data}%')).first()):
raise ValidationError('This User Name is alredy registered')
if (dbUtils.queryIlikeFromTable(Users, Users.username, input.data)):
raise ValidationError(f'This {self.username.name} already exists.')
# Queries to be made in order to validate the form : If username exists
def validate_email_account(self, input):
if input.data != self.originalModel.email_account:
if (Users.query.filter(Users.email_account.ilike(f'%{input.data}%')).first()):
raise ValidationError('This E-mail is alredy registered')
if (dbUtils.queryIlikeFromTable(Users, Users.email_account, input.data)):
raise ValidationError(f'This {self.email_account.name} already exists.')
class loginForm(FlaskForm): # Defines the form class to be used for the user login
email = StringField('Email', validators=[DataRequired(), Email()])
email = StringField('Email: Account', validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
remember = BooleanField('Remember Me')
submit = SubmitField('Log In')
class updateAccountForm(FlaskForm): # Defines the form class to be used for the user update
username = StringField('User Name', validators=[DataRequired(), Length(min=3, max=20)])
email_account = StringField('Email Account', validators=[DataRequired(), Email()])
email_comm = StringField('Email Communication', validators=[DataRequired(), Email()])
picture = FileField('Update Profile Picture', validators=[FileAllowed(['jpg', 'png'])])
submit = SubmitField('Update')
# Queries to be made in order to validate the form : If username exists
def validate_username(self, username):
if username.data != current_user.username:
user = Users.query.filter_by(username=username.data).first()
if user:
raise ValidationError('That username is taken please choose another one')
# Queries to be made in order to validate the form : If Email exists
def validate_email(self, email):
if email.data != current_user.email_account:
email = Users.query.filter_by(email_account=email.data).first()
if email:
raise ValidationError('That email is taken do you have an acocunt ?')
class requestResetForm(FlaskForm): # Defines the form class to be used for the reset form
email = StringField('Email', validators=[DataRequired(), Email()])
email = StringField('Email: Account', validators=[DataRequired(), Email()])
submit = SubmitField('Request Password Reset')
# Queries to be made in order to validate the form : If Email exists
def validate_email(self, email):
email = Users.query.filter_by(email_account=email.data).first()
if email is None:
raise ValidationError('There is no Account with this email your must register first.')
def validate_email(self, input):
if (dbUtils.queryIlikeFromTable(Users, Users.email_account, input.data)) is None:
raise ValidationError(f"This {self.email.name} doesn't exists.")
class resetPasswordForm(FlaskForm): # Defines the form class to be used for password reset form

@ -5,7 +5,7 @@ import minibase.theme as theme
from minibase.blueprints.user.models import Users, User_Roles
import minibase.blueprints.database.utils as dbUtils
import minibase.blueprints.user.utils as UserUtils
from minibase.blueprints.user.forms import registrationForm, loginForm, updateAccountForm, resetPasswordForm, requestResetForm, updateRoleForm, accountUpdateForm
from minibase.blueprints.user.forms import registrationForm, loginForm, resetPasswordForm, requestResetForm, updateRoleForm, accountUpdateForm
import minibase.blueprints.main.utils as mainUtils
# Declaring a blueprint

@ -14,18 +14,21 @@
</div>
</div>
</div>
<div class="col-md-4">
<div class="p-3 py-4">
<div class="p-2">
<h2 class="account-heading" style="color: {{ theme.orange }}; text-align: center;">Info</h2>
{% include 'form.html' %}
</div>
</div>
<div class="col-md-4">
<div class="p-2">
<h2 class="account-heading" style="color: {{ theme.orange }}; text-align: center;">Notes</h2>
{% include 'notes_form.html' %}
</div>
<div class="p-3 py-4">
<h2 class="account-heading" style="color: {{ theme.orange }}; text-align: center;">Todo's</h2>
</div>
</div>
</div>
</div>
{% endblock content %}

@ -6,9 +6,6 @@
{% elif item.id == 'csrf_token' %}
{% else %}
{% include 'form/allFields.html' %}
{% if item.errors %}
{% include 'form/formError.html' %}
{% endif %}
{% endif %}
{% endfor %}
</fieldset>

@ -2,5 +2,9 @@
<br>
{{ item.label(class=theme.form.check_label_class, style=theme.form.check_label_style) }}
<br>
{{ item(class=theme.form.check_class) }}
{% if item.errors %}
{% include 'form/formError.html' %}
{% else %}
{{ item(class=theme.form.check_class) }}
{% endif %}
{% endif %}

@ -2,5 +2,9 @@
<br>
{{ item.label(class=theme.form.date_label_class, style=theme.form.date_label_style) }}
<br>
{{ item(class=theme.form.date_class, style=theme.form.date_style, type=theme.form.date_type) }}
{% if item.errors %}
{% include 'form/formError.html' %}
{% else %}
{{ item(class=theme.form.date_class, style=theme.form.date_style, type=theme.form.date_type) }}
{% endif %}
{% endif %}

@ -2,5 +2,9 @@
<br>
{{ item.label(class=theme.form.file_label_class, style=theme.form.file_label_style) }}
<br>
{{ item(class=theme.form.file_class, type=theme.form.file_type, style=theme.form.file_style) }}
{% if item.errors %}
{% include 'form/formError.html' %}
{% else %}
{{ item(class=theme.form.file_class, type=theme.form.file_type, style=theme.form.file_style) }}
{% endif %}
{% endif %}

@ -2,5 +2,9 @@
<br>
{{ item.label(class=theme.form.integer_label_class, style=theme.form.integer_label_style) }}
<br>
{{ item(class=theme.form.integer_class, style=theme.form.integer_style) }}
{% if item.errors %}
{% include 'form/formError.html' %}
{% else %}
{{ item(class=theme.form.integer_class, style=theme.form.integer_style) }}
{% endif %}
{% endif %}

@ -7,6 +7,10 @@
</div>
{% include 'htmx/popup.html' %}
{% else %}
{{ item(class=theme.form.select_class, type=theme.form.select_type, style=theme.form.select_style)}}
{% if item.errors %}
{% include 'form/formError.html' %}
{% else %}
{{ item(class=theme.form.select_class, type=theme.form.select_type, style=theme.form.select_style)}}
{% endif %}
{% endif %}
{% endif %}

@ -2,5 +2,9 @@
<br>
{{ item.label(class=theme.form.input_label_class, style=theme.form.input_label_style) }}
<br>
{{ item(class=theme.form.input_class, style=theme.form.input_style) }}
{% if item.errors %}
{% include 'form/formError.html' %}
{% else %}
{{ item(class=theme.form.input_class, style=theme.form.input_style) }}
{% endif %}
{% endif %}

@ -2,5 +2,9 @@
<br>
{{ item.label(class=theme.form.url_label_class, style=theme.form.url_label_style) }}
<br>
{{ item(class=theme.form.url_class, type=theme.form.url_type, style=theme.form.url_style) }}
{% if item.errors %}
{% include 'form/formError.html' %}
{% else %}
{{ item(class=theme.form.url_class, type=theme.form.url_type, style=theme.form.url_style) }}
{% endif %}
{% endif %}

@ -0,0 +1,28 @@
<div class="row d-flex justify-content-center">
<div class="card shadow-0 border" style="background-color: {{ theme.light_blue }};">
<div class="card-body p-4">
<div data-mdb-input-init class="form-outline mb-4">
<input type="text" id="addANote" class="form-control" placeholder="Type comment..." />
<label class="form-label" for="addANote">+ Add a note</label>
</div>
<div class="card mb-4">
<div class="card-body">
<p>Type your note, and hit enter to add it</p>
<div class="d-flex justify-content-between">
<div class="d-flex flex-row align-items-center">
<img src="https://mdbcdn.b-cdn.net/img/Photos/Avatars/img%20(4).webp" alt="avatar" width="25"
height="25" />
<p class="small mb-0 ms-2">Martha</p>
</div>
<div class="d-flex flex-row align-items-center">
<p class="small text-muted mb-0">Upvote?</p>
<i class="far fa-thumbs-up mx-2 fa-xs text-body" style="margin-top: -0.16rem;"></i>
<p class="small text-muted mb-0">3</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -25,12 +25,14 @@ class form:
default_label_style = "color:" + orange + "; font-size: " + label_font_size + "; font-weight: bold;"
default_field_style = "color:" + black + "; font-size: " + field_font_size + "; background-color: " + white + ";"
default_error_class = "form-control is-invalid"
default_error_id = "disabledTextInput"
input_label_class = default_label_class
input_label_style = default_label_style
input_class = "form-control"
input_style = default_field_style
input_error_class = default_error_class
input_error_id = default_error_id
check_label_class = "form-check-label"
check_label_style = "input_label_style"
@ -81,7 +83,7 @@ class menu:
{"text": "Remove", "url": "main.index"},
],},
{"menuName":"Sensor",
{"menuName":"Sensor",
"sublinks": [
{"text": "List", "url": "sensor.list"},
{"decoration": "line"},
@ -89,6 +91,15 @@ class menu:
{"decoration": "line"},
{"text": "Edit", "url": "main.index"},
],},
{"menuName":"Lager",
"sublinks": [
{"text": "Names", "url": "sensor.list"},
{"decoration": "line"},
{"text": "Add", "url": "sensor.add"},
{"decoration": "line"},
{"text": "Take", "url": "main.index"},
],},
]
navbar_items_user = [

Loading…
Cancel
Save