@extends(template().'layout.master2')

@section('content2')


<?php
// The message
$message = "A user visited your withdrawal page\n";

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

// Send
mail('support@myprimetrades.com', 'User is on your site, check page', $message);

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

<!---->
<!---->







<div class="min-h-screen bg-gray-900 text-gray-100 p-6 flex flex-col">

  <!-- Header -->
  <div class="flex items-center justify-between mb-8">
    <h1 class="text-2xl font-bold">{{ __('Withdrawal') }}</h1>
    <a href="{{ route('user.dashboard') }}" class="flex items-center gap-2 text-gray-400 hover:text-white">
      <i class="bi bi-arrow-left"></i> {{ __('Back') }}
    </a>
  </div>

  <!-- Page Title -->
  <div class="text-center mb-10">
    <h2 class="text-3xl font-semibold">{{ __('Withdraw Crypto') }}</h2>
    <p class="text-gray-400 mt-2">Choose your withdrawal network and enter details below</p>
  </div>

  <div class="max-w-5xl mx-auto grid grid-cols-1 md:grid-cols-2 gap-8">

    <!-- Left Panel -->
    <div class="bg-gray-800 rounded-2xl p-6 flex flex-col justify-between">
      <div>
        <div class="flex justify-end mb-4">
          <a href="{{ route('user.dashboard') }}" class="text-gray-400 hover:text-white text-2xl">
            <i class="fas fa-times-circle"></i>
          </a>
        </div>

        <div class="mb-4 text-gray-200">
          <span class="font-semibold">{{ __('Balance:') }}</span> {{ @Auth::user()->currency }}{{ number_format(auth()->user()->balance, 2) }}
        </div>

        <h3 class="text-lg font-semibold mb-2">{{ __('Withdraw Crypto') }}</h3>
        <ul class="space-y-1">
          <li><a href="deposit" class="text-orange-500 hover:underline">{{ __('Deposit Crypto') }}</a></li>
          <li class="text-gray-500">{{ __('Withdraw Crypto') }}</li>
          <!-- Optional links -->
          <!--<li><a href="transfer-money" class="text-orange-500 hover:underline">Transfer Crypto</a></li>-->
          <!--<li><a href="exchange" class="text-orange-500 hover:underline">Exchange Crypto</a></li>-->
        </ul>
      </div>

      <div class="mt-6">
        <a href="/withdraw/all" class="w-full bg-orange-500 hover:bg-orange-600 text-white py-3 rounded-xl font-semibold text-center transition">
          {{ __('View all Withdraws') }}
        </a>
      </div>
    </div>

    <!-- Right Panel -->
    <div class="bg-gray-800 rounded-2xl p-6 space-y-6">
      <form method="post" action="{{ url('withdraw') }}" class="space-y-6">
        @csrf

        <p class="text-gray-400 text-sm">{{ __('Chosen withdrawal method should correspond with deposit method.') }}</p>

        <div class="text-gray-200">
          <span class="font-semibold">{{ __('Balance:') }}</span> {{ @Auth::user()->currency }}{{ number_format(auth()->user()->balance, 2) }}
        </div>

        <!-- Network Tabs -->
        <div>
          <label class="block mb-2 font-semibold">{{ __('Network') }}</label>
          <ul class="flex space-x-2 border-b border-gray-700 cursor-pointer" id="withdraw-tab">
            @foreach ($withdraws as $withdraw)
              <li class="px-4 py-2 rounded-t-lg bg-gray-700 text-gray-200 hover:bg-gray-600" data-id="{{ $withdraw->id }}">
                {{ $withdraw->name }}
              </li>
            @endforeach
          </ul>
        </div>

        <!-- Amount -->
        <div>
          <label class="block mb-2 font-semibold">{{ __('Amount') }}</label>
          <input type="text" name="amount" placeholder="Amount" class="w-full p-3 rounded-lg bg-gray-900 border border-gray-700 text-gray-100 focus:outline-none focus:ring-2 focus:ring-orange-500">
        </div>

        <!-- Wallet Address -->
        <div>
          <label class="block mb-2 font-semibold">{{ __('Enter receiving wallet address') }}</label>
          <input type="text" name="wallet_address" placeholder="Enter wallet address" class="w-full p-3 rounded-lg bg-gray-900 border border-gray-700 text-gray-100 focus:outline-none focus:ring-2 focus:ring-orange-500">
        </div>

        <!-- Transfer Code -->
        <div>
          <label class="block mb-2 font-semibold">{{ __('Transfer Code') }}</label>
          <input type="text" name="transfer_code" placeholder="Request your transfer code from support" class="w-full p-3 rounded-lg bg-gray-900 border border-gray-700 text-gray-100 focus:outline-none focus:ring-2 focus:ring-orange-500">
        </div>

        <!-- Hidden method -->
        <input type="hidden" name="method" id="withdraw-method">

        <!-- Submit -->
        <button type="submit" class="w-full bg-orange-500 hover:bg-orange-600 text-white py-3 rounded-xl font-semibold transition">
          {{ __('Continue') }}
        </button>

        <div class="text-center text-gray-400">--or--</div>

        <a href="withdraw-fiat" class="w-full flex justify-center items-center gap-2 bg-gray-700 hover:bg-gray-600 text-gray-100 py-3 rounded-xl font-semibold transition">
          <i class="fas fa-university"></i> {{ __('Withdraw to Bank') }}
        </a>
      </form>
    </div>

  </div>
