Commit f4f71542 authored by Eric Seigne's avatar Eric Seigne
Browse files

fix #437: interdit la saisie de montants négatifs

parent 518db6ec
......@@ -95,7 +95,7 @@
<ons-row>
<ons-col>
<label for="kmbefore" class="translate">personalVehicleKMBefore</label>
<ons-input name="kmbefore" id="kmbefore" type="number" placeholder="km"></ons-input>
<ons-input name="kmbefore" id="kmbefore" type="number" placeholder="km" min="0"></ons-input>
</ons-col>
</ons-row>
......
......@@ -29,44 +29,44 @@
<input name="compta_email" id="compta_email" type="email" placeholder="" value="">
<label for="compta_ik" class="translate">ik</label>
<input name="compta_ik" id="compta_ik" type="number" value="625100">
<input name="compta_ik" id="compta_ik" type="number" value="625100" min="0">
<div id="interobjets"></div>
<label for="compta_peage" class="translate">parkingOrToll</label>
<input name="compta_peage" id="compta_peage" type="number" value="625100">
<input name="compta_peage" id="compta_peage" type="number" value="625100" min="0">
<div id="interobjets"></div>
<label for="compta_hotel" class="translate">hotel</label>
<input name="compta_hotel" id="compta_hotel" type="number" value="625600">
<input name="compta_hotel" id="compta_hotel" type="number" value="625600" min="0">
<div id="interobjets"></div>
<label for="compta_train" class="translate">trainAndPlane</label>
<input name="compta_train" id="compta_train" type="number" value="625100">
<input name="compta_train" id="compta_train" type="number" value="625100" min="0">
<div id="interobjets"></div>
<label for="compta_restauration" class="translate">food</label>
<input name="compta_restauration" id="compta_restauration" value="625700">
<input name="compta_restauration" id="compta_restauration" type="number" value="625700" min="0">
<div id="interobjets"></div>
<label for="compta_carburant" class="translate">gas</label>
<input name="compta_carburant" id="compta_carburant" value="606100">
<input name="compta_carburant" id="compta_carburant" type="number" value="606100" min="0">
<div id="interobjets"></div>
<label for="compta_taxi" class="translate">taxi</label>
<input name="compta_taxi" id="compta_taxi" value="625100">
<input name="compta_taxi" id="compta_taxi" type="number" value="625100" min="0">
<div id="interobjets"></div>
<label for="compta_divers" class="translate">others</label>
<input name="compta_divers" id="compta_divers" value="471">
<input name="compta_divers" id="compta_divers" type="number" value="471" min="0">
<div id="interobjets"></div>
<label for="compta_compteperso" class="translate">personalAccount</label>
<input name="compta_compteperso" id="compta_compteperso" value="421000">
<input name="compta_compteperso" id="compta_compteperso" type="number" value="421000" min="0">
<div id="interobjets"></div>
<label for="compta_tvadeductible" class="translate">vatDeduc</label>
<input name="compta_tvadeductible" id="compta_tvadeductible" value="445660">
<input name="compta_tvadeductible" id="compta_tvadeductible" type="number" value="445660" min="0">
</ons-col>
</ons-row>
......
......@@ -24,7 +24,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">vatRate1</legend>
<span class="input-percent right">
<input name="compta_tva_tx1" id="compta_tva_tx1" type="number" step="any" inputmode="decimal" placeholder="">
<input name="compta_tva_tx1" id="compta_tva_tx1" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -32,7 +32,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">vatRate2</legend>
<span class="input-percent right">
<input name="compta_tva_tx2" id="compta_tva_tx2" type="number" step="any" inputmode="decimal" placeholder="">
<input name="compta_tva_tx2" id="compta_tva_tx2" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -40,7 +40,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">vatRate3</legend>
<span class="input-percent right">
<input name="compta_tva_tx3" id="compta_tva_tx3" type="number" step="any" inputmode="decimal" placeholder="">
<input name="compta_tva_tx3" id="compta_tva_tx3" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -48,7 +48,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">vatRate4</legend>
<span class="input-percent right">
<input name="compta_tva_tx4" id="compta_tva_tx4" type="number" step="any" inputmode="decimal" placeholder="">
<input name="compta_tva_tx4" id="compta_tva_tx4" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......
......@@ -44,7 +44,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">expenseTaxIncluded</legend>
<span class="input-euro right">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
</fieldset>
......
......@@ -57,7 +57,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">expenseTaxIncluded</legend>
<span class="input-euro right">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -68,7 +68,7 @@
</legend>
<input type="hidden" name="tvaTx4" value="4">
<span class="input-euro right">
<input name="tvaVal4" id="tvaVal4" type="number" step="any" inputmode="decimal" placeholder="">
<input name="tvaVal4" id="tvaVal4" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -79,7 +79,7 @@
</legend>
<input type="hidden" name="tvaTx3" value="3">
<span class="input-euro right">
<input name="tvaVal3" id="tvaVal3" type="number" step="any" inputmode="decimal" placeholder="">
<input name="tvaVal3" id="tvaVal3" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -90,7 +90,7 @@
</legend>
<input type="hidden" name="tvaTx2" value="2">
<span class="input-euro right">
<input name="tvaVal2" id="tvaVal2" type="number" step="any" inputmode="decimal" placeholder="">
<input name="tvaVal2" id="tvaVal2" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -101,7 +101,7 @@
</legend>
<input type="hidden" name="tvaTx1" value="1">
<span class="input-euro right">
<input name="tvaVal1" id="tvaVal1" type="number" step="any" inputmode="decimal" placeholder="">
<input name="tvaVal1" id="tvaVal1" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
</fieldset>
......
......@@ -56,13 +56,13 @@
<div style="display: flex; align-items: center;">
<legend class="translate">expenseTaxIncluded</legend>
<span class="input-euro right">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
</fieldset>
<!-- <label for="ttc">Dont restauration</label>
<input name="ttc" id="ttcResto" type="number" step="any" inputmode="decimal" placeholder="Restauration TTC"> -->
<input name="ttc" id="ttcResto" type="number" step="any" inputmode="decimal" placeholder="Restauration TTC" min="0"> -->
<div id="interobjetsDouble"></div>
......
......@@ -91,7 +91,7 @@
</ons-list> -->
<div style="display: flex; align-items:baseline;">
<ons-input required modifier="underbar" float name="distance" id="distance" type="number" placeholder="Distance totale (km)" value=""></ons-input>
<ons-input required modifier="underbar" float name="distance" id="distance" type="number" placeholder="Distance totale (km)" value="" min="0"></ons-input>
<!-- <ons-button modifier="material" id="btnCalculDistance" onclick="distanceAutomatique(depart.value, arrivee.value, departSlug.value, arriveeSlug.value, 'calcul');"><i class="zmdi zmdi-cloud-outline zmdib"></i></ons-button> -->
</div>
</fieldset>
......@@ -324,4 +324,4 @@
});
}
</script>
</ons-page>
</ons-page>
\ No newline at end of file
......@@ -75,7 +75,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">expenseTaxIncluded</legend>
<span class="input-euro right">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -85,7 +85,7 @@
HT : <a class="automatique" onclick="computeHT(4, ht);"><i class="zmdi zmdi-cloud-outline zmdib"></i> automatique</i></a>
</legend>
<span class="input-euro right">
<input name="ht" id="ht" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ht" id="ht" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
<input type="hidden" name="tvaTx4" value="4">
</div>
......
......@@ -60,7 +60,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">expenseTaxIncluded</legend>
<span class="input-euro right">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -71,7 +71,7 @@
</legend>
<input type="hidden" name="tvaTx2" value="2">
<span class="input-euro right">
<input name="tvaVal2" id="tvaVal2" type="number" step="any" inputmode="decimal" placeholder="">
<input name="tvaVal2" id="tvaVal2" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -83,7 +83,7 @@
</legend>
<input type="hidden" name="tvaTx3" value="3">
<span class="input-euro right">
<input name="tvaVal3" id="tvaVal3" type="number" step="any" inputmode="decimal" placeholder="">
<input name="tvaVal3" id="tvaVal3" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
......@@ -94,7 +94,7 @@
</legend>
<input type="hidden" name="tvaTx4" value="4">
<span class="input-euro right">
<input name="tvaVal4" id="tvaVal4" type="number" step="any" inputmode="decimal" placeholder="">
<input name="tvaVal4" id="tvaVal4" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
</fieldset>
......
......@@ -55,7 +55,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">expenseTaxIncluded</legend>
<span class="input-euro right">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
</fieldset>
......
......@@ -48,7 +48,7 @@
<ons-col width="90%">
<div class="has-float-label">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="Montant TTC">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="Montant TTC" min="0">
<span>Montant TTC</span>
</div>
......
......@@ -67,7 +67,7 @@
<div style="display: flex; align-items: center;">
<legend class="translate">expenseTaxIncluded</legend>
<span class="input-euro right">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="">
<input name="ttc" id="ttc" type="number" step="any" inputmode="decimal" placeholder="" min="0">
</span>
</div>
</fieldset>
......
......@@ -432,12 +432,17 @@ function genericCheckForm(leform = null) {
myDebug("on cherche a valider le champ : " + field);
if (objForm.elements[field] !== undefined) {
myDebug("Cet element existe, " + field + "(" + i + ") quelle est sa valeur ..." + objForm.elements[field].value);
//Mais si on a un compte "special ou seule la photo est autorisee alors on laisse faire"
myDebug("Cet element existe, " + field + "(" + i + "), de type " + objForm.elements[field].type + ", quelle est sa valeur ..." + objForm.elements[field].value);
if (!objForm.elements[field].value) {
$('#' + field).attr('style', "border-radius: 5px; border:#FF0000 2px solid;");
probleme += "<ul>" + fieldsTexte[i] + "</ul>";
}
// fix #437 : evite de saisir des montants négatifs
else if (objForm.elements[field].type == "number" && objForm.elements[field].value < 0) {
$('#' + field).attr('style', "border-radius: 5px; border:#FF0000 2px solid;");
probleme += "<ul>Montant négatif interdit</ul>";
}
else {
$('#' + field).attr('style', "");
}
......@@ -447,7 +452,7 @@ function genericCheckForm(leform = null) {
}
}
if (probleme != "") {
ons.notification.alert("Certaines informations sont manquantes:<ul> " + probleme + "</ul>", { title: "Attention" }).then(function () {
ons.notification.alert("Certaines informations sont manquantes ou incorrectes :<ul> " + probleme + "</ul>", { title: "Attention" }).then(function () {
return false;
});
// myDebug("genericCheckForm return false " + probleme);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment