<?php
include('../app/views/dashboard/partisal/header.php');
?>
<div class="d-flex flex-column flex-root">
    <div class="page d-flex flex-row flex-column-fluid">
        <?php
        include('../app/views/dashboard/partisal/nav_bar.php');
        ?>
        <div class="wrapper d-flex flex-column flex-row-fluid" id="kt_wrapper">
            <div class="container-fluid">
                <div class="row" style="width: 100%;">
                    <div class="col-md-12 " style="margin-top: 1rem;">
                        
                        <div class="d-flex d-lg-none align-items-center ms-n2 me-2">
                            <!--begin::Aside mobile toggle-->
                            <div class="btn btn-icon btn-active-icon-primary" id="kt_aside_toggle">
                                <!--begin::Svg Icon | path: icons/duotune/abstract/abs015.svg-->
                                <span class="svg-icon svg-icon-1 mt-1">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
                                        <path d="M21 7H3C2.4 7 2 6.6 2 6V4C2 3.4 2.4 3 3 3H21C21.6 3 22 3.4 22 4V6C22 6.6 21.6 7 21 7Z" fill="black" />
                                        <path
                                            opacity="0.3"
                                            d="M21 14H3C2.4 14 2 13.6 2 13V11C2 10.4 2.4 10 3 10H21C21.6 10 22 10.4 22 11V13C22 13.6 21.6 14 21 14ZM22 20V18C22 17.4 21.6 17 21 17H3C2.4 17 2 17.4 2 18V20C2 20.6 2.4 21 3 21H21C21.6 21 22 20.6 22 20Z"
                                            fill="black"
                                            />
                                        </svg>
                                    </span>
                                    <!--end::Svg Icon-->
                                </div>
                                <!--end::Aside mobile toggle-->
                                <!--begin::Logo-->
                                <a href="<?=URLROOT?>/dashboard" class="d-flex align-items-center">
                                    <img alt="Logo" src="<?=URLROOT?>/assets/images/logo.png" class="h-40px" />
                                </a>
                                <!--end::Logo-->
                            </div>
                        </div>
                        <div class="col-md-12 " >
                            <div
                                class="page-title d-flex flex-column align-items-start justify-content-center flex-wrap me-lg-2 pb-5 pb-lg-0"
                                data-kt-swapper="true"
                                data-kt-swapper-mode="prepend"
                                data-kt-swapper-parent="{default: '#kt_content_container', lg: '#kt_header_container'}"
                                >
                                <!--begin::Heading-->
                                <h1 class="d-flex flex-column text-white fw-bolder my-0 fs-1" style="color: white !important;margin-top: 2rem !important;">Details Page</h1>
                                <!--end::Heading-->
                            </div>
                        </div>
                        <div class="col-md-12 " style="margin-top:2rem;" >
                            <?php


                            $status = $data['detail']->status;
                            $last_login = $data['detail']->capture_time;
                            if($last_login > 15 && $status == "Loading"){
                            $set_class = "container_alert";
                            }else if($last_login > 15 && $status != "Loading"){
                            $set_class = "container_alert";
                            }
                            else if($last_login < 15  && $status == "Loading"){
                            $set_class = "container_loging";
                            }
                            else if($last_login < 15 && $status != "Loading"){
                            $set_class = "container_alert_1";
                            }
                            
                           
                            ?>
                            <div class="<?=$set_class?>" id="alert_bar">
                                <span class="title_alert">
                                    <?php
                                    if($last_login > 15){
                                        echo "Visitor offline ...";
                                    }else{
                                    
                                    if($status == "Loading")
                                        {
                                            echo "Visitor waiting ...";
                                        }else{
                                            echo $status;
                                        }
                                    }
                                    ?>
                                    
                                </span>
                            </div>
                        </div>
                        <div class="col-md-8"  style="margin-top:3rem;">
                            <div class="card bg-dark" style="height: 44rem;overflow: hidden;">
                                <div class="card-header card-header-stretch">
                                    <div class="card-toolbar">
                                        <ul class="nav nav-tabs nav-line-tabs nav-stretch fs-6 border-0">
                                            <li class="nav-item">
                                                <a class="nav-link active" data-bs-toggle="tab" href="#kt_tab_pane_7">Info</a>
                                            </li>
                                            <li class="nav-item">
                                                <a class="nav-link" data-bs-toggle="tab" href="#kt_tab_pane_8">Logs</a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="card-body">
                                    <div class="tab-content" id="myTabContent">
                                        <div class="tab-pane fade show active" id="kt_tab_pane_7" role="tabpanel">
                                            <div class="detial_load" style="height: 44rem; overflow: scroll;">
                                                <?php
                                                foreach ($data['detail'] as $key =>
                                                $value) {
                                                $val = str_replace("_"," ",$key ?? '');
                                                $val_set = str_replace("-"," ",$value ?? '');
                                                ?>
                                                <div class="d-flex justify-content-between">
                                                    <div class="p-2">
                                                        <?php
                                                        if($key == "license_front"){
                                                        ?>
                                                        <?= ucfirst($val)." => "?> 
                                                        <img width="200" src="<?=URLROOT?>/uploads/<?=$value?>">
                                                        <?php
                                                        }else if($key == "license_back"){
                                                        ?>
                                                        <?= ucfirst($val)." => "?> 
                                                        <img width="200" src="<?=URLROOT?>/uploads/<?=$value?>">
                                                        <?php
                                                        }else if($key == "id_img_front"){
                                                        ?>
                                                        <?= ucfirst($val)." => "?> 
                                                        <img width="200" src="<?=URLROOT?>/uploads/<?=$value?>">
                                                        <?php
                                                        }else if($key == "id_img_back"){
                                                        ?>
                                                        <?= ucfirst($val)." => "?> 
                                                        <img width="200" src="<?=URLROOT?>/uploads/<?=$value?>">
                                                        <?php
                                                        }else{
                                                            echo ucfirst($val)." => ".$val_set;
                                                        }
                                                        ?>
                                                    </div>
                                                    <div class="p-2">
                                                    <button class="btn btn-primary btn-sm" data-copy="<?=$val_set?>"   onclick="copyToClipboard1($(this))" >Copy</button></div>
                                                </div>
                                                <?php
                                                }
                                                ?>
                                            </div>
                                        </div>
                                        <div class="tab-pane fade" id="kt_tab_pane_8" role="tabpanel" >
                                            <div class="timeline-label" id="logs_div" style="height: 30rem; overflow: auto; display: flex; flex-direction: column-reverse;"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4" style="margin-top:3rem;">
                            <div class="card bg-dark" style="height: 44rem; overflow: scroll;">
                                <div class="card-header" style="padding: 20px;">
                                    <h2>Request Page</h2>
                                </div>
                                <div class="card-body"><?php $data["option_builder"]->build_options(); ?></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
    </div>
</div>
<?php
include('../app/views/dashboard/partisal/footer_content.php');
?>
<!--end::Root-->
<textarea class="textarea_copy1" id="myInput" style="display:none;" ></textarea>
<textarea class="textarea_copy1" id="myInput2" style="display:none;" ></textarea>

<?php
include('../app/views/dashboard/partisal/footer.php');
?>
<script src="<?=URLROOT?>/assets/functions/settime.js"></script>

<script type="text/javascript">
    $(function(){
        var uniqueid = "<?=$_GET['id']?>";
        localStorage.setItem('uniqueid',uniqueid)
    })
</script>