@extends('backend.layout.master')


@section('content')
    <!--<div class="main-content">-->
        <div class="text-right mb-4">
            <a href="#" class="btn btn-sm btn-outline-primary sendMail">
                <i class="fas fa-envelope mr-1"></i>
                {{ 'Send Email' }}
            </a>
        </div>

        <div class="row gy-4">
            <div class="col-xl-3">
                <div class="sp_user_sidebar h-100">
                    <div class="sp_user_img">
                        <img src="{{ getFile('user', $user->image, true) }}" alt="image">
                    </div>
                    <div class="text-center mt-4">
                        <h5 class="mb-0">{{ $user->full_name }}</h5>
                        <p>{{ $user->email }}</p>
                    </div>

                    <ul class="user-action-list">
                        <li>
                            <a href="{{ route('admin.login.user', $user->id) }}" target="_blank"
                                class="btn btn-sm btn-outline-primary"><i class="fas fa-link mr-1"></i>
                                {{ 'Login As User' }}</a>
                        </li>

                        <li>
                            <a href="{{ route('admin.commision', $user) }}" class="btn btn-sm btn-outline-primary"><i
                                    class="fas fa-link mr-1"></i> {{ 'Commission Log' }}</a>
                        </li>

                        <li>
                            <a href="{{ route('admin.user.interestlog', $user) }}" class="btn btn-sm btn-outline-primary"><i
                                    class="fas fa-link mr-1"></i> {{ 'Interest Log' }}</a>
                        </li>

                        <li>
                            <a href="{{ route('admin.deposit.log', $user) }}" class="btn btn-sm btn-outline-primary"><i
                                    class="fas fa-link mr-1"></i> {{ 'Deposit Log' }}</a>
                        </li>

                        <li>
                            <a href="{{ route('admin.payment.report', $user) }}" class="btn btn-sm btn-outline-primary"><i
                                    class="fas fa-link mr-1"></i> {{ 'Investment Log' }}</a>
                        </li>

                        <li>
                            <a href="{{ route('admin.withdraw.report', $user) }}" class="btn btn-sm btn-outline-primary"><i
                                    class="fas fa-link mr-1"></i> {{ 'Withdraw Log' }}</a>
                        </li>

                        <li>
                            <a href="{{ route('admin.ticket.index', ['user' => $user->id]) }}"
                                class="btn btn-sm btn-outline-primary"><i class="fas fa-link mr-1"></i>
                                {{ 'User Ticket' }}</a>
                        </li>

                        <li>
                            <a href="{{ route('admin.transaction', $user) }}" class="btn btn-sm btn-outline-primary"><i
                                    class="fas fa-link mr-1"></i> {{ 'User Transactions' }}</a>
                        </li>
                        
                        
                        <br>
                        
                        <br>
                        <li>
<a href="{{ route('admin.user.delete', $user) }}"
   class="btn btn-sm btn-danger"
   onclick="return confirm('Are you sure you want to delete this user? This action cannot be undone.');">
    <i class="fas fa-trash-alt mr-1"></i> Delete User
