fix: Replace Prawn with Grover for PDF ticket generation
- Replace Prawn PDF generation with Grover (Chrome headless) for better compatibility - Add HTML-based ticket template with embedded CSS styling - Implement robust Grover loading with fallback to HTML download - Add QR code generation methods to Ticket model - Remove legacy TicketPdfGenerator service and tests - Update PDF generation in TicketsController with proper error handling The new implementation provides: - Better HTML/CSS rendering for ticket layouts - More reliable PDF generation using Chrome engine - Fallback mechanism for better user experience - Cleaner separation of template rendering and PDF conversion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,29 @@ class Ticket < ApplicationRecord
|
||||
TicketPdfGenerator.new(self).generate
|
||||
end
|
||||
|
||||
# Generate QR code data for ticket validation
|
||||
def to_qr_data
|
||||
{
|
||||
ticket_id: id,
|
||||
qr_code: qr_code,
|
||||
event_id: event&.id,
|
||||
user_id: user&.id
|
||||
}.compact.to_json
|
||||
end
|
||||
|
||||
# Generate QR code as SVG
|
||||
def generate_qr_svg
|
||||
require 'rqrcode'
|
||||
qrcode = RQRCode::QRCode.new(to_qr_data)
|
||||
qrcode.as_svg(
|
||||
offset: 0,
|
||||
color: '000',
|
||||
shape_rendering: 'crispEdges',
|
||||
module_size: 4,
|
||||
standalone: true
|
||||
)
|
||||
end
|
||||
|
||||
# Price in euros (formatted)
|
||||
def price_euros
|
||||
price_cents / 100.0
|
||||
|
||||
Reference in New Issue
Block a user