<?php $__env->startSection('content'); ?>
    <div class="nk-content">
                        <div class="container-fluid">
                            <div class="nk-content-inner">
                                <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"><?php echo e($page_title); ?></h3>
                                                <?php
                                                 $count = \App\Bill::whereUser_id(Auth::user()->id)->whereType(5)->count();
                                                 ?>
                                                <div class="nk-block-des text-soft"><p>You have a total of <?php echo e($count); ?> conversion{s}</p></div>
                                            </div>
                                            <div class="nk-block-head-content">
                                                <div class="toggle-wrap nk-block-tools-toggle">
                                                    <a href="#" class="btn btn-icon btn-trigger toggle-expand mr-n1" data-target="pageMenu"><em class="icon ni ni-menu-alt-r"></em></a>
                                                    <div class="toggle-expand-content" data-content="pageMenu">
                                                        <ul class="nk-block-tools g-3">
                                                            <li>
                                                                <a href="#" class="btn btn-white btn-dim btn-outline-light"><em class="icon ni ni-download-cloud"></em><span>Export</span></a>
                                                            </li>

                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <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 Conversions</h5></div>
                                                        <div class="card-tools mr-n1">
                                                            <ul class="btn-toolbar gx-1">
                                                                <li>
                                                                    <a href="#" class="search-toggle toggle-search btn btn-icon" data-target="search"><em class="icon ni ni-search"></em></a>
                                                                </li>
                                                                <li class="btn-toolbar-sep"></li>

                                                            </ul>
                                                        </div>
                                                        <div class="card-search search-wrap" data-search="search">
                                                            <div class="search-content">
                                                                <a href="#" class="search-back btn btn-icon toggle-search" data-target="search"><em class="icon ni ni-arrow-left"></em></a>
                                                                  <form method="post" class="buysell-form" action="<?php echo e(route('conversionlogsearch')); ?>">
                                                                  <?php echo csrf_field(); ?>
                                                                <input type="text" name="trx" class="form-control border-transparent form-focus-none" placeholder="Quick search by transaction number" />
                                                                <button class="search-submit btn btn-icon"><em class="icon ni ni-search"></em></button>
                                                                </form>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <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>Details</span></div>
                                                            <div class="nk-tb-col tb-col-xxl"><span>Source</span></div>
                                                            <div class="nk-tb-col"><span>Conversion ID</span></div>
                                                            <div class="nk-tb-col text-right"><span>Amount</span></div>
                                                            <div class="nk-tb-col text-right tb-col-sm"><span>Date</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>
                                                        <?php if(count($log) >0): ?>
                                                         <?php $__currentLoopData = $log; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k=>$data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <div class="nk-tb-item">
                                                            <div class="nk-tb-col">
                                                                <div class="nk-tnx-type">
                                                                    <?php if($data->status == 1): ?>
                                                                   <div class="nk-tnx-type-icon bg-success-dim text-success">
                                                                    <?php elseif($data->status == 0): ?>
                                                                    <div class="nk-tnx-type-icon bg-warning-dim text-warning">
                                                                    <?php elseif($data->status == 2): ?>
                                                                    <div class="nk-tnx-type-icon bg-danger-dim text-danger">
                                                                    <?php endif; ?>

                                                                    <div class="user-avatar sm"><img src="<?php echo e(asset(App\Internet::whereCode($data->network)->first()->image)); ?> " width="100"
                             alt="Avatar"></div></div>
                                                                    <div class="nk-tnx-type-text"><span class="tb-lead"><?php echo e(isset(App\Internet::whereCode($data->network)->first()->id) ? App\Internet::whereCode($data->network)->first()->name : 'N/A'); ?></span><span class="tb-date"><?php echo e($data->phone); ?></span></div>
                                                                </div>
                                                            </div>
                                                             <div class="nk-tb-col tb-col-dlg"><span class="tb-lead"><?php echo e(isset($data->trx ) ? $data->trx  : 'N/A'); ?></span><span class="<?php if($data->status == 1): ?> badge badge-success <?php elseif($data->status == 0): ?> badge badge-warning <?php else: ?> badge badge-danger <?php endif; ?>"><?php echo date(' d/M/Y', strtotime($data->created_at)); ?></span></div>
                                                            <div class="nk-tb-col text-right">
                                                                <span class="tb-amount"><?php echo e(number_format($data->amount, $basic->decimal)); ?></span><span class="tb-amount-sm"><?php echo e($basic->currency); ?></span>
                                                            </div>
                                                            <div class="nk-tb-col text-right tb-col-sm">
                                                                <span class="tb-amount"><?php echo e(Carbon\Carbon::parse($data->updated_at)->diffForHumans()); ?> <span></span></span><span class="tb-amount-sm"><?php echo e($data->updated_at); ?></span>
                                                            </div>
                                                            <div class="nk-tb-col nk-tb-col-status">
                                                                <div class="dot dot-success d-md-none"></div>
                                                                 <?php if($data->status == 1): ?>
                                                                   <span class="badge badge-sm badge-dim badge-outline-success d-none d-md-inline-flex">Completed</span>
                                                                    <?php elseif($data->status == 0): ?>
                                                                    <span class="badge badge-sm badge-dim badge-outline-warning d-none d-md-inline-flex">Pending</span>
                                                                    <?php elseif($data->status == 2): ?>
                                                                    <span class="badge badge-sm badge-dim badge-outline-danger d-none d-md-inline-flex">Declined</span>
                                                                    <?php endif; ?>



                                                            </div>
                                                            <div class="nk-tb-col nk-tb-col-tools">
                                                                <ul class="nk-tb-actions gx-2">

                                                                    <li class="nk-tb-action-hidden">
                                                                        <a href="#tranxDetails<?php echo e($data->id); ?>" data-toggle="modal" class="bg-white btn btn-sm btn-outline-light btn-icon btn-tooltip" title="Details"><em class="icon ni ni-eye"></em></a>
                                                                    </li>

                                                                </ul>
                                                            </div>
                                                        </div>






                                                        <div class="modal fade" tabindex="-1" id="tranxDetails<?php echo e($data->id); ?>">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <a href="#" class="close" data-dismiss="modal" aria-label="Close"><em class="icon ni ni-cross"></em></a>
                    <div class="modal-body modal-body-md">
                        <div class="nk-modal-head mb-3 mb-sm-5">
                            <h4 class="nk-modal-title title">TRX ID <small class="text-primary">#<?php echo e($data->trx); ?></small></h4>
                        </div>
                        <div class="nk-tnx-details">
                            <div class="nk-block-between flex-wrap g-3">
                                <div class="nk-tnx-type">
                                     <?php if($data->status == 1): ?>
                                                                   <div class="nk-tnx-type-icon bg-success-dim text-success">
                                                                    <?php elseif($data->status == 0): ?>
                                                                    <div class="nk-tnx-type-icon bg-warning-dim text-warning">
                                                                    <?php elseif($data->status == 2): ?>
                                                                    <div class="nk-tnx-type-icon bg-danger-dim text-danger">
                                                                    <?php endif; ?>


                                   <div class="user-avatar sm"><img src="<?php echo e(asset(App\Internet::whereCode($data->network)->first()->image)); ?> " width="100"
                             alt="Avatar"></div></div>
                                    <div class="nk-tnx-type-text">
                                        <h5 class="title"><?php echo e($basic->currency); ?><?php echo e($data->amount); ?></h5>
                                        <span class="sub-text mt-n1"><?php echo date('D, d/M, Y: h:m A', strtotime($data->created_at)); ?></span>
                                    </div>
                                </div>
                                <ul class="align-center flex-wrap gx-3">
                                    <li>
                                     <?php if($data->status == 1): ?>
                                                                   <span class="badge badge-sm badge-success">Completed</span>
                                                                    <?php elseif($data->status == 0): ?>
                                                                    <span class="badge badge-sm badge-warning">Pending</span>
                                                                    <?php elseif($data->status == 2): ?>
                                                                    <span class="badge badge-sm badge-danger">Declined</span>
                                                                    <?php endif; ?>
                                    </li>
                                </ul>
                            </div>
                            <div class="nk-modal-head mt-sm-5 mt-4 mb-4"><h5 class="title">Transaction Info</h5></div>
                            <div class="row gy-3">
                                <div class="col-lg-6"><span class="sub-text">Conversion Time</span><span class="caption-text"><?php echo e(Carbon\Carbon::parse($data->updated_at)->diffForHumans()); ?></span></div>
                                <div class="col-lg-6"><span class="sub-text">Reference ID</span><span class="caption-text text-break"><?php echo e($data->trx); ?></span></div>
                                <div class="col-lg-6"><span class="sub-text">Transaction Fee</span><span class="caption-text"><?php echo e($basic->currency); ?> <?php echo e(number_format($data->charge, $basic->decimal)); ?></span></div>
                                <div class="col-lg-6"><span class="sub-text">Amount</span><span class="caption-text"><?php echo e($basic->currency); ?><?php echo e(number_format($data->amount, $basic->decimal)); ?></span></div>
                                <div class="col-lg-6"><span class="sub-text">Net Amount</span><span class="caption-text"><?php echo e($basic->currency); ?> <?php echo e(number_format($data->amount - $data->charge, $basic->decimal)); ?></span></div>
                            </div>
                            <div class="nk-modal-head mt-sm-5 mt-4 mb-4"><h5 class="title">Transaction Details</h5></div>
                            <div class="row gy-3">
                                <div class="col-lg-6"><span class="sub-text">Transaction Type</span><span class="caption-text">Airtime Conversion</span></div>
                                <div class="col-lg-6">
                                    <span class="sub-text">Network</span><span class="caption-text align-center"> <span class="badge <?php if($data->network == 01): ?>badge-warning <?php elseif($data->network == 02): ?>badge-success <?php elseif($data->network == 03): ?>badge-secondary <?php elseif($data->network == 04): ?>badge-danger  <?php endif; ?> ml-2 text-white"><?php echo e(isset(App\Internet::whereCode($data->network)->first()->id) ? App\Internet::whereCode($data->network)->first()->name : 'N/A'); ?></span></span>
                                </div>

                                <div class="col-lg-12"><span class="sub-text">Phone</span><span class="caption-text"><?php echo e($data->phone); ?></span></div>


                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>




                                                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                         <?php else: ?>
                                                         No Airtime Conversion Yet
                                                         <?php endif; ?>


                                                    </div>
                                                </div>
                                                <div class="card-inner">
                                                    <ul class="pagination justify-content-center justify-content-md-start">
                                                       <?php echo e($log->links()); ?>

                                                    </ul>
                                                </div>







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

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