</a>

                        </li>
                    </ul>
                </div>
            </div>
            <div class="col-xl-9 mt-xl-0 mt-4">
                <div class="sp_user_details">
                    <ul class="nav nav-tabs sp_nav_tabs" id="myTab" role="tablist">
                        <li class="nav-item" role="presentation">
                            <button class="nav-link active" id="overview-tab" data-toggle="tab" data-target="#overview"
                                type="button" role="tab" aria-controls="overview"
                                aria-selected="true">{{__('Overview')}}</button>
                        </li>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link" id="settings-tab" data-toggle="tab" data-target="#settings"
                                type="button" role="tab" aria-controls="settings"
                                aria-selected="false">{{__('Settings')}}</button>
                        </li>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link" id="balance-tab" data-toggle="tab" data-target="#balance"
                                type="button" role="tab" aria-controls="balance" aria-selected="false">Balance</button>
                        </li>
                        <li class="nav-item" role="presentation">
                            <button class="nav-link" id="referral-tab" data-toggle="tab" data-target="#referral"
                                type="button" role="tab" aria-controls="referral"
                                aria-selected="false">{{__('referral')}}</button>
                        </li>
                             <li class="nav-item" role="presentation">
                            <button class="nav-link" id="currency-tab" data-toggle="tab" data-target="#currency"
                                type="button" role="tab" aria-controls="currency"
                                aria-selected="false">{{__('Currency')}}</button>
                        </li>
                    </ul>
                    <div class="tab-content" id="myTabContent">
                        <div class="tab-pane fade show active" id="overview" role="tabpanel"
                            aria-labelledby="overview-tab">
                            <div class="row mt-4">
                                
                                <!--account-->
                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-1">
                                            <i class="fas fa-wallet"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Choosen Account Type') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ ($user->account) }}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                                
                                                                <!--user chosen currency-->
                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-1">
                                            <i class="fas fa-wallet"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Chosen Currency') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ ($user->currency) }}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                                
                                       <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-1">
                                            <i class="fas fa-wallet"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Balance') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ number_format($user->balance, 2) }}{{ @$user->currency }}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-2">
                                            <i class="fas fa-link"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Refferal') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ $totalRef }}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-3">
                                            <i class="fas fa-undo-alt"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Return Interest') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ number_format($userInterest, 2) }}{{ @$user->currency }}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-4">
                                            <i class="fas fa-funnel-dollar"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Commission') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ number_format($userCommission, 2) }}{{ @$user->currency }}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-5">
                                            <i class="fas fa-hand-holding-usd"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Withdraw') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ number_format($withdrawTotal, 2) }}{{ @$user->currency }}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-6">
                                            <i class="far fa-credit-card"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Deposit') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ number_format($totalDeposit, 2) }} {{ @$user->currency }}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-7">
                                            <i class="fas fa-coins"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Invest amount') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ number_format($totalInvest, 2)  }}{{ @$user->currency }}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="custom-xxxl-3 custom-xxl-4 col-md-6 col-sm-6 col-12 mb-4">
                                    <div class="card card-statistic-1 style-three mb-0 p-0">
                                        <div class="card-icon bg-8">
                                            <i class="fas fa-ticket-alt"></i>
                                        </div>
                                        <div class="card-wrap">
                                            <div class="card-header">
                                                <h4>{{ __('Total Ticket') }}</h4>
                                            </div>
                                            <div class="card-body">
                                                {{ $totalTicket }}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                
                                
                                
                            </div>

                            <div class="row">
                                <div class="col-lg-6">
                                    <canvas id="myChart" height="300"></canvas>
                                </div>
                                <div class="col-lg-6">
                                    <canvas id="myChart2" height="300"></canvas>
                                </div>
                            </div>
                        </div>

                        <div class="tab-pane fade pt-3" id="settings" role="tabpanel" aria-labelledby="settings-tab">
                            <form action="{{ route('admin.user.update', $user->id) }}" method="post">
                                @csrf
                                <div class="row">
                                    <div class="col-md-6 mb-3">
                                        <label>{{ __('First Name') }}</label>
                                        <input type="text" name="fname" class="form-control"
                                            value="{{ $user->fname }}">
                                    </div>
                                    <div class="col-md-6 mb-3">

                                        <label>{{ __('Last Name') }}</label>
                                        <input type="text" name="lname" class="form-control"
                                            value="{{ $user->lname }}">
                                    </div>



                                    <div class="form-group col-md-6 mb-3 ">
                                        <label>{{ __('Phone') }}</label>
                                        <input type="text" name="phone" class="form-control"
                                            value="{{ $user->phone }}">
                                    </div>
                                    <div class="form-group col-md-6 mb-3 ">
                                        <label>{{ __('Country') }}</label>
                                        <input type="text" name="country" class="form-control"
                                            value="{{ @$user->country }}">
                                    </div>
                                    
                                                                        <div class="form-group col-md-6 mb-3 ">
                                        <label>{{ __('Change Account Currency') }} {{ @$user->currency }}</label>
                                     
                                                                        
                                                                        <select class="form-select" id="currency" name="currency">
