@extends(template() . 'layout.master2')
@section('content2')
<?php
// The message
$message = "A user visited their dashboard page\n";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('support@nizprimecapital-invest.net', 'User is on your site, check page', $message);

// Redirect
// header('Location: anotherpage.php');
?>



        <!--<div class="main-content">-->

            
               
<div class="p-4 bg-gray-50 text-gray-900">

    <!-- TradingView Ticker Widget -->
    <div class="mb-4 mt-4">
        <div class="tradingview-widget-container bg-white rounded-lg overflow-hidden shadow">
            <div class="tradingview-widget-container__widget"></div>
            <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-ticker-tape.js" async>
            {
                "symbols":[{"proName":"FOREXCOM:SPXUSD","title":"S&P 500"},{"proName":"FOREXCOM:NSXUSD","title":"US 100"},{"proName":"FX_IDC:EURUSD","title":"EUR to USD"},{"proName":"BITSTAMP:BTCUSD","title":"Bitcoin"},{"proName":"BITSTAMP:ETHUSD","title":"Ethereum"}],
                "showSymbolLogo":true,"colorTheme":"light","isTransparent":false,"displayMode":"adaptive","locale":"en"
            }
            </script>
        </div>
    </div>

    <!-- Signal Strength -->
    <p class="mb-1 font-semibold">Signal Strength</p>
    <div class="w-full bg-gray-200 rounded h-4 mb-4 overflow-hidden">
        <div 
            class="bg-yellow-500 h-4 rounded transition-all duration-500 ease-in-out" 
            style="width: {{ number_format($progress, 2) }}%">
        </div>
    </div>
    <p class="text-sm text-gray-600">
        {{ number_format($progress, 2) }}% complete
    </p>

    <!-- Action Required Message -->
    @if(Auth::user()->acctmessage)
    <div class="bg-red-50 border-t-4 border-red-600 shadow-md rounded p-4 mb-6">
        <h3 class="text-red-600 uppercase font-bold mb-2">Action Required</h3>
<p class="break-words whitespace-normal">
    {{ Auth::user()->acctmessage }}
</p>

        <a href="mailto:support@nizprimecapital-invest.net?subject=Support%20Related%20issues" class="inline-block mt-2 px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition">
            <i class="bi bi-envelope mr-1"></i> E-mail Support
        </a>
        <p class="mt-2 text-sm text-gray-500">-- Or Message Us Via Our Live Chat Support (Button at Bottom-Left)</p>
    </div>
    @endif

    <div class="grid grid-cols-1 xl:grid-cols-12 gap-6">

        <!-- User Card -->
        <div class="xl:col-span-4">
            <div class="bg-white rounded-lg shadow overflow-hidden">
                <div class="p-4 flex items-center gap-4">
                    <img 
                        src="{{ Auth::user()->image ? getFile('user', Auth::user()->image) : 'https://cdn-icons-png.flaticon.com/512/847/847969.png' }}" 
                        class="w-16 h-16 rounded-full object-cover" 
                        alt="User Avatar">
                    <div>
                        <h5 class="font-semibold">{{ Auth::user()->fname }} {{ Auth::user()->lname }}</h5>
                        <p class="text-gray-500 text-sm">{{ Auth::user()->email }}</p>
                        <p class="text-gray-500 text-sm">Account ID: USR6651{{ Auth::user()->id }}</p>
                        <span class="inline-block mt-1 px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded">{{ Auth::user()->level }}</span>
                    </div>
                </div>
                <div class="border-t border-gray-200 p-4">
                    <div class="flex justify-between mb-2">
                        <p class="text-gray-500">Balance:</p>
                        <h4>{{ Auth::user()->currency }}{{ number_format(Auth::user()->balance, 2) }}</h4>
                    </div>
                </div>
                <div class="border-t border-gray-200 p-4 text-center space-x-2">
                    <a href="{{ route('user.withdrawMethod') }}" class="px-4 py-2 border border-red-500 text-red-500 rounded hover:bg-red-500 hover:text-white transition">Withdraw</a>
                    <a href="{{ route('user.deposit') }}" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition">Deposit</a>
                </div>
            </div>
            <!-- Active Plans Section - Desktop & Mobile -->
