Finihsed with Products database and admin

master
Kerem Yollu 2 years ago
parent 5d3b3b4a82
commit 1fd231a1a7

@ -0,0 +1,269 @@
from minibase.database.models import Company, Company_relation, Company_legal_entity
from minibase.database.models import Industry, Countries
from minibase.database.models import Person, Person_role, Person_competence
from minibase.database.models import Project, Project_element
from minibase import db
from numpy import genfromtxt
# 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 Industry
# Note that the formating is done during the SQLAlchemy Table declaration.
def company_industry_choices():
choices = 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 = 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
###################################################################################################
# CSV manipulation
###################################################################################################
def openCsv(filename):
data = genfromtxt(filename,
delimiter=',',
skip_header=1,
dtype=None,
encoding='UTF-8')
return data.tolist()
def db_add_name_and_description(csv, table):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = table(**{
'name': i[0],
'description': i[1]})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except:
db.session.rollback() # Rollback the changes on error
print("Error Ocured during <<NAME AND DESCRIPTION>> upload to DB")
def db_add_company(csv):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = Company(**{
'name': i[0],
'legal_entity_id': i[1],
'relation_id': i[2],
'industry_id': i[3],
'status_id': i[4],
'website': i[5],
'street_bill': i[6],
'street_no_bill': i[7],
'city_bill': i[8],
'post_code_bill': i[9],
'state_bill': i[10],
'country_bill': i[11],
'street_ship': i[12],
'street_no_ship': i[13],
'city_ship': i[14],
'post_code_ship': i[15],
'state_ship': i[16],
'country_ship': i[17]})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print("Error Ocured during <<COMPANY>> upload to DB")
print(error)
def db_add_person(csv):
try:
csv_list = openCsv(csv)
print(csv_list)
for i in csv_list:
record = Person(**{
'name': i[0],
'last_name': i[1],
'company_id': i[2],
'role_id': i[3],
'competence_id': i[4],
'mail_prof': i[5],
'mail_priv': i[6],
'tel_prof_mobile': i[7],
'street_name': i[8],
'street_no': i[9],
'city': i[10],
'post_code': i[11],
'state': i[12],
'country': i[13]
})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print("Error Ocured during <<PERSON>> upload to DB")
print(error)
def db_add_project(csv):
try:
csv_list = openCsv(csv)
print(csv_list)
for i in csv_list:
record = Project(**{
'name': i[0],
'description': i[1],
'company_id': i[2],
'status_id': i[3],
'industry_id': i[4],
'owner_id': i[5],
'qte_prototype': i[6],
'qte_start': i[7],
'qte_production': i[8],
})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print(csv)
print("Error Ocured during <<PROJECT>> upload to DB")
print(error)
def db_add_project_element(csv):
try:
csv_list = openCsv(csv)
print(csv_list)
for i in csv_list:
record = Project_element(**{
'name': i[0],
'description': i[1],
'qte_per_project': i[2],
'project_id': i[3],
'owner_id': i[4],
'status_id': i[5],
})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print(csv)
print("Error Ocured during <<PROJECT ELEMENT>> upload to DB")
print(error)

