<?php $__env->startSection('body'); ?>

    <?php
        $totalusers = \App\User::count();
       $banusers = \App\User::where('status',0)->count();
       $verified = \App\User::where('verified',2)->count();
       $activeusers = \App\User::where('status',1)->count();
       $users = \App\User::where('status',1)->take(5)->orderby('id', 'desc')->get();
       $inbox = \App\Message::where('view',0)->where('admin',0)->orderby('id', 'desc')->get();
       $trx = \App\Trx::take(3)->orderby('id', 'desc')->get();

        $gateway =  App\Gateway::count();
        $deposit =  App\Deposit::whereStatus(1)->count();
        $totalDeposit =  App\Deposit::whereStatus(1)->sum('amount');
        $totalWithdraw =  App\WithdrawLog::whereStatus(2)->sum('amount');
        $bal =  App\USer::sum('balance');
         $totalTransfer =  App\Transfer::whereStatus(1)->sum('amount');
        $blog =App\Post::count();
        $subscribers =App\Subscriber::count();


         $ppro =  App\BuyMoney::whereStatus(2)->sum('enter_amount');
         $pdec =  App\BuyMoney::whereStatus(12)->sum('enter_amount');
         $ppend =  App\BuyMoney::whereStatus(1)->sum('enter_amount');


         $spro =  App\SellMoney::whereStatus(2)->sum('enter_amount');
         $sdec =  App\SellMoney::whereStatus(12)->sum('enter_amount');
         $spend =  App\SellMoney::whereStatus(1)->sum('enter_amount');

         $wpro =  App\WithdrawLog::whereStatus(2)->sum('amount');
         $wdec =  App\WithdrawLog::whereStatus(12)->sum('amount');
         $wpend =  App\WithdrawLog::whereStatus(1)->sum('amount');

         $ex =  App\ExchangeMoney::count();
         $epro =  App\ExchangeMoney::whereStatus(2)->count();
         $edec =  App\ExchangeMoney::whereStatus(12)->count();
         $epend =  App\ExchangeMoney::whereStatus(1)->count();

    $currency =  App\Currency::count();
    $buycurrency =  App\BuyMoney::where('status','!=',0)->count();
    $sellcurrency =  App\SellMoney::where('status','!=',0)->count();
    $exchangecurrency =  App\ExchangeMoney::where('status','!=',0)->count();

    ?>

  <div class="page-content"><div class="container"><div class="row"><div class="col-lg-4"><div class="token-statistics card card-token height-auto"><div class="card-innr"><div class="token-balance token-balance-with-icon"><div class="token-balance-icon"><em class="h2 color-white ti ti-wallet"></em></div><div class="token-balance-text"><h6 class="card-sub-title">Users' Wallet Balance</h6><span class="lead"><?php echo e(number_format($bal, $basic->decimal)); ?> <span><?php echo e($basic->currency); ?></span></span></div></div><div class="token-balance token-balance-s2"><h6 class="card-sub-title">Finance</h6><ul class="token-balance-list"><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($totalDeposit, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?> </span><span class="sub">Total Deposits</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($totalWithdraw, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?></span><span class="sub">Total Withdraw</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($totalTransfer, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?></span><span class="sub">Total Transfer</span></li></ul></div></div></div></div>




  <div class="col-lg-4"><div class="bg-secondary token-statistics card card-token height-auto"><div class="card-innr"><div class="token-balance token-balance-with-icon"><div class="token-balance-icon"><em class="h2 color-white ti ti-import"></em></div><div class="token-balance-text"><h6 class="card-sub-title">Purchased Cryptocurrency</h6><span class="lead"><?php echo e(number_format($ppro, $basic->decimal)); ?> <span><?php echo e($basic->currency); ?></span></span></div></div><div class="token-balance token-balance-s2"><h6 class="card-sub-title">Summary</h6><ul class="token-balance-list"><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($ppro, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?> </span><span class="sub">Processed</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($ppend, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?></span><span class="sub">Pending</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($pdec, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?></span><span class="sub">Declined</span></li></ul></div></div></div></div>




  <div class="col-lg-4"><div class="bg-primary token-statistics card card-token height-auto"><div class="card-innr"><div class="token-balance token-balance-with-icon"><div class="token-balance-icon"><em class="h2 color-white ti ti-export"></em></div><div class="token-balance-text"><h6 class="card-sub-title">Sold Cryptocurrency</h6><span class="lead"><?php echo e(number_format($spro, $basic->decimal)); ?> <span><?php echo e($basic->currency); ?></span></span></div></div><div class="token-balance token-balance-s2"><h6 class="card-sub-title">Summary</h6><ul class="token-balance-list"><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($spro, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?> </span><span class="sub">Processed</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($spend, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?></span><span class="sub">Pending</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($pdec, $basic->decimal)); ?><?php echo e($basic->currency_sym); ?></span><span class="sub">Declined</span></li></ul></div></div></div></div>





  <div class="col-lg-4"><div class="bg-primary token-statistics card card-token height-auto"><div class="card-innr"><div class="token-balance token-balance-with-icon"><div class="token-balance-icon"><em class="h2 color-white ti ti-user"></em></div><div class="token-balance-text"><h6 class="card-sub-title">Total Users</h6><span class="lead"><?php echo e($totalusers); ?> <span>Users</span></span></div></div><div class="token-balance token-balance-s2"><h6 class="card-sub-title">Summary</h6><ul class="token-balance-list"><li class="token-balance-sub"><span class="lead"><?php echo e($activeusers); ?> User(s) </span><span class="sub">Active Users</span></li><li class="token-balance-sub"><span class="lead"><?php echo e($verified); ?> User(s)</span><span class="sub">Verified Users</span></li><li class="token-balance-sub"><span class="lead"><?php echo e($banusers); ?> User(s)</span><span class="sub">Inactive Users</span></li></ul></div></div></div></div>



  <div class="col-lg-4"><div class="bg-theme token-statistics card card-token height-auto"><div class="card-innr"><div class="token-balance token-balance-with-icon"><div class="token-balance-icon"><em class="h2 color-white ti ti-shopping-cart"></em></div><div class="token-balance-text"><h6 class="card-sub-title">Total Withdrawal</h6><span class="lead"><?php echo e(number_format($wpro, $basic->decimal)); ?> <span><?php echo e($basic->currency); ?></span></span></div></div><div class="token-balance token-balance-s2"><h6 class="card-sub-title">Summary</h6><ul class="token-balance-list"><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($wpro, $basic->decimal)); ?> <?php echo e($basic->currency_sym); ?></span><span class="sub">Processed</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($wpend, $basic->decimal)); ?> <?php echo e($basic->currency_sym); ?></span><span class="sub">Unprocessed</span></li><li class="token-balance-sub"><span class="lead"><?php echo e(number_format($wdec, $basic->decimal)); ?> <?php echo e($basic->currency_sym); ?></span><span class="sub">Declined</span></li></ul></div></div></div></div>



  <div class="col-lg-4"><div class="bg-secondary token-statistics card card-token height-auto"><div class="card-innr"><div class="token-balance token-balance-with-icon"><div class="token-balance-icon"><em class="h2 color-white ti ti-shopping-cart"></em></div><div class="token-balance-text"><h6 class="card-sub-title">Exchanged Cryptos</h6><span class="lead"><?php echo e($ex); ?> <span> Exchange(s)</span></span></div></div><div class="token-balance token-balance-s2"><h6 class="card-sub-title">Summary</h6><ul class="token-balance-list"><li class="token-balance-sub"><span class="lead"><?php echo e($epro); ?></span><span class="sub">Processed</span></li><li class="token-balance-sub"><span class="lead"><?php echo e($epend); ?> </span><span class="sub">Unprocessed</span></li><li class="token-balance-sub"><span class="lead"><?php echo e($edec); ?> </span><span class="sub">Declined</span></li></ul></div></div></div></div>





  <!-- .col -->

   <!-- .col --><div class="col-lg-6"><div class="card card-full-height"><div class="card-innr"><div class="card-head has-aside pb-0"><h4 class="card-title">Recent Users</h4></div><table class="data-table user-list"><tbody>

<?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=>$data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr class="data-item"><td class="data-col dt-user"><div class="user-block"><div class="user-photo"> <?php if( file_exists($data->image)): ?>
                        <img src=" <?php echo e(url($data->image)); ?> " width="100"
                             alt="Profile Pic">
                    <?php else: ?>

                        <img src=" <?php echo e(url('assets/user/images/user-default.png')); ?> " width="100"
                             alt="Profile Pic">
                    <?php endif; ?></div><div class="user-info"><span class="lead user-name"><?php echo e($data->username); ?></span><span class="sub user-id"><?php echo e($data->email); ?></span></div></div></td><td class="data-col dt-join text-right"><span class="sub join-time"><?php echo date(' D, d/M/Y', strtotime($data->created_at)); ?></span></td></tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

<!-- .data-item --></tbody></table></div></div><!-- .card --></div><!-- .col --><div class="col-lg-6"><div class="card card-timeline card-full-height"><div class="card-innr"><div class="card-head has-aside"><h4 class="card-title">Requests & Messages</h4></div>


<div class="timeline-wrap" id="timeline-notify">
<div data-simplebar="init"><div class="timeline-innr"><div class="timeline"><div class="timeline-line"></div>

<?php if(count($inbox) > 0): ?>
<?php $__currentLoopData = $inbox; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=>$data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="timeline-item secondary"><div class="timeline-time"><?php echo date('d/M/y', strtotime($data->created_at)); ?></div><div class="timeline-content"><a href="<?php echo e(route('ticket.view',$data->id)); ?>" class="timeline-content-url"><?php echo e($data->title); ?></a><span class="timeline-content-info"><?php echo e(App\User::whereId($data->user_id)->first()->username); ?></span></div></div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php else: ?>
<div class="timeline-item secondary"><div class="timeline-time">Today</div><div class="timeline-content"><a href="#" class="timeline-content-url">Message Inbox Is Empty As No User Has Made Any Request Or Complaints So Far. Keep up the good management task</a><span class="timeline-content-info">Empty</span></div></div>
<?php endif; ?>
 </div></div></div><div class="timeline-load"><a href="" class="link load-timeline" data-target="timeline-notify" data-show="2">Load More</a></div></div></div></div><!-- .card --></div><!-- .col --><div class="col-lg-6"><div class="token-transaction card card-full-height"><div class="card-innr"><div class="card-head has-aside"><h4 class="card-title">Last 3 Transaction</h4><div class="card-opt"><a href="#" class="link ucap">View ALL <em class="fas fa-angle-right ml-2"></em></a></div></div><table class="table tnx-table"><thead><tr><th>TRX ID</th><th>Amount</th><th class="d-none d-sm-table-cell tnx-date">Date</th><th class="tnx-type"><div class="tnx-type-text"></div></th></tr><!-- tr --></thead><!-- thead --><tbody>

<?php $__currentLoopData = $trx; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=>$data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr><td><div class="d-flex align-items-center"><div class="data-state data-state-progress"></div><span class="lead"><?php echo e(substr($data->trx, 0, 5)); ?>....</span></div></td><td><span><span class="lead"><?php echo e(number_format($data->amount, $basic->decimal)); ?></span><span class="sub"><?php echo e($basic->currency); ?> <em class="fas fa-info-circle" data-toggle="tooltip" data-placement="bottom" data-original-title="<?php echo e($data->title); ?>"></em></span></span></td><td class="d-none d-sm-table-cell tnx-date"><span class="sub sub-s2"><?php echo e($data->created_at); ?></span></td><td class="tnx-type"><span class="tnx-type-md badge badge-outline badge-success badge-md"><?php echo e($data->action); ?></span><span class="tnx-type-sm badge badge-sq badge-outline badge-success badge-md">P</span></td></tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

</tbody><!-- tbody --></table><!-- .table --></div></div></div><div class="col-lg-6"><div class="token-sale-graph card card-full-height"><div class="card-innr"><div class="card-head has-aside"><h4 class="card-title">Tokens Sale Graph</h4><div class="card-opt"><a href="#" class="link ucap link-light toggle-tigger toggle-caret">7 Days</a><div class="toggle-class dropdown-content"><ul class="dropdown-list"><li><a href="#">30 days</a></li><li><a href="#">1 years</a></li></ul></div></div></div><div class="chart-tokensale"><canvas id="tknSale"></canvas></div></div></div><!-- .card --></div><!-- .col --></div><!-- .row --></div><!-- .container --></div><!-- .page-content -->

<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>


<?php $__env->stopSection(); ?>


<?php echo $__env->make('include.admindashboard', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>