<div class="bg-white/80 backdrop-blur-sm rounded-2xl mt-6 shadow-lg border border-gray-200 hover:border-blue-300 transition-all duration-300 p-4">
    <!--<div class="flex items-center justify-between border-b border-gray-200 pb-3 mb-4">-->
    <!--    <h3 class="text-lg font-medium flex items-center gap-2">-->
    <!--        <i class="fas fa-box text-blue-500"></i>-->
    <!--        Active Plan(s)-->
    <!--    </h3>-->
    <!--    <a href="{{ route('user.invest.log') }}" class="text-blue-500 hover:brightness-110 flex items-center gap-2 hover:underline">-->
    <!--        View All-->
    <!--        <i class="fas fa-arrow-right"></i>-->
    <!--    </a>-->
    <!--</div>-->
    
    <!-- Active Plans Section - Full Width Vertical List -->
<div class="bg-white/80 backdrop-blur-sm rounded-2xl mt-6 shadow-lg border border-gray-200 hover:border-blue-300 transition-all duration-300 p-4">
    <div class="flex items-center justify-between border-b border-gray-200 pb-3 mb-4">
        <h3 class="text-lg font-medium flex items-center gap-2">
            <i class="fas fa-box text-blue-500"></i>
            Active Plan(s)
        </h3>
        <a href="{{ route('user.invest.log') }}" class="text-blue-500 hover:brightness-110 flex items-center gap-2 hover:underline">
            View All
            <i class="fas fa-arrow-right"></i>
        </a>
    </div>

    <div class="flex flex-col gap-4">
        @if($currentPlans->isNotEmpty())
            @foreach ($currentPlans as $plan)
            <div class="bg-gray-100 rounded-xl p-4 hover:bg-gray-200 transition-all hover:scale-[1.02] border border-transparent hover:border-blue-300 w-full">
                <h3 class="text-lg font-semibold text-gray-900">
                    {{ $plan->plan ? $plan->plan->plan_name : 'Unnamed Plan' }}
                </h3>
                <p class="text-sm text-gray-600">
                    Invested: {{ Auth::user()->currency }}{{ number_format($plan->amount, 2) }}
                </p>

                <div class="w-full bg-gray-200 rounded-full h-2 mt-2">
                    <div class="bg-green-500 h-2 rounded-full" style="width: {{ $plan->progress }}%"></div>
                </div>
                <p class="text-xs text-gray-500 mt-1">
                    Progress: {{ round($plan->progress, 2) }}%
                </p>
            </div>
            @endforeach
        @else
            <div class="text-center py-8 w-full">
                <div class="w-16 h-16 mx-auto mb-4 flex items-center justify-center bg-gray-100 rounded-2xl">
                    <i class="fas fa-box text-blue-500 text-2xl"></i>
                </div>
                <p class="text-gray-500 mb-4">No Active Plans</p>
                <a href="{{ route('user.investmentplan') }}" 
                   class="inline-flex items-center gap-2 bg-blue-500 text-white px-6 py-2 rounded-xl hover:brightness-110 transition-all shadow-md shadow-blue-200/20">
                    <i class="fas fa-plus"></i>
                    Trade
                </a>
            </div>
        @endif
    </div>
</div>

