Commit Graph

169 Commits

Author SHA1 Message Date
kbe
9b5d8fcf97 feat: Add comprehensive address-first geolocation system for events
This implementation provides automatic geocoding and map integration:

- **Event Model Enhancements:**
  - Automatic geocoding callback using OpenStreetMap Nominatim API
  - 3-tier fallback system: exact coordinates → city-based → country default
  - Fallback coordinates for major French cities (Paris, Lyon, Marseille, etc.)
  - Robust error handling that prevents event creation failures

- **User-Friendly Event Forms:**
  - Address-first approach - users just enter addresses
  - Hidden coordinate fields (auto-generated behind scenes)
  - Real-time geocoding with 1.5s debounce
  - "Ma position" button for current location with reverse geocoding
  - "Prévisualiser" button to show map links
  - Smart feedback system (loading, success, warnings, errors)

- **Enhanced Event Show Page:**
  - Map provider links (OpenStreetMap, Google Maps, Apple Plans)
  - Warning badges when approximate coordinates are used
  - Address-based URLs for better map integration

- **Comprehensive JavaScript Controller:**
  - Debounced auto-geocoding to minimize API calls
  - Multiple geocoding strategies (manual vs automatic)
  - Promise-based geolocation with proper error handling
  - Dynamic map link generation with address + coordinates

- **Failure Handling:**
  - Events never fail to save due to missing coordinates
  - Fallback to city-based coordinates when exact geocoding fails
  - User-friendly warnings when approximate locations are used
  - Maintains existing coordinates on update failures

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2025-09-10 19:36:47 +02:00
kbe
748f839346 feat: Implement comprehensive promoter system with dashboard and role-based access
This commit implements a complete promoter system that allows professional users
(is_professionnal: true) to manage events with advanced analytics and controls.

## Key Features Added:

### Role-Based Access Control
- Update User#can_manage_events? to use is_professionnal field
- Add promoter? alias method for semantic clarity
- Restrict event management to professional users only

### Enhanced Navigation
- Add conditional "Créer un événement" and "Mes événements" links
- Display promoter navigation only for professional users
- Include responsive mobile navigation with appropriate icons
- Maintain clean UI for regular users

### Comprehensive Promoter Dashboard
- Revenue metrics with total earnings calculation
- Tickets sold counter across all events
- Published vs draft events statistics
- Monthly revenue trend chart (6 months)
- Recent events widget with quick management actions
- Recent orders table with customer information

### Advanced Analytics
- Real-time revenue calculations from order data
- Monthly revenue trends with visual progress bars
- Event performance metrics and status tracking
- Customer order history and transaction details

### Event Management Workflow
- Verified existing event CRUD operations are comprehensive
- Maintains easy-to-use interface for event creation/editing
- State management system (draft → published → cancelled)
- Quick action buttons for common operations

### Documentation
- Comprehensive implementation guide in docs/
- Technical details and architecture explanations
- Future enhancement recommendations
- Testing and deployment considerations

## Technical Implementation:

