Added database connection, Person and COmpany registrations forms and Admin panels aswel

master
Kerem Yollu 2 years ago
parent c4f3892707
commit aa2fb21444

@ -30,17 +30,20 @@ def create_minibase(config_class=Config):
# (EMAIL AGENT) Initialisation
mail.init_app(app)
# (FLASK) Importing and then registering Blueprints (Wievs)
from minibase.users.routes import users
from minibase.posts.routes import posts
from minibase.main.routes import main
from minibase.errors.handlers import errors
from minibase.company.routes import company
from minibase.administration.routes import administration
from minibase.admin.routes import admin
from minibase.person.routes import person
from minibase.errors.handlers import errors
app.register_blueprint(users)
app.register_blueprint(posts)
app.register_blueprint(main)
app.register_blueprint(errors)
app.register_blueprint(company)
app.register_blueprint(administration)
app.register_blueprint(admin)
app.register_blueprint(person)
app.register_blueprint(errors)
# Returnr The created app
return app

@ -0,0 +1,69 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, ValidationError
from minibase.models import Company_legal_entity, Company_industry, Company_relation, Person_role, Person_competence
class compIndustryForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Industry')
# Queries to be made in order to validate the form : If Relation Type exitst # Case Insensistive
def validate_name(self, name):
industry_query = Company_industry.query.filter(Company_industry.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if industry_query:
raise ValidationError('That Industry Type is already registered')
class compRelationForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Relation')
# Queries to be made in order to validate the form : If Relation Type exitst # Case Insensistive
def validate_name(self, name):
relation_query = Company_relation.query.filter(Company_relation.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if relation_query:
raise ValidationError('That Relation Type is already registered')
class compLegalEntityForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Legal Entity')
# Queries to be made in order to validate the form : If Legal Entity exitst # Case Insensistive
def validate_name(self, name):
legal_entity_query = Company_legal_entity.query.filter(Company_legal_entity.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if legal_entity_query:
raise ValidationError('That Legal Entity is already registered')
class personRoleForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Role')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
person_role_query = Person_role.query.filter(Person_role.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if person_role_query:
raise ValidationError('That Person Role is already registered')
class personCompetenceForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Role')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
person_competence_query = Person_role.query.filter(Person_role.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if person_competence_query:
raise ValidationError('That Person Conpewtence is already registered')

@ -0,0 +1,123 @@
from flask import render_template, url_for, flash, redirect, request, Blueprint
from minibase import db
from minibase.config import themeMinibase
from minibase.models import Company, Company_industry, Company_legal_entity, Company_relation, Person_role, Person_competence
from minibase.admin.forms import compLegalEntityForm, compRelationForm, compIndustryForm,personRoleForm, personCompetenceForm
# Declaring a blueprint
admin = Blueprint('admin', __name__)
@admin.route("/company_register_legal_entity", methods=['GET', 'POST'])
def company_register_legal_entity():
form = compLegalEntityForm()
if form.validate_on_submit():
companyLegal = Company_legal_entity(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyLegal)
db.session.commit()
flash(f'{"Company Legal Entity registered!"}', 'success')
return render_template('admin/company_register_legal_entity.html',
title='Register Company Legal Entity',
theme=themeMinibase,
form=form)
return render_template('admin/company_register_legal_entity.html',
title='Register Company Legal Entity',
theme=themeMinibase,
form=form)
@admin.route("/company_register_relation", methods=['GET', 'POST'])
def company_register_relation():
form = compRelationForm()
if form.validate_on_submit():
companyRelation = Company_relation(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyRelation)
db.session.commit()
flash(f'{"Company Relation registered!"}', 'success')
return render_template('admin/company_register_relation.html',
title='Register Company Relation',
theme=themeMinibase,
form=form)
return render_template('admin/company_register_relation.html',
title='Register Company Relation',
theme=themeMinibase,
form=form)
@admin.route("/company_register_industry", methods=['GET', 'POST'])
def company_register_industry():
form = compIndustryForm()
if form.validate_on_submit():
companyIndustry = Company_industry(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyIndustry)
db.session.commit()
flash(f'{"Company Idustry registered!"}', 'success')
return render_template('admin/company_register_industry.html',
title='Register Company Industry',
theme=themeMinibase,
form=form)
return render_template('admin/company_register_industry.html',
title='Register Company Industry',
theme=themeMinibase,
form=form)
@admin.route("/person_register_role", methods=['GET', 'POST'])
def person_register_role():
form = personRoleForm()
if form.validate_on_submit():
personRole = Person_role(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(personRole)
db.session.commit()
flash(f'{"Person Role registered!"}', 'success')
return render_template('admin/person_register_role.html',
title='Register Person_role',
theme=themeMinibase,
form=form)
return render_template('admin/person_register_role.html',
title='Register Person Role',
theme=themeMinibase,
form=form)
@admin.route("/person_register_competence", methods=['GET', 'POST'])
def person_register_competence():
form = personCompetenceForm()
if form.validate_on_submit():
personCompetence = Person_competence(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(personCompetence)
db.session.commit()
flash(f'{"Person Competence registered!"}', 'success')
return render_template('admin/person_register_competence.html',
title='Register Person Competence',
theme=themeMinibase,
form=form)
return render_template('admin/person_register_competence.html',
title='Register Person Competence',
theme=themeMinibase,
form=form)

@ -1,31 +0,0 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
class compIndustryForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Industry')
class compRelationForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Relation')
class compLegalEntityForm(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Legal Entity')
class personRole(FlaskForm): # Defines the form class to be used for the user registretion
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Role')

@ -1,77 +0,0 @@
from flask import render_template, url_for, flash, redirect, request, Blueprint
from minibase import db
from minibase.config import themeMinibase
from minibase.models import Company, Company_industry, Company_legal_entity, Company_relation
from minibase.administration.forms import compLegalEntityForm, compRelationForm, compIndustryForm
# Declaring a blueprint
administration = Blueprint('administration', __name__)
@administration.route("/administration_company_legal_entity", methods=['GET', 'POST'])
def administration_company_legal_entity():
form = compLegalEntityForm()
if form.validate_on_submit():
companyLegal = Company_legal_entity(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyLegal)
db.session.commit()
flash(f'{"Company Legal Entity registered!"}', 'success')
return render_template('administration_company_legal_entity.html',
title='Register Company Legal Entity',
theme=themeMinibase,
form=form)
return render_template('administration_company_legal_entity.html',
title='Register Company Legal Entity',
theme=themeMinibase,
form=form)
@administration.route("/administration_company_relation", methods=['GET', 'POST'])
def administration_company_relation():
form = compRelationForm()
if form.validate_on_submit():
companyLegal = Company_relation(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyLegal)
db.session.commit()
flash(f'{"Company Relation registered!"}', 'success')
return render_template('administration_company_relation.html',
title='Register Company Relation',
theme=themeMinibase,
form=form)
return render_template('administration_company_relation.html',
title='Register Company Relation',
theme=themeMinibase,
form=form)
@administration.route("/administration_company_industry", methods=['GET', 'POST'])
def administration_company_industry():
form = compIndustryForm()
if form.validate_on_submit():
companyLegal = Company_industry(
name=form.name.data,
description=form.description.data)
# Here we need to give the id of thr role as this is a foreign key
db.session.add(companyLegal)
db.session.commit()
flash(f'{"Company Idustry registered!"}', 'success')
return render_template('administration_company_industry.html',
title='Register Company Industry',
theme=themeMinibase,
form=form)
return render_template('administration_company_industry.html',
title='Register Company Industry',
theme=themeMinibase,
form=form)

@ -1,11 +0,0 @@
from minibase.models import Countries
# Retunrs the query of all awailable Country names on the table named Countries
# Note that the formating is done during the SQLAlchemy Table declaration.
# Important note This table is ImporteD externally from a modifier SQL version of
# Github : https://github.com/dr5hn/countries-states-cities-database
def country_choices():
choices = Countries.query.all()
return choices

@ -1,27 +1,31 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, IntegerField, SelectField
from wtforms.validators import DataRequired, Length, ValidationError
from minibase.models import Company, Company_relation
import minibase.company.utils as utils
import minibase.administration.utils as adminUtils
from wtforms.validators import DataRequired, Length, ValidationError, Optional
from minibase.models import Company
import minibase.database.utils as DbUtils
class companyForm(FlaskForm): # Defines the form class to be used for the user registretion
# Defines the form class to be used for the user registretion
class companyForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired(), Length(min=3, max=100)])
legal_entity = SelectField('Legal Entity', choices=utils.company_legal_entity_choices, validators=[DataRequired()])
relation = SelectField('Relation', choices=utils.company_relation_choices, validators=[DataRequired()])
country = SelectField('Country', choices=adminUtils.country_choices, validators=[DataRequired()])
company_name = StringField('Name', validators=[DataRequired(), Length(min=3, max=20)])
legal_entity_id = SelectField('Legal Entity', choices=DbUtils.company_legal_entity_choices, validators=[DataRequired()])
relation_id = SelectField('Relation', choices=DbUtils.company_relation_choices, validators=[DataRequired()])
website = StringField('Website', validators=[Optional(), Length(min=3, max=100)])
country = SelectField('Country', choices=DbUtils.country_choices,validators=[DataRequired()])
state = StringField('State', validators=[DataRequired()])
city = StringField('City', validators=[DataRequired()])
post = IntegerField('Zip', validators=[DataRequired()])
street = StringField('Street', validators=[DataRequired()])
no = IntegerField('No', validators=[DataRequired()])
industry = SelectField('Area', choices=utils.company_industry_choices, validators=[DataRequired()])
industry_id = SelectField('Area', choices=DbUtils.company_industry_choices, validators=[DataRequired()])
submit = SubmitField('Register Company')
def validate_company_duplicate(self, name, country, relation):
companyName = Company.query.filter_by(name=name.data).first()
if companyName:
raise ValidationError('That Company Allredy Exitst Please modify it instead')
# Queries to be made in order to validate the form : If Company name exitst within the same country
# Case Insensistive
def validate_company_name(self, company_name):
company_query = Company.query.filter(Company.name.ilike(self.company_name.data)) # Database Querry ilike means case insessitive
for company in company_query:
if company.name:
if company.country_bill == self.country.data:
raise ValidationError('This company in this contry alredy exist')

@ -14,28 +14,33 @@ def company_register():
form = companyForm()
if form.validate_on_submit():
company = Company(
name=form.name.data,
name=form.company_name.data,
website=form.website.data,
country_bill=form.country.data,
state_bill=form.state.data,
city_bill=form.city.data,
postal_code_bill=form.post.data,
post_code_bill=form.post.data,
street_bill=form.street.data,
street_no_bill=form.no.data,
country_ship=form.country.data,
state_ship=form.state.data,
city_ship=form.city.data,
postal_code_ship=form.post.data,
post_code_ship=form.post.data,
street_ship=form.street.data,
street_no_ship=form.no.data,
industry=utils.getIndustryId(form.industry.data),
relation=utils.getRelationId(form.relation.data),
legal_entity=utils.getLegalEntityId(form.legal_entity.data))
industry_id=utils.getIndustryId(form.industry_id.data),
relation_id=utils.getRelationId(form.relation_id.data),
legal_entity_id=utils.getLegalEntityId(form.legal_entity_id.data))
# Here we need to give the id of thr role as this is a foreign key
db.session.add(company)
db.session.commit()
flash(f'{"Company succesfull registered!"} { company.industry} ', 'success')
return redirect(url_for('company.company_register'))
flash(f'{"Company succesfull registered!"}', 'success')
return render_template('company_register.html',
title='Register Company',
theme=themeMinibase,
form=form)
# return redirect(url_for('company.company_register'))
return render_template('company_register.html',
title='Register Company',

@ -0,0 +1,133 @@
from minibase.models import Company, Company_industry, Company_relation, Company_legal_entity
from minibase.models import Countries, Person, Person_role, Person_competence
# Gets the id of company from the formated output defined at models.py for the Company Model
# The argument formatedCompanySelection is formated by SQLAlchemy in models.py files
# Please look there before changing anything here.
def getCompanyId(formatedCompanySelection):
text = formatedCompanySelection.split(",")
return text[2] # Corresponds to the ID of the Company
# Gets the id of Person's role
def getPersonRoleId(nameForId):
selection = Person_role.query.filter_by(name=nameForId).first()
return selection.id
# Gets the id of Person's competence
def getPersonCompetenceId(nameForId):
selection = Person_competence.query.filter_by(name=nameForId).first()
return selection.id
# Gets the country of the company based on it's id
def getCompanyCountry(companyId):
selection = Company.query.filter_by(id=companyId).first()
return selection.country_bill
# Gets the state of the company based on it's id
def getCompanyState(companyId):
selection = Company.query.filter_by(id=companyId).first()
return selection.street_bill
# Gets the city of the company based on it's id
def getCompanyCity(companyId):
selection = Company.query.filter_by(id=companyId).first()
return selection.city_bill
# Gets the Postal Code of the company based on it's id
def getCompanyPostCode(companyId):
selection = Company.query.filter_by(id=companyId).first()
return selection.post_code_bill
# Gets the Name of the street of the company based on it's id
def getCompanyStreetName(companyId):
selection = Company.query.filter_by(id=companyId).first()
return selection.street_bill
# Gets the Number of the street of the company based on it's id
def getCompanyStreetNo(companyId):
selection = Company.query.filter_by(id=companyId).first()
return selection.street_no_bill
# Returns the query of all awailable companie names on the table named Company
# Note that the formating is done during the SQLAlchemy Table declaration.
def person_role_choices():
choices = Person_role.query.all()
return choices
# Returns the query of all awailable companie names on the table named Company
# Note that the formating is done during the SQLAlchemy Table declaration.
def person_competence_choices():
choices = Person_competence.query.all()
return choices
# Returns the query of all awailable companie names on the table named Company
# Note that the formating is done during the SQLAlchemy Table declaration.
def company_choices():
choices = Company.query.all()
return choices
# Retunrs the qurry of all awailable industrie names on the table named Company_industry
# Note that the formating is done during the SQLAlchemy Table declaration.
def company_industry_choices():
choices = Company_industry.query.all()
return choices
# Retunrs the query of all awailable legal entity names on the table named Company_legal_entity
# Note that the formating is done during the SQLAlchemy Table declaration.
def company_legal_entity_choices():
choices = Company_legal_entity.query.all()
return choices
# Retunrs the query of all awailable Relation names on the table named Company_relation
# Note that the formating is done during the SQLAlchemy Table declaration.
def company_relation_choices():
choices = Company_relation.query.all()
return choices
# The Company Model has Industry Column as a foreign key and it requires the Industry's ID
# And not the name. so this function returns the right ID of the name shown at the
# Register Company Form
def getIndustryId(nameForId):
selection = Company_industry.query.filter_by(name=nameForId).first() # Gets the id of Role
return selection.id
# The Company Model has Relation Column as a foreign key and it requires the Industry's ID
# And not the name. so this function returns the right ID of the name shown at the
# Register Company Form
def getRelationId(nameForId):
selection = Company_relation.query.filter_by(name=nameForId).first() # Gets the id of Role
return selection.id
# The Company Model has Legal Entity Column as a foreign key and it requires the Industry's ID
# And not the name. so this function returns the right ID of the name shown at the
# Register Company Form
def getLegalEntityId(nameForId):
selection = Company_legal_entity.query.filter_by(name=nameForId).first() # Gets the id of Role
return selection.id
# Retunrs the query of all awailable Country names on the table named Countries
# Note that the formating is done during the SQLAlchemy Table declaration.
# Important note This table is ImporteD externally from a modifier SQL version of
# Github : https://github.com/dr5hn/countries-states-cities-database
def country_choices():
choices = Countries.query.all()
return choices

@ -1,6 +1,7 @@
from flask import render_template, request, Blueprint
from minibase.models import Post
from minibase.config import themeMinibase
from minibase import db
# Declaring a blueprint
main = Blueprint('main', __name__)
@ -25,3 +26,12 @@ def about():
@main.route("/customer")
def customer():
return render_template('customer.html', theme=themeMinibase, title='About')
@main.cli.command("initdb")
def reset_db():
"""Drops and Creates fresh database"""
db.drop_all()
db.create_all()
print("Initialized default DB")

@ -48,50 +48,75 @@ class Countries(db.Model):
class Company(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(100), nullable=False)
country_bill = db.Column(db.String(100), nullable=False)
state_bill = db.Column(db.String(100), nullable=False)
city_bill = db.Column(db.String(100), nullable=False)
postal_code_bill = db.Column(db.Integer, nullable=False)
legal_entity_id = db.Column(db.Integer, db.ForeignKey('company_legal_entity.id'), nullable=False)
relation_id = db.Column(db.Integer, db.ForeignKey('company_relation.id'), nullable=False)
industry_id = db.Column(db.Integer, db.ForeignKey('company_industry.id'), nullable=False)
main_company = db.Column(db.Integer, nullable=False, default=1)
subsidiary_of = db.Column(db.Integer, nullable=True, default='')
website = db.Column(db.String(100), nullable=True, default='')
street_bill = db.Column(db.String(100), nullable=False)
street_no_bill = db.Column(db.Integer, nullable=False)
country_ship = db.Column(db.String(100), nullable=False)
state_ship = db.Column(db.String(100), nullable=False)
city_ship = db.Column(db.String(100), nullable=False)
postal_code_ship = db.Column(db.Integer, nullable=False)
city_bill = db.Column(db.String(100), nullable=False)
post_code_bill = db.Column(db.Integer, nullable=False)
state_bill = db.Column(db.String(100), nullable=False)
country_bill = db.Column(db.String(100), nullable=False)
street_ship = db.Column(db.String(100), nullable=False)
street_no_ship = db.Column(db.Integer, nullable=False)
main_company = db.Column(db.Integer, nullable=False, default=1)
subsidiary_of = db.Column(db.Integer, nullable=True, default='')
city_ship = db.Column(db.String(100), nullable=False)
post_code_ship = db.Column(db.Integer, nullable=False)
state_ship = db.Column(db.String(100), nullable=False)
country_ship = db.Column(db.String(100), nullable=False)
classification = db.Column(db.Integer, nullable=False, default=0)
comment = db.Column(db.String(300), nullable=True)
image_file = db.Column(db.String(20), nullable=False, default='default_company.jpg')
employees = db.relationship('Person', backref='company', lazy=True)
notes = db.relationship('Company_note', backref='concerns', lazy=True)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
industry = db.Column(db.Integer, db.ForeignKey('company_industry.id'), nullable=False)
relation = db.Column(db.Integer, db.ForeignKey('company_relation.id'), nullable=False)
legal_entity = db.Column(db.Integer, db.ForeignKey('company_legal_entity.id'), nullable=False)
# returns a more information-rich, or official, string representation of an object
# >>> company.query.all()
# [1, ComanyName, CompanyCounntry] (Do not change this presentation
# it will corrupt: the getCompanyId function in minibase.dabase.utils
def __repr__(self):
return f"{self.name}, {self.country_bill}, {self.id}"
class Person(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False)
last_name = db.Column(db.String(50), nullable=False)
date_of_birth = db.Column(db.Date, nullable=False)
date_of_birth = db.Column(db.Date, nullable=True, default='')
company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
role_id = db.Column(db.Integer, db.ForeignKey('person_role.id'), nullable=False)
competence_id = db.Column(db.Integer, db.ForeignKey('person_competence.id'), nullable=False)
mail_prof = db.Column(db.String(320), nullable=False)
mail_priv = db.Column(db.String(320), nullable=True, default='')
tel_prof_fix = db.Column(db.String(30), nullable=True, default='')
tel_prof_mobile = db.Column(db.String(30), nullable=True, default='')
tel_priv_fix = db.Column(db.String(30), nullable=True, default='')
tel_priv_mobile = db.Column(db.String(30), nullable=True, default='')
mail_prof = db.Column(db.String(320), nullable=False)
mail_priv = db.Column(db.String(320), nullable=True, default='')
country = db.Column(db.String(75), nullable=False)
state = db.Column(db.String(75), nullable=True, default='')
city = db.Column(db.String(75), nullable=True, default='')
post_code = db.Column(db.String(10), nullable=True, default='')
street_name = db.Column(db.String(150), nullable=True, default='')
street_no = db.Column(db.Integer, nullable=True, default='')
city = db.Column(db.String(75), nullable=True, default='')
post_code = db.Column(db.String(10), nullable=True, default='')
state = db.Column(db.String(75), nullable=True, default='')
country = db.Column(db.String(75), nullable=True, default='')
notes = db.relationship('Person_note', backref='concerns', lazy=True)
image_file = db.Column(db.String(20), nullable=False, default='default_person.jpg')
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
company = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
role = db.Column(db.Integer, db.ForeignKey('person_role.id'), nullable=False)
class Person_role(db.Model):
@ -100,6 +125,7 @@ class Person_role(db.Model):
description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# returns a more information-rich, or official, string representation of an object
# >>> Company_industry.query.all()
# >>> [('1', 'Indsutrial'), ('2', 'Consumer')]
@ -107,6 +133,19 @@ class Person_role(db.Model):
return f"{self.name}"
class Person_competence(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# returns a more information-rich, or official, string representation of an object
# >>> Company_industry.query.all()
# >>> [('1', 'Indsutrial'), ('2', 'Consumer')]
def __repr__(self):
return f"{self.name}"
class Company_industry(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
@ -114,6 +153,8 @@ class Company_industry(db.Model):
description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
companies = db.relationship('Company', backref='companies', lazy=True)
# returns a more information-rich, or official, string representation of an object
# >>> Company_industry.query.all()
# >>> [('1', 'Indsutrial'), ('2', 'Consumer')]
@ -127,6 +168,7 @@ class Company_relation(db.Model):
description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# returns a more information-rich, or official, string representation of an object
# >>> Company_industry.query.all()
# >>> [('1', 'Indsutrial'), ('2', 'Consumer')]
@ -140,6 +182,21 @@ class Company_legal_entity(db.Model):
description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# returns a more information-rich, or official, string representation of an object
# >>> Company_industry.query.all()
# >>> [('1', 'Indsutrial'), ('2', 'Consumer')]
def __repr__(self):
return f"{self.name}"
class Status(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
# returns a more information-rich, or official, string representation of an object
# >>> Company_industry.query.all()
# >>> [('1', 'Indsutrial'), ('2', 'Consumer')]
@ -177,6 +234,7 @@ class User(db.Model, UserMixin):
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), nullable=False)
date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
content = db.Column(db.Text, nullable=False)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
@ -184,3 +242,31 @@ class Post(db.Model):
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"User('{self.title}', '{self.date_posted}')"
class Person_note(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), nullable=False)
content = db.Column(db.Text, nullable=False)
status = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
date_due = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
person_id = db.Column(db.Integer, db.ForeignKey('person.id'), nullable=False)
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"{self.title}, {self.status}, {self.content}"
class Company_note(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), nullable=False)
content = db.Column(db.Text, nullable=False)
status = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
date_due = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"{self.title}, {self.status}, {self.content}"

@ -0,0 +1,33 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField, DateField
from wtforms.validators import DataRequired, Length, ValidationError, Email, Optional
from minibase.models import Person
import minibase.database.utils as DbUtils
# Defines the form class to be used for the user registretion
class personForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired(), Length(min=3, max=20)])
last_name = StringField('Last Name', validators=[DataRequired(), Length(min=3, max=20)])
date_of_birth = DateField('Birth Date')
mail_prof = StringField('Email Professional', validators=[DataRequired(), Email()])
mail_priv = StringField('Email Private', validators=[Optional(), Email()])
tel_prof_fix = StringField('Tel Professional Fix', validators=[Optional()])
tel_prof_mobile = StringField('Tel Professional Mob', validators=[Optional()])
tel_priv_fix = StringField('Tel Private Fix', validators=[Optional()])
tel_priv_mobile = StringField('Tel Private Mob', validators=[Optional()])
company_id = SelectField('Company', choices=DbUtils.company_choices, validators=[DataRequired()])
competence_id = SelectField('Competence', choices=DbUtils.person_competence_choices, validators=[DataRequired()])
role_id = SelectField('Role', choices=DbUtils.person_role_choices, validators=[DataRequired()])
submit = SubmitField('Register Person')
# Queries to be made in order to validate the form : If person with this name exitst within the same company
# Case Insensistive
def validate_person(self):
person_query = Person.query.filter(Person.name.ilike(self.name.data)) # Database Querry ilike means case insessitive
for person in person_query:
if person.name:
if person.last_name.lower() == self.last_name.data.lower():
if person.company == self.company.data:
raise ValidationError('This person working in this company alredy exist')

@ -0,0 +1,50 @@
from flask import render_template, url_for, flash, redirect, request, Blueprint
from minibase import db
from minibase.config import themeMinibase
from minibase.models import Person
from minibase.person.forms import personForm
import minibase.database.utils as DbUtils
# Declaring a blueprint
person = Blueprint('person', __name__)
@person.route("/person_register", methods=['GET', 'POST'])
def person_register():
form = personForm()
if form.validate_on_submit():
companyID = DbUtils.getCompanyId(form.company_id.data)
person = Person(
name=form.name.data,
last_name=form.last_name.data,
date_of_birth=form.date_of_birth.data,
tel_prof_fix=form.tel_prof_fix.data,
tel_prof_mobile=form.tel_prof_mobile.data,
tel_priv_fix=form.tel_priv_fix.data,
tel_priv_mobile=form.tel_priv_mobile.data,
mail_prof=form.mail_prof.data,
mail_priv=form.mail_priv.data,
company_id=companyID,
country=DbUtils.getCompanyCountry(companyID),
state=DbUtils.getCompanyState(companyID),
city=DbUtils.getCompanyCity(companyID),
post_code=DbUtils.getCompanyPostCode(companyID),
street_name=DbUtils.getCompanyStreetName(companyID),
street_no=DbUtils.getCompanyStreetNo(companyID),
role_id=DbUtils.getPersonRoleId(form.role_id.data),
competence_id=DbUtils.getPersonCompetenceId(form.competence_id.data))
db.session.add(person)
db.session.commit()
flash(f'{"Company succesfull registered!"}', 'success')
return render_template('person_register.html',
title='Register Person',
theme=themeMinibase,
form=form)
# return redirect(url_for('company.company_register'))
return render_template('person_register.html',
title='Register Person',
theme=themeMinibase,
form=form)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -1,4 +1,6 @@
{% extends "layout.html" %}
{% block content %}
<div class="{{ theme.userInputDivClass }}" style="{{ theme.userInputFormColor }}">
<form method="POST" action="">

@ -0,0 +1,46 @@
{% extends "layout.html" %}
{% block content %}
<div class="{{ theme.userInputDivClass }}" style="{{ theme.userInputFormColor }}">
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group"></fieldset>
<legend class="border-bottom mb-4">Register Person Competence</legend>
<!-- name of the company-->
<div class="form-group">
{{ form.name.label(class="form-control-label") }}
{% if form.name.errors %}
{{ form.name(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.name.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.name(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- description of the company-->
<div class="form-group">
{{ form.description.label(class="form-control-label") }}
{% if form.description.errors %}
{{ form.description(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.description.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.description(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Submit Button -->
<div class="form-group">
{{ form.submit(class="btn btn-outline-info") }}
</div>
</form>
</div>
{% endblock content %}

@ -0,0 +1,46 @@
{% extends "layout.html" %}
{% block content %}
<div class="{{ theme.userInputDivClass }}" style="{{ theme.userInputFormColor }}">
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group"></fieldset>
<legend class="border-bottom mb-4">Register Person Role</legend>
<!-- name of the company-->
<div class="form-group">
{{ form.name.label(class="form-control-label") }}
{% if form.name.errors %}
{{ form.name(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.name.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.name(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- description of the company-->
<div class="form-group">
{{ form.description.label(class="form-control-label") }}
{% if form.description.errors %}
{{ form.description(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.description.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.description(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Submit Button -->
<div class="form-group">
{{ form.submit(class="btn btn-outline-info") }}
</div>
</form>
</div>
{% endblock content %}

@ -3,165 +3,179 @@
<div class="{{ theme.userInputDivClass }}" style="{{ theme.userInputFormColor }}">
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group"></fieldset>
<legend class="border-bottom mb-4">Register Company</legend>
<fieldset class="form-group">
<legend class="border-bottom mb-4">Register Company</legend>
<!-- name of the company-->
<div class="form-group">
{{ form.name.label(class="form-control-label") }}
{% if form.name.errors %}
{{ form.name(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.name.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.name(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- legal_entity of the company-->
<div class="form-group">
{{ form.legal_entity.label(class="form-control-label") }}
{% if form.legal_entity.errors %}
{{ form.legal_entity(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.legal_entity.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.legal_entity(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Relation of the company to us-->
<div class="form-group">
{{ form.relation.label(class="form-control-label") }}
{% if form.relation.errors %}
{{ form.relation(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.relation.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.relation(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- industry of the company-->
<div class="form-group">
{{ form.industry.label(class="form-control-label") }}
{% if form.industry.errors %}
{{ form.industry(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.industry.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.industry(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- street of the company -->
<div class="form-group">
{{ form.street.label(class="form-control-label") }}
{% if form.street.errors %}
{{ form.street(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.street.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.street(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- name of the company-->
<div class="form-group">
{{ form.company_name.label(class="form-control-label") }}
{% if form.company_name.errors %}
{{ form.company_name(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.company_name.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.company_name(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- legal_entity_id of the company-->
<div class="form-group">
{{ form.legal_entity_id.label(class="form-control-label") }}
{% if form.legal_entity_id.errors %}
{{ form.legal_entity_id(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.legal_entity_id.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.legal_entity_id(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Relation of the company to us-->
<div class="form-group">
{{ form.relation_id.label(class="form-control-label") }}
{% if form.relation_id.errors %}
{{ form.relation_id(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.relation_id.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.relation_id(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- industry_id of the company-->
<div class="form-group">
{{ form.industry_id.label(class="form-control-label") }}
{% if form.industry_id.errors %}
{{ form.industry_id(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.industry_id.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.industry_id(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- website of the company-->
<div class="form-group">
{{ form.website.label(class="form-control-label") }}
{% if form.website.errors %}
{{ form.website(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.website.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.website(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- no of the company -->
<div class="form-group">
{{ form.no.label(class="form-control-label") }}
{% if form.no.errors %}
{{ form.no(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.no.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.no(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- street of the company -->
<div class="form-group">
{{ form.street.label(class="form-control-label") }}
{% if form.street.errors %}
{{ form.street(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.street.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.street(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- no of the company -->
<div class="form-group">
{{ form.no.label(class="form-control-label") }}
{% if form.no.errors %}
{{ form.no(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.no.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.no(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- city of the company-->
<div class="form-group">
{{ form.city.label(class="form-control-label") }}
{% if form.city.errors %}
{{ form.city(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.city.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.city(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- state of the company-->
<div class="form-group">
{{ form.state.label(class="form-control-label") }}
{% if form.state.errors %}
{{ form.state(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.state.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.state(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- city of the company-->
<div class="form-group">
{{ form.city.label(class="form-control-label") }}
{% if form.city.errors %}
{{ form.city(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.city.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.city(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Postal Code of the company -->
<div class="form-group">
{{ form.post.label(class="form-control-label") }}
{% if form.post.errors %}
{{ form.post(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.post.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.post(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- state of the company-->
<div class="form-group">
{{ form.state.label(class="form-control-label") }}
{% if form.state.errors %}
{{ form.state(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.state.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.state(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Country of the company -->
<div class="form-group">
{{ form.country.label(class="form-control-label") }}
{% if form.country.errors %}
{{ form.country(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.country.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.country(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Postal Code of the company -->
<div class="form-group">
{{ form.post.label(class="form-control-label") }}
{% if form.post.errors %}
{{ form.post(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.post.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.post(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Country of the company -->
<div class="form-group">
{{ form.country.label(class="form-control-label") }}
{% if form.country.errors %}
{{ form.country(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.country.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.country(class="form-control form-control-lg") }}
{% endif %}
</div>
</fieldset>
<!-- Submit Button -->
<div class="form-group">
{{ form.submit(class="btn btn-outline-info") }}
</div>
</form>
</div>
{% endblock content %}

@ -12,10 +12,9 @@
<title> MiniBase </title>
{% endif %}
</head>
<body style="{{ theme.layoutBgColor }};">
<nav class="navbar navbar-expand-lg" style="{{ theme.layoutNavbarBgColor }}">
<a class="navbar-brand" style="color: {{ theme.orange }};" href="#">MiniBase</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
@ -36,8 +35,8 @@
<a class="dropdown-item" href="{{ url_for('company.company_register') }}">Register Company</a>
<a class="dropdown-item" href="#">Update Company</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Register Contact</a>
<a class="dropdown-item" href="#">Update Contact</a>
<a class="dropdown-item" href="{{ url_for('person.person_register') }}">Register Person</a>
<a class="dropdown-item" href="#">Update Person</a>
</div>
<li class="nav-item"><a class="nav-link" href="{{ url_for('main.customer') }}">Custommer</a></li>
@ -46,11 +45,12 @@
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">User Management</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ url_for('administration.administration_company_legal_entity') }}">Company Regiters Legal Entity</a>
<a class="dropdown-item" href="{{ url_for('administration.administration_company_relation') }}">Company Register Relation</a>
<a class="dropdown-item" href="{{ url_for('administration.administration_company_industry') }}">Company Register Industry</a>
<a class="dropdown-item" href="{{ url_for('admin.company_register_legal_entity') }}">Company Regiters Legal Entity</a>
<a class="dropdown-item" href="{{ url_for('admin.company_register_relation') }}">Company Register Relation</a>
<a class="dropdown-item" href="{{ url_for('admin.company_register_industry') }}">Company Register Industry</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Contact Attributes</a>
<a class="dropdown-item" href="{{ url_for('admin.person_register_role') }}">Person Register Role</a>
<a class="dropdown-item" href="{{ url_for('admin.person_register_competence') }}">Person Register Competence</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Countries</a>
<div class="dropdown-divider"></div>
@ -59,28 +59,6 @@
<li class="nav-item"><a class="nav-link" href="{{ url_for('main.customer') }}">Custommer</a></li>
<li class="nav-item"><a class="nav-link" href="#">Projects</a></li>
<!-- If not then -->
{% else %}
<li class="nav-item"><a class="nav-link disabled" href="#">Overwiev</a></li>
<li class="nav-item"><a class="nav-link disabled" href="#">Projects</a></li>
<li class="nav-item"><a class="nav-link disabled" href="#">Custommer</a></li>
<li class="nav-item"><a class="nav-link disabled" href="#">Manufacturer</a></li>
<li class="nav-item"><a class="nav-link disabled" href="#">Messages</a></li>
<li class="nav-item"><a class="nav-link disabled" href="#">FuP</a></li>
<li class="nav-item"><a class="nav-link disabled" href="#">Contacts</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle disabled" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Search By</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Project Name</a>
<a class="dropdown-item" href="#">Customer Name</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Project ID</a>
<a class="dropdown-item" href="#">Customer ID</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Cutsom Options</a>
</div>
</li>
<!-- End -->
{% endif %}
</ul>
<ul class="navbar-nav ml-auto">

@ -0,0 +1,198 @@
{% extends "layout.html" %}
{% block content %}
<div class="{{ theme.userInputDivClass }}" style="{{ theme.userInputFormColor }}">
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group">
<legend class="border-bottom mb-4">Register Person</legend>
<!-- name of the person-->
<div class="form-group">
{{ form.name.label(class="form-control-label") }}
{% if form.name.errors %}
{{ form.name(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.name.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.name(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- last_name of the person-->
<div class="form-group">
{{ form.last_name.label(class="form-control-label") }}
{% if form.last_name.errors %}
{{ form.last_name(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.last_name.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.last_name(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Company of the person -->
<div class="form-group">
{{ form.company_id.label(class="form-control-label") }}
{% if form.company_id.errors %}
{{ form.company_id(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.company_id.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.company_id(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Role on the company no of the person -->
<div class="form-group">
{{ form.role_id.label(class="form-control-label") }}
{% if form.role_id.errors %}
{{ form.role_id(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.role_id.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.role_id(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Competence on the company no of the person -->
<div class="form-group">
{{ form.competence_id.label(class="form-control-label") }}
{% if form.competence_id.errors %}
{{ form.competence_id(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.competence_id.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.competence_id(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- date_of_birth of the person to us-->
<div class="form-group">
{{ form.date_of_birth.label(class="form-control-label") }}
{% if form.date_of_birth.errors %}
{{ form.date_of_birth(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.date_of_birth.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.date_of_birth(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- mail_prof of the person-->
<div class="form-group">
{{ form.mail_prof.label(class="form-control-label") }}
{% if form.mail_prof.errors %}
{{ form.mail_prof(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.mail_prof.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.mail_prof(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- mail_priv of the person -->
<div class="form-group">
{{ form.mail_priv.label(class="form-control-label") }}
{% if form.mail_priv.errors %}
{{ form.mail_priv(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.mail_priv.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.mail_priv(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Fix professional tel no of the person-->
<div class="form-group">
{{ form.tel_prof_fix.label(class="form-control-label") }}
{% if form.tel_prof_fix.errors %}
{{ form.tel_prof_fix(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.tel_prof_fix.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.tel_prof_fix(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Mobile professional number of the person-->
<div class="form-group">
{{ form.tel_prof_mobile.label(class="form-control-label") }}
{% if form.tel_prof_mobile.errors %}
{{ form.tel_prof_mobile(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.tel_prof_mobile.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.tel_prof_mobile(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Private fix Tel Number of the person -->
<div class="form-group">
{{ form.tel_priv_fix.label(class="form-control-label") }}
{% if form.tel_priv_fix.errors %}
{{ form.tel_priv_fix(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.tel_priv_fix.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.tel_priv_fix(class="form-control form-control-lg") }}
{% endif %}
</div>
<!-- Private Tel no of the person -->
<div class="form-group">
{{ form.tel_priv_mobile.label(class="form-control-label") }}
{% if form.tel_priv_mobile.errors %}
{{ form.tel_priv_mobile(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.tel_priv_mobile.errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.tel_priv_mobile(class="form-control form-control-lg") }}
{% endif %}
</div>
</fieldset>
<!-- Submit Button -->
<div class="form-group">
{{ form.submit(class="btn btn-outline-info") }}
</div>
</form>
</div>
{% endblock content %}
Loading…
Cancel
Save