redirect quando cria uma comanda

This commit is contained in:
2025-02-18 22:32:41 -03:00
parent 44a9c694dc
commit f0c956d2ba
7 changed files with 30 additions and 27 deletions

View File

@@ -200,7 +200,7 @@ Detalhes {{comanda.name}}
</div>
</div>
<div>
<p>Recebido:</p> <input id="recebido" type="number">
<p>Recebido:</p> <input id="recebido" oninput="troco()" name="recebido" type="number">
<h4 id="troco">Troco: </h4>
</div>
<footer>

View File

@@ -1,4 +1,5 @@
from decimal import Decimal
from django.urls import reverse
from django.utils import timezone
from django.http import JsonResponse
@@ -69,7 +70,7 @@ def createComanda(request):
mesa = Mesa.objects.get(id=mesa_id)
comanda = Comanda(name=name, mesa=mesa, user=request.user)
comanda.save()
return redirect('comandas')
return redirect(reverse('viewcomanda') + f'?parametro={comanda.id}')
@group_required(groupName='Garçom')
def editComanda(request):

Binary file not shown.

View File

@@ -176,20 +176,20 @@ function troco(){
}
document.onkeydown = teclado
// document.onkeydown = teclado
function teclado(event){
if (document.getElementById('payment-comanda').style.display == 'block'){
if (event.keyCode == 13){
troco()
}else{
console.log(event.keyCode)
}
}else{
console.log('')
}
// function teclado(event){
// if (document.getElementById('payment-comanda').style.display == 'block'){
// if (event.keyCode == 13){
// troco()
// }else{
// console.log(event.keyCode)
// }
// }else{
// console.log('')
// }
}
// }
function addOrder(){
obs = document.getElementById('obs').value
var id = document.getElementById('id-temp').value