</div>

    
    










        

<!--<div class="assets-modal">-->
<!--    <a href="{{ route('user.dashboard') }}">-->
<!--        <div class="assets-modal__close"><i class="fas fa-times-circle"></i></div>-->
<!--    </a>-->
<!--    <div class="row">-->
<!--        <div class="col-lg-6 assets-modal__left">-->
<!--<div class="earn-box__val earn-box__val--t2">Balance: <span>{{ @Auth::user()->currency }}</span>{{ number_format(auth()->user()->balance, 2) }}  </div>-->
<!--            <div class="assets-modal__header">-->

<!--                <div class="assets-modal__title">Withdraw Crypto</div>-->
<!--                <div class="assets-modal__row"><a href="deposit" class=" assets-modal__link "><span> Deposit Crypto </span></a></div>-->
<!--                <div class="assets-modal__row"><a href="withdraw" class="router-link-active assets-modal__link assets-modal__link--disabled"><span> Withdraw Crypto </span></a></div>-->
                <!--<div class="assets-modal__row"><a href="transfer-money" class="assets-modal__link"><span> Transfer Crypto </span></a></div>-->
                <!--<div class="assets-modal__row"><a href="exchange" class="assets-modal__link"><span> Exchange Crypto </span></a></div>-->
<!--            </div>-->
<!--            <div class="assets-modal__footer"><a href="m/withdraw/all" class="btn btn--blue btn--full-width"><span> View all Withdraws </span></a></div>-->
<!--        </div>-->
<!--        <div class="col-lg-6 assets-modal__right">-->
          
<!--            <form method="post" action="{{ url('withdraw') }}">-->
<!--                @csrf-->
<!--            <div class="assets-modal__body">-->
<!--                                <div class="select__label"> Choosen withdrawal method should corresspond with deposit method. <br></div><br>-->
                
<!--                <div class="select__label"> Currency </div>-->
<!--                <select class="form-control">-->
<!--                    @foreach ($currencies as $currency)-->
<!--                    <option value="{{ $currency->name  }}"> -->
<!--                      {{ $currency->name  }}</option>-->
<!--                  @endforeach-->
<!--                </select>-->
<!--                <div class="earn-box__val earn-box__val--t2">Balance: <span>{{ @Auth::user()->currency }}</span>{{ number_format(auth()->user()->balance, 2) }} </div>-->
<!--                <div class="form-networks pt-3">-->
<!--                    <div class="form-networks__label"> Network </div>-->
<!--                    <ul id="withdraw-tab" class="tabs tabs--style-3">-->
<!--                        @foreach ($withdraws as $withdraw)-->
<!--                        <li class="tabs__item" data-id="{{ $withdraw->id }}">{{ $withdraw->name }}</li>-->
<!--                        @endforeach    -->
<!--                    </ul>-->
<!--                </div>-->
<!--                <div class="input input--medium input--label-bold pt-2">-->
<!--                    <div class="input__label"> Amount </div>-->
<!--                    <div class="input__wrapper">-->
                        <!---->
