Skip to content

feat(orders): add "Devis" button + preview modal to every order detail page#46

Open
AntoinePoindron wants to merge 1 commit intofeat/quote-preview-download-buttonfrom
feat/quote-button-on-order-detail
Open

feat(orders): add "Devis" button + preview modal to every order detail page#46
AntoinePoindron wants to merge 1 commit intofeat/quote-preview-download-buttonfrom
feat/quote-button-on-order-detail

Conversation

@AntoinePoindron
Copy link
Copy Markdown
Collaborator

Summary

The "Voir le devis" preview modal already existed on the request detail pages on both sides. This PR surfaces it on the order detail pages too so:

  • a client can re-read the quote that's been turned into an order,
  • the caterer can re-open it from the order context,
  • the super_admin gets the same observer-view.

Validated end-to-end manually by @AntoinePoindron before opening this PR.

What changed

Surface Where Download route
client/orders/detail.html "Devis" ghost-pill on the Devis accepté sidebar card client.quote_pdf (added in #44)
caterer/orders/detail.html "Devis" ghost-pill in the Detail du devis section header caterer.quote_pdf
admin/orders/detail.html "Devis" ghost-pill in the Montants section header admin.quote_pdf (new in this PR)

Each modal mirrors the per-quote one on client/requests/<id>: same _pdf_preview.html partial, same close-X + Télécharger pair in the header.

⚠️ Stacked on #44

Base branch: feat/quote-preview-download-button (PR #44). The client side relies on client.quote_pdf from that PR. Merge order: #44 → this one, this one rebases onto main automatically.

Backend

  • New GET /admin/quotes/<q_id>/pdf route in blueprints/admin.py. super_admin sees every quote, no scope check needed; same _MAX_PDF_LINES = 500 cap as the other roles.
  • Each order_detail handler now calls services.quotes.build_pdf_preview(order.quote, order.quote.quote_request, order.quote.caterer) and passes the dict + meal_type_labels to the template. Returns None (button hidden, modal not rendered) if the order's quote has no line items — defensive against legacy rows.

What is NOT changed

  • services.quote_pdf.render_quote_pdf — same signature, same template.
  • The existing per-quote modals on the request detail pages.
  • Permission checks: each role's PDF download is scoped to that role's view (caterer → caterer_id, client → company_id, admin → unscoped).

Test plan

🤖 Generated with Claude Code

…l page

The "Voir le devis" preview modal already existed on the request
detail pages on both sides. Surface it on the order detail pages
too so a client can re-read the quote that's been turned into an
order, the caterer can re-open it from the order context, and
super_admin gets the same observer-view.

Three pages, same modal pattern (mirror of the per-quote modal on
client/requests/<id>): a "Devis" ghost-pill button on the page,
opens an overlay with the existing _pdf_preview.html partial and
a "Télécharger" button that hits the role-appropriate PDF route.

Pieces:
- new GET /admin/quotes/<q_id>/pdf route (super_admin sees every
  quote, no scope check). Mirrors caterer.quote_pdf and the
  client.quote_pdf added in #44; same _MAX_PDF_LINES = 500 cap.
- the three order_detail handlers (client / caterer / admin) now
  compute pdf_preview via services.quotes.build_pdf_preview and
  pass it + meal_type_labels to the template.
- modal HTML inlined into each template (one per role to keep the
  download URL role-specific). Each modal `with`-binds quote, qr
  and caterer for the included partial.

Stacked on #44.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant