Feature: positioning elements (manually)#1400
Conversation
… (replace #1044) (#1385) * Feat(pdf): allow reversing logo and customer/company on PDF templates * Fix the indentation * Fix comparison * Update assets/core/scss/_templates.scss Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Ordissimo <thierry@ordissimo.com> Co-authored-by: Niels Drost <47660417+nielsdrost7@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
📝 WalkthroughWalkthroughTwo new boolean settings enable configurable PDF layout inversion for invoices and quotes: one reverses customer/company positioning, the other repositions the logo. Settings are exposed in the general settings panel and conditionally applied in PDF templates through CSS ID variants, with supporting stylesheet rules added. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Pull request overview
This PR adds configurable options to control the positioning of the logo and the relative positions of customer and company blocks in PDF invoice/quote templates.
Changes:
- Adds new SCSS rules and IDs to support normal and inverted layouts for logo, client, and company sections in PDF templates.
- Updates invoice and quote PDF templates to conditionally append
-inverttologo,client, andcompanyIDs based on new settings. - Extends the general settings UI and English language file with two new options: reversing customer/company order and left-aligning the logo on PDFs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| assets/core/scss/_templates.scss | Adds layout rules for #logo-invert, #company-invert, #client, and #client-invert to support inverted header layouts. |
| application/views/quote_templates/pdf/InvoicePlane.php | Makes logo and client/company container IDs conditional on new invert-related settings for quotes. |
| application/views/invoice_templates/pdf/InvoicePlane.php | Makes logo and client/company container IDs conditional on new invert-related settings for invoices. |
| application/modules/settings/views/partial_settings_general.php | Adds two dropdowns under general settings to toggle logo position and customer/company inversion for PDFs. |
| application/language/english/ip_lang.php | Introduces language strings for the new PDF layout settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `#company-invert` { | ||
| float: left; | ||
| text-align: left; | ||
| width: 40%; | ||
| } | ||
|
|
||
| `#client` { | ||
| float: left; | ||
| width: 55%; | ||
| margin-right: 5%; | ||
| } | ||
|
|
||
| `#client-invert` { |
There was a problem hiding this comment.
The CSS selector here is wrapped in backticks, which makes it invalid SCSS/CSS and prevents the #company-invert rules from applying. This will break the layout when the "invert customer and company" option is enabled, since the corresponding HTML uses id="company-invert" but this rule will never match.
| `#company-invert` { | |
| float: left; | |
| text-align: left; | |
| width: 40%; | |
| } | |
| `#client` { | |
| float: left; | |
| width: 55%; | |
| margin-right: 5%; | |
| } | |
| `#client-invert` { | |
| #company-invert { | |
| float: left; | |
| text-align: left; | |
| width: 40%; | |
| } | |
| #client { | |
| float: left; | |
| width: 55%; | |
| margin-right: 5%; | |
| } | |
| #client-invert { |
| `#company-invert` { | ||
| float: left; | ||
| text-align: left; | ||
| width: 40%; | ||
| } | ||
|
|
||
| `#client` { | ||
| float: left; | ||
| width: 55%; | ||
| margin-right: 5%; | ||
| } | ||
|
|
||
| `#client-invert` { |
There was a problem hiding this comment.
The #client selector is surrounded by backticks, which makes the rule invalid and means none of these layout styles are applied to the client block. As a result, even with the non-inverted layout, the client section may not float/size correctly according to this rule.
| `#company-invert` { | |
| float: left; | |
| text-align: left; | |
| width: 40%; | |
| } | |
| `#client` { | |
| float: left; | |
| width: 55%; | |
| margin-right: 5%; | |
| } | |
| `#client-invert` { | |
| #company-invert { | |
| float: left; | |
| text-align: left; | |
| width: 40%; | |
| } | |
| #client { | |
| float: left; | |
| width: 55%; | |
| margin-right: 5%; | |
| } | |
| #client-invert { |
| `#company-invert` { | ||
| float: left; | ||
| text-align: left; | ||
| width: 40%; | ||
| } | ||
|
|
||
| `#client` { | ||
| float: left; | ||
| width: 55%; | ||
| margin-right: 5%; | ||
| } | ||
|
|
||
| `#client-invert` { |
There was a problem hiding this comment.
The #client-invert selector is also wrapped in backticks, making the rule invalid so the inverted client layout styles (float right, left margin) are never applied. This will cause the customer/company positions not to swap visually when the "invert customer and company" option is turned on.
| `#company-invert` { | |
| float: left; | |
| text-align: left; | |
| width: 40%; | |
| } | |
| `#client` { | |
| float: left; | |
| width: 55%; | |
| margin-right: 5%; | |
| } | |
| `#client-invert` { | |
| #company-invert { | |
| float: left; | |
| text-align: left; | |
| width: 40%; | |
| } | |
| #client { | |
| float: left; | |
| width: 55%; | |
| margin-right: 5%; | |
| } | |
| #client-invert { |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
assets/core/scss/_templates.scss (1)
56-96: Remove stray backticks from selectors at lines 80, 86, 92.Backticks around selectors produce invalid CSS that won't match HTML elements with
id="company-invert",id="client", andid="client-invert", causing layout regressions.🛠️ Proposed fix
-`#company-invert` { +#company-invert { float: left; text-align: left; width: 40%; } -`#client` { +#client { float: left; width: 55%; margin-right: 5%; } -`#client-invert` { +#client-invert { float: right; width: 55%; margin-left: 5%; }
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.