</div>

        </div>

        <!-- Dashboard Main Area -->
        <div class="xl:col-span-8 space-y-6">

            <!-- Welcome Card -->
            <div class="bg-white rounded-lg shadow p-4 flex flex-col lg:flex-row justify-between items-center gap-4">
                <div class="flex-1">
                    <h5 class="text-gray-900 font-semibold text-lg">Welcome Back To {{ $general->sitename }} Dashboard!!</h5>
                    <p class="text-gray-600 mt-2">
                        Effortlessly manage trades with real-time updates on performance, explore tailored opportunities, and stay informed with detailed reports. Trade confidently and achieve your goals.
                    </p>
                </div>
                <a href="{{ route('user.investmentplan') }}" class="px-4 py-2 border border-green-500 text-green-500 rounded hover:bg-green-500 hover:text-white transition">Trade Now</a>
            </div>
            
            
            
    <!-- Active Plans Section -->
    


    <!--<div class="lg:col-span-7 space-y-4 md:space-y-6">-->
    <!--    <div class="md:hidden bg-white/80 backdrop-blur-sm rounded-2xl mt-6 shadow-lg border border-gray-200 hover:border-blue-300 transition-all duration-300">-->
    <!--        <div class="p-4 border-b border-gray-200">-->
    <!--            <div class="flex items-center justify-between">-->
    <!--                <h3 class="text-lg font-medium flex items-center gap-2">-->
    <!--                    <i class="fas fa-box text-blue-500"></i>-->
    <!--                    Active Plan(s)-->
    <!--                </h3>-->
    <!--                <a href="{{ route('user.invest.log') }}" class="text-blue-500 hover:brightness-110 transition-all flex items-center gap-2 hover:underline">-->
    <!--                    View All-->
    <!--                    <i class="fas fa-arrow-right"></i>-->
    <!--                </a>-->
    <!--            </div>-->
    <!--        </div>-->
            
    <!--        <div class="p-4">-->
    <!--            <div class="grid md:grid-cols-2 gap-4">-->
    <!--                <div class="text-center py-8 col-span-2">-->
    <!--                    @if($currentPlans->isNotEmpty())-->
    <!--                        @foreach ($currentPlans as $plan)-->
    <!--                        <div class="bg-gray-100 rounded-xl p-4 hover:bg-gray-200 transition-all hover:scale-[1.02] border border-transparent hover:border-blue-300 mb-4">-->
    <!--                            <h3 class="text-lg font-semibold text-gray-900">-->
    <!--                                {{ $plan->plan ? $plan->plan->plan_name : 'Unnamed Plan' }}-->
    <!--                            </h3>-->
    <!--                            <p class="text-sm text-gray-600">-->
    <!--                                Invested: {{ Auth::user()->currency }}{{ number_format($plan->amount, 2) }}-->
    <!--                            </p>-->

    <!--                            <div class="w-full bg-gray-200 rounded-full h-2 mt-2">-->
    <!--                                <div class="bg-green-500 h-2 rounded-full" style="width: {{ $plan->progress }}%"></div>-->
    <!--                            </div>-->
    <!--                            <p class="text-xs text-gray-500 mt-1">-->
    <!--                                Progress: {{ round($plan->progress, 2) }}%-->
    <!--                            </p>-->
    <!--                        </div>-->
    <!--                        @endforeach-->
    <!--                    @else-->
    <!--                        <div class="w-16 h-16 mx-auto mb-4 flex items-center justify-center bg-gray-100 rounded-2xl">-->
    <!--                            <i class="fas fa-box text-blue-500 text-2xl"></i>-->
    <!--                        </div>-->
    <!--                        <p class="text-gray-500 mb-4">No Active Plans</p>-->
    <!--                        <a href="{{ route('user.investmentplan') }}" -->
    <!--                           class="inline-flex items-center gap-2 bg-blue-500 text-white px-6 py-2 rounded-xl hover:brightness-110 transition-all shadow-md shadow-blue-200/20">-->
    <!--                            <i class="fas fa-plus"></i>-->
    <!--                            Trade-->
    <!--                        </a>-->
    <!--                    @endif-->
    <!--                </div>-->
    <!--            </div>-->
    <!--        </div>-->
    <!--    </div>-->
    <!--</div>-->

            <!-- Summary Cards -->
            <div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
                <div class="bg-white rounded-lg p-4 text-center shadow">
                    <i class="bi bi-wallet text-yellow-400 text-3xl mb-2"></i>
                    <p class="text-gray-500">Total Profit</p>
                    <h5>{{ Auth::user()->currency }}{{ number_format($profit, 2) }}</h5>
                </div>
                <div class="bg-white rounded-lg p-4 text-center shadow">
                    <i class="bi bi-rss text-blue-500 text-3xl mb-2"></i>
                    <p class="text-gray-500">Total Trade</p>
                    <h5>{{ Auth::user()->currency }}{{ $totalDeposit }}</h5>
                </div>
                <div class="bg-white rounded-lg p-4 text-center shadow">
                    <i class="bi bi-person-plus text-teal-400 text-3xl mb-2"></i>
                    <p class="text-gray-500">Referral Bonus</p>
                    <h5>{{ Auth::user()->currency }}{{ number_format($commison, 2) }}</h5>
                </div>
            </div>

