<?php 
include('authentication.php');
include('includes/header.php');
include('includes/topbar.php');
include('includes/sidebar.php');
?>

<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h3>User Details</h3>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="#">Home</a></li>
                        <li class="breadcrumb-item active">User Details</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>
    <section class="content">
        <?php include('message.php'); ?>
        <div class="container-fluid">

        <?php 
            $ref = 'Users/'. $_GET['id'].'/';
            $fetchdata = $database->getReference($ref)->getValue();
        ?>



            <div class="card">
                <div class="card-body">
                    <div class="card card-primary">
                        <div class="card-header">
                            <h3 class="card-title">User Details</h3>
                        </div>
                        <!-- /.card-header -->
                        <div class="card-body">

                            <img src="<?php $expiresAt = new \DateTime('tomorrow');
                            echo $bucket->object('Users/'.$_GET['id'].'/'.'Profile')->signedUrl($expiresAt); ?>" alt="Aadhar 1" width="200" height="300">
                            <br>


                            <strong><i class="fas fa-book mr-1"></i> First Name</strong>

                            <p class="text-muted">
                             <?php echo $fetchdata['first'] ?> 
                            </p>

                            <hr>

                            <strong><i class="fas fa-map-marker-alt mr-1"></i> Last Name</strong>

                            <p class="text-muted"> <?php echo $fetchdata['last'] ?> </p>

                            <hr>

                            <strong><i class="fas fa-pencil-alt mr-1"></i> Date Of Birth</strong>

                            <p class="text-muted">
                            <?php echo $fetchdata['dob'] ?> 
                            </p>

                            <hr>

                            <strong><i class="fas fa-pencil-alt mr-1"></i> Phone Number</strong>

                            <p class="text-muted">
                            <?php echo $fetchdata['number'] ?> 
                            </p>

                            <hr>

                            <strong><i class="fas fa-pencil-alt mr-1"></i> Address</strong>

                            <p class="text-muted">
                            <?php echo $fetchdata['address'] ?> 
                            </p>

                            <hr>

                            <strong><i class="fas fa-pencil-alt mr-1"></i> Aadhar</strong>

                            <p class="text-muted">
                            <?php echo $fetchdata['aadhar'] ?> 
                            </p>
                            
                            <div class="row">

                            <div class="form-group mb-3">

                            <img src="<?php $expiresAt = new \DateTime('tomorrow');
                            echo $bucket->object('Users/'.$_GET['id'].'/'.'Aadhar1')->signedUrl($expiresAt); ?>" alt="Aadhar 1" width="200" height="200">
                            </div>


                            <div class="form-group mb-3">

                            <img src="<?php $expiresAt = new \DateTime('tomorrow');
                            echo $bucket->object('Users/'.$_GET['id'].'/'.'Aadhar2')->signedUrl($expiresAt); ?>" alt="Aadhar 1" width="200" height="200">
                            </div>

                            </div>


                            <hr>

                            <strong><i class="fas fa-pencil-alt mr-1"></i> Role</strong>

                            <p class="text-muted">
                            <?php if($fetchdata['roles'] == 1){
                                echo "Carpenter";
                            }  ?> 
                            </p>

                            <hr>

                            <strong><i class="far fa-file-alt mr-1"></i> Register On </strong>

                            <p class="text-muted"><?php echo(date('d/m/Y',$fetchdata['created_at']))?></p>

                            <hr>
                            <form action="code.php" method="POST" >

                            <strong><i class="far fa-file-alt mr-1"></i> Points </strong>
                            
                            <div class="form-group mt-3">
                                <input type="hidden" name="old_points" value="<?=$fetchdata['points']?>" placeholder="Points" class="form-control" required>
                            
                            </div>
                            
                             <div class="form-group mt-3">
                                <input type="text" name="point_name" value="" placeholder="Point Name" class="form-control" required>
                            
                            </div>

                            <div class="form-group mt-3">
                                <input type="number" name="points" value="<?=$fetchdata['points']?>" placeholder="Points" class="form-control" required>
                            
                            </div>
                            

                            <hr>
                            
                             

                            <strong><i class="far fa-file-alt mr-1"></i> Status </strong>

                           
                           

                            <input type="hidden" name="id" value="<?=$_GET['id']?>">


                            <div class="input-group mt-3 mb-3">
                                <select name="select_enable_disable" class="form-control" required>
                                    <option value="review"<?=$fetchdata['status'] == 0 ? ' selected="selected"' : '';?>>InReview
                                    </option>
                                    <option value="accepted"<?=$fetchdata['status'] == 1 ? ' selected="selected"' : '';?>>Accepted
                                    </option>
                                    <option value="reject"<?=$fetchdata['status'] == 2 ? ' selected="selected"' : '';?>>Rejected
                                    </option>
                                </select>
                            </div>


                            <strong><i class="far fa-file-alt mr-1"></i> Roles </strong>


                        <div class="input-group mt-3 mb-3">
                            <select name="roles" class="form-control" required>
                                <option value="1"<?=$fetchdata['roles'] == 1 ? ' selected="selected"' : '';?>>Carpenter
                                </option>
                                <option value="2"<?=$fetchdata['roles'] == 2 ? ' selected="selected"' : '';?>>DEMO
                                </option>
                            </select>
                        </div>

                            <button type="submit" name="user_status_update_btn" class="btn btn-info btn-sm float-sm-right">Submit</button>

                            </form>
                        </div>
                        <!-- /.card-body -->
                    </div>

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


    </section>



</div>


<?php
include('includes/script.php');
include('includes/footer.php');
?>