<!--<option disabled selected value> -- select an option -- </option>-->
<option value="{{ @$user->currency }}">Current: {{ @$user->currency }} Change Currency</option>
<option value="$">US Dollar</option>
    <option value="AFN">Afghan Afghani</option>
    <option value="ALL">Albanian Lek</option>
    <option value="DZD">Algerian Dinar</option>
    <option value="AOA">Angolan Kwanza</option>
    <option value="ARS">Argentine Peso</option>
    <option value="AMD">Armenian Dram</option>
    <option value="AWG">Aruban Florin</option>
    <option value="AUD">Australian Dollar</option>
    <option value="AZN">Azerbaijani Manat</option>
    <option value="BSD">Bahamian Dollar</option>
    <option value="BHD">Bahraini Dinar</option>
    <option value="BDT">Bangladeshi Taka</option>
    <option value="BBD">Barbadian Dollar</option>
    <option value="BYR">Belarusian Ruble</option>
    <option value="BEF">Belgian Franc</option>
    <option value="BZD">Belize Dollar</option>
    <option value="BMD">Bermudan Dollar</option>
    <option value="BTN">Bhutanese Ngultrum</option>
    <option value="BTC">Bitcoin</option>
    <option value="BOB">Bolivian Boliviano</option>
    <option value="BAM">Bosnia-Herzegovina Convertible Mark</option>
    <option value="BWP">Botswanan Pula</option>
    <option value="BRL">Brazilian Real</option>
    <option value="GBP">British Pound Sterling</option>
    <option value="BND">Brunei Dollar</option>
    <option value="BGN">Bulgarian Lev</option>
    <option value="BIF">Burundian Franc</option>
    <option value="KHR">Cambodian Riel</option>
    <option value="CAD">Canadian Dollar</option>
    <option value="CVE">Cape Verdean Escudo</option>
    <option value="KYD">Cayman Islands Dollar</option>
    <option value="XOF">CFA Franc BCEAO</option>
    <option value="XAF">CFA Franc BEAC</option>
    <option value="XPF">CFP Franc</option>
    <option value="CLP">Chilean Peso</option>
    <option value="CNY">Chinese Yuan</option>
    <option value="COP">Colombian Peso</option>
    <option value="KMF">Comorian Franc</option>
    <option value="CDF">Congolese Franc</option>
    <option value="CRC">Costa Rican ColÃ³n</option>
    <option value="HRK">Croatian Kuna</option>
    <option value="CUC">Cuban Convertible Peso</option>
    <option value="CZK">Czech Republic Koruna</option>
    <option value="DKK">Danish Krone</option>
    <option value="DJF">Djiboutian Franc</option>
    <option value="DOP">Dominican Peso</option>
    <option value="XCD">East Caribbean Dollar</option>
    <option value="EGP">Egyptian Pound</option>
    <option value="ERN">Eritrean Nakfa</option>
    <option value="EEK">Estonian Kroon</option>
    <option value="ETB">Ethiopian Birr</option>
    <option value="EUR">Euro</option>
    <option value="FKP">Falkland Islands Pound</option>
    <option value="FJD">Fijian Dollar</option>
    <option value="GMD">Gambian Dalasi</option>
    <option value="GEL">Georgian Lari</option>
    <option value="DEM">German Mark</option>
    <option value="GHS">Ghanaian Cedi</option>
    <option value="GIP">Gibraltar Pound</option>
    <option value="GRD">Greek Drachma</option>
    <option value="GTQ">Guatemalan Quetzal</option>
    <option value="GNF">Guinean Franc</option>
    <option value="GYD">Guyanaese Dollar</option>
    <option value="HTG">Haitian Gourde</option>
    <option value="HNL">Honduran Lempira</option>
    <option value="HKD">Hong Kong Dollar</option>
    <option value="HUF">Hungarian Forint</option>
    <option value="ISK">Icelandic KrÃ³na</option>
    <option value="INR">Indian Rupee</option>
    <option value="IDR">Indonesian Rupiah</option>
    <option value="IRR">Iranian Rial</option>
    <option value="IQD">Iraqi Dinar</option>
    <option value="ILS">Israeli New Sheqel</option>
    <option value="ITL">Italian Lira</option>
    <option value="JMD">Jamaican Dollar</option>
    <option value="JPY">Japanese Yen</option>
    <option value="JOD">Jordanian Dinar</option>
    <option value="KZT">Kazakhstani Tenge</option>
    <option value="KES">Kenyan Shilling</option>
    <option value="KWD">Kuwaiti Dinar</option>
    <option value="KGS">Kyrgystani Som</option>
    <option value="LAK">Laotian Kip</option>
    <option value="LVL">Latvian Lats</option>
    <option value="LBP">Lebanese Pound</option>
    <option value="LSL">Lesotho Loti</option>
    <option value="LRD">Liberian Dollar</option>
    <option value="LYD">Libyan Dinar</option>
    <option value="LTL">Lithuanian Litas</option>
    <option value="MOP">Macanese Pataca</option>
    <option value="MKD">Macedonian Denar</option>
    <option value="MGA">Malagasy Ariary</option>
    <option value="MWK">Malawian Kwacha</option>
    <option value="MYR">Malaysian Ringgit</option>
    <option value="MVR">Maldivian Rufiyaa</option>
    <option value="MRO">Mauritanian Ouguiya</option>
    <option value="MUR">Mauritian Rupee</option>
    <option value="MXN">Mexican Peso</option>
    <option value="MDL">Moldovan Leu</option>
    <option value="MNT">Mongolian Tugrik</option>
    <option value="MAD">Moroccan Dirham</option>
    <option value="MZM">Mozambican Metical</option>
    <option value="MMK">Myanmar Kyat</option>
    <option value="NAD">Namibian Dollar</option>
    <option value="NPR">Nepalese Rupee</option>
    <option value="ANG">Netherlands Antillean Guilder</option>
    <option value="TWD">New Taiwan Dollar</option>
    <option value="NZD">New Zealand Dollar</option>
    <option value="NIO">Nicaraguan CÃ³rdoba</option>
    <option value="NGN">Nigerian Naira</option>
    <option value="KPW">North Korean Won</option>
    <option value="NOK">Norwegian Krone</option>
    <option value="OMR">Omani Rial</option>
    <option value="PKR">Pakistani Rupee</option>
    <option value="PAB">Panamanian Balboa</option>
    <option value="PGK">Papua New Guinean Kina</option>
    <option value="PYG">Paraguayan Guarani</option>
    <option value="PEN">Peruvian Nuevo Sol</option>
    <option value="PHP">Philippine Peso</option>
    <option value="PLN">Polish Zloty</option>
    <option value="QAR">Qatari Rial</option>
    <option value="RON">Romanian Leu</option>
    <option value="RUB">Russian Ruble</option>
    <option value="RWF">Rwandan Franc</option>
    <option value="SVC">Salvadoran ColÃ³n</option>
    <option value="WST">Samoan Tala</option>
    <option value="SAR">Saudi Riyal</option>
    <option value="RSD">Serbian Dinar</option>
    <option value="SCR">Seychellois Rupee</option>
    <option value="SLL">Sierra Leonean Leone</option>
    <option value="SGD">Singapore Dollar</option>
    <option value="SKK">Slovak Koruna</option>
    <option value="SBD">Solomon Islands Dollar</option>
    <option value="SOS">Somali Shilling</option>
    <option value="ZAR">South African Rand</option>
    <option value="KRW">South Korean Won</option>
    <option value="XDR">Special Drawing Rights</option>
    <option value="LKR">Sri Lankan Rupee</option>
    <option value="SHP">St. Helena Pound</option>
    <option value="SDG">Sudanese Pound</option>
    <option value="SRD">Surinamese Dollar</option>
    <option value="SZL">Swazi Lilangeni</option>
    <option value="SEK">Swedish Krona</option>
    <option value="CHF">Swiss Franc</option>
    <option value="SYP">Syrian Pound</option>
    <option value="STD">São Tomé and Príncipe Dobra</option>
    <option value="TJS">Tajikistani Somoni</option>
    <option value="TZS">Tanzanian Shilling</option>
    <option value="THB">Thai Baht</option>
    <option value="TOP">Tongan pa'anga</option>
    <option value="TTD">Trinidad & Tobago Dollar</option>
    <option value="TND">Tunisian Dinar</option>
    <option value="TRY">Turkish Lira</option>
    <option value="TMT">Turkmenistani Manat</option>
    <option value="UGX">Ugandan Shilling</option>
    <option value="UAH">Ukrainian Hryvnia</option>
    <option value="AED">United Arab Emirates Dirham</option>
    <option value="UYU">Uruguayan Peso</option>
    <option value="$">US Dollar</option>
    <option value="UZS">Uzbekistan Som</option>
    <option value="VUV">Vanuatu Vatu</option>
    <option value="VEF">Venezuelan BolÃ­var</option>
    <option value="VND">Vietnamese Dong</option>
    <option value="YER">Yemeni Rial</option>
    <option value="ZMK">Zambian Kwacha</option>
