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
Open
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Validated end-to-end manually by @AntoinePoindron before opening this PR.
What changed
client/orders/detail.htmlclient.quote_pdf(added in #44)caterer/orders/detail.htmlcaterer.quote_pdfadmin/orders/detail.htmladmin.quote_pdf(new in this PR)Each modal mirrors the per-quote one on
client/requests/<id>: same_pdf_preview.htmlpartial, same close-X + Télécharger pair in the header.Base branch:
feat/quote-preview-download-button(PR #44). The client side relies onclient.quote_pdffrom that PR. Merge order: #44 → this one, this one rebases ontomainautomatically.Backend
GET /admin/quotes/<q_id>/pdfroute inblueprints/admin.py. super_admin sees every quote, no scope check needed; same_MAX_PDF_LINES = 500cap as the other roles.order_detailhandler now callsservices.quotes.build_pdf_preview(order.quote, order.quote.quote_request, order.quote.caterer)and passes the dict +meal_type_labelsto the template. ReturnsNone(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.Test plan
🤖 Generated with Claude Code