@extends('layouts.dasht')
@section('title', $title)
@section('content')
<div class="udex-main" id="main">
	<x-danger-alert />
    <x-success-alert />
    {{-- <script src="https://tradersrite.net/js/validation.js"></script> --}}
    
    @if( Auth::user()->withdrawal_code==='on' ) 
     <div class="bg-white p-4 mt-3 rounded mb-5">
				<div class="mb-3 ">
				    
				    <div class="alert alert-warning" role="alert">
<h6 class="h6 ">The Withdrwal Code is required to enable you to continue with your withdrawal. Please contact any of our online customer care representative on livechat or on with {{$settings->contact_email}} they will help you with the appropriate withdrwal code for this transaction.</h6>
                            </div>
</div>
                                
                          
                               <form action="{{ route('userwithdrawal') }}" method="post">
                                    @csrf
                                    <div class="mb-3">
                                        <label class="">Enter Withdrwal Code 
                                          </label>
                                        <input class="form-control " placeholder="Enter Withdrwal Code" type="text"
                                            name="withdrawal_code" step="any" required>
                                            </div>
                                           
                                            	<button class="btn btn-primary">Verify Withdrawal code</button>
                                            	
                                            </form>
</div>

@else
    
    <ul class="breadcrumb shadow-none p-0" style="background-color: transparent">
		<li class="breadcrumb-item"><a href="{{route('dashboard')}}">Home</a></li>
		<li class="breadcrumb-item active">Withdraw </li>
	</ul><h1 class="clearfix">Withdrawal <div class="float-right"></div></h1>
			<div class="bg-white p-4 mt-3 rounded mb-5">
				<h3 class="mb-4">Select Withdrawal method</h3>
				<form method="POST" action="{{ route('withdrawamount') }}">
					@csrf


                  
                    <div class="input-group mb-3">
                <select class="form-control"  name="method"  required>
                    @forelse ($wmethods as $method)
                  <option value="{{$method->name}}">{{$method->name}}</option>
                 
                  @empty
					<option class="">No Withdrawal Method enabled at the moment, please check
						back later.</option>
                        @endforelse
</select>
</div>				
					
					{{-- <div class="input-group mb-3">
						<div class="input-group-prepend">
							<span class="input-group-text">{{ $settings->s_currency }}</span>
						</div>
						<input type="number" required name="amount" placeholder="Amount" class="form-control" />
					</div> --}}

					
					<button class="btn btn-primary">CONTINUE</button>
				</form>
			</div>
			<h3>Withdrawal History</h3>
			<div class="table-responsive mt-3">
				<table class="table table-bordered table-hover table-striped bg-white">
              
					<tr class="bg-dark text-light">
						<th style="min-width: 150px">Details</th><th style="min-width: 150px">Method</th><th style="min-width: 120px">Status</th>
					</tr>
					  @forelse ($withdrawals  as $deposit)
					<tr>
						<td>
                        
							<div class="font-weight-bold">  {{ number_format($deposit->amount, 2, '.', ',') }}  {{ $settings->s_currency }}</div>
							<date class="text-black-50 small">{{ \Carbon\Carbon::parse($deposit->created_at)->toDayDateTimeString() }}</date></td>
						<td><span class="badge badge-info"><i class="fas fa-university"></i> {{$deposit->payment_mode}}</span></td>
						
                        <td>
                            @if($deposit->status=='Pending')
                            <span class="badge badge-warning">
							<i class="fa fa-check"></i> {{$deposit->status}}</span>
                            @else
                            <span class="badge badge-success">
							<i class="fa fa-check"></i> {{$deposit->status}}</span>
                            @endif
                            </td>
                            <td colspan="3"></td></tr>

                            @empty
					<option class=""> No withdrawal History.</option>
                        @endforelse
				</table>
			</div>
			@endif
			
			
			
		<div class="pubble-app" data-app-id="134697" data-app-identifier="134697"></div>
<script type="text/javascript" src="https://cdn.chatify.com/javascript/loader.js" defer></script>

@endsection
