feat: an order can be marked "Aguardando contato" until the customer is reached
All checks were successful
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Integration suite on a real stack (push) Successful in 4m8s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m7s
All checks were successful
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Integration suite on a real stack (push) Successful in 4m8s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m7s
The 7 October meeting asked for a way to flag orders whose file needs a word with the customer before printing: rename Arte tratada, or tag the card. A tag keeps the stage meaning "file checked" and the order where it is in the queue. In the order panel, "☎ Aguardando contato" asks what has to be agreed; the card then shows the mark, the board has an "Aguardando contato" filter, and the panel shows the note, who marked it and when, the customer's WhatsApp and "Contato feito", which clears it. The customer is not told. Sellers see the mark but cannot set it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, Response
|
||||
from fastapi.responses import RedirectResponse
|
||||
from pydantic import Field
|
||||
|
||||
from ..core import db
|
||||
from ..core.auth import (COOKIE_SECURE, DUMMY_PASSWORD_HASH, audit, can, client_ip, operator,
|
||||
@@ -514,6 +515,30 @@ def choose_machine(uid: UUID, body: MachineChoice, user=Depends(can('produce')))
|
||||
return {'ok': True}
|
||||
|
||||
|
||||
class ContactWait(StrictModel):
|
||||
waiting: bool
|
||||
note: str = Field(default='', max_length=500)
|
||||
|
||||
|
||||
@router.post('/api/operator/orders/{uid}/contact')
|
||||
def contact(uid: UUID, body: ContactWait, user=Depends(can('produce'))):
|
||||
"""Mark an order as waiting for a word with the customer, with what has to
|
||||
be agreed, or clear the mark once that is done. The stage does not change
|
||||
and the customer is not told."""
|
||||
note = ' '.join(body.note.split())
|
||||
if body.waiting and len(note) < 3:
|
||||
raise HTTPException(422, 'Escreva o que precisa ser combinado com o cliente.')
|
||||
with db.connect() as c:
|
||||
row = c.execute('''UPDATE dtf_local.orders SET contact_since=CASE WHEN %s THEN now() END,
|
||||
contact_by=CASE WHEN %s THEN %s END, contact_note=CASE WHEN %s THEN %s END
|
||||
WHERE id=%s AND cancelled_at IS NULL RETURNING number''',
|
||||
(body.waiting, body.waiting, user, body.waiting, note, uid)).fetchone()
|
||||
if not row:
|
||||
raise HTTPException(404, 'Pedido não encontrado.')
|
||||
audit('order_contact_waiting' if body.waiting else 'order_contact_done', order=row['number'], operator=user)
|
||||
return {'ok': True}
|
||||
|
||||
|
||||
class QueuePlace(StrictModel):
|
||||
"""Where a dragged card lands: between two orders of its column, either
|
||||
of them absent at the top or the bottom."""
|
||||
|
||||
Reference in New Issue
Block a user