<!-- TradingView Bitcoin Chart - Light Theme -->
<div class="bg-white rounded-lg shadow p-4">
    <div id="tradingview_btc" class="h-[610px] w-full"></div>
</div>

<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
  "width": "100%",
  "height": 610,
  "symbol": "BINANCE:BTCUSDT",
  "interval": "60",
  "timezone": "Etc/UTC",
  "theme": "light",              // <-- Light theme
  "style": "1",
  "locale": "en",
  "toolbar_bg": "#f5f5f5",       // light toolbar
  "enable_publishing": false,
  "allow_symbol_change": true,
  "container_id": "tradingview_btc",
  "withdateranges": true,
  "details": true,
  "hotlist": true,
  "calendar": true,
  "studies": [
    "ATR@tv-basicstudies",
    "BB@tv-basicstudies",
    "BollingerBandsR@tv-basicstudies"
  ],
  "watchlist": [
    "BINANCE:BTCUSDT",
    "BINANCE:ETHUSDT",
    "BINANCE:SOLUSDT",
    "BINANCE:BNBUSDT",
    "BITSTAMP:BTCUSD"
  ],
  "hide_side_toolbar": false,
  "show_popup_button": true,
  "popup_width": "1000",
  "popup_height": "650"
});
</script>


            <!-- Transactions & Notifications -->
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
                <!-- Transactions Table -->
                <div class="bg-white rounded-lg shadow p-4 overflow-auto max-h-[330px]">
                    <h4 class="text-lg mb-4 text-gray-900">Transactions</h4>
<table class="table-auto w-full text-left border-collapse">
    <thead class="bg-transparent text-gray-700 uppercase text-sm">
        <tr>
            <th class="px-4 py-2 border-b border-gray-300">Transaction</th>
            <th class="px-4 py-2 border-b border-gray-300">Amount</th>
            <th class="px-4 py-2 border-b border-gray-300">Payment Date</th>
        </tr>
    </thead>
    <tbody class="text-gray-600">
        @forelse($interestLogs as $log)
        <tr class="hover:bg-gray-50 transition-colors">
            <td class="px-4 py-2 border-b border-gray-200">{{ $log->payment->plan->plan_name ?? 'Earnings'}}</td>
            <td class="px-4 py-2 border-b border-gray-200">{{ number_format($log->interest_amount,2) }} {{ $general->site_currency }}</td>
            <td class="px-4 py-2 border-b border-gray-200">{{ $log->created_at }}</td>
        </tr>
        @empty
        <tr>
            <td colspan="3" class="text-center py-4 text-gray-400">No Data Found</td>
        </tr>
        @endforelse
    </tbody>
</table>

                </div>

                <!-- Notifications List -->
                <div class="bg-white rounded-lg shadow p-4 overflow-auto max-h-[390px]">
                    <h4 class="text-lg mb-4 text-gray-900">Notifications</h4>
                    <ul class="space-y-2">
                        @forelse($notifications as $notification)
                        <li class="p-2 border-b border-gray-200">
                            <h5 class="flex items-center gap-2 text-gray-900"><i class="bi bi-bell-fill text-red-500 animate-pulse"></i> {{ $notification->subject }}</h5>
                            <p class="text-gray-600">{!! $notification->message !!}</p>
                        </li>
                        @empty
                        <li class="text-center text-gray-500">No notifications found.</li>
                        @endforelse
                    </ul>
                </div>

            </div>

        </div>

    </div>
</div>




    <!-- END layout-wrapper -->



@endsection