- Optimized database queries to prevent N+1 problems
- Proper eager loading for dashboard performance
- Responsive design with Tailwind CSS components
- Clean separation of promoter vs regular user features
- Maintainable code structure following Rails conventions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 18:12:04 +02:00
kbe
83e76f71bf Move increment_payment_attempt to API namespace and update JavaScript
- Add API route for increment_payment_attempt in config/routes.rb
- Update API OrdersController to handle increment_payment_attempt and skip API key authentication
- Update JavaScript code in checkout view to use API endpoint without CSRF tokens
- Remove CSRF token from API requests as it's not required for API endpoints
- Maintain backward compatibility by keeping original method in OrdersController
2025-09-10 16:27:05 +02:00
kbe
20ae3de7a3 Link to homepage on and more comments in controller 2025-09-10 15:20:29 +02:00
kbe
6d2a6ed027 chore: Remove links to non working themes 2025-09-10 15:11:33 +02:00
kbe
60b7bc6aa7 feat: Update from breadcrumb on the current page 2025-09-10 14:31:48 +02:00
kbe
8d2127fce2 feat: Use invoice emitter details from env var 2025-09-10 10:21:32 +02:00
kbe
2fb0e1fdbb Make invoice emitter configurable via environment variables
Add environment variables for invoice company details to allow customization without code changes. Update invoice view and Stripe service to use these configurable values.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 10:16:24 +02:00
kbe
ca35abe01d Fix link_to helper syntax error in orders checkout page
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-08 18:45:41 +02:00
kbe
f2448383d4 Setup container system for all pages with max-width constraint while maintaining full-width backgrounds
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-08 18:34:00 +02:00
kbe
9be7a01d93 Update all views to use new design system components and styling
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-08 17:59:12 +02:00
kbe
569303b631 Update breadcrumbs to use dynamic component with new design system colors
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-08 17:51:11 +02:00
kbe
259837622a Update design system to match Aperonight design guidelines - Replace gradient buttons with solid color buttons
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-08 17:31:19 +02:00
kbe
cf34c9c7a6 Fix i18n load path configuration that was causing translation helper issues
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-08 16:09:03 +02:00
kbe
1261efc4c8 Improve design system 2025-09-08 15:52:19 +02:00
kbe
a101885d87 Restyle of the homepage 2025-09-08 15:19:57 +02:00
kbe
0b6eec0c7b In mailer use application name
Some checks failed
CI / scan_ruby (pull_request) Successful in 5m46s
CI / lint (pull_request) Failing after 39s
CI / test (pull_request) Failing after 1m22s
2025-09-08 12:38:40 +02:00
kbe
8f9795d773 Fix failing tests and improve email template consistency
- Fix onboarding controller test by using consistent application name
- Fix ticket mailer template error by correcting variable reference (@user.first_name)
- Update event reminder template to use configurable app name
- Refactor mailer tests to properly handle multipart email content
- Update test assertions to match actual template content
- Remove duplicate migration for onboarding field
- Add documentation for test fixes and solutions
2025-09-08 12:36:33 +02:00
kbe
d1308bc988 Remove company information section from onboarding
Completely remove the enterprise/company information functionality from
the onboarding flow to simplify the user experience:

- Remove company information toggle section and form fields from view
- Delete unused Stimulus toggle controller (toggle_section_controller.js)
- Update onboarding controller to only process first/last name parameters
- Remove company_name from permitted parameters and validation logic
- Update tests to remove company name assertions and test cases
- Simplify onboarding to only collect essential personal information

The onboarding now focuses solely on collecting required first and last
names, providing a cleaner and faster user experience.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 11:41:43 +02:00
kbe
758d461c1a feat: Implement comprehensive onboarding system for new users
Add complete user onboarding flow that redirects new users to complete their
profile before accessing the application:

- Add onboarding_completed boolean field to users with migration
- Create OnboardingController with form validation and completion logic
- Design professional onboarding UI with progressive disclosure for company info
- Implement Stimulus controller for toggling company information section
- Add application-wide redirect middleware for incomplete users
- Create comprehensive test suite for all onboarding functionality
- Update test fixtures and helpers to support onboarding in existing tests

The onboarding collects required first/last name and optional company information.
Users are redirected to onboarding after login until profile is completed.
Features smooth animations, full-width form button, and clean UX design.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 11:38:28 +02:00
kbe
67d3bcde5b Fix service fee missing from Stripe invoices
The StripeInvoiceService was only creating line items for tickets but missing
the 1€ service fee, causing a discrepancy where customers paid 26€ via Stripe
checkout but the generated invoice only showed 25€.

- Add service fee line item to Stripe invoices in StripeInvoiceService
- Update all related tests to expect two line items (tickets + service fee)
- Fix order controller test to account for service fee in total calculation

