@forelse ($categories as $category)
@php
$current_investments = App\Models\Investment::where('category_id', $category->id)->get();
@endphp
@if (count($current_investments) > 0)
@forelse ($opened_investments as $investment)
{{-- @dd($investment->business_plan); --}}
@php
$close = \Carbon\Carbon::parse($investment->created_at)->toFormattedDateString();
$date = strtotime($close);
$validity_date = $investment->validity;
$get_closing_date = strtotime('+' . $investment->closing_date . ' ' . $validity_date, $date);
$closing_date = date('M d, Y', $get_closing_date);
$closing_date = \Carbon\Carbon::parse($closing_date)->diffForHumans();
@endphp
{{ $investment->asset_name }}
{{-- {{ $investment->asset_name }} - Closes
{{ $closing_date }}
{{ $investment->roi }}%
@if ($investment->type == 'fixed')
return
{{ \Carbon\Carbon::parse($investment->return_date)->diffForHumans() }}
@else
Shares
@endif
--}}
@php
$per = $investment->type == 'fixed' ? 'Slots' : 'Share';
@endphp
@php
$unit_bought = App\Models\BoughtInvestment::where('investment_id', $investment->id)->sum('user_id');
@endphp
{{ number_format($investment->slot) }}
{{--
{{ number_format($investment->slot - $unit_bought ?? 0) }}
--}}
Total
{{ $per . 's' }}
₦{{ number_format($investment->amount_per_slot, 2) }}
Per
{{ $per }}
@if (Auth::user()->isTenant())
@endif
{{--
@php
$bought = App\Models\BoughtInvestment::where('investment_id', $investment->id)
->where('user_id', Auth::user()->id)
->first();
@endphp
@if (!$bought)
Open
@else
Bought
@endif
--}}
@empty
No Investments Yet!
All Investments will
appear here
@endforelse
@forelse ($closed_investments as $investment)
{{ $investment->asset_name }}
{{ $investment->roi }}%
@if ($investment->type == 'fixed')
return
{{ \Carbon\Carbon::parse($investment->return_date)->diffForHumans() }}
@else
Shares
@endif
₦{{ number_format($investment->amount_per_slot, 2) }}
Per
Slot
@php
$unit_bought = App\Models\BoughtInvestment::where('investment_id', $investment->id)->sum('slot_bought');
@endphp
{{ number_format($investment->slot - $unit_bought ?? 0) }}
Slots
@empty
No Investments Yet!
All Investments will
appear here
@endforelse
@else
No Investments Yet!
All Investments will appear
here
@endif
@empty
No Investments Yet!
All Investments will appear here
@endforelse