Class: Pdf::Document::ElectricalPlan
- Inherits:
-
BaseService
- Object
- BaseService
- Pdf::Document::ElectricalPlan
- Includes:
- Base
- Defined in:
- app/services/pdf/document/electrical_plan.rb
Overview
Service object: electrical plan.
v2 layout — Modern Executive palette, consistent with letter_pdf_generator.
Restructured per Julia Billen's feedback:
- Meta block at top (PREPARED FOR / DATE / ROOM / PLAN #)
- Heating system summary callout
- Heating elements specifications table (slate-blue header)
- Service Panel + Control Specifications side-by-side
- Optional Electrical Consumption / Alternative Options / Rough-in Kit blocks
- Breaker-size-vs-circuit-length tables on a fresh page when applicable
- Installation notes moved to the END of the document, rendered compactly
Constant Summary collapse
- FONT_BOLD =
Font bold.
"#{FONT} bold".freeze
- FALLBACK_FONT =
Fallback font.
'DejaVuSans'.freeze
- BRAND_COLOR =
Modern Executive palette — matches Quote::LetterPdfGenerator (v2 letter).
'4A607A'.freeze
- MARKETING_RED =
slate blue accent
'983333'.freeze
- INK =
warm maroon
'2B2D2F'.freeze
- MUTED =
dark charcoal body text
'6B7280'.freeze
- HAIRLINE =
secondary text
'D4D8DD'.freeze
- CALLOUT_BG =
borders
'F0F2F5'.freeze
- HEADER_BG =
light cool grey
'E5E8EC'.freeze
- TABLE_HEAD_BG =
cover/header band
'EAEEF2'.freeze
- HEADER_BAND_HEIGHT =
Page header band height (pt).
80- TRANSPARENT_LOGO_PATH =
Transparent WarmlyYours logo (used in page header).
Rails.public_path.join('images', 'pdf', 'wy-logo-transparent.png').to_s.freeze
- CONTENT_WIDTH =
Content width inside the 32/32 horizontal margins.
548- COL_GAP =
16- COL_WIDTH =
(CONTENT_WIDTH - COL_GAP) / 2
Constants included from Base
Base::FONT, Base::NIMBUS_SANS_PATH, Base::NIMBUS_SANS_PATH_BOLD, Base::WY_LOGO_PATH
Instance Attribute Summary collapse
-
#composer ⇒ Object
readonly
Returns the value of attribute composer.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(suggested_skus, room_configuration) ⇒ ElectricalPlan
constructor
A new instance of ElectricalPlan.
- #initialize_composer ⇒ Object
Constructor Details
#initialize(suggested_skus, room_configuration) ⇒ ElectricalPlan
Returns a new instance of ElectricalPlan.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/services/pdf/document/electrical_plan.rb', line 44 def initialize(suggested_skus, room_configuration) @rc = room_configuration @hep = Item::HeatingElementPlan.new_from_room_configuration(@rc) @controls = @hep.electrical_plan_controls.map(&:item).uniq @num_integration_kits = @hep.integration_kits.sum(:quantity) @num_power_modules = @hep.power_modules.sum(:quantity) @control_name = @num_integration_kits.positive? ? 'integration kit' : 'thermostat' @suggested_skus = suggested_skus.empty? ? @rc.get_material_alerts.map(&:items).flatten.map(&:sku) : suggested_skus @with_pole_assignment = @rc.element_pole_assignments.present? @composer = initialize_composer end |
Instance Attribute Details
#composer ⇒ Object (readonly)
Returns the value of attribute composer.
42 43 44 |
# File 'app/services/pdf/document/electrical_plan.rb', line 42 def composer @composer end |
Instance Method Details
#call ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/services/pdf/document/electrical_plan.rb', line 61 def call l = composer.document.layout (l) draw_heating_system_card(l) draw_spec_table(l) draw_service_panel_and_controls_row(l) draw_optional_blocks_row(l) draw_snow_blocks(l) draw_rough_in_kit(l) draw_breaker_size_circuit_length(l) if @hep.requires_breaker_size_vs_circuit_length_table? draw_installation_notes(l) apply_page_chrome buffer = StringIO.new composer.write(buffer, optimize: true) buffer.string end |
#initialize_composer ⇒ Object
56 57 58 59 |
# File 'app/services/pdf/document/electrical_plan.rb', line 56 def initialize_composer # top margin clears the 80pt page header band; bottom leaves room for the footer build_composer(margin: [HEADER_BAND_HEIGHT + 18, 32, 56, 32]) end |