diff --git a/static/images/search.png b/static/images/search.png
new file mode 100644
index 0000000..7eb60c5
Binary files /dev/null and b/static/images/search.png differ
diff --git a/static/style/style.css b/static/style/style.css
index d0f1a42..35242f5 100644
--- a/static/style/style.css
+++ b/static/style/style.css
@@ -204,9 +204,6 @@ div.block {
border-top-style: solid;
border-top-width: 1px;
height: 20px;
-/*
- background-color: red;
-*/
}
div.inner{
@@ -241,17 +238,25 @@ div.block text.num{
div.inner text.edit, div.block text.edit {
background: url(../images/edit.png);
+ margin: 2px 0px 0px 20px;
}
div.inner text.trash {
background: url(../images/trash.png);
+ margin: 2px 0px 0px 20px;
}
div.block text.refresh {
background: url(../images/refresh.png);
+ margin: 2px 0px 0px 20px;
}
-div.inner text.edit:hover, div.inner text.trash:hover, div.block text.refresh:hover {
+div.block text.search {
+ background: url(../images/search.png);
+ margin-left: 275px;
+}
+
+div.inner text.edit:hover, div.inner text.trash:hover, div.block text.refresh:hover, div.block text.search:hover{
background-color: #FFB387;
cursor: pointer;
}
@@ -265,11 +270,10 @@ div.inner text.edit {
background-repeat: no-repeat;
}
-div.inner text.trash, div.inner text.edit, div.block text.refresh {
+div.inner text.trash, div.inner text.edit, div.block text.refresh, div.block text.search {
width: 8px;
float:left;
height: 16px;
- margin: 2px 0px 0px 20px;
border-radius: 2px;
background-repeat: no-repeat;
}
@@ -338,8 +342,9 @@ div.margin_bottom {
}
div.block label.editable {
- height: 18px;
+ height: 20px;
text-align: left;
+ vertical-align: middle;
padding: 0 4px 0 4px;
}
@@ -352,7 +357,7 @@ div.block text.editable {
background-color: #FFFFFF;
border-style: solid;
border-width: 1px;
- height: 18px;
+ height: 20px;
}
div.block select, div.block input {
@@ -366,7 +371,7 @@ div.block select, div.block input {
border-width: 1px;
border-color: #555555;
color: #555555;
- height: 18px;
+ height: 20px;
}
div.block input {
diff --git a/templates/componants.html b/templates/componants.html
index db43549..e26c64d 100644
--- a/templates/componants.html
+++ b/templates/componants.html
@@ -23,7 +23,65 @@
{% endblock %}
{% block content %}
-
Liste des composants
+
+ Recherche:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Résultat
@@ -39,8 +97,8 @@
{{ componant.quantity }}
{{ componant.place }}
-
-
+
+
{% endfor %}
diff --git a/tetastock.py b/tetastock.py
index e5f09ae..958e95e 100755
--- a/tetastock.py
+++ b/tetastock.py
@@ -7,7 +7,7 @@ from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_pyfile('config.py')
-app.secret_key = app.config.get('446307a5f61c2bb810436b2ee0f903f2')
+app.secret_key = '446307a5f61c2bb810436b2ee0f903f2'
app.debug = True
app.static_url_path='/static'
db = SQLAlchemy(app)
@@ -61,7 +61,9 @@ def authenticate():
########################################################################
@app.route('/componants', methods=['GET', 'POST'])
def get_componants():
- limit = 16
+ if not session or not session['plop']:
+ session['plop']='plip'
+ limit = 8
offset = 0
sort = 'reference'
order = 'asc'
@@ -78,6 +80,7 @@ def get_componants():
offset = int(offset)
except ValueError:
offset = 0
+ providers = Stock_providers.query.order_by(Stock_providers.name).all()
row_count = db.session.query(Stock_componants.id).count()
page_count = int(math.ceil(row_count / float(limit)))
page = int(math.ceil(float(offset + 1) / float(limit)))
@@ -95,6 +98,7 @@ def get_componants():
componants = Stock_componants.query.order_by(getattr(Stock_componants, sort).desc()).offset(offset).limit(limit).all()
return render_template('componants.html',
componants=componants,
+ providers = providers,
offset=offset,
nexthop=nexthop,
prevhop=prevhop,
@@ -106,6 +110,7 @@ def get_componants():
@app.route('/componants/')
def get_componant(componant_id):
+ print session['plop']
try:
componant_id = int(componant_id)
except ValueError as e:
@@ -236,8 +241,9 @@ def search_users():
return render_template('wip.html')
##############################################
-
-def get_distinct(query):
+# SQL
+##############################################
+def sql_get_distinct(query):
results = []
for result in query:
result = result[0]
@@ -248,4 +254,4 @@ def get_distinct(query):
# Main #######################################
if __name__ == '__main__':
- app.run()
+ app.run(host='0.0.0.0')