<?php
ob_start();
include('../include/db_conx.php');
isset($_SESSION['admin_login']);
if (!isset($_SESSION['admin_login'])) {
    header("location: auth-login.php");
    exit();
} else {
    include('../include/admin_head.php');


    // this is to check if the url is empty 

?>

    <!-- now we have to get the client full Information -->
    <?php

    include('../include/admin_action/info.php');


    // success of kyc update

    // checking if the kyc have be successfully updated

    $kyc_success = $_GET['kycStatus'];
    if ($kyc_success == 'true') {
        $msg = 'KYC Successfully Verified';
        $link = 'client_dashboard.php?userID=' . $user_id;
        swal_success($msg, $link);
    }



    // checking if kyc was successfully deleted 
    $kyc_delete = $_GET['DeleteKycStatus'];
    if ($kyc_delete == 'true') {
        $msg = ' Successfully Deleted';
        $link = 'client_dashboard.php?userID=' . $user_id;
        swal_success($msg, $link);
    }
    // checking if dp was successfully deleted 
    $DeleteDpStatus = $_GET['DeleteDpStatus'];
    if ($DeleteDpStatus == 'true') {
        $msg = 'Dp Removed Successfully';
        $link = 'client_dashboard.php?userID=' . $user_id;
        swal_success($msg, $link);
    }


    $block = $_GET['block'];
    if ($block == 'true') {
        $msg = 'Account Blocked ';
        $link = 'client_dashboard.php?userID=' . $user_id;
        swal_success($msg, $link);
    }

    $unblock = $_GET['unblock'];
    if ($unblock == 'true') {
        $msg = 'Account Unblocked ';
        $link = 'client_dashboard.php?userID=' . $user_id;
        swal_success($msg, $link);
    }

    $PackageStatus = $_GET['PackageStatus'];
    if ($PackageStatus == 'true') {
        $msg = 'Status Changed ';
        $link = 'client_dashboard.php?userID=' . $user_id;
        swal_success($msg, $link);
    }
    $ReduceStatus = $_GET['ReduceStatus'];
    if ($ReduceStatus == 'true') {
        $msg = 'Amount Reduced ';
        $link = 'client_dashboard.php?userID=' . $user_id;
        swal_success($msg, $link);
    }


    ?>



    <body>

        <!-- <body data-layout="horizontal"> -->

        <!-- Begin page -->
        <div id="layout-wrapper">

            <?php include('../include/admin_header.php'); ?>

            <!-- ========== Left Sidebar Start ========== -->

            <!-- Left Sidebar End -->
            <?php include('../include/admin_sidebar.php'); ?>



            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->
            <div class="main-content">

                <div class="page-content">
                    <div class="container-fluid">

                        <!-- start page title -->
                        <div class="row">
                            <div class="col-12">
                                <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                                    <h4 class="mb-sm-0 font-size-18">Registered Visa </h4>

                                    <div class="page-title-right">
                                        <ol class="breadcrumb m-0">
                                            <li class="breadcrumb-item"><a href="javascript: void(0);">Visa</a></li>
                                            <li class="breadcrumb-item active">Clients Visa Info</li>
                                        </ol>
                                    </div>

                                </div>
                            </div>
                        </div>
                        <!-- end page title -->

                        <div class="row">
                            <div class="col-xl-9 col-lg-8">
                                <div class="card">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-sm order-2 order-sm-1">
                                                <div class="d-flex align-items-start mt-3 mt-sm-0">
                                                    <div class="flex-shrink-0">
                                                        <div class="avatar-xl me-3">
                                                            <?php

                                                            if (empty($passport_photo)) {

                                                            ?>
                                                                <img src="p3.jpg" alt="" class="img-fluid rounded-circle d-block">
                                                            <?php  } else {
                                                            ?>

                                                                <img src="<?php echo 'photo/' . $passport_photo ?>" alt="" class="img-fluid rounded-circle d-block">

                                                            <?php

                                                            } ?>

                                                        </div>
                                                    </div>
                                                    <div class="flex-grow-1">
                                                        <div>
                                                            <h5 class="font-size-16 mb-1"><?php echo $tracking_code  ?> </h5>
                                                            <p class="text-muted font-size-13"> Tracking Code</p>


                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-sm-auto order-1 order-sm-2">
                                                <div class="d-flex align-items-start justify-content-end gap-2">
                                                    <a href='DeleteUser.php?userID=<?php echo $user_id ?>'>
                                                        <button type="button" class="btn btn-danger"><i class="me-1"></i> <i class="fas fa-trash-alt"></i> Delete</button>
                                                    </a>

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


                                    </div>
                                    <!-- end card body -->
                                </div>
                                <!-- end card -->

                                <div class="tab-content">



                                </div>
                                <!-- end tab pane -->

                                <div class="tab-pane" id="about" role="tabpanel">
                                    <div class="card">
                                        <div class="card-header">
                                            <h5 class="card-title mb-0">Full Details</h5>
                                        </div>
                                        <div class="card-body">
                                            <div>
                                                <div class="pb-3">
                                                    <h5 class="font-size-15">Registered on the:</h5>
                                                    <div class="text-muted">
                                                        <p class="mb-2"><?php echo $date_created ?></p>
                                                    </div>
                                                </div>

                                                <div class="pt-3">
                                                    <h5 class="font-size-15">Application :</h5>
                                                    <div class="text-muted">

                                                        <ul class="list-unstyled mb-0">

                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i>Final Decision Date : <?php echo $final_decision_date ?></li>

                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Final Decision Note : <?php echo $final_decision_note ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Principal Applicant : <?php echo $principal_applicant ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> UCI : <?php echo $uci ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Application Number  : <?php echo $application_number ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Date Received : <?php echo $date_received ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Biometrics Number : <?php echo $biometrics_number ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Date Biometrics Enrolment : <?php echo $date_biometrics_enrolment ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Expiry Date : <?php echo $expiry_date ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Details Status : <?php echo $details_status ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Review of Eligibility : <?php echo $review_of_eligibility ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Review of Medical : <?php echo $review_of_medical ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Review of additional Document : <?php echo $review_of_additoinal_doc ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Interview : <?php echo $interview ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Biometrics : <?php echo $biometrics ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Background Check : <?php echo $background_check ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Final Decision : <?php echo $final_decision ?></li>
                                                            <li class="py-1"><i class="mdi mdi-circle-medium me-1 text-success align-middle"></i> Date Created : <?php echo $date_created ?></li>

                                                        </ul>

                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                        <!-- end card body -->
                                    </div>
                                    <!-- end card -->
                                </div>
                                <!-- end tab pane -->

                                <div class="tab-pane" id="post" role="tabpanel">
                                    <div class="card">
                                        <div class="card-header">
                                            <h5 class="card-title mb-0">Other Details</h5>
                                        </div>

                                        <!-- end card body -->
                                 






                                    </div>
                                    <!-- end card -->
                                </div>
                                <!-- end tab pane -->
                            </div>
                            <!-- end tab content -->
                        </div>
                        <!-- end col -->

                        <div class="col-xl-3 col-lg-4">

                            <!-- end card -->

                            <div class="card">
                                <div class="card-body">
                                    <!-- MY REDUCE BUTTON WILL GO HERE -->
                                    <a href='edit_info.php?userID=<?php echo $user_id ?>'>
                                        <button type="button" class="btn btn-success waves-effect waves-light btn-sm">
                                            <i class="bx bx-check-double font-size-16 align-middle me-2"></i> Click to Edit Information
                                        </button>

                                    </a>

                                </div>
                                <!-- end card body -->
                            </div>
                            <!-- end card -->

                            <!-- end card -->
                        </div>
                        <!-- end col -->
                    </div>



                </div> <!-- container-fluid -->
            </div>
            <!-- End Page-content -->


            <?php include('../include/admin_footer.php'); ?>
        </div>
        <!-- end main content-->

        </div>
        <!-- END layout-wrapper -->

        <!-- this modal is the one for upgrading and selecting package for client  -->

        <div class="modal fade bs-example-modal-center" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Change Status </h5>

                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <form Method='POST'>
                            <div class="form-group">
                                <label for="exampleFormControlSelect1">Select New Package</label>
                                <select class="form-control" id="exampleFormControlSelect1" name='new_package'>
                                    <option value="Active">Active</option>
                                    <option value="Hold"> On Hold</option>
                                    <option value="Complete"> Complete</option>
                                </select>
                            </div>

                            <div class="form-group mt-2">
                                <button type="submit" name='plan_submit' class="btn btn-dark waves-effect waves-light">
                                    <i class="bx bx-loader bx-spin font-size-16 align-middle me-2"></i> Update Status
                                </button>
                            </div>


                        </form>

                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

        <!-- this modal is a delete modal  -->

        <div class="modal2 fade bs-example-modal-center" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Are You sure you want to delete this account ? </h5>

                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                    </div>
                    <div class="modal-body">
                        <form Method='POST'>
                            <div class="form-group">
                                <input type="text" class="form-control" value='<?php echo $user_id ?>'>

                            </div>

                            <div class="form-group mt-2">
                                <button type="submit" name='plan_submit' class="btn btn-danger waves-effect waves-light">
                                    <i class="bx bx-loader bx-spin font-size-16 align-middle me-2"></i> click here to delete
                                </button>
                            </div>


                        </form>

                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

        <?php
        if (isset($_POST['plan_submit'])) {
            $new_package = $db_conx->real_escape_string($_POST['new_package']);
            $sql_p = "UPDATE clients SET status = '$new_package' WHERE id = '$user_id'";
            $result_p = $db_conx->query($sql_p);
            if ($result_p) {
                header('location:client_dashboard.php?PackageStatus=true&userID=' . $user_id);
            } else {
                echo 'An error has occurred please contact admin';
            }
        }
        ?>




        <!-- Right bar overlay-->
        <div class="rightbar-overlay"></div>

        <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
        <script src="assets/libs/metismenu/metisMenu.min.js"></script>
        <script src="assets/libs/simplebar/simplebar.min.js"></script>
        <script src="assets/libs/node-waves/waves.min.js"></script>
        <script src="assets/libs/feather-icons/feather.min.js"></script>
        <!-- pace js -->
        <script src="assets/libs/pace-js/pace.min.js"></script>

        <!-- flatpickr js -->
        <script src="assets/libs/flatpickr/flatpickr.min.js"></script>

        <!-- Required datatable js -->
        <script src="assets/libs/datatables.net/js/jquery.dataTables.min.js"></script>
        <script src="assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>

        <!-- Responsive examples -->
        <script src="assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
        <script src="assets/libs/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>

        <!-- init js -->
        <script src="assets/js/pages/invoices-list.init.js"></script>

        <script src="assets/js/app.js"></script>
    </body>

    </html>

<?php  }
ob_end_flush(); ?>