enter key simulated submit form
This commit is contained in:
@@ -19,7 +19,7 @@ def execute_query(request, query, params):
|
|||||||
mark_changed(request.dbsession)
|
mark_changed(request.dbsession)
|
||||||
transaction.commit()
|
transaction.commit()
|
||||||
|
|
||||||
def get_chantiers_byName(request, societe, name, tous):
|
def get_chantiers_byName(request, societe, name):
|
||||||
|
|
||||||
query = "CALL spGET_CHANTIERS_byName('%s','%s');" % (societe, name)
|
query = "CALL spGET_CHANTIERS_byName('%s','%s');" % (societe, name)
|
||||||
results = request.dbsession.execute(query).fetchall()
|
results = request.dbsession.execute(query).fetchall()
|
||||||
|
|||||||
@@ -8,31 +8,21 @@
|
|||||||
<br />
|
<br />
|
||||||
<div class="col-md-offset-4 col-md-4 well">
|
<div class="col-md-offset-4 col-md-4 well">
|
||||||
|
|
||||||
<form id="login-form" role="form" action="${url}" method="post"
|
<form id="login-form" role="form" action="${url}" method="post" >
|
||||||
data-fv-framework="bootstrap"
|
|
||||||
data-fv-icon-valid="glyphicon glyphicon-ok"
|
|
||||||
data-fv-icon-invalid="glyphicon glyphicon-remove"
|
|
||||||
data-fv-icon-validating="glyphicon glyphicon-refresh">
|
|
||||||
|
|
||||||
<h3>Se connecter</h3>
|
<h3>Se connecter</h3>
|
||||||
<input type="hidden" name="came_from" value="${came_from}"/>
|
<input type="hidden" name="came_from" value="${came_from}"/>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input class="form-control" type="text" name="login" value="${login}"
|
<input class="form-control" type="text" name="login" value="${login}" />
|
||||||
placeholder="Identifiant"
|
|
||||||
data-fv-notempty="true"
|
|
||||||
data-fv-notempty-message="L'identifiant est obligatoire" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input class="form-control" type="password" name="password" value=""
|
<input class="form-control" type="password" name="password" value="" />
|
||||||
placeholder="Mot de passe"
|
|
||||||
data-fv-notempty="true"
|
|
||||||
data-fv-notempty-message="Le mot de passe est obligatoire">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button class="btn btn-primary" type="submit" name="form.submitted">Se connecter</button>
|
<button id="submitButton" class="btn btn-primary" type="submit" name="form.submitted">Se connecter</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
@@ -49,9 +39,38 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#login-form').formValidation();
|
$('#login-form').formValidation({
|
||||||
|
framework: 'bootstrap',
|
||||||
|
message: 'This value is not valid',
|
||||||
|
icon: {
|
||||||
|
valid: 'glyphicon glyphicon-ok',
|
||||||
|
invalid: 'glyphicon glyphicon-remove',
|
||||||
|
validating: 'glyphicon glyphicon-refresh'
|
||||||
|
},
|
||||||
|
fields: {
|
||||||
|
login: {
|
||||||
|
validators: {
|
||||||
|
notEmpty: {
|
||||||
|
message: 'Le code utilisateur est obligatoire'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
validators: {
|
||||||
|
notEmpty: {
|
||||||
|
message: 'Le mot de passe est obligatoire'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
$('form input').on('keypress', function(e) {
|
$('form input').on('keypress', function(e) {
|
||||||
return e.which !== 13;
|
var code = e.keyCode || e.which;
|
||||||
|
if (code === 13) {
|
||||||
|
e.preventDefault();
|
||||||
|
// simuler clic bouton submit
|
||||||
|
document.getElementById("submitButton").click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -25,23 +25,12 @@
|
|||||||
<label class="col-sm-4 control-label">Nom ou numéro du chantier</label>
|
<label class="col-sm-4 control-label">Nom ou numéro du chantier</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="text" class="form-control" name="name" value="${name}"
|
<input type="text" class="form-control" name="name" value="${name}"
|
||||||
data-fv-notempty="true"
|
|
||||||
data-fv-notempty-message="Le nom ou le numéro est obligatoire"
|
|
||||||
|
|
||||||
data-fv-stringlength="true"
|
data-fv-stringlength="true"
|
||||||
data-fv-stringlength-min="2"
|
data-fv-stringlength-min="2"
|
||||||
data-fv-stringlength-max="30"
|
data-fv-stringlength-max="30"
|
||||||
data-fv-stringlength-message="Le nom ou le numéro doit avoir de 2 à 30 caractères de long" />
|
data-fv-stringlength-message="Le nom ou le numéro doit avoir de 2 à 30 caractères de long" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- case a cocher "Afficher fiches cloturées" -->
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-offset-4 col-sm-8">
|
|
||||||
<input type="checkbox" name="cb_tous" value="cb_tous"
|
|
||||||
tal:attributes="checked cb_tous == 'oui' and 'checked' or None">
|
|
||||||
Afficher les chantiers cloturées</input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-4 col-sm-8">
|
<div class="col-sm-offset-4 col-sm-8">
|
||||||
@@ -74,6 +63,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var dataSet = ${dt_data};
|
var dataSet = ${dt_data};
|
||||||
var goto_url = '${goto_url}';
|
var goto_url = '${goto_url}';
|
||||||
|
var order_option = '${order_option}'
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.fn.dataTable.moment('DD-MM-YYYY');
|
$.fn.dataTable.moment('DD-MM-YYYY');
|
||||||
@@ -84,6 +74,7 @@
|
|||||||
language: {
|
language: {
|
||||||
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
|
||||||
},
|
},
|
||||||
|
order: [[0, order_option]],
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{ "targets": 0,
|
{ "targets": 0,
|
||||||
"render": function (data, type, full, meta) {
|
"render": function (data, type, full, meta) {
|
||||||
|
|||||||
@@ -75,20 +75,20 @@ def dossier_lookup(request):
|
|||||||
else:
|
else:
|
||||||
societe = societe_defaut
|
societe = societe_defaut
|
||||||
|
|
||||||
# si afficher tous les fiches ?
|
# lire les chantiers
|
||||||
if 'cb_tous' in request.params:
|
chantiers = get_chantiers_byName(request, societe, name)
|
||||||
cb_tous = "oui"
|
if len(chantiers) == 0:
|
||||||
chantiers = get_chantiers_byName(request, societe, name, True)
|
message = "Chantier non trouvé : %s" % name
|
||||||
else:
|
# construire la liste
|
||||||
cb_tous = "non"
|
for item in chantiers:
|
||||||
chantiers = get_chantiers_byName(request, societe, name, False)
|
d = ('%s-%s' % (societe, item.numero),item.date.strftime('%d-%m-%Y'), item.nomcli, item.chantier, to_euro(item.montant),
|
||||||
if len(chantiers) == 0:
|
item.nosin, item.status)
|
||||||
message = "Chantier non trouvé : %s" % name
|
liste.append(d)
|
||||||
# construire la liste
|
|
||||||
for item in chantiers:
|
if len(name) == 0 :
|
||||||
d = ('%s-%s' % (societe, item.numero),item.date.strftime('%d-%m-%Y'), item.nomcli, item.chantier, to_euro(item.montant),
|
order_option = 'desc'
|
||||||
item.nosin, item.status)
|
else:
|
||||||
liste.append(d)
|
order_option = 'asc'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'page_title': "Rechercher un chantier",
|
'page_title': "Rechercher un chantier",
|
||||||
@@ -99,7 +99,7 @@ def dossier_lookup(request):
|
|||||||
'societes': societes,
|
'societes': societes,
|
||||||
'societe': societe,
|
'societe': societe,
|
||||||
'name': name,
|
'name': name,
|
||||||
'cb_tous': cb_tous,
|
'order_option': order_option,
|
||||||
}
|
}
|
||||||
|
|
||||||
@view_config(route_name='dossier_view', renderer='../templates/dossier/dossier_view.pt', permission='view')
|
@view_config(route_name='dossier_view', renderer='../templates/dossier/dossier_view.pt', permission='view')
|
||||||
@@ -450,6 +450,10 @@ def rdf_edit(request):
|
|||||||
tierce_personnes = get_rdf_causes(request, 'C08')
|
tierce_personnes = get_rdf_causes(request, 'C08')
|
||||||
|
|
||||||
if 'form.submitted' in request.params:
|
if 'form.submitted' in request.params:
|
||||||
|
if len(request.params['signature_svg']) > 7000:
|
||||||
|
request.session.flash(u"La signature est trop grande !", 'danger')
|
||||||
|
return HTTPFound(location=url)
|
||||||
|
|
||||||
new_values = {}
|
new_values = {}
|
||||||
for param, db_value in rapport.items():
|
for param, db_value in rapport.items():
|
||||||
if param in request.params and request.params[param] != db_value:
|
if param in request.params and request.params[param] != db_value:
|
||||||
|
|||||||
Reference in New Issue
Block a user