@extends('layouts.layout-2') @section('content')

@if($view === 'ot') {{ __('navigation.customerabos') }} @endif @if($view === 'me') {{ __('navigation.myabos') }} @endif / {{ __('navigation.overview') }}

@if(isset($chartData)) @include('user.abo._abo_chart') @endif @if($view === 'ot' && isset($filterMonth))
@if($filterMonth) {{ __('abo.reset') }} @endif
@endif @if (Session::has('alert-success'))
{{ Session::get('alert-success') }}
@endif @if (Session::has('alert-error'))
{{ Session::get('alert-error') }}
@endif
@php $abo_payment_links = $abo_payment_links ?? collect(); @endphp @if($view === 'ot' && $abo_payment_links->isNotEmpty()) @foreach($abo_payment_links as $paymentLink)
{{ __('navigation.abo') }} #{{ $paymentLink->identifier }} {!! \App\Services\OrderPaymentService::getTypeBadge($paymentLink) !!}
{{ __('abo.abo_details') }} @if(\App\Services\OrderPaymentService::canDeleteInstance($paymentLink)) {!! Form::open(['action' => route('user_abos_payment_link_delete', [$paymentLink->identifier]), 'class' => 'd-inline-block ml-1']) !!} {!! Form::close() !!} @endif

@if(\App\Services\OrderPaymentService::isPaymentFailed($paymentLink))
{{ __('abo.pending_payment_failed_title') }}
{{ __('abo.payment_link_failed_copy') }}
@elseif(\App\Services\OrderPaymentService::isPaymentProcessing($paymentLink))
{{ __('abo.pending_payment_processing_title') }}
{{ __('abo.payment_link_processing_copy') }}
@else
{{ __('abo.payment_link_sent_title') }}
{{ __('abo.payment_link_sent_copy') }}
@endif
{{ __('tables.date') }}
{{ $paymentLink->created_at->format('d.m.Y') }}
{{ __('tables.status') }}
{!! \App\Services\OrderPaymentService::getStatusBadge($paymentLink) !!}
{{ __('tables.amount') }}
{{ $paymentLink->getAmountFormatted() }} €
{{ __('tables.email') }}
{{ $paymentLink->shopping_data['billing_email'] ?? '-' }}
@endforeach @endif @if((!$user_abos || $user_abos->isEmpty()) && $abo_payment_links->isEmpty())
{{ __('abo.abo_delivery') }}

@endif @php // Kundenabos laufen ueber die sortierbare Liste; als Karte bleiben nur // die Ausnahmefaelle mit offener Erstzahlung, weil dort Aktionsbuttons // haengen (Kundenwunsch 2026-09-07). $cardAbos = $view === 'ot' ? collect($user_abos)->filter(fn ($abo) => $abo->isPendingInitialPayment()) : collect($user_abos); $listAbos = $view === 'ot' ? collect($user_abos)->reject(fn ($abo) => $abo->isPendingInitialPayment())->values() : collect(); @endphp @foreach($cardAbos as $user_abo)
@if($user_abo->isPendingInitialPayment())
@if($user_abo->hasFailedInitialPayment())
{{ __('abo.pending_payment_failed_title') }}
{{ __('abo.pending_payment_failed_copy') }} {!! Form::open(['action' => route('user_abos_delete_pending', [$view, $user_abo->id]), 'class' => 'd-inline-block ml-2']) !!} {!! Form::close() !!}
@elseif($user_abo->hasInitialPaymentStatus())
{{ __('abo.pending_payment_processing_title') }}
{{ __('abo.pending_payment_processing_copy') }}
@else
{{ __('abo.pending_payment_waiting_title') }}
{{ __('abo.pending_payment_waiting_copy') }}
@endif
@endif
{{ __('tables.start_date') }}
{{ $user_abo->start_date }}
{{ __('tables.next_date') }}
{{ $user_abo->next_date }}
{{ __('tables.abo_delivery_day') }}
{{ \App\Services\HTMLHelper::getAboStrLang($user_abo->abo_interval) }}
{{ __('tables.last_date') }}
{{ $user_abo->last_date }}

{{ __('tables.status') }} / {{ __('tables.active') }}
{!! get_active_badge($user_abo->active) !!} @include('admin.abo._status_explain', ['abo' => $user_abo])
{{ __('tables.abo_delivery') }}
{{ $user_abo->getCountOrders() }}
@if($view === 'ot')
{{ __('navigation.points') }}
{{ $user_abo->getFormattedTotalPoints() }} Pkt. @else
{{ __('tables.amount') }}
{{ $user_abo->getFormattedAmount() }} € @endif
{{ __('tables.payment') }}
{{ $user_abo->getPaymentType() }}
@if($view === 'ot')
{{ __('First name') }}
@if($user_abo->shopping_user) {{ $user_abo->shopping_user->billing_firstname }} @endif
{{ __('Last name') }}
@if($user_abo->shopping_user) {{ $user_abo->shopping_user->billing_lastname }} @endif
{{ __('E-Mail') }}
@if($user_abo->shopping_user) {{ $user_abo->shopping_user->billing_email }} @endif
{{ __('tables.customer') }}
@if($user_abo->shopping_user) @endif
@endif
@endforeach @if($view === 'ot' && $listAbos->isNotEmpty()) @include('user.abo._customer_abo_list', [ 'listAbos' => $listAbos, 'customerAboForecast' => $customerAboForecast ?? null, 'customerAboBilled' => $customerAboBilled ?? null, 'customerAboBilledTotal' => $customerAboBilledTotal ?? null, ]) @endif
@endsection