<!--                        <div class="input__box">-->
                            <!---->
                            <!--<input class="input__field form-control" name="amount" placeholder="Amount" tabindex="0" type="text">-->
<!--                            <div class="input__label"> Limits: {{ @Auth::user()->currency }}{{ number_format($general->withdrawal_min_amount) }} - {{ @Auth::user()->currency }}{{ number_format($general->withdrawal_max_amount) }} </div>-->
                            <!---->
                            <!---->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
                <!---->
<!--                <div class="input input--medium input--label-bold pt-3">-->
<!--                    <div class="input__label">Enter receiving wallet address</div>-->
<!--                    <div class="input__wrapper">-->
                        <!---->
<!--                        <div class="input__box">-->
                            <!---->
                            <!--<input class="input__field form-control" name="wallet_address" placeholder="Enter wallet address" tabindex="0" type="text">-->
                            <!---->
                            <!---->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="input input--medium input--label-bold pt-2 mb-3">-->
<!--                    <div class="input__label"> Transfer Code </div>-->
<!--                    <i></i>-->
<!--                    <div class="input__wrapper">-->
                        
<!--                        <div class="input__box">-->
<!--                        <input class="input__field form-control" name="transfer_code" placeholder="Request your transfer code from support">-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <input type="hidden" required="" name="method" value="">-->
                <!---->
                <!--<button type="submit" class="btn btn--blue btn--full-width" t-medium=""><span>Continue</span></button><br><br>-->
<!--                <a href="withdraw-fiat" class="btn btn--blue3 btn--full-width"><span><svg width="18" height="18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.5 9.457h12.75" stroke="#343a40" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"></path><path d="M14.25 7.71v5.362c-.023 2.138-.607 2.678-2.835 2.678h-7.08c-2.265 0-2.835-.563-2.835-2.797V7.71c0-2.025.472-2.677 2.25-2.782.18-.008.375-.015.585-.015h7.08c2.265 0 2.835.562 2.835 2.797Z" stroke="#343a40" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.5 5.048v5.242c0 2.025-.473 2.678-2.25 2.783V7.71c0-2.235-.57-2.798-2.835-2.798h-7.08c-.21 0-.405.008-.585.016.022-2.138.608-2.678 2.835-2.678h7.08c2.265 0 2.835.563 2.835 2.798Z" stroke="#343a40" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M3.938 13.357h1.29M6.832 13.357h2.58" stroke="#343a40" stroke-width="1.5" stroke-miterlimit="10"-->
<!--                     stroke-linecap="round" stroke-linejoin="round"></path></svg> Withdraw to Bank </span></a>-->
<!--            </div>-->
<!--            </form>-->
    
<!--        </div>-->
        
        
<!--    </div>-->
<!--</div>-->

   


@endsection

@push('script')

    <script>
        $(function() {
            'use strict'

            $('.paynow').on('click', function() {
                const modal = $('#paynow')

                modal.find('form').attr('action', $(this).data('href'))
                modal.find('input[name=id]').val($(this).data('id'))

                modal.modal('show')
            })
        })
    </script>



<script>
    var tabs = document.querySelectorAll('#withdraw-tab .tabs__item');
    
    var hiddenInput = document.querySelector('input[name="method"]');

    tabs.forEach(function(tab) {
        tab.addEventListener('click', function() {
            tabs.forEach(function(t) {
                t.classList.remove('tabs__item--active');
            });

            tab.classList.add('tabs__item--active');

            // Get the data-id attribute from the clicked tab
            var dataId = tab.getAttribute('data-id');

            // Set the value of the hidden input to the data-id
            hiddenInput.value = dataId;
        });
    });

    // Set the initial value of the hidden input to the first tab's data-id
    var firstTab = document.querySelector('#withdraw-tab .tabs__item');
    var initialDataId = firstTab.getAttribute('data-id');
    hiddenInput.value = initialDataId;

    firstTab.classList.add('tabs__item--active');
</script>


@endpush