Now Stripe invoices properly match the amount paid: tickets + 1€ service fee.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-08 11:15:36 +02:00
kbe
bc214867b0 Add invoice functionality for orders with Stripe integration 2025-09-08 10:55:36 +02:00
kbe
4bc40967c8 feat: Internal invoice generation
- TODO: make use of Stripe invoice
2025-09-08 09:42:22 +02:00
kbe
039ae7d1f8 Add 1€ service fee to all order-related pages and Stripe integration
- Added 1€ service fee to order total calculation in Order model
- Updated checkout page to display fee breakdown (subtotal + 1€ fee = total)
- Updated payment success page to show fee breakdown
- Updated order show page to display fee breakdown
- Updated payment cancel page to show fee breakdown
- Modified Stripe session creation to include service fee as separate line item
- Updated order model tests to account for the 1€ service fee
- Enhanced overall pricing transparency for users

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 01:29:24 +02:00
kbe
f285d689b4 Make the flash message use the page width 2025-09-07 01:22:44 +02:00
kbe
b74fd49816 Update event show page breadcrumb to match new style and minor flash message improvements
- Updated breadcrumb on event show page to use the new consistent style with rounded background and shadow
- Improved spacing and responsive design for breadcrumbs
- Made minor layout adjustments to flash messages component
- Enhanced overall UI consistency across the application

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 01:11:31 +02:00
kbe
8ad2194d48 Add security documentation for ticket download implementation and minor UI fixes
- Created comprehensive documentation for implementing secure unique IDs for ticket PDF downloads
- Document includes migration steps, model updates, controller changes, and security best practices
- Fixed minor spacing issues in orders index page
- Updated breadcrumb spacing for better visual hierarchy

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 01:09:00 +02:00
kbe
94d1145668 Update all breadcrumbs to match the new style
- Updated all breadcrumbs across the application to use the new consistent style
- Added rounded background with shadow for better visual hierarchy
- Improved spacing and responsive design
- Maintained proper navigation paths for all pages
- Enhanced overall UI consistency with the new design language

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 00:55:07 +02:00
kbe
dc228b18ba Revert breadcrumbs to old style for consistency across all pages
- Updated all breadcrumbs to match the style used in events index page
- Simplified breadcrumb design with cleaner, more consistent look
- Maintained proper navigation paths for all pages
- Improved overall UI consistency across the application

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 00:44:29 +02:00
kbe
38fc0059ea Add consistent breadcrumbs to ticket page
- Updated ticket show page breadcrumbs to match the consistent style used across order pages
- Breadcrumbs now show clear path: Home → Dashboard → Order # → Ticket #
- Improved user navigation and context awareness on ticket page

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 00:27:54 +02:00
kbe
11340e5e58 Add breadcrumbs to all order-related pages for improved navigation
- Added consistent breadcrumb navigation to order show, payment success, payment cancel, checkout, new order, and orders index pages
- Standardized breadcrumb style across all pages for better UX
- Breadcrumbs now show clear path from home to current page
- Improved user navigation and context awareness

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 00:25:54 +02:00
kbe
ceb5a13297 chore: On tickets#show add back link to order#show
Instead of going back to dashboard, user now goes to order
details.
2025-09-07 00:21:36 +02:00
kbe
7694e50fa0 Improve mobile responsiveness and UI consistency across order pages and dashboard
- Updated payment success and cancel pages to match order details layout
- Made dashboard fully responsive with improved mobile layouts
- Added missing venue address to order pages
- Standardized styling and spacing across all order-related pages
- Improved PDF ticket generator formatting

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-09-07 00:12:28 +02:00
kbe
e86b84ba61 feat: Enhance user dashboard and order management
- Add orders index action to OrdersController with pagination support
- Simplify dashboard to focus on user orders and actions
- Redesign order show page with improved layout and ticket access
- Remove complex event metrics in favor of streamlined order management
- Add direct links to ticket downloads and better order navigation
- Improve responsive design and user experience across order views

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 22:55:27 +02:00
kbe
f1750cb887 chore: Translate pdf into french 2025-09-06 21:35:50 +02:00
kbe
2aae7fe8ea Merge branch 'feat/ticket' into develop 2025-09-06 21:31:34 +02:00
kbe
b8efa1e26d feat: Ticket ID now appears on PDF
- Promoters can now check the name and ID based on their dashboard
2025-09-06 21:29:41 +02:00
kbe
9e6c48dc5c refactor: Simplify PDF ticket design for single-page layout
- Switch to standard A4 page size with proper 40px margins
- Remove complex gradient backgrounds and card layouts for simplicity
- Implement clean, minimalist design with clear visual hierarchy
- Use two-column layout for efficient space utilization
- Center QR code with optimal 120px size for scanning
- Simplify typography with consistent font sizes and colors
- Remove unnecessary visual elements (shadows, rounded corners, badges)
- Ensure all content fits comfortably on single page
- Maintain brand colors (purple for header) with subtle styling
- Keep all essential information: event details, ticket holder, QR code
- Preserve robust error handling and QR code validation