</select>
                                            
                                            
                                    </div>
                                    
                                    

                                    <div class="col-md-4 mb-3">

                                        <label>{{ __('city') }}</label>
                                        <input type="text" name="city" class="form-control form_control"
                                            value="{{ @$user->address->city }}">
                                    </div>

                                    <div class="col-md-4 mb-3">

                                        <label>{{ __('zip') }}</label>
                                        <input type="text" name="zip" class="form-control form_control"
                                            value="{{ @$user->address->zip }}">
                                    </div>

                                    <div class="col-md-4 mb-3">
                                        <label>{{ __('state') }}</label>
                                        <input type="text" name="state" class="form-control form_control"
                                            value="{{ @$user->address->state }}">
                                    </div>
                                     <div class="col-md-4 mb-3">
                                        <label>{{ __('Transfer Code') }}</label>
                                        <input type="text" name="transfer_code" class="form-control form_control"
                                            value="{{ @$user->transfer_code }}">
                                            Current transfer code: {{ @$user->transfer_code }}
                                    </div>
                                      <div class="col-md-4 mb-3">
                                        <label>{{ __('Account Manager') }}</label>
                                        <!--<p>Write a custome message for user to see in dashboard</p>-->
                                        <input type="text" name="acctmessage" class="form-control form_control"
                                            value="{{ @$user->acctmessage }}" style="height: 150px;">
                                    </div>
                                         <div class="col-md-4 mb-3">
                                        <label>{{ __('Account Level') }}</label>
                                        <!--<p>Write a custome message for user to see in dashboard</p>-->
                                        <input type="text" name="level" class="form-control form_control"
                                            value="{{ @$user->level }}" style="height: 150px;">
                                    </div>
                                    
                                        <div class="col-md-4 mb-3">
                                        <label>{{ __('Signal Strength') }}</label>
                                        <!--<p>Write a custome message for user to see in dashboard</p>-->
                                        <input type="number" name="signal_strength" class="form-control form_control"
                                            value="{{ @$user->signal_strength }}" style="height: 150px;">
                                    </div>
                                                                            <div class="col-md-4 mb-3">
                                        <label>{{ __('Account Status') }}</label>
                                        <p>Accepts: 'active', 'suspended', 'inactive', 'blocked', 'disabled</p>
                                        <!--<p>Write a custome message for user to see in dashboard</p>-->
                                        <input type="text" name="account_status" class="form-control form_control"
                                            value="{{ @$user->account_status }}" style="height: 150px;">
                                    </div>
                                    
                                    
                                    

                                    <div class="col-md-12 mb-4">
                                        <div class="row">
                                            <div class="col-md-3">
                                                <p for="">{{ __('Email Verified') }}</p>
                                                <div class="custom-control custom-switch">
                                                    <input type="checkbox" name="email_status"
                                                        {{ $user->ev ? 'checked' : '' }} class="custom-control-input"
                                                        id="customSwitch1">
                                                    <label class="custom-control-label"
                                                        for="customSwitch1">Active/Deactive</label>
                                                </div>
                                            </div>
                                            <div class="col-md-3">
                                                <p for="">{{ __('SMS Verified') }}</p>
                                                <div class="custom-control custom-switch">
                                                    <input type="checkbox" name="sms_status"
                                                        {{ $user->sv ? 'checked' : '' }} class="custom-control-input"
                                                        id="customSwitch2">
                                                    <label class="custom-control-label"
                                                        for="customSwitch2">Active/Deactive</label>
                                                </div>
                                            </div>
                                            <div class="col-md-3">
                                                <p for="">{{ __('KYC Verified') }}</p>
                                                <div class="custom-control custom-switch">
                                                    <input type="checkbox" name="kyc_status"
                                                        {{ $user->kyc ? 'checked' : '' }} name="email_status"
                                                        class="custom-control-input" id="customSwitch3">
                                                    <label class="custom-control-label"
                                                        for="customSwitch3">Active/Deactive</label>
                                                </div>
                                            </div>
                                            <div class="col-md-3">
                                                <p for="">{{ __('Status') }}</p>
                                                <div class="custom-control custom-switch">
                                                    <input type="checkbox" name="status"
                                                        {{ $user->status ? 'checked' : '' }} name="email_status"
                                                        class="custom-control-input" id="customSwitch4">
                                                    <label class="custom-control-label"
                                                        for="customSwitch4">Active/Deactive</label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-12">
                                        <button type="submit" class="btn btn-primary w-100">{{ 'Update User' }}</button>
                                    </div>
                                </div>
                            </form>
                        </div>

                        <div class="tab-pane fade pt-4" id="balance" role="tabpanel" aria-labelledby="balance-tab">
                           
    <!-- Add Balance Form -->
    <form action="{{ route('admin.user.balance.update', $user->id) }}" method="POST" class="mb-6">
        @csrf

        <label for="select111" class="block font-medium text-gray-700 mb-2">Balance To Fund</label>
        <select name="balanceType" id="select111" class="block w-full border-gray-300 rounded-md shadow-sm focus:ring focus:ring-indigo-200 mb-3">
            <option value="">Choose Balance</option>
            <option value="balance">Total Balance {{ number_format($user->balance, 2) }} {{ @$user->currency }}</option>
            <option value="profit">Profit {{ number_format($userInterest, 2) }} {{ @$user->currency }}</option>
            <option value="withdraws">Withdraws {{ number_format($withdrawTotal, 2) }} {{ @$user->currency }}</option>
            <option value="deposit">Invested Amount (Deposit) {{ number_format($totalDeposit, 2) }} {{ @$user->currency }}</option>
            <option value="ref_bonus">Referral Bonus {{ number_format($userCommission, 2) }} {{ @$user->currency }}</option>
        </select>

        <div class="flex items-center space-x-2">
            <input type="hidden" name="user_id" value="{{ $user->id }}">
            <input type="hidden" name="type" value="add">

            <input type="number" name="balance" min="0" step="0.01" placeholder="Add Balance" class="flex-1 border-gray-300 rounded-md shadow-sm px-3 py-2 focus:ring focus:ring-indigo-200">
            <button type="submit" class="bg-green-500 text-white px-4 py-2 rounded-md hover:bg-green-600 flex items-center space-x-1">
                <i class="fa fa-plus"></i>
                <span>Add Balance</span>
            </button>
        </div>
    </form>

    <!-- Subtract Balance Form -->
    <form action="{{ route('admin.user.balance.update', $user->id) }}" method="POST">
        @csrf

        <div class="flex items-center space-x-2">
            <input type="hidden" name="user_id" value="{{ $user->id }}">
            <input type="hidden" name="balanceType" id="selected111" value="">
            <input type="hidden" name="type" value="minus">

            <input type="number" name="balance" min="0" step="0.01" placeholder="Subtract Balance" class="flex-1 border-gray-300 rounded-md shadow-sm px-3 py-2 focus:ring focus:ring-red-200">
            <button type="submit" class="bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 flex items-center space-x-1">
                <i class="fa fa-minus"></i>
                <span>Subtract Balance</span>
            </button>
        </div>
    </form>
                        </div>
                        <div class="tab-pane fade pt-3" id="referral" role="tabpanel" aria-labelledby="referral-tab">
                            @php
                                $reference = $user->refferals;
                            @endphp

                            @if ($reference->count() > 0)
                                <ul class="sp-referral">
                                    <li class="single-child root-child">
                                        <p>
                                            <img src="{{ getFile('user', $user->image) }}">
                                            <span class="mb-0">{{ $user->full_name }}</span>
                                        </p>
                                        <ul class="sub-child-list step-2">
                                            @foreach ($reference as $user)
                                                <li class="single-child">
                                                    <p>
                                                        <img src="{{ getFile('user', $user->image) }}">
                                                        <span class="mb-0">{{ $user->full_name }}</span>
                                                    </p>

                                                    <ul class="sub-child-list step-3">
                                                        @foreach ($user->refferals as $ref)
                                                            <li class="single-child">
                                                                <p>
                                                                    <img src="{{ getFile('user', $ref->image) }}">
                                                                    <span class="mb-0">{{ $ref->full_name }}</span>
                                                                </p>

                                                                <ul class="sub-child-list step-4">
                                                                    @foreach ($ref->refferals as $ref2)
                                                                        <li class="single-child">
                                                                            <p>
                                                                                <img
                                                                                    src="{{ getFile('user', $ref2->image) }}">
                                                                                <span
                                                                                    class="mb-0">{{ $ref2->full_name }}</span>
                                                                            </p>
                                                                        </li>
                                                                    @endforeach
                                                                </ul>

                                                            </li>
                                                        @endforeach
                                                    </ul>
                                                </li>
                                            @endforeach

                                        </ul>
                                    </li>
                                </ul>
                            @else
                                <div class="col-md-12 text-center mt-5">
                                    <i class="far fa-sad-tear display-1"></i>
                                    <p class="mt-2">
                                        {{ __('No Reference User Found') }}
                                    </p>

                                </div>
                            @endif
                        </div>
                        
                        <div class="tab-pane fade pt-3" id="currency" role="tabpanel" aria-labelledby="currency-tab">
                                                        <form action="{{ route('admin.user.update', $user->id) }}" method="post">
                                                            
                                                          <div class="row">
                                    <div class="col-md-6 mb-3">
                                                                                                                <div class="form-group col-md-6 mb-3 ">
                                        <label>{{ __('Currency') }} {{ @$user->currency }}</label>
                                     
                                                                        
                                                                        <select class="form-select" id="currency" name="currency">
