@extends('frontend.main_master') @section('body-class', 'panel-page panel-scrollable') @section('title', t('my-basket') . ' - ' . t('site-title')) @push('styles') @endpush @section('content')
{{-- Toasts --}}
@if (session('success')) @endif @if (session('error')) @endif
{{-- Header --}}

{{ t('your-basket') }}

@if (!empty($cart['items'])) ({{ count($cart['items']) }} {{ t('product') }}) @endif
{{ t('view-plans') }}
{{-- Main Grid --}}
{{-- LEFT: Items --}}
@if (empty($cart['items']))
{{ t('empty-cart') }}

{{ t('empty-cart-content') }}

@else
{{-- Cart Items --}}
@foreach ($cart['items'] as $idx => $item) @php $type = $item['type'] ?? ''; $iconBg = 'background:#6366f1'; $iconSymbol = 'fa-solid fa-box'; if ($type === 'subscription') { $iconBg = 'background:var(--astro-main-green)'; $iconSymbol = 'fa-solid fa-crown'; } elseif ($type === 'package') { $iconBg = 'background:#f59e0b'; $iconSymbol = 'fa-solid fa-gem'; } elseif (str_contains($type, 'chat')) { $iconSymbol = 'fa-solid fa-comments'; } elseif (str_contains($type, 'report')) { $iconSymbol = 'fa-solid fa-file-lines'; } elseif (str_contains($type, 'comment')) { $iconSymbol = 'fa-solid fa-star'; } @endphp
{{ $item['label'] }}
{{ number_format($item['unit_price'], 0, ',', '.') }} {{ t('currency') }} @if (($item['type'] ?? '') === 'subscription') × {{ $item['quantity'] }} @else × {{-- Miktar arttır/azalt (paket ve diğer ürünler) --}}
@csrf
{{ $item['quantity'] }}
@csrf
@endif
{{ number_format($item['line_total'], 0, ',', '.') }} {{ t('currency') }}
@csrf
@if (!empty($item['meta']['features'])) @php $meta = $item['meta']; @endphp
@foreach ($meta['features'] as $feat)
{{ $feat }}
@endforeach @if (!empty($meta['package_name']) && $item['type'] === 'subscription')
{{ $meta['package_name'] }} — {{ number_format($meta['package_word_limit']) }} {{ t('token') }}
@endif
@if (!empty($meta['has_discount']) && !empty($meta['price_normal'])) {{ number_format($meta['price_normal'], 0, ',', '.') }} {{ t('currency') }} @endif @if (!empty($meta['is_subscriber_price'])) {{ t('subscriber-price') }} @endif @if (!empty($meta['monthly_eq'])) {{ t('monthly') }} {{ number_format($meta['monthly_eq'], 0, ',', '.') }} ~{{ t('currency') }} @endif
@endif
@endforeach
{{-- Billing Info --}}
@if ($hasBillingInfo)
{{ t('billing-info') }}
{{ t('billing-type') }}: {{ ($billingInfo->invoice_type ?? 'individual') === 'corporate' ? t('corporate') : t('individual') }}
{{ t('billing-company-name') }}: {{ $billingInfo->company_name ?? '-' }}
{{ t('identity-number') }}: {{ $billingInfo->tax_id ?? '-' }}
@if (!empty($billingInfo->tax_office))
{{ t('tax-office') }}: {{ $billingInfo->tax_office }}
@endif @if (!empty($billingInfo->billing_address))
{{ t('billing-address') }}: {{ $billingInfo->billing_address }}
@endif @if ($billingInfo->city || $billingInfo->district)
{{ t('city') }} / {{ t('district') }}: {{ $billingInfo->city ?? '' }}{{ $billingInfo->district ? ' / ' . $billingInfo->district : '' }}
@endif
@else
{{ t('billing-info') }} {{ t('add') }}
{{ t('billing-info-required') }}
@endif
@endif
{{-- RIGHT: Summary --}}
{{ t('order-summary') }}
@if (!empty($cart['items']))
{{ t('purchased-items') ?? 'Purchased Items' }}
@foreach ($cart['items'] as $summaryItem)
{{ $summaryItem['label'] }} @if (($summaryItem['quantity'] ?? 1) > 1) {{ $summaryItem['quantity'] }} × {{ number_format($summaryItem['unit_price'], 0, ',', '.') }} {{ t('currency') }} @endif
{{ number_format($summaryItem['line_total'], 0, ',', '.') }} {{ t('currency') }}
@endforeach
@endif @php $currentLocale = strtolower((string) env('APP_LOCALE', app()->getLocale() ?? 'es')); $isEn = str_starts_with($currentLocale, 'en'); $isTr = str_starts_with($currentLocale, 'tr'); $subtotal = $cart['subtotal'] ?? ($cart['total'] ?? 0); $discount = $cart['discount'] ?? 0; $total = $cart['total'] ?? 0; $appliedCoupon = $cart['coupon'] ?? null; $bonusMonths = $appliedCoupon['bonus_subscription_months'] ?? 0; $bonusDurationText = $isEn ? 'months of gifted subscription duration' : ($isTr ? 'ay hediye abonelik süresi' : 'meses de suscripción de regalo'); $bonusNoteText = $isEn ? 'Valid for orders containing subscription items; only subscription duration is extended.' : ($isTr ? 'Abonelik içeren siparişlerde geçerlidir, sadece abonelik süresi uzar.' : 'Válido para pedidos con suscripción; solo se amplía la duración de la suscripción.'); @endphp
{{ t('subtotal') }} {{ number_format($subtotal, 0, ',', '.') }}{{ t('currency') }}
@if ($discount > 0 && $appliedCoupon)
{{ t('coupon') }} ({{ $appliedCoupon['code'] }}) -{{ number_format($discount, 0, ',', '.') }} {{ t('currency') }}
@endif
{{ t('vat') }} {{ t('including') }}
@if ($appliedCoupon && $bonusMonths > 0)
+{{ $bonusMonths }} {{ $bonusDurationText }} {{ $bonusNoteText }}
@endif
{{-- Coupon --}}
@if ($appliedCoupon)
{{ $appliedCoupon['code'] }} — {{ number_format($appliedCoupon['amount'], 0, ',', '.') }} @php $couponType = $appliedCoupon['discount_type'] ?? 'amount'; @endphp @if ($couponType === 'percent') % @else {{ t('currency') }} @endif @if ($bonusMonths > 0) +{{ $bonusMonths }} {{ $bonusDurationText }} @endif
@csrf
@else
@csrf
@endif

{{-- Total --}}
{{ t('total') }} {{ number_format($total, 0, ',', '.') }} {{ t('currency') }}

{{ t('including-vat') }}

{{-- Checkout --}}
@if (!empty($cart['items'])) @if ($hasBillingInfo) @if (!empty($hasStoreItem) && $addresses->isEmpty())
Mağaza ürünü sipariş edebilmek için önce bir kargo adresi eklemelisiniz. Adres Ekle
@endif
@csrf @if (!empty($hasStoreItem) && $addresses->isNotEmpty())
@endif
@else
{{ t('payment-info-required') }} {{ t('add-payment-info') }}
@endif @endif
{{ t('secure-payment') }} • {{ t('buyer-protection') }}
{{ t('buyer-protection-content') }}
@endsection