Files
aperonight/app/views/components/_header.html.erb
kbe 1acc3e09d4 feat: Implement payment retry system and draft ticket expiry management
- Add 30-minute expiry window for draft tickets with automatic cleanup
- Implement 3-attempt payment retry mechanism with tracking
- Create background job for cleaning expired draft tickets every 10 minutes
- Add comprehensive UI warnings for expiring tickets and retry attempts
- Enhance dashboard to display pending draft tickets with retry options
- Add payment cancellation handling with smart retry redirections
- Include rake tasks for manual cleanup and statistics
- Add database fields: expires_at, payment_attempts, last_payment_attempt_at, stripe_session_id
- Fix payment attempt counter display to show correct attempt number (1/3, 2/3, 3/3)
2025-08-31 10:22:55 +02:00

99 lines
5.8 KiB
Plaintext
Executable File

<header class="bg-neutral-800 border-b border-neutral-700">
<nav data-controller="header" class="container mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<!-- Logo -->
<div class="flex items-center">
<%= link_to Rails.application.config.app_name, current_user ? "/dashboard" : "/",
class: "text-xl font-bold text-white" %>
</div>
<!-- Desktop Navigation -->
<div class="hidden sm:flex items-center space-x-6">
<%= link_to t("header.parties"), events_path,
class: "text-gray-100 hover:text-purple-200 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
<%= link_to t("header.concerts"), "#",
class: "text-gray-100 hover:text-purple-200 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
</div>
<!-- Authentication -->
<div class="hidden sm:flex items-center space-x-4">
<% if user_signed_in? %>
<div class="relative" data-header-target="userMenuButton">
<button data-action="click->header#toggleUserMenu"
class="bg-purple-700 text-white border border-purple-800 font-medium py-2 px-4 rounded-lg hover:bg-purple-800 transition-colors duration-200 flex items-center space-x-2">
<span><%= current_user.email.length > 20 ? current_user.email[0,20] + "..." : current_user.email %></span>
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
<div data-header-target="userMenu" class="absolute right-0 mt-2 w-48 rounded-md shadow-lg z-50 hidden">
<%= link_to t("header.profile"), edit_user_registration_path,
class: "block px-4 py-2 text-sm text-gray-100 hover:bg-purple-700 first:rounded-t-md" %>
<%= link_to t("header.reservations"), "#",
class: "block px-4 py-2 text-sm text-gray-100 hover:bg-purple-700" %>
<%= link_to t("header.logout"), destroy_user_session_path,
data: { controller: "logout", action: "click->logout#signOut",
logout_url_value: destroy_user_session_path, redirect_url_value: "/", turbo: false },
class: "block px-4 py-2 text-sm text-gray-100 hover:bg-purple-700 last:rounded-b-md" %>
</div>
</div>
<% else %>
<%= link_to t("header.login"), new_user_session_path,
class: "text-gray-100 hover:text-purple-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
<%= link_to t("header.register"), new_user_registration_path,
class: "bg-purple-600 text-white font-medium py-2 px-4 rounded-lg hover:bg-purple-700 transition-colors duration-200" %>
<% end %>
</div>
<!-- Mobile menu button -->
<div class="flex items-center sm:hidden">
<button data-action="click->header#toggleMobileMenu" data-header-target="mobileMenuButton" class="p-2 rounded-md text-neutral-300 hover:text-white hover:bg-purple-700">
<svg data-menu-icon="open" class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
<svg data-menu-icon="close" class="h-6 w-6 hidden" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
<!-- Mobile Menu -->
<div data-header-target="mobileMenu" class="hidden sm:hidden">
<div class="px-2 pt-2 pb-3 space-y-1">
<%= link_to t("header.parties"), events_path,
class: "block px-3 py-2 rounded-md text-base font-medium text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.concerts"), "#",
class: "block px-3 py-2 rounded-md text-base font-medium text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
</div>
<div class="pt-4 pb-3 border-t border-gray-700">
<% if user_signed_in? %>
<div class="px-4 mb-3">
<div class="text-base font-medium text-white">
<%= current_user.first_name || current_user.email %>
</div>
</div>
<div class="px-2 space-y-1">
<%= link_to t("header.profile"), edit_user_registration_path,
class: "block px-3 py-2 rounded-md text-base font-medium text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.reservations"), "#",
class: "block px-3 py-2 rounded-md text-base font-medium text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.logout"), destroy_user_session_path,
data: { controller: "logout", action: "click->logout#signOut", logout_url_value: destroy_user_session_path, login_url_value: new_user_session_path, turbo: false },
class: "block px-3 py-2 rounded-md text-base font-medium text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
</div>
<% else %>
<div class="px-2 space-y-1">
<%= link_to t("header.login"), new_user_session_path,
class: "block px-3 py-2 rounded-md text-base font-medium text-gray-100 hover:text-purple-200 hover:bg-purple-700" %>
<%= link_to t("header.register"), new_user_registration_path,
class: "block px-3 py-2 rounded-md text-base font-medium bg-purple-600 text-white hover:bg-purple-700" %>
</div>
<% end %>
</div>
</div>
</nav>
</header>