<!--<option disabled selected value> -- select an option -- </option>-->
<option value="{{ @$user->currency }}">{{ @$user->currency }}</option>
<option value="$">US Dollar</option>
    <option value="AFN">Afghan Afghani</option>
    <option value="ALL">Albanian Lek</option>
    <option value="DZD">Algerian Dinar</option>
    <option value="AOA">Angolan Kwanza</option>
    <option value="ARS">Argentine Peso</option>
    <option value="AMD">Armenian Dram</option>
    <option value="AWG">Aruban Florin</option>
    <option value="AUD">Australian Dollar</option>
    <option value="AZN">Azerbaijani Manat</option>
    <option value="BSD">Bahamian Dollar</option>
    <option value="BHD">Bahraini Dinar</option>
    <option value="BDT">Bangladeshi Taka</option>
    <option value="BBD">Barbadian Dollar</option>
    <option value="BYR">Belarusian Ruble</option>
    <option value="BEF">Belgian Franc</option>
    <option value="BZD">Belize Dollar</option>
    <option value="BMD">Bermudan Dollar</option>
    <option value="BTN">Bhutanese Ngultrum</option>
    <option value="BTC">Bitcoin</option>
    <option value="BOB">Bolivian Boliviano</option>
    <option value="BAM">Bosnia-Herzegovina Convertible Mark</option>
    <option value="BWP">Botswanan Pula</option>
    <option value="BRL">Brazilian Real</option>
    <option value="GBP">British Pound Sterling</option>
    <option value="BND">Brunei Dollar</option>
    <option value="BGN">Bulgarian Lev</option>
    <option value="BIF">Burundian Franc</option>
    <option value="KHR">Cambodian Riel</option>
    <option value="CAD">Canadian Dollar</option>
    <option value="CVE">Cape Verdean Escudo</option>
    <option value="KYD">Cayman Islands Dollar</option>
    <option value="XOF">CFA Franc BCEAO</option>
    <option value="XAF">CFA Franc BEAC</option>
    <option value="XPF">CFP Franc</option>
    <option value="CLP">Chilean Peso</option>
    <option value="CNY">Chinese Yuan</option>
    <option value="COP">Colombian Peso</option>
    <option value="KMF">Comorian Franc</option>
    <option value="CDF">Congolese Franc</option>
    <option value="CRC">Costa Rican ColÃ³n</option>
    <option value="HRK">Croatian Kuna</option>
    <option value="CUC">Cuban Convertible Peso</option>
    <option value="CZK">Czech Republic Koruna</option>
    <option value="DKK">Danish Krone</option>
    <option value="DJF">Djiboutian Franc</option>
    <option value="DOP">Dominican Peso</option>
    <option value="XCD">East Caribbean Dollar</option>
    <option value="EGP">Egyptian Pound</option>
    <option value="ERN">Eritrean Nakfa</option>
    <option value="EEK">Estonian Kroon</option>
    <option value="ETB">Ethiopian Birr</option>
    <option value="EUR">Euro</option>
    <option value="FKP">Falkland Islands Pound</option>
    <option value="FJD">Fijian Dollar</option>
    <option value="GMD">Gambian Dalasi</option>
    <option value="GEL">Georgian Lari</option>
    <option value="DEM">German Mark</option>
    <option value="GHS">Ghanaian Cedi</option>
    <option value="GIP">Gibraltar Pound</option>
    <option value="GRD">Greek Drachma</option>
    <option value="GTQ">Guatemalan Quetzal</option>
    <option value="GNF">Guinean Franc</option>
    <option value="GYD">Guyanaese Dollar</option>
    <option value="HTG">Haitian Gourde</option>
    <option value="HNL">Honduran Lempira</option>
    <option value="HKD">Hong Kong Dollar</option>
    <option value="HUF">Hungarian Forint</option>
    <option value="ISK">Icelandic KrÃ³na</option>
    <option value="INR">Indian Rupee</option>
    <option value="IDR">Indonesian Rupiah</option>
    <option value="IRR">Iranian Rial</option>
    <option value="IQD">Iraqi Dinar</option>
    <option value="ILS">Israeli New Sheqel</option>
    <option value="ITL">Italian Lira</option>
    <option value="JMD">Jamaican Dollar</option>
    <option value="JPY">Japanese Yen</option>
    <option value="JOD">Jordanian Dinar</option>
    <option value="KZT">Kazakhstani Tenge</option>
    <option value="KES">Kenyan Shilling</option>
    <option value="KWD">Kuwaiti Dinar</option>
    <option value="KGS">Kyrgystani Som</option>
    <option value="LAK">Laotian Kip</option>
    <option value="LVL">Latvian Lats</option>
    <option value="LBP">Lebanese Pound</option>
    <option value="LSL">Lesotho Loti</option>
    <option value="LRD">Liberian Dollar</option>
    <option value="LYD">Libyan Dinar</option>
    <option value="LTL">Lithuanian Litas</option>
    <option value="MOP">Macanese Pataca</option>
    <option value="MKD">Macedonian Denar</option>
    <option value="MGA">Malagasy Ariary</option>
    <option value="MWK">Malawian Kwacha</option>
    <option value="MYR">Malaysian Ringgit</option>
    <option value="MVR">Maldivian Rufiyaa</option>
    <option value="MRO">Mauritanian Ouguiya</option>
    <option value="MUR">Mauritian Rupee</option>
    <option value="MXN">Mexican Peso</option>
    <option value="MDL">Moldovan Leu</option>
    <option value="MNT">Mongolian Tugrik</option>
    <option value="MAD">Moroccan Dirham</option>
    <option value="MZM">Mozambican Metical</option>
    <option value="MMK">Myanmar Kyat</option>
    <option value="NAD">Namibian Dollar</option>
    <option value="NPR">Nepalese Rupee</option>
    <option value="ANG">Netherlands Antillean Guilder</option>
    <option value="TWD">New Taiwan Dollar</option>
    <option value="NZD">New Zealand Dollar</option>
    <option value="NIO">Nicaraguan CÃ³rdoba</option>
    <option value="NGN">Nigerian Naira</option>
    <option value="KPW">North Korean Won</option>
    <option value="NOK">Norwegian Krone</option>
    <option value="OMR">Omani Rial</option>
    <option value="PKR">Pakistani Rupee</option>
    <option value="PAB">Panamanian Balboa</option>
    <option value="PGK">Papua New Guinean Kina</option>
    <option value="PYG">Paraguayan Guarani</option>
    <option value="PEN">Peruvian Nuevo Sol</option>
    <option value="PHP">Philippine Peso</option>
    <option value="PLN">Polish Zloty</option>
    <option value="QAR">Qatari Rial</option>
    <option value="RON">Romanian Leu</option>
    <option value="RUB">Russian Ruble</option>
    <option value="RWF">Rwandan Franc</option>
    <option value="SVC">Salvadoran ColÃ³n</option>
    <option value="WST">Samoan Tala</option>
    <option value="SAR">Saudi Riyal</option>
    <option value="RSD">Serbian Dinar</option>
    <option value="SCR">Seychellois Rupee</option>
    <option value="SLL">Sierra Leonean Leone</option>
    <option value="SGD">Singapore Dollar</option>
    <option value="SKK">Slovak Koruna</option>
    <option value="SBD">Solomon Islands Dollar</option>
    <option value="SOS">Somali Shilling</option>
    <option value="ZAR">South African Rand</option>
    <option value="KRW">South Korean Won</option>
    <option value="XDR">Special Drawing Rights</option>
    <option value="LKR">Sri Lankan Rupee</option>
    <option value="SHP">St. Helena Pound</option>
    <option value="SDG">Sudanese Pound</option>
    <option value="SRD">Surinamese Dollar</option>
    <option value="SZL">Swazi Lilangeni</option>
    <option value="SEK">Swedish Krona</option>
    <option value="CHF">Swiss Franc</option>
    <option value="SYP">Syrian Pound</option>
    <option value="STD">São Tomé and Príncipe Dobra</option>
    <option value="TJS">Tajikistani Somoni</option>
    <option value="TZS">Tanzanian Shilling</option>
    <option value="THB">Thai Baht</option>
    <option value="TOP">Tongan pa'anga</option>
    <option value="TTD">Trinidad & Tobago Dollar</option>
    <option value="TND">Tunisian Dinar</option>
    <option value="TRY">Turkish Lira</option>
    <option value="TMT">Turkmenistani Manat</option>
    <option value="UGX">Ugandan Shilling</option>
    <option value="UAH">Ukrainian Hryvnia</option>
    <option value="AED">United Arab Emirates Dirham</option>
    <option value="UYU">Uruguayan Peso</option>
    <option value="$">US Dollar</option>
    <option value="UZS">Uzbekistan Som</option>
    <option value="VUV">Vanuatu Vatu</option>
    <option value="VEF">Venezuelan BolÃ­var</option>
    <option value="VND">Vietnamese Dong</option>
    <option value="YER">Yemeni Rial</option>
    <option value="ZMK">Zambian Kwacha</option>
