@extends('layouts.user')

@section('title')
    My Grants
@endsection

@section('content')

<!-- Start Hero -->
<section class="relative lg:pb-24 pb-16 md:mt-[84px] mt-[70px]">
            <div class="relative md:container container-fluid">
                <div class="relative overflow-hidden md:rounded-md shadow dark:shadow-gray-700 h-52 bg-[url('../../assets/images/hero/pages.html')] bg-center bg-no-repeat bg-cover" 
                style="background-image: url('{{ asset('images/profile-1.jpg') }}');"></div>
            </div><!--end container-->

            <div class="container relative mt-16 md:mt-24">
                <div class="md:flex">
                    <div class="lg:w-1/4 md:w-1/3 md:px-3">
                        <div class="relative -mt-32 md:-mt-48">
                            <div class="p-6 bg-white rounded-md shadow dark:shadow-gray-800 dark:bg-slate-900">
                                <div class="mb-5 text-center profile-pic">
                                    <!-- <input id="pro-img" name="profile-image" type="file" class="hidden" onchange="loadFile(event)" /> -->
                                    <div>
                                        <div class="relative mx-auto h-28 w-28">
                                            <img src="{{ asset('images/avatar-1.png') }}" class="rounded-full shadow dark:shadow-gray-800 ring-4 ring-slate-50 dark:ring-slate-800" id="profile-image" alt="">
                                            <label class="absolute inset-0 cursor-pointer" for="pro-img"></label>
                                        </div>

                                        <div class="mt-4">
                                            <h5 class="text-lg font-semibold">{{ auth()->user()->username }}</h5>
                                            <p class="text-slate-400">{{ auth()->user()->email }}</p>
                                        </div>
                                    </div>
                                </div>

                                <!-- Side Nav -->
                                <x-side-nav/>
                                
                            </div>
                        </div>
                    </div>

                    
                    <div class="mt-6 lg:w-3/4 md:w-2/3 md:px-3 md:mt-0">

                    <x-alert/>
                    
                    <div class="bg-white rounded-md shadow dark:shadow-gray-800 dark:bg-slate-900">
                            <div class="items-center justify-between p-6 border-b border-gray-100 md:flex dark:border-gray-700">
                                <div class="mb-4 md:mb-0">
                                    <h5 class="text-xl font-semibold">My Grants History</h5>
                                </div>
                            </div>
                            @forelse($grants as $grant)
                            <div class="items-center justify-between p-6 border-t border-b border-gray-100 md:flex dark:border-gray-700">
                                <div class="mb-4 md:mb-0">
                                    <h5 class="text-2xl font-semibold">{{ $grant->grant_type }}</h5>
                                    <div class="flex items-center justify-start">
                                        @php
                                            $bot = App\Models\Investment::find($grant->investment_id);
                                        @endphp
                                        <p class="mt-2 text-slate-400">Insurace AI:&nbsp;{{ $bot?->plan?->name }}</p>
                                    </div>
                                    <p class="mt-2 text-slate-400">&nbsp;Status - <b>
                                        @if($grant->status == 0)
                                            Pending...
                                        @elseif($grant->status == 1)
                                            Approved
                                        @else
                                            Declined
                                        @endif
                                    </b></p>
                                </div>
                            </div>
                            @empty
                            @endforelse
                        </div>

                    
                        </div><!--end grid-->

                    </div>
                </div><!--end grid-->
            </div><!--end container-->
        </section><!--end section-->
        <!-- End Hero -->

@endsection