3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-11-25 22:22:27 +00:00

Ajustement des flottants

This commit is contained in:
Yoann Pétri 2018-12-02 19:50:15 +01:00
parent 6810db96e2
commit fb54815df1
2 changed files with 5 additions and 5 deletions

View file

@ -91,10 +91,10 @@ def manage(request):
"pay_buttons": pay_buttons "pay_buttons": pay_buttons
}) })
@csrf_exempt
@active_required @active_required
@login_required @login_required
@permission_required('gestion.add_consumptionhistory') @permission_required('gestion.add_consumptionhistory')
@csrf_exempt
def order(request): def order(request):
""" """
Process the given order. Called by a js/JQuery script. Process the given order. Called by a js/JQuery script.

View file

@ -56,11 +56,11 @@ function generate_html(){
html ="" html =""
for(k=0;k<products.length;k++){ for(k=0;k<products.length;k++){
product = products[k] product = products[k]
html += '<tr><td>' + product.barcode + '</td><td>' + product.name + '</td><td>' + String(product.amount) + '</td><td><input type="number" data-target="' + String(k) + '" onChange="updateInput(this)" value="' + String(product.quantity) + '"/></td><td>' + String(product.quantity * product.amount) + '</td></tr>'; html += '<tr><td>' + product.barcode + '</td><td>' + product.name + '</td><td>' + String(product.amount) + '</td><td><input type="number" data-target="' + String(k) + '" onChange="updateInput(this)" value="' + String(product.quantity) + '"/></td><td>' + String(Number((product.quantity * product.amount).toFixed(2))) + '</td></tr>';
} }
for(k=0; k<menus.length;k++){ for(k=0; k<menus.length;k++){
menu = menus[k] menu = menus[k]
html += '<tr><td>' + menu.barcode + '</td><td>' + menu.name + '</td><td>' + String(menu.amount) + '</td><td><input type="number" data-target="' + String(k) + '" onChange="updateMenuInput(this)" value="' + String(menu.quantity) + '"/></td><td>' + String(menu.quantity * menu.amount) + '</td></tr>'; html += '<tr><td>' + menu.barcode + '</td><td>' + menu.name + '</td><td>' + String(menu.amount) + '</td><td><input type="number" data-target="' + String(k) + '" onChange="updateMenuInput(this)" value="' + String(menu.quantity) + '"/></td><td>' + String(Number((menu.quantity * menu.amount).toFixed(2))) + '</td></tr>';
} }
$("#items").html(html) $("#items").html(html)
updateTotal(); updateTotal();
@ -74,9 +74,9 @@ function updateTotal(){
for(k=0; k<menus.length;k++){ for(k=0; k<menus.length;k++){
total += menus[k].quantity * menus[k].amount; total += menus[k].quantity * menus[k].amount;
} }
$("#totalAmount").text(String(total) + "€") $("#totalAmount").text(String(Number(total.toFixed(2))) + "€")
totalAfter = balance - total totalAfter = balance - total
$("#totalAfter").text(totalAfter + "€") $("#totalAfter").text(String(Number(totalAfter.toFixed(2))) + "€")
} }
function updateInput(a){ function updateInput(a){