feat: review photo or video in Revisão (front 2)
All checks were successful
Build and deploy / Validate source (push) Successful in 8s
Build and deploy / Integration suite on a real stack (push) Successful in 6m4s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m6s

In Revisão the card gets "Revisar": a photo or a video of up to 30 s of
the printed sheet, from the computer's or the phone's camera in the
browser, or a file already recorded. It is attached to the order as
DTF-<n>-revisao-<seq> with when and who, kept 180 days, and copied by
the computers with the order folders to Kanban/Revisões/. A photo needs
1600 px on its longer side. An order above 1 m cannot reach Finalizado
without one. In Finalizado the customer's order page shows the photo.

The Revisor, Gestão and the administrators take it (capability
"inspect"). Dialogs opened from a card's face or the board (Revisar,
Editar tempos) now show over the page when the order panel is closed;
inside the closed panel they were invisible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-09 11:39:15 -03:00
parent 5aafd9ee91
commit b280e0cfa6
18 changed files with 725 additions and 22 deletions

View File

@@ -105,6 +105,26 @@ def upload_bytes(client, content, name='LOCAL-TEST.cdr', order_id=None, expected
wait_scan(client,uid,operator,expected_scan)
return uid
def review_photo(client, order_id):
"""A 2000x1500 JPEG attached as the order's review photo, in Revisão.
The same transport site_video_test uses: start the operator upload, PUT the
single part, complete it, wait for the scan, then POST the review."""
from io import BytesIO
from PIL import Image
out=BytesIO()
Image.new('RGB',(2000,1500),(200,80,40)).save(out,'JPEG',quality=85)
content=out.getvalue()
start=client.call('/operator/orders/'+order_id+'/reviews/uploads',
{'name':'revisao.jpg','size':len(content)},operator=True)
uid=start['id']
url=client.call('/operator/uploads/'+uid+'/parts/1',{},operator=True)['url']
with urlopen(Request(url,data=content,method='PUT'),timeout=30) as response:
assert response.status==200
client.call('/operator/uploads/'+uid+'/complete',{},operator=True)
wait_scan(client,uid,operator=True)
return client.call('/operator/orders/'+order_id+'/reviews',{'upload_id':uid},operator=True)
def item_spec(mode, metres, grade, uid):
film_width=27 if mode in ('uvfile','uv') else 57
length_cm=float(metres)*100
@@ -304,6 +324,8 @@ def run():
if machine is None:
machine=client.call('/operator/machines',{'name':'Smoke '+uuid4().hex[:6],'products':['textil']},operator=True)['id']
body['machine_id']=machine
# Above 1 m Finalizado needs the review photo (app/reviews.py).
if state=='fin':review_photo(client,oid)
moved=client.call('/operator/orders/'+oid+'/move',body,operator=True)
version+=1;assert moved['version']==version
client.call('/operator/orders/'+oid+'/move',{'state':'rec','version':0},operator=True,expected=409)
@@ -315,6 +337,7 @@ def run():
client.call('/operator/orders/'+oid+'/move',{'state':'imp','version':version},operator=True,expected=409)
back=client.call('/operator/orders/'+oid+'/move',{'state':'rev','version':version,'reason':'Movido por engano'},operator=True)
assert back['state']=='rev';version+=1
review_photo(client,oid)
client.call('/operator/orders/'+oid+'/move',{'state':'fin','version':version},operator=True);version+=1
history=client.call('/operator/orders/'+oid+'/history',operator=True)
assert len(history)==8 and history[-2]['back'] and history[-2]['reason']=='Movido por engano' and not history[-1]['back']