"old stable"
This commit is contained in:
parent
954c1e7e10
commit
2e04a88d9a
BIN
static/images/search.png
Normal file
BIN
static/images/search.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 371 B |
@ -204,9 +204,6 @@ div.block {
|
|||||||
border-top-style: solid;
|
border-top-style: solid;
|
||||||
border-top-width: 1px;
|
border-top-width: 1px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
/*
|
|
||||||
background-color: red;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.inner{
|
div.inner{
|
||||||
@ -241,17 +238,25 @@ div.block text.num{
|
|||||||
|
|
||||||
div.inner text.edit, div.block text.edit {
|
div.inner text.edit, div.block text.edit {
|
||||||
background: url(../images/edit.png);
|
background: url(../images/edit.png);
|
||||||
|
margin: 2px 0px 0px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.inner text.trash {
|
div.inner text.trash {
|
||||||
background: url(../images/trash.png);
|
background: url(../images/trash.png);
|
||||||
|
margin: 2px 0px 0px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.block text.refresh {
|
div.block text.refresh {
|
||||||
background: url(../images/refresh.png);
|
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;
|
background-color: #FFB387;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -265,11 +270,10 @@ div.inner text.edit {
|
|||||||
background-repeat: no-repeat;
|
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;
|
width: 8px;
|
||||||
float:left;
|
float:left;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
margin: 2px 0px 0px 20px;
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
@ -338,8 +342,9 @@ div.margin_bottom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.block label.editable {
|
div.block label.editable {
|
||||||
height: 18px;
|
height: 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
vertical-align: middle;
|
||||||
padding: 0 4px 0 4px;
|
padding: 0 4px 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +357,7 @@ div.block text.editable {
|
|||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
height: 18px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.block select, div.block input {
|
div.block select, div.block input {
|
||||||
@ -366,7 +371,7 @@ div.block select, div.block input {
|
|||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-color: #555555;
|
border-color: #555555;
|
||||||
color: #555555;
|
color: #555555;
|
||||||
height: 18px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.block input {
|
div.block input {
|
||||||
|
@ -23,7 +23,65 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>Liste des composants</h3>
|
<!-- ----------------------------------------------------
|
||||||
|
Recherche
|
||||||
|
----------------------------------------------------- -->
|
||||||
|
<h3>Recherche:</h3>
|
||||||
|
<div class='block margin_bottom no_border'>
|
||||||
|
<label class='editable'>Référence (unique)</label>
|
||||||
|
<input
|
||||||
|
id='reference'
|
||||||
|
type='text'
|
||||||
|
class='editable'
|
||||||
|
onchange='javascript:search_componant(this, "text");'
|
||||||
|
maxlength='20'
|
||||||
|
title='Référence interne unique (max. 20)'
|
||||||
|
placeholder='Référence interne unique (max. 20)'
|
||||||
|
value='' />
|
||||||
|
</div>
|
||||||
|
<div class='block margin_bottom no_border'>
|
||||||
|
<label class='editable'>Désignation</label>
|
||||||
|
<input
|
||||||
|
id='designation'
|
||||||
|
type='text'
|
||||||
|
class='editable'
|
||||||
|
onchange='javascript:search_componant(this, "text");'
|
||||||
|
maxlength='50'
|
||||||
|
title='Désignation (max. 50)'
|
||||||
|
placeholder='Désignation (max. 50)'
|
||||||
|
value='' />
|
||||||
|
</div>
|
||||||
|
<div class='block margin_bottom no_border'>
|
||||||
|
<label class='editable'>Emplacement</label>
|
||||||
|
<input
|
||||||
|
id='place'
|
||||||
|
type='text'
|
||||||
|
class='editable'
|
||||||
|
onchange='javascript:search_componant(this, "text");'
|
||||||
|
maxlength='15'
|
||||||
|
title='Emplacement (max. 15)'
|
||||||
|
placeholder='Emplacement (max. 15)'
|
||||||
|
value='' />
|
||||||
|
</div>
|
||||||
|
<div class='block margin_bottom no_border'>
|
||||||
|
<label class='editable'>Fournisseur</label>
|
||||||
|
<select
|
||||||
|
id='provider_id'
|
||||||
|
onchange='javascript:search_componant(this, "numeric");'
|
||||||
|
title='Fournisseur'>
|
||||||
|
<option value='0' selected>Tous</option>
|
||||||
|
{% for prov in providers %}
|
||||||
|
<option value='prov.id'>{{ prov.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class='block margin_bottom no_border center'>
|
||||||
|
<text title='Rechercher' class='search' onclick='javascript:search_componant();'></text>
|
||||||
|
</div>
|
||||||
|
<!-- ----------------------------------------------------
|
||||||
|
Resultat
|
||||||
|
----------------------------------------------------- -->
|
||||||
|
<h3>Résultat</h3>
|
||||||
<div class='block' style='border-top-style: none;'>
|
<div class='block' style='border-top-style: none;'>
|
||||||
<label onclick='document.location="/componants?offset={{ offset }}&s=reference&o={{ norder }}";'>Référence</label>
|
<label onclick='document.location="/componants?offset={{ offset }}&s=reference&o={{ norder }}";'>Référence</label>
|
||||||
<label onclick='document.location="/componants?offset={{ offset }}&s=designation&o={{ norder }}";' class='border_left' style='width: 440px;'>Désignation</label>
|
<label onclick='document.location="/componants?offset={{ offset }}&s=designation&o={{ norder }}";' class='border_left' style='width: 440px;'>Désignation</label>
|
||||||
@ -39,8 +97,8 @@
|
|||||||
<text class='num border_left' style='width: 92px;'>{{ componant.quantity }}</text>
|
<text class='num border_left' style='width: 92px;'>{{ componant.quantity }}</text>
|
||||||
<text class='num border_right border_left' style='width: 152px;'>{{ componant.place }}</text>
|
<text class='num border_right border_left' style='width: 152px;'>{{ componant.place }}</text>
|
||||||
<div class='inner' style='width: 95px;'>
|
<div class='inner' style='width: 95px;'>
|
||||||
<text class='edit' onclick='javascript:document.location="/componants/{{ componant.id }}"'></text>
|
<text class='edit' title='Éditer' onclick='javascript:document.location="/componants/{{ componant.id }}"'></text>
|
||||||
<text class='trash' onclick='javascript:confirm_delete()?document.location="/componants/delete/{{ componant.id }}":false;'></text>
|
<text class='trash' title='Supprimer' onclick='javascript:confirm_delete()?document.location="/componants/delete/{{ componant.id }}":false;'></text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
16
tetastock.py
16
tetastock.py
@ -7,7 +7,7 @@ from flask_sqlalchemy import SQLAlchemy
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_pyfile('config.py')
|
app.config.from_pyfile('config.py')
|
||||||
app.secret_key = app.config.get('446307a5f61c2bb810436b2ee0f903f2')
|
app.secret_key = '446307a5f61c2bb810436b2ee0f903f2'
|
||||||
app.debug = True
|
app.debug = True
|
||||||
app.static_url_path='/static'
|
app.static_url_path='/static'
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
@ -61,7 +61,9 @@ def authenticate():
|
|||||||
########################################################################
|
########################################################################
|
||||||
@app.route('/componants', methods=['GET', 'POST'])
|
@app.route('/componants', methods=['GET', 'POST'])
|
||||||
def get_componants():
|
def get_componants():
|
||||||
limit = 16
|
if not session or not session['plop']:
|
||||||
|
session['plop']='plip'
|
||||||
|
limit = 8
|
||||||
offset = 0
|
offset = 0
|
||||||
sort = 'reference'
|
sort = 'reference'
|
||||||
order = 'asc'
|
order = 'asc'
|
||||||
@ -78,6 +80,7 @@ def get_componants():
|
|||||||
offset = int(offset)
|
offset = int(offset)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
offset = 0
|
offset = 0
|
||||||
|
providers = Stock_providers.query.order_by(Stock_providers.name).all()
|
||||||
row_count = db.session.query(Stock_componants.id).count()
|
row_count = db.session.query(Stock_componants.id).count()
|
||||||
page_count = int(math.ceil(row_count / float(limit)))
|
page_count = int(math.ceil(row_count / float(limit)))
|
||||||
page = int(math.ceil(float(offset + 1) / 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()
|
componants = Stock_componants.query.order_by(getattr(Stock_componants, sort).desc()).offset(offset).limit(limit).all()
|
||||||
return render_template('componants.html',
|
return render_template('componants.html',
|
||||||
componants=componants,
|
componants=componants,
|
||||||
|
providers = providers,
|
||||||
offset=offset,
|
offset=offset,
|
||||||
nexthop=nexthop,
|
nexthop=nexthop,
|
||||||
prevhop=prevhop,
|
prevhop=prevhop,
|
||||||
@ -106,6 +110,7 @@ def get_componants():
|
|||||||
|
|
||||||
@app.route('/componants/<componant_id>')
|
@app.route('/componants/<componant_id>')
|
||||||
def get_componant(componant_id):
|
def get_componant(componant_id):
|
||||||
|
print session['plop']
|
||||||
try:
|
try:
|
||||||
componant_id = int(componant_id)
|
componant_id = int(componant_id)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
@ -236,8 +241,9 @@ def search_users():
|
|||||||
return render_template('wip.html')
|
return render_template('wip.html')
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
# SQL
|
||||||
def get_distinct(query):
|
##############################################
|
||||||
|
def sql_get_distinct(query):
|
||||||
results = []
|
results = []
|
||||||
for result in query:
|
for result in query:
|
||||||
result = result[0]
|
result = result[0]
|
||||||
@ -248,4 +254,4 @@ def get_distinct(query):
|
|||||||
# Main #######################################
|
# Main #######################################
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run()
|
app.run(host='0.0.0.0')
|
||||||
|
Loading…
Reference in New Issue
Block a user