From 53d156b919133080d988d3590eeddb89297fdfd6 Mon Sep 17 00:00:00 2001 From: Welton Moura Date: Fri, 21 Mar 2025 16:34:14 -0300 Subject: [PATCH] feat: obs from orders print --- .../__pycache__/views.cpython-313.pyc | Bin 8154 -> 8154 bytes .../comandas/templates/viewcomanda.html | 3 +- .../custom_filter_tag.cpython-313.pyc | Bin 3123 -> 3723 bytes .../templatetags/custom_filter_tag.py | 15 +++++++- gestaoRaul/comandas/views.py | 2 ++ gestaoRaul/db.sqlite3 | Bin 335872 -> 335872 bytes .../htmx_list_products_in_comanda.html | 3 +- gestaoRaul/templates/static/base.js | 32 +++++++++++++----- .../static/comandas/js/viewcomanda.js | 7 ++-- 9 files changed, 47 insertions(+), 15 deletions(-) diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc index d5ca5da4ee956e579bc6f6032c915d9d5654d2b6..bfce7f7240b20b9d946157f6278fb32a1ffba0e7 100644 GIT binary patch delta 85 zcmca*f6JctGcPX}0}#}1xts32k#{!_;0lF^^}GcyB|>IWte^P|P&R{2l>{|y`k delta 85 zcmca*f6JctGcPX}0}x2>-;u7hk#{!_;0oY9~8GcyB|>IWte^P|b+R{2l>&T<<_ diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index 023a793..d66f75f 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -86,7 +86,8 @@ Detalhes {{comanda.name}} {{item.product.name}} {% if item.product.cuisine == True %} - + + {69NH4>@)=nU7CPcYd7jTE3J4d zHv|H5b19{V)GQ6;lw5Nw7(xO$CTr zn}y#?=1w+iNVtA{`nq*b-!KcZ#Ws#j&z7Z{R8yCdiyCN)I_P4bSV}D#V2C)mlwQn0 zrYzl1maUC$sc+semnSLJ|5r_`>1S9iWl7)d9zgB@r6H8*eaid+%8XEE_bCs}9w0S^ zbY!1&w3V~-agLRA#uGn)>%ry>3*<@?>*HFuvg$Q^5m#DX4>Y2ZH~paJ0i@#RO4a;A zP|dJ&({Dj8ey1F<4~dINMQiPlYh4GLz7ufP1!^r45V~u<5X|_cJ{B*iw-QH@Pj5a| zFDaUd;R1}rAGB&ek1>oAj3L-r&?%lEI7~23KxIOKKp~(KAw@uyfkjXx_!7a+aJ?D$ zUZ;1(g%Ytg0&-#7>9|fL3ItJqrWclbPH_3-R{%{C$^;dHDT1%C{_%+_hTQns_ikSn znPCoz^5#4J2xHT+VcgB7k+2n>Y(cozji3-eFuooa*HS+@QA5yh5=E!tSH{fDG$qu- zl}OB@$#A>3R1D}Vcm6{7Q@Sq2|0GNC`^4x}U8=D&ti$STnHuuh>d4o1lz!WnYci^o zx>8dTsOhM6bvg5y7`Ii)RnOWk93_oZS>_QmMqM*tNsc& zaEI&Qwfu-)opAb5JQO|?wh`TUB8gf>d$@ici&+c2i*N;%XG!Gyb?dZQ8#q%T(~RzI^u2wTay< zd{-tLch`CvXdR`m^o#p?&j3TlrTucx1hb+6qM-&j%} z{7ry;jj}A2<`rf28s(f+R<0;(9p7^7A9RJog#L^Vg2)XqG%_9~p_}pP8x|H;ODGU} ze00JGSt?YYXP^=Ns4FZ*b z?14c*uHY8I5&;d{sR&~b27H+9d2pN94Fu%k$Q^oaD$RlPUdiH4=7zho4xmlq6@m`I zD#03hpKrh&jD`6w;O}?kr(p|;mFZ@=&DeUrXP(vQH*r*<`4Eqi6dL(g^WK6iE5CNr zSCR(W_rttCcYnN&(MzW;bZ@p6*_hD06L;vxP{gdLUOL{2VvmREYzlHU_N>A5GD9;H z)xneDVt`GS3T)J(6XA0PH8SzW@LL diff --git a/gestaoRaul/comandas/templatetags/custom_filter_tag.py b/gestaoRaul/comandas/templatetags/custom_filter_tag.py index 0b93dce..e42d1f2 100644 --- a/gestaoRaul/comandas/templatetags/custom_filter_tag.py +++ b/gestaoRaul/comandas/templatetags/custom_filter_tag.py @@ -1,5 +1,6 @@ from decimal import Decimal from django import template +from orders.models import Order from comandas.models import Comanda, ProductComanda from clients.models import Client @@ -53,4 +54,16 @@ def viewClient(clientId): @register.filter(name='groupUser') def has_group(user, group_name): - return user.groups.filter(name=group_name).exists() \ No newline at end of file + return user.groups.filter(name=group_name).exists() + + +@register.filter(name='obsOrder') +def obsOrder(id): + product_comanda_obj = ProductComanda.objects.get(pk=id) # Supondo que você tenha o ID do ProductComanda + + produto_associado = product_comanda_obj.product + + pedidos_relacionados = Order.objects.filter(id_product=produto_associado) + pedido = pedidos_relacionados[0] + + return pedido.obs \ No newline at end of file diff --git a/gestaoRaul/comandas/views.py b/gestaoRaul/comandas/views.py index 4063fb6..7e379df 100644 --- a/gestaoRaul/comandas/views.py +++ b/gestaoRaul/comandas/views.py @@ -48,6 +48,7 @@ def viewComanda(request): comanda_id = int(id) comanda = Comanda.objects.get(id=comanda_id) consumo = ProductComanda.objects.filter(comanda=comanda_id) + # consumo[0].product. parcial = Payments.objects.filter(comanda=comanda_id) mesas = Mesa.objects.all() clients = Client.objects.filter(active=True) @@ -63,6 +64,7 @@ def viewComanda(request): if p.name == produto['nome'] and p.active == True: products_ordenados.append(p) valores = somar(consumo,comanda) + return render(request, 'viewcomanda.html', {'config':config, 'valores':valores,'parcials':parcial,'clients':clients,'comanda': comanda, 'consumo': consumo, 'products': products_ordenados,'mesas':mesas}) diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 50827e53b842778de62df9745eb17c8d3ac3ed79..901e973ffaf183c2af48347736a83567652823e6 100644 GIT binary patch delta 727 zcmZvaUr5tY6vyv9_x^sr?RS5_O>zm9+K#{M&Lu7mvhg#=bZ0{bB42y z;jCl)5Uxx+PvXj#SK?kAd9dc4#ko5P-$=rTMZyR7$EhAgDK2HoNXL;T?;%u;;|Swz!USZR|KG-uu6ikn;m>n^|PCLN$+zT_sO`&651s6%S6 zdQt6AYgDIoM_j5Pla?xl07wy(qXglkL=d29bw5(*R#GN_>FS``^7qA^H6%fnkV8z= zka@rZyxl{NQ2ica{JMv97J$x+*QN(#j%B&xCkw!`;*Fm`QMeQ3#7Yx6LCt)ID=p+Z zu#CvJkXf||hH@iQT|`WE(da1!KSK>@L*kZk+Fy+}@NIkn%LrpI{6@XUZ+HUrr;`jF zXl*qIV}NLHUw^cZJJYnW%ot>-ybv$^Ph5?;doG+%StF&WJ5!zEEwb89(LmW@g zG9F9QaDm4so~P;MW~`app?O<-%EeG;u`eJYuhZWy?Bi0Nc9qF56qi=Qez3PnzjcvK zvmw^ayds*XPpr6>FTa8eAKs>!qm`o(8MT_iiX6v1M!+3t3#{8)r{=}Kw2DMr&{U~|}?+LQLP_6pli+k4xL{!x$FKiO{02i#|L5j!kdaBX#} YlOg>d{eP#_2Sas!r+G+X#wGROKftEC5dZ)H delta 548 zcmWkrO-NKx7`^wq-<$X5y?fsaGO-$m5roomoU9zvknsmmgft`<5f~Iw#uPFYx+ybA z2#gskKXf9{MG37+;u3+3i<&5{krokHi)zzus6|8(z1bbk4;;>!$dygx%F;V|MJCk2 zD;}S`5aoln3(-aX>UyevDpk*Qsvd5okuf$&Mh-q$YFOTo({hx)zxMP|EfVUeoya`eM zneJ}FB9=Ja@(J?oMuIKbAu=Q499@ivZd!?mo8@Xmy|8EP27AmtZ4cVrcC8)iXw%25 z#Jol3Yf>Y%dOXn*KaZ++$>=@r=bE z@+kG#)!{gIVCgLjCGeCrXOYSL@T%b#jxmhUkf{| zr<5o~bYKJjg?WsOBKD#>CD*CHh}-npBHjz~qqO=2?$E?Hd`1I*@GHunjCAu~%x|r9 zFEK|Y!7cM1c;ns?ugd-9zHt}STb1 {{item.product.name}} {% if item.product.cuisine == True %} - + + { switch (data.local) { case 'cozinha': + + + + if (document.getElementById('Fila') !== null && data.tipo === 'add'){ - const novoElemento = document.createElement('div'); - // const novoElemento = document.getElementById('Fila'); - novoElemento.innerHTML = data.message; - var fila = document.getElementById('Fila').appendChild(novoElemento); + + + // const novoElemento = document.createElement('div'); + // novoElemento.innerHTML = data.message; + // var fila = document.getElementById('Fila').appendChild(novoElemento); let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1"); if (valorAtual === 'true') { texto = new SpeechSynthesisUtterance(data.speak); window.speechSynthesis.speak(texto); + setTimeout(function() { + location.reload(); + }, 6000); } } else if (document.getElementById('obs-'+data.id) !== null && data.tipo === 'edit'){ const obs = document.getElementById('obs-'+data.id) - const card = obs.parentNode; - card.style.backgroundColor = 'rgb(243, 165, 75)'; - obs.innerHTML = data.message; + // const card = obs.parentNode; + // card.style.backgroundColor = 'rgb(243, 165, 75)'; + // obs.innerHTML = data.message; let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1"); if (valorAtual === 'true') { texto = new SpeechSynthesisUtterance(data.speak); window.speechSynthesis.speak(texto); + setTimeout(function() { + location.reload(); + }, 6000); } } else if (document.getElementById('m-card-'+data.id) !== null && data.tipo === 'delete'){ - const card = document.getElementById('m-card-'+data.id) - card.style.backgroundColor = 'rgb(253, 69, 69)'; + // const card = document.getElementById('m-card-'+data.id) + // card.style.backgroundColor = 'rgb(253, 69, 69)'; let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1"); if (valorAtual === 'true') { texto = new SpeechSynthesisUtterance(data.speak); window.speechSynthesis.speak(texto); + setTimeout(function() { + location.reload(); + }, 6000); } } diff --git a/gestaoRaul/templates/static/comandas/js/viewcomanda.js b/gestaoRaul/templates/static/comandas/js/viewcomanda.js index dbb348c..ef5b31b 100644 --- a/gestaoRaul/templates/static/comandas/js/viewcomanda.js +++ b/gestaoRaul/templates/static/comandas/js/viewcomanda.js @@ -114,6 +114,7 @@ function printOrder(id) { var item = document.getElementById('id-for-print-'+id).innerText var cliente = document.getElementById('name-comanda').innerText var local = document.getElementById('mesa-comanda').innerText + var obs = document.getElementById(id+'-obsOrder').value const agora = new Date(); var dateString = agora.getDate() + '/' + (agora.getMonth()+1) + '/' + agora.getFullYear() + ' - ' + agora.getHours() + ':' + agora.getMinutes(); console.log(item) @@ -123,14 +124,14 @@ function printOrder(id) { td, th { border-collapse: collapse; - padding-top: 35px; + padding-top: 20px; margin: 20px; text-align: center; font-size: 20px;} ${item} - ${cliente} - ${local} + ${obs} + ${cliente}${local} ${dateString} `;