@extends('front.layout-ref') @section('content')

Buy a Subscription

@if(\Session::has('error'))

{!! \Session::get('error') !!}

@endif @if(\Session::has('success-payment'))

{!! \Session::get('success-payment') !!}
Back to Home

@endif @if(\Session::has('mpesa-success'))

{!! \Session::get('mpesa-success') !!} . Kindly enter your mPesa pin to accept payment and click to
Complete Transaction

@endif
@if(isset($subscriptions)) @php $gridColor = ['FFA500', '228B22', 'A020F0', 'FF0000', '0000FF', 'FFD700', '808080']; $colorCount = count($gridColor); @endphp @foreach($subscriptions as $index => $subscription) @if(isset($subscription->expiry_date_time)) @if($subscription->expiry_date_time > \Carbon\Carbon::now())
@php // If index is less than the count of colors, use the color from the array, else use gray $colorIndex = $index < $colorCount ? $index : $colorCount - 1; @endphp

{{$subscription->title}}

Number of days: {{$subscription->days}} days

Price: Ksh.{{ number_format($subscription->price * (get_setting('Currency_exchange_rate')->value ?? 0), 2) }} (${{number_format($subscription->price, 2)}})

{{$subscription->description}}

@if(isset($subscription->expiry_date_time)) Event Date: {{ \Carbon\Carbon::parse($subscription->expiry_date_time)->format('d M, Y') }} @endif

@if(isset($subscription->start_time)) Event Starts: {{ \Carbon\Carbon::parse($subscription->start_time)->format('H:i a') }} @endif @if(isset($subscription->end_time)) Event Ends: {{ \Carbon\Carbon::parse($subscription->end_time)->format('H:i a') }} @endif

@if(in_array($subscription->id, $purchased_custom_user_subscriptions)) Already Purchased @else Purchase Subscription @endif
Click to Pay
@endif @elseif(isset($subscription['price_ranges']))
@php // If index is less than the count of colors, use the color from the array, else use gray $colorIndex = $index < $colorCount ? $index : $colorCount - 1; @endphp

{{$subscription->title}}

{{$subscription->description}}

@php $intersected_ids = array_intersect(array_column($subscription['price_ranges'], 'id'), $purchased_general_user_subscriptions); @endphp @if(empty($intersected_ids)) @else Already Purchased @endif
Click to Pay
@else
@php // If index is less than the count of colors, use the color from the array, else use gray $colorIndex = $index < $colorCount ? $index : $colorCount - 1; @endphp

{{$subscription->title}}

Number of days: {{$subscription->days}} days

Price: Ksh.{{ number_format($subscription->price * (get_setting('Currency_exchange_rate')->value ?? 0), 2) }} (${{number_format($subscription->price, 2)}})

{{$subscription->description}}

@if(isset($subscription->expiry_date_time)) Event Date: {{ \Carbon\Carbon::parse($subscription->expiry_date_time)->format('d M, Y') }} @endif

@if(isset($subscription->start_time)) Event Starts: {{ \Carbon\Carbon::parse($subscription->start_time)->format('H:i a') }} @endif @if(isset($subscription->end_time)) Event Ends: {{ \Carbon\Carbon::parse($subscription->end_time)->format('H:i a') }} @endif

@php $general_subscriptions_found = 0; @endphp @foreach($general_subscriptions as $subscription_number => $general_subscription) @if(in_array($general_subscription, $purchased_general_user_subscriptions)) @php $general_subscriptions_found++; @endphp @endif @endforeach @if($general_subscriptions_found > 0) Active subscription @else Purchase subscription @endif
Click to Pay
@endif @endforeach @endif
@section('custom_js_script') @endsection @endsection