Design improvements:
• Single-page layout that fits within A4 margins
• Clean two-column information display
• Simplified color scheme with good contrast
• Optimized spacing for readability
• Centered QR code for easy scanning
• Minimal but professional appearance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 21:11:00 +02:00
kbe
6e3413a128 feat: Implement professional PDF ticket design with modern styling
- Redesign PDF layout with modern gradient background and card-based structure
- Add sophisticated color scheme using purple/indigo brand colors
- Implement visual hierarchy with improved typography and spacing
- Create information grid layout with labeled sections and visual indicators
- Add color-coded price badge with rounded corners and proper contrast
- Enhance QR code section with dedicated background card and better positioning
- Improve security elements and footer styling with professional appearance
- Increase ticket size to 400x650px for better readability and visual impact
- Fix encoding issues for French characters and special symbols compatibility
- Maintain all existing functionality while significantly improving visual design

New features:
• Modern gradient header with brand identity
• Card-based layout with subtle shadow effects
• Grid-based information layout with clear visual hierarchy
• Professional color coding and typography choices
• Enhanced QR code presentation with dedicated section
• Improved security messaging and timestamp styling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 21:05:39 +02:00
kbe
0a3a913f66 refactor: Simplify PDF ticket download functionality
- Rename download_ticket action to download for consistency
- Use QR code lookup consistently in both show and download actions
- Simplify routes to use QR code pattern for both viewing and downloading
- Remove complex dual-lookup logic in favor of consistent QR code access
- Clean up route constraints and duplicate route definitions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 21:00:28 +02:00
kbe
dcaa83e756 feat: Merge PDF ticket generation functionality from feat/pdf-ticket branch
- Add TicketPdfGenerator service for creating PDF tickets with QR codes
- Implement download_ticket action in TicketsController
- Update ticket routes to support both ID and QR code access
- Add to_pdf method to Ticket model using TicketPdfGenerator
- Resolve conflicts between email notifications and PDF ticket features
- Maintain backward compatibility with existing QR code routes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 20:51:06 +02:00
kbe
213a11e731 feat: Display ticket based on `qr_code` field
- Previously ticket was displayed using id which is too easy to find
- Now the URL takes ``qr_code`` field as parameters
2025-09-06 20:33:42 +02:00
kbe
ce0752bbda feat: Complete email notifications system with comprehensive functionality
- Implement comprehensive email notification system for ticket purchases and event reminders
- Add event reminder job with configurable scheduling
- Enhance ticket mailer with QR code generation and proper formatting
- Update order model with email delivery tracking
- Add comprehensive test coverage for all email functionality
- Configure proper mailer settings and disable annotations
- Update backlog to reflect completed email features

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 20:21:01 +02:00
kbe
e983b68834 refactor: Replace external QR code dependency with bundled qrcode package
- Install qrcode npm package for proper QR code generation
- Create new Stimulus controller using qrcode library instead of external CDN
- Update ticket show view to use self-contained QR code generation
- Remove dependency on external qrserver.com API
- Generate valid, scannable QR codes client-side

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 20:18:22 +02:00
kbe
d5326c7dc6 fix: Eliminate duplicate email notifications after Stripe checkout
Previously, users received multiple emails after successful payment:
- One email per individual ticket (via orders_controller.rb)
- One order-level email with all tickets (via order.rb mark_as_paid!)

