@extends('layouts.admin')

@section('content')




<!-- content @s -->
                <div class="nk-content nk-content-fluid">
                    <div class="container-xl wide-lg">
                        <div class="nk-content-body">
                            <div class="nk-block-head nk-block-head-sm">
                                <div class="nk-block-between g-3">
                                    <div class="nk-block-head-content">
                                        <h3 class="nk-block-title page-title">Crypto Transaction</h3>
                                        
                                    </div><!-- .nk-block-head-content -->
                                    <div class="nk-block-head-content">
                                        <div class="toggle-wrap nk-block-tools-toggle">
                                            <a href="#" class="btn btn-icon btn-trigger toggle-expand me-n1" data-target="pageMenu"><em class="icon ni ni-menu-alt-r"></em></a>
                                            
                                        </div>
                                    </div><!-- .nk-block-head-content -->
                                </div><!-- .nk-block-between -->
                            </div><!-- .nk-block-head -->
                            <div class="nk-block">
                                <div class="card card-bordered card-stretch">
                                    <div class="card-inner-group">
                                        <div class="card-inner">
                                            <div class="card-title-group">
                                                <div class="card-title">
                                                    <h5 class="title">All Orders</h5>
                                                </div>
                                                
                                                
                                            </div><!-- .card-title-group -->
                                        </div><!-- .card-inner -->
                                        <div class="card-inner p-0">
                                            <div class="nk-tb-list nk-tb-tnx">
                                                <div class="nk-tb-item nk-tb-head">
                                                    <div class="nk-tb-col"><span>ID</span></div>
                                                    <div class="nk-tb-col tb-col-xxl"><span>User/Email</span></div>
                                                    <div class="nk-tb-col tb-col-lg"><span>Coin</span></div>
                                                    <div class="nk-tb-col text-end"><span>Amount</span></div>
                                                     
                                                    <div class="nk-tb-col nk-tb-col-status"><span class="sub-text d-none d-md-block">Status</span></div>
                                                    <div class="nk-tb-col nk-tb-col-tools"></div>
                                                </div><!-- .nk-tb-item -->
                                                
                                                
                                               @foreach($transactions as $transaction) 
                                                <div class="nk-tb-item">
                                                    <div class="nk-tb-col">
                                                        <div class="nk-tnx-type">
                                                            <div class="nk-tnx-type-icon bg-success-dim text-success">
                                                                <em class="icon ni ni-arrow-up-right"></em>
                                                            </div>
                                                            <div class="nk-tnx-type-text">
                                                                <span class="tb-lead">#{{ $transaction->id }}</span>
                                                                <span class="tb-date">{{ $transaction->created_at }}</span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="nk-tb-col tb-col-xxl">
                                                        <span class="tb-lead-sub">{{ $transaction->user->name }}</span>
                                                        <span class="tb-lead-sub">{{ $transaction->user->email }}</span>
                                                        <span class="tb-sub">{{ $transaction->user->email }}</span>
                                                    </div>
                                                    <div class="nk-tb-col tb-col-lg">
                                                        <span class="tb-lead-sub">{{ $transaction->coin->name }}</span>
                                                        <span class="badge badge-dot bg-success">{{ $transaction->coin->symbol }}</span>
                                                    </div>
                                                    <div class="nk-tb-col text-end">
                                                        <span class="tb-amount">{{ $transaction->amount }} <span>{{$currency}}</span></span>
                                                         
                                                    </div>
                                                     
                                                    <div class="nk-tb-col nk-tb-col-status">
                                                        <div class="dot dot-success d-md-none"></div>
                                                        
                                                       @if($transaction->status == '0') 
                                                        <span class="badge badge-sm badge-dim bg-outline-warning d-none d-md-inline-flex">Pending</span>
                                             @elseif($transaction->status == '1')           
                                                        <span class="badge badge-sm badge-dim bg-outline-success d-none d-md-inline-flex">Completed</span>
                                          @elseif($transaction->status == '2')              <span class="badge badge-sm badge-dim bg-outline-warning d-none d-md-inline-flex">Pending</span>
                                            @endif            
                                                    </div>
                                                    <div class="nk-tb-col nk-tb-col-tools">
                                                        <ul class="nk-tb-actions gx-2">
                                                            <li class="nk-tb-action-hidden">
                                                                
                                            <form action="{{ route('admin.transactions.approve', $transaction) }}" method="POST" style="display:inline;">
                            @csrf
                            <button type="submit" class="bg-white btn btn-sm btn-outline-light btn-icon" data-bs-toggle="tooltip" data-bs-placement="top" title="Approve"><em class="icon ni ni-done"></em></button>
                        </form>              
                        
                        
                                                                 
                                                            </li>
                                                            <li class="nk-tb-action-hidden">
                                                       <form action="{{ route('admin.transactions.reject', $transaction) }}" method="POST" style="display:inline;">
                            @csrf
                            <button type="submit" class="bg-white btn btn-sm btn-outline-light btn-icon btn-tooltip" title="Reject"><em class="icon ni ni-cross-round"></em></button>
                        </form>         
                                                                
                                                                 
                                                            </li>
                                                            <li>
                                                                <div class="dropdown">
                                                                    <a href="#" class="dropdown-toggle bg-white btn btn-sm btn-outline-light btn-icon" data-bs-toggle="dropdown"><em class="icon ni ni-more-h"></em></a>
                                                                    <div class="dropdown-menu dropdown-menu-end">
                                                                        <ul class="link-list-opt">
                                                                            <li><form action="{{ route('admin.transactions.approve', $transaction) }}" method="POST" style="display:inline;">
                            @csrf
                            <button type="submit"  ><em class="icon ni ni-done"></em><span>Approve</span></button>
                        </form> </li>
                                                                            <li><form action="{{ route('admin.transactions.reject', $transaction) }}" method="POST" style="display:inline;">
                            @csrf
                            <button type="submit"  ><em class="icon ni ni-cross-round"></em><span>Reject</span></button>
                        </form></li>
                                                                            <li><form action="{{ route('admin.transactions.delete', $transaction) }}" method="POST" style="display:inline;">
                            @csrf
                            @method('DELETE')
                            <button type="submit" ><em class="icon ni ni-repeat"></em><span>Delete</span></button>
                        </form>  </li>
                                                                             
                                                                        </ul>
                                                                    </div>
                                                                </div>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                                
                                                
                                         @endforeach        
                                                
                                                
                                               
                                               
                                            </div><!-- .nk-tb-list -->
                                        </div><!-- .card-inner -->
                                        <div class="card-inner">
                                            <ul class="pagination justify-content-center justify-content-md-start">
                                                
                                            </ul>
                                        </div><!-- .card-inner -->
                                    </div><!-- .card-inner-group -->
                                </div><!-- .card -->
                            </div><!-- .nk-block -->
                        </div>
                    </div>
                </div>
                <!-- content @e -->







@endsection