<?php $__env->startSection('content'); ?>
<?php 
$capital = DB::table('invest')->where('user_id', $user->id)->get()->sum('capital');

$capitalInvested = DB::table('invest')->where('user_id', $user->id)->get()->sum('daily_income');

$days  = DB::table('invest')->where('user_id', $user->id)->get()->sum('days_paid');

$cashouts = DB::table('cashouts')->where('phone', $user->phone)->sum('amount');

$commissions = $cashouts;

$deposits = $user->balance + $capital;

$ref_bonus = $user->wallet;

$inactive_team = DB::table('users')->where('status', 0)->where('upline', $user->username)->get()->count();

?>
    <div class="col-lg-3">
        <div class="card">
            <div class="card-body text-center border-bottom">
                <img src="\assets\images\dummy.png" alt="profile-image" class="img-fluid" />
                <h5 class="card-title mt-3" style="
                        text-transform: capitalize;
                    ">
                    <?php echo e($user->name); ?>

                </h5>
            </div>
            <div class="card-body">
                <p class="clearfix">
                    <span class="float-left">Username</span>
                    <span class="col-sm-8 font-weight-bold"
                        style="
                            text-transform: lowercase;
                        ">
                        <a href="#"><?php echo e($user->username); ?></a>
                    </span>
                </p>
                <p class="clearfix">
                    <span class="float-left">Email</span>
                    <span class="col-sm-8 text-muted">
                        <?php echo e($user->email); ?>

                    </span>
                </p>
                <p class="clearfix">
                    <span class="float-left">Phone</span>
                    <span class="col-sm-8 text-muted">
                        <?php echo e($user->phone); ?>

                    </span>
                </p>
                <p class="clearfix">
                    <span class="float-left">Current
                        Balance</span>
                    <span class="col-sm-8 text-muted">
                        KSH
                        <?php echo e($user->balance); ?>

                    </span>
                </p>
                <p class="clearfix">
                    <span class="float-left">Compound
                        Balance</span>
                    <span class="col-sm-8 text-muted">
                        KSH 0.00
                    </span>
                </p>
                <p class="clearfix">
                    <span class="float-left">Refered
                        By</span>
                    <span class="col-sm-8 text-muted">
                        <?php echo e($user->upline); ?>

                    </span>
                </p>
                <p class="clearfix">
                    <span class="float-left">Subscribed
                        Plan</span>
                    <span class="col-sm-8 text-muted">
                        <span class="badge badge-pill badge-danger">None</span>
                    </span>
                </p>
                <p class="clearfix">
                    <span class="float-left">Joined</span>
                    <span class="col-sm-8 text-muted">
                       <?php echo e(\Carbon\Carbon::parse($user->created_at)->diffForHumans()); ?>

                    </span>
                </p>

                <p class="clearfix">
                    <span class="float-left">Status</span>
                    <span class="col-sm-8 text-muted">
                        <span class="badge badge-danger"><?php echo e($user->status); ?></span>
                    </span>
                </p>
            </div>
        </div>
    </div>
    <div class="col-lg-9">
        <div class="card">
            <div class="row p-4">
                <!-- task, page, download counter  start -->
                <div class="col-lg-4">
                    <div class="card">
                        <div class="card-block">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <h5 class="text-c-blue f-w-600">
                                        KSH
                                       <?php echo e(number_format($deposits, 2)); ?> 
                                    </h5>
                                    <h6 class="text-muted m-b-0">
                                        Total Deposits
                                    </h6>
                                </div>
                            </div>
                        </div>
                        <div class="card-footer bg-c-blue">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <a href="<?php echo e(env('APP_URL')); ?>/deposits/all?search=<?php echo e($user->id); ?>">
                                        <p class="text-white m-b-0">
                                            View All
                                        </p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="card">
                        <div class="card-block">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <h5 class="text-c-green f-w-600">
                                        KSH
                                        <?php echo e(number_format($cashouts, 2)); ?>

                                    </h5>
                                    <h6 class="text-muted m-b-0">
                                        Total Withdrawals
                                      
                                    </h6>
                                </div>
                            </div>
                        </div>
                        <div class="card-footer bg-c-green">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <a href="<?php echo e(env('APP_URL')); ?>/withdrawals/all?search=<?php echo e($user->phone); ?>">
                                        <p class="text-white m-b-0">
                                            View
                                            All
                                        </p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="card">
                        <div class="card-block">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <h5 class="text-c-pink f-w-600">
                                        Ksh
                                        <?php echo e(number_format($ref_bonus)); ?>

                                    </h5>
                                    <h6 class="text-muted m-b-0">
                                        Referal
                                        Earningss
                                    </h6>
                                </div>
                            </div>
                        </div>
                        <div class="card-footer bg-c-pink">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <a href="<?php echo e(env('APP_URL')); ?>/affiliates/all?search=<?php echo e($user->username); ?>">
                                        <p class="text-white m-b-0">
                                            View
                                            All
                                        </p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- task, page, download counter  start -->
                <div class="col-lg-4">
                    <div class="card">
                        <div class="card-block">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <h5 class="text-c-blue f-w-600">
                                        Ksh
                                        <?php echo e(number_format($capital)); ?>

                                    </h5>
                                    <h6 class="text-muted m-b-0">
                                        Total
                                        Investment
                                    </h6>
                                </div>
                            </div>
                        </div>
                        <div class="card-footer bg-c-yellow">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <a href="<?php echo e(env('APP_URL')); ?>/users/all_investments?search=<?php echo e($user->id); ?>">
                                        <p class="text-white m-b-0">
                                            View
                                            All
                                        </p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="card">
                        <div class="card-block">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <h5 class="text-c-green f-w-600">
                                        Ksh
                                        <?php echo e(number_format($cashouts)); ?>

                                    </h5>
                                    <h6 class="text-muted m-b-0">
                                        Total
                                        Commision
                                    </h6>
                                </div>
                            </div>
                        </div>
                        <div class="card-footer bg-c-pink">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <a href="<?php echo e(env('APP_URL')); ?>/users/all">
                                        <p class="text-white m-b-0">
                                            View
                                            All
                                        </p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="card">
                        <div class="card-block">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <h5 class="text-c-pink f-w-600">
                                        <?php echo e($inactive_team); ?>

                                    </h5>
                                    <h6 class="text-muted m-b-0">
                                        Dormant
                                        Referals
                                    </h6>
                                </div>
                            </div>
                        </div>
                        <div class="card-footer bg-c-blue">
                            <div class="row align-items-center">
                                <div class="col-12">
                                    <a href="<?php echo e(env('APP_URL')); ?>/affiliates/dormant?search=<?php echo e($user->username); ?>">
                                        <p class="text-white m-b-0">
                                            View
                                            All
                                        </p>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- task, page, download counter  end -->
                <div class="col-lg-4">
                    <a href="#addModal" data-toggle="modal" class="text-white text-center btn-block">
                        <div class="card outline-success bg-success">
                            <div class="card-body">
                                Add
                                Balance
                            </div>
                        </div>
                    </a>
                </div>
                <div class="col-lg-4">
                    <a href="#subModal" data-toggle="modal" class="text-white text-center btn-block">
                        <div class="card outline-danger bg-danger">
                            <div class="card-body">
                                Subtract
                                Balance
                            </div>
                        </div>
                    </a>
                </div>
                <div class="col-lg-4">
                    <a href="#revModal" data-toggle="modal" class="text-white text-center btn-block">
                        <div class="card outline-dark bg-dark">
                            <div class="card-body">
                                Reverse
                                User
                            </div>
                        </div>
                    </a>
                </div>
                <div class="col-lg-4">
                    <a href="" class="text-white text-center btn-block">
                        <div class="card outline-warning bg-warning">
                            <div class="card-body">
                                Send
                                Email
                            </div>
                        </div>
                    </a>
                </div>

                <div class="col-lg-4">
                    <a href="#addUserReferer" data-toggle="modal" class="text-white text-center btn-block">
                        <div class="card outline-success bg-primary">
                            <div class="card-body">
                                Add
                                User
                                Referer
                            </div>
                        </div>
                    </a>
                </div>

                <div class="col-lg-4">
                    <a href="#changeUserPassword" data-toggle="modal" class="text-white text-center btn-block">
                        <div class="card outline-info bg-info">
                            <div class="card-body">
                                Change
                                Password
                            </div>
                        </div>
                    </a>
                </div>

                <div class="col-lg-12">
                    <form method="POST" action="<?php echo e(env('APP_URL')); ?>/updateuserdetails>
                        <?php echo csrf_field(); ?>
                       <input type="hidden" name="userid" value="<?php echo e($user->id); ?>">
                        <div class="form-group row">
                            <div class="col-md-6">
                                <label>Full name</label>
                                <input id="full_name" placeholder="Enter Full Name" type="text"
                                    class="form-control" name="full_name" value="<?php echo e($user->name); ?>" required
                                    autocomplete="full_name" autofocus />
                            </div>
                            <div class="col-md-6">
                                <label>Country
                                    </label>
                                <input id="country" placeholder="Enter Country" type="text"
                                    class="form-control" name="country" value="<?php echo e($user->country); ?>" required
                                    autocomplete="country" autofocus />
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col-md-6">
                                <label>Email</label>
                                <input id="email" placeholder="Enter  Email" type="email" class="form-control"
                                    name="email" value="<?php echo e($user->email); ?>" required autocomplete="email" />
                            </div>

                            <div class="col-md-6">
                                <label>Phone</label>
                                <input id="phone" placeholder="Enter  Phone No." type="phone"
                                    class="form-control" name="phone" value="<?php echo e($user->phone); ?>" required
                                    autocomplete="phone" />
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col-md-6">
                                <label>Balance</label>
                                <input id="balance" placeholder="Enter  balance" type="text"
                                    class="form-control" name="balance" value="<?php echo e($user->balance); ?>" required
                                    autocomplete="balance" />
                            </div>
                            <div class="col-md-6">
                                <label>Username</label>
                                <input id="username" placeholder="Enter Your Username" type="username"
                                    class="form-control" name="username" value="<?php echo e($user->username); ?>" required
                                    autocomplete="username" />
                            </div>
                        </div>
                        <div class="card-footer">
                            <div class="form-group row">
                                <div class="col-lg-12 text-center">
                                    <input type="submit" class="btn btn-block btn-success mt-2" value="Save Changes" />
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/hqpzspxr/adminpanel.ebay7.1ai.co.ke/resources/views/users/user.blade.php ENDPATH**/ ?>