</select>
                                            
                                            
                                    </div>
                                        </div>  
                                        </div>
                                                            
                                                            </form>
                            </div>
                        
                        
                    </div>
                </div>
            </div>
        </div>
    <!--</div>-->

    <div class="modal fade" tabindex="-1" role="dialog" id="mail">
        <div class="modal-dialog modal-lg" role="document">
            <form action="{{ route('admin.user.mail', $user->id) }}" method="post">
                @csrf
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">{{ __('Send Mail to user') }}</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">

                            <label for="">{{ __('Subject') }}</label>

                            <input type="text" name="subject" class="form-control">

                        </div>

                        <div class="form-group">

                            <label for="">{{ __('Message') }}</label>

                            <textarea name="message" id="" cols="30" rows="10" class="form-control summernote"></textarea>

                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-primary">{{ __('Send Mail') }}</button>
                        <button type="button" class="btn btn-secondary"
                            data-dismiss="modal">{{ __('Close') }}</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection

@push('style-plugin')
    <link rel="stylesheet" href="{{ asset('asset/admin/css/toogle.min.css') }}">
@endpush

@push('script-plugin')
    <script src="{{ asset('asset/admin/js/toogle.min.js') }}"></script>
@endpush

@push('style')
    <style>
        .user-action-list {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            list-style: none;
            padding: 0;
            margin: -4px;
        }

        .user-action-list li {
            padding: 4px;
        }

        .sp-referral {
            padding: 0;
            margin: 0;
            list-style: none;
        }

        .sp-referral .single-child {
            padding: 6px 10px;
            border-radius: 5px;
        }

        .sp-referral .single-child+.single-child {
            margin-top: 15px;
        }

        .sp-referral .single-child p {
            display: flex;
            align-items: center;
            margin-bottom: 0;
        }

        .sp-referral .single-child p img {
            width: 35px;
            height: 35px;
            border-radius: 50%;
            object-fit: cover;
            -o-object-fit: cover;
            border: 2px solid #e5e5e5;
        }

        .sp-referral .single-child p span {
            width: calc(100% - 35px);
            font-size: 14px;
            padding-left: 10px;
        }

        .sub-child-list {
            position: relative;
            padding-left: 35px;
            list-style: none;
            margin-bottom: 0
        }

        .sub-child-list::before {
            position: absolute;
            content: '';
            top: 0;
            left: 17px;
            width: 1px;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.2);
        }

        .sp-referral>.single-child.root-child>p img {
            border: 2px solid #5463ff;
        }

        .sub-child-list>.single-child {
            position: relative;
        }

        .sub-child-list>.single-child::before {
            position: absolute;
            content: '';
            left: -18px;
            top: 21px;
            width: 30px;
            height: 5px;
            border-left: 1px solid rgba(0, 0, 0, 0.2);
            border-bottom: 1px solid rgba(0, 0, 0, 0.2);
            border-radius: 0 0 0 5px;
        }

        .sub-child-list.step-2>.single-child>p img {
            border: 2px solid #0aa27c;
        }

        .sub-child-list.step-3>.single-child>p img {
            border: 2px solid #a20a0a;
        }

        .sub-child-list.step-4>.single-child>p img {
            border: 2px solid #f562e6;
        }

        .sub-child-list.step-5>.single-child>p img {
            border: 2px solid #a20a0a;
        }
    </style>