@ -1,12 +1,15 @@
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, ValidationError
from minibase.database.models import Person_role
from minibase.database.models import Company_legal_entity, Company_relation
from minibase.database.models import Industry
from minibase.database.models import Person_role, Person_competence
from minibase.database.models import Company_legal_entity, Company_relation, Company_status
from minibase.database.models import Industry, Note_status
from minibase.database.models import Project_status
from minibase.database.models import Product_status, Product_physical, Product_packaging, Product_eligibility, Product_classification, Product_domain, Product_category, Product_sub_category
import minibase.admin.utils as adminUtils
class compIndustryForm(FlaskForm): # Defines the form class to be used for the user registretion
class industryRegisterForm(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()])
@ -14,8 +17,7 @@ class compIndustryForm(FlaskForm): # Defines the form class to be used for the
# Queries to be made in order to validate the form : If Relation Type exitst # Case Insensistive
def validate_name(self, name):
industry_query = Industry.query.filter(Industry.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if industry_query:
if adminUtils.doesNameExistsCi(Product_status, name.data):
raise ValidationError('That Industry Type is already registered')
@ -23,38 +25,46 @@ class compRelationForm(FlaskForm): # Defines the form class to be used for the
# 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')
submit = SubmitField('Register Company 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')
if adminUtils.doesNameExistsCi(Company_relation, name.data):
raise ValidationError('That Company 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')
submit = SubmitField('Register Company 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')
if adminUtils.doesNameExistsCi(Company_legal_entity, name.data):
raise ValidationError('That Company Legal Entity is already registered')
class compStatusForm(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 Company Status')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Company_status, name.data):
raise ValidationError('That Company Status 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')
submit = SubmitField('Register Person 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:
if adminUtils.doesNameExistsCi(Person_role, name.data):
raise ValidationError('That Person Role is already registered')
@ -62,23 +72,105 @@ class personCompetenceForm(FlaskForm): # Defines the form class to be used for
# 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')
submit = SubmitField('Register Person Competence')
# 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:
if adminUtils.doesNameExistsCi(Person_competence, name.data):
raise ValidationError('That Person Conpetence is already registered')
class statusRegisterForm(FlaskForm): # Defines the form class to be used for the user registretion
class noteStatusForm(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 Note Status')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Note_status, name.data):
raise ValidationError('That Note Status is already registered')
class projectStatusForm(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 Project Status')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Project_status, name.data):
raise ValidationError('That Project Status is already registered')
class productStatusForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Product Status')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Product_status, name.data):
raise ValidationError('That Product Status is already registered')
class productEligibilityForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Product Eligibility')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Product_eligibility, name.data):
raise ValidationError('That Product Eligibility is already registered')
class productDomainForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Product Domain')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Product_domain, name.data):
raise ValidationError('That Product domain is already registered')
class productClassificationForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Prodcut Classification')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Product_classification, name.data):
raise ValidationError('That Product Classification is already registered')
class productCategoryForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Product Category')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
if adminUtils.doesNameExistsCi(Product_category, name.data):
raise ValidationError('That Product Category is already registered')
class productSubCategoryForm(FlaskForm):
# Decalarion of the fields for the form and it's propereties
name = StringField('Name', validators=[DataRequired()])
description = StringField('Description', validators=[DataRequired()])
submit = SubmitField('Register Status')
submit = SubmitField('Register Product Sub Category')
# Queries to be made in order to validate the form : If Person Role exitst # Case Insensistive
def validate_name(self, name):
person_competence_query = Status.query.filter(Status.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if person_competence_query:
raise ValidationError('That Status is already registered')
if adminUtils.doesNameExistsCi(Product_sub_category, name.data):
raise ValidationError('That Product Sub Category is already registered')

@ -1,165 +1,414 @@
from flask import render_template, url_for, flash, redirect, request, Blueprint
from minibase import db
from minibase.config import themeMinibase
from minibase.database.models import Company, Company_legal_entity, Company_relation
from minibase.database.models import Industry
from minibase.database.models import Company, Company_legal_entity, Company_relation,Company_status
from minibase.database.models import Industry, Note_status
from minibase.database.models import Person_role, Person_competence
from minibase.admin.forms import compLegalEntityForm, compRelationForm, compIndustryForm,personRoleForm, personCompetenceForm, statusRegisterForm
from minibase.database.models import Product_status, Product_physical, Product_packaging, Product_eligibility, Product_classification, Product_domain, Product_category, Product_sub_category
from minibase.admin.forms import compLegalEntityForm, compRelationForm, compStatusForm
from minibase.admin.forms import personRoleForm, personCompetenceForm
from minibase.admin.forms import industryRegisterForm, noteStatusForm
from minibase.admin.forms import projectStatusForm
from minibase.admin.forms import productStatusForm, productEligibilityForm, productDomainForm, productClassificationForm, productCategoryForm, productSubCategoryForm
# Declaring a blueprint
admin = Blueprint('admin', __name__)
@admin.route("/company_register_legal_entity", methods=['GET', 'POST'])
def company_register_legal_entity():
toPrint = "Company Legal Entity"
form = compLegalEntityForm()
legal_entities = Company_legal_entity.query.order_by(Company_legal_entity.name.asc())
query = Company_legal_entity.query.order_by(Company_legal_entity.name.asc())
if form.validate_on_submit():
companyLegal = Company_legal_entity(
dbRow = 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.add(dbRow)
db.session.commit()
flash(f'{"Company Legal Entity registered!"}', 'success')
return render_template('admin/company_register_legal_entity.html',
title='Register Company Legal Entity',
legal_entities=legal_entities,
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/company_register_legal_entity.html',
title='Register Company Legal Entity',
legal_entities=legal_entities,
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/company_register_relation", methods=['GET', 'POST'])
def company_register_relation():
toPrint = "Company Relation"
form = compRelationForm()
relations = Company_relation.query.order_by(Company_relation.name.asc())
query = Company_relation.query.order_by(Company_relation.name.asc())
if form.validate_on_submit():
companyRelation = Company_relation(
dbRow = 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.add(dbRow)
db.session.commit()
flash(f'{"Company Relation registered!"}', 'success')
return render_template('admin/company_register_relation.html',
title='Register Company Relation',
relations=relations,
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/company_register_relation.html',
title='Register Company Relation',
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
relations=relations,
form=form)
@admin.route("/company_register_industry", methods=['GET', 'POST'])
def company_register_industry():
form = compIndustryForm()
industries = Industry.query.order_by(Industry.name.asc())
@admin.route("/company_register_status", methods=['GET', 'POST'])
def company_register_status():
toPrint = "Company Status"
form = compStatusForm()
query = Company_status.query.order_by(Company_status.name.asc())
if form.validate_on_submit():
companyIndustry = Industry(
dbRow = Company_status(
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.add(dbRow)
db.session.commit()
flash(f'{"Company Idustry registered!"}', 'success')
return render_template('admin/company_register_industry.html',
title='Register Company Industry',
industries=industries,
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/company_register_industry.html',
title='Register Company Industry',
industries=industries,
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/register_industry", methods=['GET', 'POST'])
def register_industry():
toPrint = "Company Industry"
form = industryRegisterForm()
query = Industry.query.order_by(Industry.name.asc())
if form.validate_on_submit():
dbRow = 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(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/person_register_role", methods=['GET', 'POST'])
def person_register_role():
toPrint = "Person Role"
form = personRoleForm()
roles = Person_role.query.order_by(Person_role.name.asc())
query = Person_role.query.order_by(Person_role.name.asc())
if form.validate_on_submit():
personRole = Person_role(
dbRow = 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.add(dbRow)
db.session.commit()
flash(f'{"Person Role registered!"}', 'success')
return render_template('admin/person_register_role.html',
title='Register Person_role',
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
roles=roles,
form=form)
return render_template('admin/person_register_role.html',
title='Register Person Role',
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
roles=roles,
form=form)
@admin.route("/person_register_competence", methods=['GET', 'POST'])
def person_register_competence():
toPrint = "Person Competence"
form = personCompetenceForm()
competences = Person_competence.query.order_by(Person_competence.name.asc())
query = Person_competence.query.order_by(Person_competence.name.asc())
if form.validate_on_submit():
personCompetence = Person_competence(
dbRow = 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.add(dbRow)
db.session.commit()
flash(f'{"Person Competence registered!"}', 'success')
return render_template('admin/person_register_competence.html',
title='Register Person Competence',
competences=competences,
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/person_register_competence.html',
title='Register Person Competence',
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
competences=competences,
form=form)
@admin.route("/status_register", methods=['GET', 'POST'])
def status_register():
form = statusRegisterForm()
statuses = Status.query.order_by(Status.name.asc())
@admin.route("/note_register_status", methods=['GET', 'POST'])
def note_register_status():
toPrint = "Note Status"
form = noteStatusForm()
query = Note_status.query.order_by(Note_status.name.asc())
if form.validate_on_submit():
statusRegister = Status(
dbRow = Company_status(
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(statusRegister)
db.session.add(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/project_register_status", methods=['GET', 'POST'])
def project_register_status():
toPrint = "Project Status"
form = projectStatusForm()
query = Project_status.query.order_by(Project_status.name.asc())
if form.validate_on_submit():
dbRow = Project_status(
name=form.name.data,
description=form.description.data)
db.session.add(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/product_register_status", methods=['GET', 'POST'])
def product_register_status():
toPrint = "Product Status"
form = productStatusForm()
query = Product_status.query.order_by(Product_status.name.asc())
if form.validate_on_submit():
dbRow = Product_status(
name=form.name.data,
description=form.description.data)
db.session.add(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/product_register_eligibility", methods=['GET', 'POST'])
def product_register_eligibility():
toPrint = "Product Eligibility"
form = productEligibilityForm()
query = Product_eligibility.query.order_by(Product_eligibility.name.asc())
if form.validate_on_submit():
dbRow = Product_eligibility(
name=form.name.data,
description=form.description.data)
db.session.add(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/product_register_domain", methods=['GET', 'POST'])
def product_register_domain():
toPrint = "Product Domain"
form = productEligibilityForm()
query = Product_domain.query.order_by(Product_domain.name.asc())
if form.validate_on_submit():
dbRow = Product_domain(
name=form.name.data,
description=form.description.data)
db.session.add(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/product_register_classification", methods=['GET', 'POST'])
def product_register_classification():
toPrint = "Product Classification"
form = productEligibilityForm()
query = Product_classification.query.order_by(Product_classification.name.asc())
if form.validate_on_submit():
dbRow = Product_classification(
name=form.name.data,
description=form.description.data)
db.session.add(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/product_register_category", methods=['GET', 'POST'])
def product_register_category():
toPrint = "Product Category"
form = productEligibilityForm()
query = Product_category.query.order_by(Product_category.name.asc())
if form.validate_on_submit():
dbRow = Product_category(
name=form.name.data,
description=form.description.data)
db.session.add(dbRow)
db.session.commit()
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
@admin.route("/product_register_sub_category", methods=['GET', 'POST'])
def product_register_sub_category():
toPrint = "Product Sub Category"
form = productEligibilityForm()
query = Product_sub_category.query.order_by(Product_sub_category.name.asc())
if form.validate_on_submit():
dbRow = Product_sub_category(
name=form.name.data,
description=form.description.data)
db.session.add(dbRow)
db.session.commit()
flash(f'{"New Status registered!"}', 'success')
return render_template('admin/status_register.html',
title='Register Status',
statuses=statuses,
flash(f' {toPrint} {" registered!"}', 'success')
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)
return render_template('admin/status_register.html',
title='Register Status',
statuses=statuses,
return render_template('admin/register_name_and_desc.html',
title='Register ' + toPrint,
tableTitle='Existing ' + toPrint,
dbTable=query,
theme=themeMinibase,
form=form)

@ -1 +1,6 @@
def doesNameExistsCi(table, name):
exists = table.query.filter(table.name.ilike(name.data)).first() # Database Querry ilike means case insessitive
if exists:
return 1
return 0

@ -0,0 +1,5 @@
name,legal_entity_id,relation_id,industry_id,status_id,website,street_bill,street_no_bill,city_bill,post_code_bill,state_bill,country_bill,street_ship,street_no_ship,city_ship,post_code_ship,state_ship,country_ship
Steinel,1,1,1,1,www.steinel.ch,Almeinstrasse,10,Einsiedeln,8406,Schwyz,Switzerland,Almeinstrasse,10,Einsiedeln,8406,Schwyz,Switzerland
Kynsight,2,2,3,1,www.kynsight.com,Meierackerestrasse,10,Uster,8610,Zürich,Switzerland,Meierackerestrasse,10,Uster,8610,Zürich,Switzerland
V-zug,3,1,2,1,www.v-zug.com,Industriestrasse,66,Zug,6302,Zug,Switzerland,Industriestrasse,66,Zug,6302,Zug,Switzerland
Stmicroelectronics,1,2,1,1,www.stm.com,Champ-des-Filles,39,Plan-les-Ouates,1228,Geneva,Switzerland,Champ-des-Filles,39,Plan-les-Ouates,1228,Geneva,Switzerland
1 name legal_entity_id relation_id industry_id status_id website street_bill street_no_bill city_bill post_code_bill state_bill country_bill street_ship street_no_ship city_ship post_code_ship state_ship country_ship
2 Steinel 1 1 1 1 www.steinel.ch Almeinstrasse 10 Einsiedeln 8406 Schwyz Switzerland Almeinstrasse 10 Einsiedeln 8406 Schwyz Switzerland
3 Kynsight 2 2 3 1 www.kynsight.com Meierackerestrasse 10 Uster 8610 Zürich Switzerland Meierackerestrasse 10 Uster 8610 Zürich Switzerland
4 V-zug 3 1 2 1 www.v-zug.com Industriestrasse 66 Zug 6302 Zug Switzerland Industriestrasse 66 Zug 6302 Zug Switzerland
5 Stmicroelectronics 1 2 1 1 www.stm.com Champ-des-Filles 39 Plan-les-Ouates 1228 Geneva Switzerland Champ-des-Filles 39 Plan-les-Ouates 1228 Geneva Switzerland

@ -0,0 +1,9 @@
name,description
AG,Aktiengesellschaft
GmbH,Gesellschaft mit beschränkter Haftung
SA,Société anonyme
SARL,Société à responsabilité limitée
EINZEL F.,Einzelfirma
KOLLEKTIV,Kollektivgesellschaft
E. INDIVIDIUEL,Entreprise individuel
COLLECTIF,Société en nom collectif
1 name description
2 AG Aktiengesellschaft
3 GmbH Gesellschaft mit beschränkter Haftung
4 SA Société anonyme
5 SARL Société à responsabilité limitée
6 EINZEL F. Einzelfirma
7 KOLLEKTIV Kollektivgesellschaft
8 E. INDIVIDIUEL Entreprise individuel
9 COLLECTIF Société en nom collectif

@ -0,0 +1,5 @@
name,description
Customer,Buying company
Supplier,Selling company
Producer,Main producer may sell directly or trough a second channel
Collaborator,Whith whom we work together. Buying and Selling
1 name description
2 Customer Buying company
3 Supplier Selling company
4 Producer Main producer may sell directly or trough a second channel
5 Collaborator Whith whom we work together. Buying and Selling

@ -0,0 +1,5 @@
name,description
Activ,Actively making business
Closed,Out ob business
Bankrupt,Went bankrupt
Ignoring,Company with whom we dont want to do business
1 name description
2 Activ Actively making business
3 Closed Out ob business
4 Bankrupt Went bankrupt
5 Ignoring Company with whom we don’t want to do business

@ -0,0 +1,8 @@
name,description
Industrial,Active in industrial area tend to ask for long life components
Medical,Very long engineering time. Life sensitive devices may be prone to get rejects from certain manufactures
Consumer,High volume and short life cycles
Defence,May not be subjected to the same restrictions as Military but please discuss it with manufacturers.
Military,The most difficult type of customer as many manufacturers does not desire to work with them
Automotive,High volumes High life cycle
Aerospatial,Low volume very long lifecycles and price does rarely play a role
1 name description
2 Industrial Active in industrial area tend to ask for long life components
3 Medical Very long engineering time. Life sensitive devices may be prone to get rejects from certain manufactures
4 Consumer High volume and short life cycles
5 Defence May not be subjected to the same restrictions as Military but please discuss it with manufacturers.
6 Military The most difficult type of customer as many manufacturers does not desire to work with them
7 Automotive High volumes High life cycle
8 Aerospatial Low volume very long lifecycles and price does rarely play a role

@ -253,6 +253,7 @@ class Company(db.Model):
employees = db.relationship('Person', backref='employer', lazy=True)
projects = db.relationship('Project', backref='belongs_to', lazy=True)
notes = db.relationship('Company_note', backref='company', lazy=True)
products = db.relationship('Product', backref='manufacturer', lazy=True)
# returns a more information-rich, or official, string representation of an object
@ -334,11 +335,11 @@ class Project_element(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(100), nullable=False)
description = db.Column(db.String(300), nullable=False)
qte_per_project = db.Column(db.Integer, nullable=False, default='0')
qte_per_project = db.Column(db.Integer, nullable=False, default='1')
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)
project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True)
project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=False)
owner_id = db.Column(db.Integer, db.ForeignKey('person.id'), nullable=False)
status_id = db.Column(db.Integer, db.ForeignKey('project_status.id'), nullable=False)
@ -366,9 +367,11 @@ class Project_status(db.Model):
class Product(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(100), nullable=False)
ordering_code = db.Column(db.String(100), nullable=False)
buy_cost = db.Column(db.Float, nullable=False)
comment = db.Column(db.String(300), nullable=False)
comment_manufacturer = db.Column(db.String(300), nullable=False)
comment = db.Column(db.String(300), nullable=True)
comment_manufacturer = db.Column(db.String(300), nullable=True)
currency = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), nullable=False)
last_time_buy_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
@ -377,26 +380,30 @@ class Product(db.Model):
minimum_order_quantity = db.Column(db.Integer, nullable=False)
minimum_quote_quantity = db.Column(db.Integer, nullable=False)
obsolete_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
ordering_code = db.Column(db.String(100), nullable=False)
pollution_level = db.Column(db.String(50), nullable=True)
price_change_flag = db.Column(db.Boolean, nullable=False, default='0')
pricing_scheme = db.Column(db.String(300), nullable=False)
proposed_margin = db.Column(db.Float, nullable=False)
price_change_flag = db.Column(db.Boolean, nullable=False, default=False)
proposed_margin = db.Column(db.Float, nullable=True)
production_country = db.Column(db.String(75), nullable=True, default='')
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)
classification_id = db.Column(db.Integer, db.ForeignKey('product_classification.id'), nullable=True)
domain_id = db.Column(db.Integer, db.ForeignKey('product_domain.id'), nullable=True)
category_id = db.Column(db.Integer, db.ForeignKey('product_category.id'), nullable=True)
sub_category_id = db.Column(db.Integer, db.ForeignKey('product_sub_category.id'), nullable=True)
status_id = db.Column(db.Integer, db.ForeignKey('product_status.id'), nullable=False)
classification_id = db.Column(db.Integer, db.ForeignKey('product_classification.id'), nullable=False)
packaging_id = db.Column(db.Integer, db.ForeignKey('product_packaging.id'), nullable=False)
physical_id = db.Column(db.Integer, db.ForeignKey('product_physical.id'), nullable=False)
eligibility_id = db.Column(db.Integer, db.ForeignKey('product_eligibility.id'), nullable=False)
packaging_id = db.Column(db.Integer, db.ForeignKey('product_packaging.id'), nullable=True)
physical_id = db.Column(db.Integer, db.ForeignKey('product_physical.id'), nullable=True)
manufacturer_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
class Product_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)
products = db.relationship('Product', backref='status', lazy=True)
@ -405,6 +412,18 @@ class Product_status(db.Model):
return f"{self.name}"
class Product_eligibility(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)
products = db.relationship('Product', backref='eligibility', lazy=True)
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"{self.name}"
class Product_classification(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False)
@ -417,13 +436,48 @@ class Product_classification(db.Model):
return f"{self.name}"
class Product_domain(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)
products = db.relationship('Product', backref='domain', lazy=True)
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"{self.name}"
class Product_category(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)
products = db.relationship('Product', backref='category', lazy=True)
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"{self.name}"
class Product_sub_category(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)
products = db.relationship('Product', backref='sub_category', lazy=True)
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"{self.name}"
class Product_packaging(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)
unit = db.Column(db.Integer)
quantity = db.Column(db.Integer)
total = db.Column(db.Integer)
products = db.relationship('Product', backref='packaging', lazy=True)
@ -436,23 +490,14 @@ class Product_physical(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)
image_file = db.Column(db.String(20), nullable=False, default='default_company.jpg')
image_file = db.Column(db.String(20), nullable=False, default='default_product.jpg')
pitch_x = db.Column(db.Float, nullable=True)
pitch_y = db.Column(db.Float, nullable=True)
size_x = db.Column(db.Float, nullable=True)
size_y = db.Column(db.Float, nullable=True)
size_z = db.Column(db.Float, nullable=True)
type = db.Column(db.String(50), nullable=False)
products = db.relationship('Product', backref='physical', lazy=True)
# returns a more information-rich, or official, string representation of an object
def __repr__(self):
return f"{self.name}"
'''
physical (MUL, int)
container (varchar)
favourite (tinyint, NULL, nullable)
manufacturer (varchar)
production_site (varchar)
'''

@ -0,0 +1,5 @@
name,description
Open,Open and need action
Pending,Pending We are waiting on someone
Done,Done we have solved the issue
Closed,Closed as no action is required anymore
1 name description
2 Open Open and need action
3 Pending Pending We are waiting on someone
4 Done Done we have solved the issue
5 Closed Closed as no action is required anymore

@ -0,0 +1,3 @@
name,last_name,company_id,role_id,competence_id,mail_prof,mail_priv,tel_prof_mobile,street_name,street_no,city,post_code,state,country
Kerem,Yollu,2,3,1,kerem.yollu_at_kynsight.com,kerem.yollu@gmail.com,41789716697,Meierackerstrasse,10,Uster,8610,Zürich,Switzerland
Stefan,Walker,1,2,2,stefan.walker_at_steinel.ch,stefan.walker@gmail.com,41789716697,Almeinderstrasse,10,Einsiedeln,8410,Schwyz,Switzerland
1 name last_name company_id role_id competence_id mail_prof mail_priv tel_prof_mobile street_name street_no city post_code state country
2 Kerem Yollu 2 3 1 kerem.yollu_at_kynsight.com kerem.yollu@gmail.com 41789716697 Meierackerstrasse 10 Uster 8610 Zürich Switzerland
3 Stefan Walker 1 2 2 stefan.walker_at_steinel.ch stefan.walker@gmail.com 41789716697 Almeinderstrasse 10 Einsiedeln 8410 Schwyz Switzerland

@ -0,0 +1,6 @@
name,description
Embedded Software,Embedded Software
Embedded Hardware,Embedded Hardware
Hardware,Electronics Hardware
Software,Electronics Software
Mechanical,Mechanical Engineer
1 name description
2 Embedded Software Embedded Software
3 Embedded Hardware Embedded Hardware
4 Hardware Electronics Hardware
5 Software Electronics Software
6 Mechanical Mechanical Engineer

@ -0,0 +1,12 @@
name,description
Engineer,An engineer in any domain
Engineering Manager,Engineering Responsible
Sales,Too much blabla
Sales Manager,Manages sales
Purchasing,Purchases required Material
Purchasing Manager,Manages purchasing team
Purchasing Strategical,Strategically Purchases required Materials on specific domain
CEO,Chief Executive Officer
CTO,Chief Technology Officer
Human Resources,Human Trafikers
Secretary,Knows Everything
1 name description
2 Engineer An engineer in any domain
3 Engineering Manager Engineering Responsible
4 Sales Too much blabla
5 Sales Manager Manages sales
6 Purchasing Purchases required Material
7 Purchasing Manager Manages purchasing team
8 Purchasing Strategical Strategically Purchases required Materials on specific domain
9 CEO Chief Executive Officer
10 CTO Chief Technology Officer
11 Human Resources Human Trafikers
12 Secretary Knows Everything

@ -0,0 +1,3 @@
name,ordering_code,buy_cost,currency,description,lead_time_days,minimum_awarding_quantity,minimum_order_quantity,minimum_quote_quantity,classification_id,domain_id,category_id,sub_category_id,status_id,eligibility_id,packaging_id,physical_id,manufacturer_id
SMT32F031FQH,SMT32F031FQH,3,USD,SMT32F031FQH MCU,64,1000,500,500,1,1,1,1,1,1,1,1,3
SMT32F456QQA,SMT32F456QQA,10,USD,SMT32F456QQA MCU,180,1000,250,250,2,2,2,2,2,2,2,2,3
1 name ordering_code buy_cost currency description lead_time_days minimum_awarding_quantity minimum_order_quantity minimum_quote_quantity classification_id domain_id category_id sub_category_id status_id eligibility_id packaging_id physical_id manufacturer_id
2 SMT32F031FQH SMT32F031FQH 3 USD SMT32F031FQH MCU 64 1000 500 500 1 1 1 1 1 1 1 1 3
3 SMT32F456QQA SMT32F456QQA 10 USD SMT32F456QQA MCU 180 1000 250 250 2 2 2 2 2 2 2 2 3

@ -0,0 +1,10 @@
mane,description
Transistor,A transistor is a miniature semiconductor that regulates or controls current or voltage flow in addition amplifying and generating these electrical signals and acting as a switch/gate for them.
Op-amp ,A op-amp is an analog circuit block that takes a differential voltage input and produces a single-ended voltage output
MCU,A microcontroller (μC) or microcontroller unit (MCU) is a small computer on a single integrated circuit.
FPGA,Field Programmable Gate Arrays
CPLD,A Complex Programmable Logic Device
Resistor,Resistor
Connector,Connector
Cable,Cable
Logic,Logic
1 mane description
2 Transistor A transistor is a miniature semiconductor that regulates or controls current or voltage flow in addition amplifying and generating these electrical signals and acting as a switch/gate for them.
3 Op-amp A op-amp is an analog circuit block that takes a differential voltage input and produces a single-ended voltage output
4 MCU A microcontroller (μC) or microcontroller unit (MCU) is a small computer on a single integrated circuit.
5 FPGA Field Programmable Gate Arrays
6 CPLD A Complex Programmable Logic Device
7 Resistor Resistor
8 Connector Connector
9 Cable Cable
10 Logic Logic

@ -0,0 +1,6 @@
name,description
Passive,Passive components like resistors
Active ,Active components like transistors of op-amps
Electromechanical,Electromechanical components like connectors
Mechanical,Purely Mechanical components like PCB or housings
Hardware,general hardware like Screws and so
1 name description
2 Passive Passive components like resistors
3 Active Active components like transistors of op-amps
4 Electromechanical Electromechanical components like connectors
5 Mechanical Purely Mechanical components like PCB or housings
6 Hardware general hardware like Screws and so

@ -0,0 +1,8 @@
name,description
Power,Power Components like IGBTs
Precision,Precision Components like precision op-amps
Ev-Charging,Components for ev-chaging like charging cables
Security,Security Components like e-fuses
Programmable,Programmable Components
High speed,High speed relevant components rj45 and os on
Radio,telecommunication components
1 name description
2 Power Power Components like IGBTs
3 Precision Precision Components like precision op-amps
4 Ev-Charging Components for ev-chaging like charging cables
5 Security Security Components like e-fuses
6 Programmable Programmable Components
7 High speed High speed relevant components rj45 and os on
8 Radio telecommunication components

@ -0,0 +1,5 @@
name,description
Standard,Standard products do not have a pricing plan or scheme
Design Registrable,Products with special pricing schemes (manufacturer rules apply and differs for each component)
Restricted,This product is restricted to o given market or Region in the world
Mutli source,This component is produced by may manufacturers
1 name description
2 Standard Standard products do not have a pricing plan or scheme
3 Design Registrable Products with special pricing schemes (manufacturer rules apply and differs for each component)
4 Restricted This product is restricted to o given market or Region in the world
5 Mutli source This component is produced by may manufacturers

@ -0,0 +1,7 @@
name,description,unit,quantity
Tape,Taped packaging,1,1000
Reel,Reeled packaging,1,1000
Tape and Reel,Taped and Reeled packaging,1,5000
Box,Box,5,1000
Single,Single Unit,1,1
Tray,Tray units,1,250
1 name description unit quantity
2 Tape Taped packaging 1 1000
3 Reel Reeled packaging 1 1000
4 Tape and Reel Taped and Reeled packaging 1 5000
5 Box Box 5 1000
6 Single Single Unit 1 1
7 Tray Tray units 1 250

@ -0,0 +1,8 @@
name,description
SOP-18,Small-outline package
CSOP-24,Ceramic small-outline package
DSOP-18,Dual small-outline package
HSOP-32,Thermally-enhanced small-outline package
HSSOP-18,Thermally-enhanced shrink small-outline package
HTSSOP-18,Thermally-enhanced thin shrink small-outline package
MSOP-8,Mini small-outline package
1 name description
2 SOP-18 Small-outline package
3 CSOP-24 Ceramic small-outline package
4 DSOP-18 Dual small-outline package
5 HSOP-32 Thermally-enhanced small-outline package
6 HSSOP-18 Thermally-enhanced shrink small-outline package
7 HTSSOP-18 Thermally-enhanced thin shrink small-outline package
8 MSOP-8 Mini small-outline package

@ -0,0 +1,11 @@
name,description
New,Newly put on data base (Default)
Pending,Registration request sent to Manufacturer and we are waiting for an answer
Accepted,Registration was successful
Denied,Registration was denied ( Negotiation is possible)
Already registered,Competitor has it already registered
Closed,Closed by us
Rejected,Registration was rejected (no Negotiation is possible)
Fulfillment,Only a margin will be given but no registration process
Open For all,Everyone get the same margin for this component
Not Registrable,Not par of a special pricing scheme
1 name description
2 New Newly put on data base (Default)
3 Pending Registration request sent to Manufacturer and we are waiting for an answer
4 Accepted Registration was successful
5 Denied Registration was denied ( Negotiation is possible)
6 Already registered Competitor has it already registered
7 Closed Closed by us
8 Rejected Registration was rejected (no Negotiation is possible)
9 Fulfillment Only a margin will be given but no registration process
10 Open For all Everyone get the same margin for this component
11 Not Registrable Not par of a special pricing scheme

@ -0,0 +1,12 @@
name,description
Mosfet NPN,Mosfet NPN Transistor
Mosfet PNP,Mosfet PNP Transistor
Bipolar NPN,Bipolar NPN Transistor
Bipolar NPN,Bipolar NPN Transistor
Rail to Rial,Rail to Rail Op-amp
Cortex M4,Cortex M4 Core MCU
Cortex M0,Cortex M0 Core MCU
Thick film,Thick film Resistor
Thin film,Thin film Resistor
Metal film,Metal film Resistor
Carbon,Carbon Resistor
1 name description
2 Mosfet NPN Mosfet NPN Transistor
3 Mosfet PNP Mosfet PNP Transistor
4 Bipolar NPN Bipolar NPN Transistor
5 Bipolar NPN Bipolar NPN Transistor
6 Rail to Rial Rail to Rail Op-amp
7 Cortex M4 Cortex M4 Core MCU
8 Cortex M0 Cortex M0 Core MCU
9 Thick film Thick film Resistor
10 Thin film Thin film Resistor
11 Metal film Metal film Resistor
12 Carbon Carbon Resistor

@ -0,0 +1,3 @@
name,description,company_id,status_id,industry_id,owner_id,qte_prototype,qte_start,qte_production
STWA-HS,Aküsprühgerät für hautmittel,1,1,1,1,10,5000,10000
Kolibri,Shisha Heat element,2,1,2,1,5,500,1000
1 name description company_id status_id industry_id owner_id qte_prototype qte_start qte_production
2 STWA-HS Aküsprühgerät für hautmittel 1 1 1 1 10 5000 10000
3 Kolibri Shisha Heat element 2 1 2 1 5 500 1000

@ -0,0 +1,3 @@
name,description,qte_per_project,project_id,owner_id,atatus_id
Power Board,Dc-Dc regulation fo batteries,8,1,1,1
Ui,user input,1,1,1,1
1 name description qte_per_project project_id owner_id atatus_id
2 Power Board Dc-Dc regulation fo batteries 8 1 1 1
3 Ui user input 1 1 1 1

@ -0,0 +1,8 @@
name,description
Open,Ongoing project
Pending,Waiting on something
Closed,Closed project that did not go to production
Production,Is in production
Prototyping,Is in prototyping phase
End Of Life,End of Lifed projects.
Redesign,An old project being redone it must be linked to another project
1 name description
2 Open Ongoing project
3 Pending Waiting on something
4 Closed Closed project that did not go to production
5 Production Is in production
6 Prototyping Is in prototyping phase
7 End Of Life End of Lifed projects.
8 Redesign An old project being redone it must be linked to another project

@ -1,7 +1,9 @@
from minibase.database.models import Company, Company_relation, Company_legal_entity
from minibase.database.models import Industry
from minibase.database.models import Industry, Countries
from minibase.database.models import Person, Person_role, Person_competence
from minibase.database.models import Countries
from minibase.database.models import Project, Project_element, Product
from minibase import db
from numpy import genfromtxt
# Gets the id of company from the formated output defined at models.py for the Company Model
@ -17,6 +19,7 @@ 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()
@ -133,3 +136,167 @@ def country_choices():
choices = Countries.query.all()
return choices
###################################################################################################
# CSV manipulation
###################################################################################################
def openCsv(filename):
data = genfromtxt(filename,
delimiter=',',
skip_header=1,
dtype=None,
encoding='UTF-8')
return data.tolist()
def db_add_name_and_description(csv, table):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = table(**{
'name': i[0],
'description': i[1]})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print(csv)
print("Error Ocured during <<NAME AND DESCRIPTION>> upload to DB")
print(error)
def db_add_company(csv):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = Company(**{
'name': i[0],
'legal_entity_id': i[1],
'relation_id': i[2],
'industry_id': i[3],
'status_id': i[4],
'website': i[5],
'street_bill': i[6],
'street_no_bill': i[7],
'city_bill': i[8],
'post_code_bill': i[9],
'state_bill': i[10],
'country_bill': i[11],
'street_ship': i[12],
'street_no_ship': i[13],
'city_ship': i[14],
'post_code_ship': i[15],
'state_ship': i[16],
'country_ship': i[17]})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print("Error Ocured during <<COMPANY>> upload to DB")
print(error)
def db_add_person(csv):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = Person(**{
'name': i[0],
'last_name': i[1],
'company_id': i[2],
'role_id': i[3],
'competence_id': i[4],
'mail_prof': i[5],
'mail_priv': i[6],
'tel_prof_mobile': i[7],
'street_name': i[8],
'street_no': i[9],
'city': i[10],
'post_code': i[11],
'state': i[12],
'country': i[13]
})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print("Error Ocured during <<PERSON>> upload to DB")
print(error)
def db_add_project(csv):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = Project(**{
'name': i[0],
'description': i[1],
'company_id': i[2],
'status_id': i[3],
'industry_id': i[4],
'owner_id': i[5],
'qte_prototype': i[6],
'qte_start': i[7],
'qte_production': i[8]
})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print(csv)
print("Error Ocured during <<PROJECT>> upload to DB")
print(error)
def db_add_project_element(csv):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = Project_element(**{
'name': i[0],
'description': i[1],
'qte_per_project': i[2],
'project_id': i[3],
'owner_id': i[4],
'status_id': i[5]})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print(csv)
print("Error Ocured during <<PROJECT ELEMENT>> upload to DB")
print(error)
def db_add_product(csv):
try:
csv_list = openCsv(csv)
for i in csv_list:
record = Product(**{
'name': i[0],
'ordering_code': i[1],
'buy_cost': i[2],
'currency': i[3],
'description': i[4],
'lead_time_days': i[5],
'minimum_awarding_quantity': i[6],
'minimum_order_quantity': i[7],
'minimum_quote_quantity': i[8],
'classification_id': i[9],
'domain_id': i[10],
'category_id': i[11],
'sub_category_id': i[12],
'status_id': i[13],
'eligibility_id': i[14],
'packaging_id': i[15],
'physical_id': i[16],
'manufacturer_id': i[17]})
db.session.add(record) # Add all the records
db.session.commit() # Attempt to commit all the records
except Exception as error:
db.session.rollback() # Rollback the changes on error
print(csv)
print("Error Ocured during <<PROJECT ELEMENT>> upload to DB")
print(error)

@ -0,0 +1,37 @@
from flask import render_template, url_for, flash, redirect, request, Blueprint
from minibase import db
from minibase.config import themeMinibase
from minibase.database.models import Company, Company_legal_entity, Company_relation,Company_status
from minibase.database.models import Industry, Note_status
from minibase.database.models import Person_role, Person_competence
from minibase.database.models import Project_status
from minibase.admin.forms import compLegalEntityForm, compRelationForm, industryRegisterForm,personRoleForm, personCompetenceForm, compStatusForm, noteStatusForm
from minibase.admin.forms import projectStatusForm
# Declaring a blueprint
project = Blueprint('project', __name__)
@admin.route("/register", methods=['GET', 'POST'])
def register():
form = register()
legal_entities = Company_legal_entity.query.order_by(Company_legal_entity.name.asc())
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',
legal_entities=legal_entities,
theme=themeMinibase,
form=form)
return render_template('admin/company_register_legal_entity.html',
title='Register Company Legal Entity',
legal_entities=legal_entities,
theme=themeMinibase,
form=form)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -1,65 +0,0 @@
{% 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 Company Endustry</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>
<div class="container-fluid pt-2">
<h3> <a href="#"> Existing Industries</a> </h3>
<table class="{{ theme.tableClass }}">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
{% for item in industries %}
<tr>
<th scope="row">{{ item.name }}</th>
<td>{{ item.description}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}

@ -1,65 +0,0 @@
{% 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 Company Legal Entity</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>
<div class="container-fluid pt-2">
<h3> <a href="#"> Existing Legal Entities</a> </h3>
<table class="{{ theme.tableClass }}">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
{% for item in legal_entities %}
<tr>
<th scope="row">{{ item.name }}</th>
<td>{{ item.description}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}

@ -1,67 +0,0 @@
{% 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 Company Relation</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>
<div class="container-fluid pt-2">
<h3> <a href="#"> Existing Relations</a> </h3>
<table class="{{ theme.tableClass }}">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
{% for item in relations %}
<tr>
<th scope="row">{{ item.name }}</th>
<td>{{ item.description}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}

@ -1,65 +0,0 @@
{% 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>
<div class="container-fluid pt-2">
<h3> <a href="#"> Existing Competences</a> </h3>
<table class="{{ theme.tableClass }}">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
{% for item in competences %}
<tr>
<th scope="row">{{ item.name }}</th>
<td>{{ item.description}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}

@ -1,86 +0,0 @@
{% 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>
<div class="container-fluid pt-2">
<div class="container-fluid pt-2">
<h3> <a href="#"> Existing Roles</a> </h3>
<table class="{{ theme.tableClass }}">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
{% for item in roles %}
<tr>
<th scope="row">{{ item.name }}</th>
<td>{{ item.description}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<h3> <a href="#"> Existing Roles</a> </h3>
<table class="{{ theme.tableClass }}">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
{% for item in roles %}
<tr>
<th scope="row">{{ item.name }}</th>
<td>{{ item.description}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock content %}

@ -4,7 +4,7 @@
<form method="POST" action="">
{{ form.hidden_tag() }}
<fieldset class="form-group"></fieldset>
<legend class="border-bottom mb-4">Register Status</legend>
<legend class="border-bottom mb-4">{{ title }}</legend>
<!-- name of the company-->
<div class="form-group">
@ -44,7 +44,7 @@
</form>
</div>
<div class="container-fluid pt-2">
<h3> <a href="#"> Existing Statuses</a> </h3>
<h3> <a href="#"> {{ tableTitle }}</a> </h3>
<table class="{{ theme.tableClass }}">
<thead>
<tr>
@ -53,7 +53,7 @@
</tr>
</thead>
<tbody>
{% for item in statuses %}
{% for item in dbTable %}
<tr>
<th scope="row">{{ item.name }}</th>
<td>{{ item.description}}</td>

@ -47,13 +47,24 @@
<div class="dropdown-divider"></div>
<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>
<a class="dropdown-item" href="{{ url_for('admin.company_register_status') }}">Company Register Status</a>
<div class="dropdown-divider"></div>
<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>
<a class="dropdown-item" href="{{ url_for('admin.person_register_role') }}">Person Register Role</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ url_for('admin.project_register_status') }}">Project Register Status</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ url_for('admin.product_register_status') }}">Product Register Status</a>
<a class="dropdown-item" href="{{ url_for('admin.product_register_eligibility') }}">Product Register Eligibility</a>
<a class="dropdown-item" href="{{ url_for('admin.product_register_domain') }}">Product Register Domain</a>
<a class="dropdown-item" href="{{ url_for('admin.product_register_classification') }}">Product Register Classification</a>
<a class="dropdown-item" href="{{ url_for('admin.product_register_category') }}">Product Register Category</a>
<a class="dropdown-item" href="{{ url_for('admin.product_register_sub_category') }}">Product Register Sub Category</a>
<a class="dropdown-item" href="#">Product Register Physical</a>
<a class="dropdown-item" href="#">Product Register Packaging</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ url_for('admin.status_register') }}">Status Register</a>
<a class="dropdown-item" href="#">Countries</a>
<a class="dropdown-item" href="{{ url_for('admin.note_register_status') }}">Note Register Status</a>
<a class="dropdown-item" href="{{ url_for('admin.register_industry') }}">Register Industry</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Database</a>
</div>

@ -1,9 +1,10 @@
from minibase import db, create_minibase
import minibase.database.utils as dbUtils
from minibase.database.models import Person, Person_role, Person_competence, Person_note
from minibase.database.models import Company, Company_relation, Company_legal_entity, Company_note, Company_status
from minibase.database.models import Status, Industry, Note_status
from minibase.database.models import Project, Project_status, Project_element
from minibase.database.models import Product, Product_status, Project_element, Product_physical, Product_packaging
from minibase.database.models import Product, Product_status, Product_physical, Product_packaging, Product_domain, Product_eligibility, Product_category, Product_sub_category, Product_classification
app = create_minibase()
app.app_context().push()
@ -11,116 +12,21 @@ db.drop_all()
db.create_all()
###################################################################################################
industry1 = Industry(
name='Industrial',
description="Active in Industrial area")
db.session.add(industry1)
industry2 = Industry(
name='Consumer',
description="Active in Consumer area")
db.session.add(industry1)
companyRelation1 = Company_relation(
name='Customer',
description="Only Buyiong customer")
db.session.add(companyRelation1)
companyRelation2 = Company_relation(
name='Supplier',
description="Only Selling customer")
db.session.add(companyRelation2)
companyRelation3 = Company_relation(
name='Collaborator',
description="Buying and Selling customer")
db.session.add(companyRelation2)
companyLegal1 = Company_legal_entity(
name='AG',
description='AktienGezelschaft')
db.session.add(companyLegal1)
companyLegal2 = Company_legal_entity(
name='GMBH',
description='Gesellschaft mit beschränkter Haftung')
db.session.add(companyLegal2)
dbUtils.db_add_name_and_description("minibase/database/industry.csv", Industry)
###################################################################################################
companyStatus1 = Company_status(
name='Activ',
description='Company is active and business is running')
db.session.add(companyStatus1)
companyStatus2 = Company_status(
name='Bankrupt',
description='Company is bankrupt')
db.session.add(companyStatus2)
companyStatus3 = Company_status(
name='Closed',
description='Company is closed')
db.session.add(companyStatus3)
company1 = Company(
name='Steinel',
legal_entity_id='1',
relation_id='1',
industry_id='1',
status_id='1',
website='www.steinel.ch',
street_bill='Alemeinrstrasse',
street_no_bill='10',
city_bill='Einsiedeln',
post_code_bill='8406',
state_bill='Schyz',
country_bill='Switzerland',
street_ship='Alemeinrstrasse',
street_no_ship='10',
city_ship='Einsiedeln',
post_code_ship='8406',
state_ship='Schyz',
country_ship='Switzerland')
db.session.add(company1)
dbUtils.db_add_name_and_description("minibase/database/company_relation.csv", Company_relation)
company2 = Company(
name='Kynsight',
legal_entity_id='1',
relation_id='1',
industry_id='1',
status_id='3',
website='www.kynsight.com',
street_bill='Meierackerstrasse',
street_no_bill='10',
city_bill='Uster',
post_code_bill='8610',
state_bill='Zürich',
country_bill='Switzerland',
street_ship='Meierackerstrasse',
street_no_ship='10',
city_ship='Uster',
post_code_ship='8610',
state_ship='Zürich',
country_ship='Switzerland')
db.session.add(company2)
dbUtils.db_add_name_and_description("minibase/database/company_legal_entity.csv", Company_legal_entity)
noteStatus1 = Note_status(
name='Open',
description='Ongoing')
db.session.add(noteStatus1)
dbUtils.db_add_name_and_description("minibase/database/company_status.csv", Company_status)
noteStatus2 = Note_status(
name='Closed',
description='Ongoing')
db.session.add(noteStatus2)
dbUtils.db_add_company("minibase/database/company.csv")
noteStatus3 = Note_status(
name='Done',
description='Ongoing')
db.session.add(noteStatus3)
dbUtils.db_add_name_and_description("minibase/database/note_status.csv", Note_status)
note1 = Company_note(
title='Need to find a valid MCU For Stefan',
@ -148,69 +54,12 @@ db.session.add(note2)
###################################################################################################
PeresonRole1 = Person_role(
name='Engineer',
description='Standart Engineer')
db.session.add(PeresonRole1)
dbUtils.db_add_name_and_description("minibase/database/person_role.csv", Person_role)
PeresonRole2 = Person_role(
name='Engineerin Manager',
description='Manager for egineering')
db.session.add(PeresonRole2)
dbUtils.db_add_name_and_description("minibase/database/person_competence.csv", Person_competence)
PeresonRole3 = Person_role(
name='CEO',
description='Chief Executif Operation')
db.session.add(PeresonRole1)
dbUtils.db_add_person("minibase/database/person.csv")
PersonCompethence1 = Person_competence(
name='Embedded Systems',
description='Embedded Systems Engineer')
db.session.add(PersonCompethence1)
PersonCompethence2 = Person_competence(
name='hardware',
description='Electronics Hardwre specialist')
db.session.add(PersonCompethence2)
PersonCompethence3 = Person_competence(
name='Software',
description='Software engineer')
db.session.add(PersonCompethence1)
person1 = Person(
name='Kerem',
last_name='Yollu',
company_id='2',
role_id='3',
competence_id='1',
mail_prof='kerem.yollu@kynsight.com',
mail_priv='kerem.yollu@gmail.com',
tel_prof_mobile='+41789716697',
street_name='Meierackerstrasse',
street_no='10',
city='Uster',
post_code='8610',
state='Zürich',
country='Switzerland')
db.session.add(person1)
person2 = Person(
name='Stefan',
last_name='Walker',
company_id='1',
role_id='2',
competence_id='2',
mail_prof='stefan.walker@steinel.ch',
mail_priv='stefan.walker@gmail.com',
tel_prof_mobile='+4178956787',
street_name='Alemeinrstrasse',
street_no='10',
city='Einsiedeln',
post_code='8406',
state='Schyz',
country='Switzerland')
db.session.add(person2)
note3 = Person_note(
title='Birthday of Stefan',
@ -238,55 +87,19 @@ db.session.add(note5)
###################################################################################################
dbUtils.db_add_name_and_description("minibase/database/project_status.csv", Project_status)
projectStatus1 = Project_status(
name='Open',
description='Ongoing')
db.session.add(projectStatus1)
dbUtils.db_add_project("minibase/database/project.csv")
projectStatus2 = Project_status(
name='Closed',
description='Closed')
db.session.add(projectStatus2)
dbUtils.db_add_project_element("minibase/database/project_element.csv")
projectStatus3 = Project_status(
name='Pending',
description='Action Required')
db.session.add(projectStatus3)
project1 = Project(
name='STWA-HS',
description='Aküsprühgerät für hautmittel',
company_id='1',
status_id='1',
industry_id='1',
owner_id='1',
qte_prototype='10',
qte_start='5000',
qte_production='10000')
db.session.add(project1)
element1 = Project_element(
name='Power Board',
description='Dc-Dc regulation fo batteries',
qte_per_project='8',
project_id='1',
owner_id='1',
status_id='1')
db.session.add(element1)
'''
###################################################################################################
status1 = Status(
name='Obsolete',
description='Obsolete from Manufacturer')
db.session.add(status1)
status2 = Status(
name='Active',
description='Everything is in order')
db.session.add(status2)
'''
db.session.commit()
dbUtils.db_add_name_and_description("minibase/database/product_category.csv", Product_category)
dbUtils.db_add_name_and_description("minibase/database/product_classification.csv", Product_classification)
dbUtils.db_add_name_and_description("minibase/database/product_domain.csv", Product_domain)
dbUtils.db_add_name_and_description("minibase/database/product_eligibility.csv", Product_eligibility)
dbUtils.db_add_name_and_description("minibase/database/product_packaging.csv", Product_packaging)
dbUtils.db_add_name_and_description("minibase/database/product_physical.csv", Product_physical)
dbUtils.db_add_name_and_description("minibase/database/product_status.csv", Product_status)
dbUtils.db_add_name_and_description("minibase/database/product_sub_category.csv", Product_sub_category)
dbUtils.db_add_product("minibase/database/product.csv")

Loading…
Cancel
Save