This resulted in N+1 emails for N tickets purchased.

Changes:
- Removed individual ticket email sending from orders_controller.rb
- Kept single comprehensive order email in order.rb
- Updated test to reflect that email failures don't prevent order completion
- Users now receive exactly one email with all tickets as PDF attachments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 14:13:26 +02:00
kbe
fdad3bfb7b fix: Remove extra '>' characters from email templates
The '>' characters at the end of emails were caused by Rails development
mode adding HTML comment annotations to rendered views, including email
templates. This creates comments like '<!-- END app/views/...erb -->'
which can appear as stray characters in email clients.

Solution:
- Add initializer to disable view annotations specifically for ActionMailer
- Preserves debugging annotations for regular views
- Ensures clean email formatting in development mode
- No impact on production where annotations are disabled by default

The emails will now render cleanly without extra HTML comments or
stray characters at the end.
2025-09-06 13:43:33 +02:00
kbe
c3f5d72a91 fix: Resolve QR code generation errors in checkout email notifications
This fixes the 'data must be a String, QRSegment, or an Array' error that was
preventing checkout completion.

Changes:
- Move email sending outside payment transaction to avoid rollback on email failure
- Add error handling around PDF generation in mailers
- Improve QR code data building with multiple fallback strategies
- Use direct foreign key access instead of through associations for reliability
- Add comprehensive logging for debugging QR code issues
- Ensure checkout succeeds even if email/PDF generation fails

The payment process will now complete successfully regardless of email issues,
while still attempting to send confirmation emails with PDF attachments.
2025-09-06 13:33:22 +02:00
kbe
241256e373 docs: Update backlog to reflect completed email notifications feature 2025-09-06 13:25:24 +02:00
kbe
7f36abbcec feat: Implement comprehensive email notifications system
This commit implements a complete email notifications system for purchase
confirmations and event reminders as requested in the medium priority
backlog tasks.

## Features Added

### Purchase Confirmation Emails
- Automatically sent when orders are marked as paid
- Supports both single tickets and multi-ticket orders
- Includes PDF ticket attachments
- Professional HTML and text templates in French

### Event Reminder Emails
- Automated reminders sent 7 days, 1 day, and day of events
- Only sent to users with active tickets
- Smart messaging based on time until event
- Venue details and ticket information included

### Background Jobs
- EventReminderJob: Sends reminders to all users for a specific event
- EventReminderSchedulerJob: Daily scheduler to queue reminder jobs
- Proper error handling and logging

### Email Templates
- Responsive HTML templates with ApéroNight branding
- Text fallbacks for better email client compatibility
- Dynamic content based on number of tickets and time until event

### Configuration & Testing
- Environment-based SMTP configuration for production
- Development setup with MailCatcher support
- Comprehensive test suite with mocking for PDF generation
- Integration tests for end-to-end functionality
- Documentation with usage examples

## Technical Implementation
- Enhanced TicketMailer with new notification methods
- Background job scheduling via Rails initializer
- Order model integration for automatic purchase confirmations
- Proper associations handling for user/ticket relationships
- Configurable via environment variables

## Files Added/Modified
- Enhanced app/mailers/ticket_mailer.rb with order support
- Added app/jobs/event_reminder_*.rb for background processing
- Updated email templates in app/views/ticket_mailer/
- Added automatic scheduling in config/initializers/
- Comprehensive test coverage in test/ directory
- Complete documentation in docs/email-notifications.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 13:25:02 +02:00
kbe
73eefdd7bd Add a document on how to implement check-in system 2025-09-06 13:09:00 +02:00