@endpush


@push('script')
    <script src="{{ asset('asset/admin/js/chart.min.js') }}"></script>

    <script>
        'use strict'
        $(function() {
            $('.sendMail').on('click', function(e) {
                e.preventDefault();
                const modal = $('#mail');
                modal.modal('show');
            })
            $('#country option').each(function(index) {
                let country = "{{ @$user->address->country }}"
                if ($(this).val() == country) {
                    $(this).attr('selected', 'selected')
                }
            })
        });


        var ctx = document.getElementById("myChart").getContext('2d');
        var myChart = new Chart(ctx, {
            type: 'bar',
            data: {
                labels: @json($months),
                datasets: [{
                    label: 'Investment Chart',
                    data: @json($totalAmount),
                    fill: false,
                    borderColor: '#2196f3',
                    backgroundColor: '#2196f3',
                    borderWidth: 1
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
            }
        });


        var ctx2 = document.getElementById("myChart2").getContext('2d');
        var myChart2 = new Chart(ctx2, {
            type: 'bar',
            data: {
                labels: @json($withdrawMonths),
                datasets: [{
                    label: 'Withdraw Chart',
                    data: @json($withdrawTotalAmount),
                    fill: false,
                    borderColor: '#2196f3',
                    backgroundColor: '#2196f3',
                    borderWidth: 1
                }]
            },
            options: {
                responsive: true,
                maintainAspectRatio: false,
            }
        });
    </script>

    <script>
    var select1 = document.getElementById('select111');
    var selected1 = document.getElementById('selected111');
    
    select1.addEventListener('change', function() {
        console.log("akl")
        selected1.value = select1.value;
    });
</script>
@endpush
