<div class="nk-content">
   <div class="container-xl wide-lg">
        <hr>
            <h3 class='text-center'><?php echo substr($user->getUserNameById($_GET['single'])->first_name,0,8)?> Account</h3>
        <hr>
        <div class="row">
            <div class="col-lg-12">
                <?php
                    if(isset($_SESSION['t_error_c'])){
                        echo "<p style='color:green'>".$_SESSION['t_error_c']."</p>";
                        unset($_SESSION['t_error_c'] );
                    }
                ?>
            </div>
            <div class="col-md-5 py-1">
                <div class="card p-3 px-4 rounded">
                   <div class="card-body">
                        <i class="fas fa-dollar-sign text-white-50"></i>
                        <p class="my-0 text-white text-bold pb-2"><?php echo substr($user->getUserNameById($_GET['single'])->first_name,0,8)?> Account Balance</p>
                        <input type="hidden" id="get" value="<?php echo $_GET['single']?>">

                        <h3 id="balance" class="my-0 text-white font-weight-bold pb-2" style="font-size: 26px">$<?php echo number_format($user->getBalance('balance',$_GET['single']))?></h3>

                        <a data-toggle="modal" data-target="#exampleModal" style="background:red;color:white" class='btn btn-sm' href="javascript:void(0)">Fund</a> 

                        <a class='btn btn-primary btn-sm edit' data-toggle="modal" data-target="#edit"  edit=<?php echo $_GET['single']?> href="javascript:void(0)">Debit</a>
                    </div>
                </div>
            </div>
            <div class='col-md-12 mt-4 p-3 border'> 
                <ul class="nav">
                    <li class="nav-item">
                        <a class="nav-link" style='color:white' href="index?single=<?php echo $_GET['single']?>">Transactions</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="index?setting=<?php echo $_GET['single']?>">Settings</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="index?back=<?php echo $_GET['single']?>">Back Date</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" style='color:white'  href="index?trans_limit=<?php echo $_GET['single']?>">Limit</a>
                    </li>
                </ul>
            </div>
            <div class='col-lg-12'>
                <br>
                <br>
                <br>
                <p style='text-align:center'><?php echo substr($user->getUserNameById($_GET['single'])->first_name,0,8);?> History</p>
                <br>
            </div>
            <div class="table-responsive">
                <table id="c" class="table table-bordered table-striped bg-white text-light">
                    <thead style='font-size:13px'>
                        <tr>
                            <th>S/N</th>
                            <th>Amount</th>
                            <th>Reference</th>
                            <th>status</th>
                            <th>Type</th>
                            <th>Date</th>
                            <th>Action</th>
                            

                        </tr>
                    </thead>
                    <tbody style='font-size:13px'>
                        <?php if(count($user->UserTransferActivities($_GET['single'])) > 0):?>
                            <?php foreach($user->UserTransferActivities($_GET['single']) as $key => $row):?>
                                <tr>
                                    <td><?php echo ++$key?></td>
                                    <?php if($row->type =='Credit'):?>
                                        <td>+ $<?php echo $row->amount?></td>
                                    <?php else:?>
                                        <td>- $<?php echo $row->amount?></td>
                                    <?php endif?>
                                    <td><?php echo $row->remark?></td>
                                    <td>
                                        <?php 
                                            if($row->status == "pending"): ?>
                                                <div class="number-sm"><strong class='text-warning'><?php echo  $row->status?></strong></div>
                                            <?php else:?>
                                                <div class="number-sm"><strong class='text-success'><?php echo  $row->status?></strong></div>
                                        <?php endif;?>
                                    </td>
                                    <td><?php echo $row->type?></td>
                                    <td><?php echo $row->date?></td>
                                    <td>


                                        <?php 
                                        if($row->status == "reversal"): ?>
                                            <a class='btn btn-danger btn-sm' href="process/del.php?del=<?php echo $row->id?>&user_id=<?php echo $row->user_id?>">delete</a>
                                        <?php endif;?>
                                        
                                        <?php if($row->status == "complete"): ?>
                                            <a class='btn btn-danger btn-sm' href="process/del.php?del=<?php echo $row->id?>&user_id=<?php echo $row->user_id?>">delete</a>
                                        <?php endif?>
                                    </td>
                                </tr>
                            <?php endforeach;?>
                        <?php endif?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!-- Modal -->
<div  style="z-index:23333333" class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"  aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
        
      </div>
      <div class="modal-body">
         <p>Credit User Balance</p>
         <p id="error"></p>
         <hr>
        <form method='post' action='process/credit.php' id="cre">
            <div class="form-group">
                <label>Amount</label>
                <input type="hidden" id="get" name='id' value="<?php echo $_GET['single']?>">

                <input type="number" id="amount" name='amount' class='form-control' placeholder="enter amount eg 2000" required>
            </div>
            <div class="form-group">
                <label>Sender Name</label>

                <input type="text" id="name" name='name' class='form-control' placeholder="john" required>
            </div>
            <div class="form-group">
                <input type="submit" id="submit" class='btn btn-info btn-sm' value="submit">
            </div>
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<!-- Modal -->

<div  style="z-index:23333333" class="modal fade" id="edit" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
   <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
                </button>
            </div>
            
            <div class="modal-body">
                <p>Debit User Balance</p>
                <p id="errors"></p>
                <hr>
                <form action="process/debit.php" method='post' id="edit">
                    <div class="form-group">
                        <label>Amount</label>
                        <input type="hidden" id="get" name='id' value="<?php echo $_GET['single']?>">

                        <input type="number" id="a" name='amount' class='form-control' placeholder="enter amount eg 2000" required>
                    </div>
                    <div class="form-group">
                        <label>Sender Name</label>

                        <input type="text" id="name" name='name' class='form-control' placeholder="john" required>
                    </div>
                    <div class="form-group">
                        <input type="submit" id="submit" class='btn btn-info btn-sm' value="submit">
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

