<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="<?=base_url("assets/css/guests.css")?>">
    <!-- Global css  -->
    <link rel="stylesheet" href="<?=base_url("assets/css/global.css")?>">
    <!----------- Font Awesome icons  ------>
    <link rel="stylesheet" href="<?=base_url("assets/css/all.min.css")?>">
        <!-- Google Font Roboto  -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
    <link href='https://fonts.googleapis.com/css?family=Cairo' rel='stylesheet'>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
    <title>Doha Forum 2023 - Guests</title>
</head>
<body>
    <div class="landing-page" >
        <!------------------------ sidebar ------------------->
        <?php echo $this->include('parts/side_menu.php'); ?>
        <!------------------------ sidebar ------------------->
            <div class="content">
                <header>
                        <img src="<?=base_url('logo.png')?>" style="width: 200px;" alt="">
                </header>
                <div class="container">
                    <div class="title">
                        <h2>Guests</h2>
                        <form method="post" >
                            <?php if($is_superadmin || $is_admin): ?>
                            <div class="add-guest"><a href="<?=base_url('add-guest')?>"><i class="fas fa-plus"></i>Add Guest</a></div>
                            <?php endif; ?>
                         
                            <input type="search" placeholder="Search" id="search_text">
                            <button type="submit"><img src="<?=base_url("assets/images/search.png")?>" alt="search"></button>
                        </form>
                        <div class="card-filter" id="showing-card">
                            
                            <div class="filter-title">
                               
                                <h2>Filter</h2>
                                 <i class="fas fa-times closePOP" onclick="closeFilter()"></i>
                            </div>
                            <form method="post" class="filter">
                                <input type=hidden name=search value=1 >
                                <div class="select-filter">
                                    
                                    
                                    <div class="event_category">
                                        <label for="event_category">Company</label>
                                        <select id="event_category" name ="event_category">
                                            <option value="">--- Select Country ---</option>
                                            <?php foreach($countries as $key => $value): ?>
                                            <option <?=((isset($data) && $data['event_category'] == $value)?(' selected '):(''))?> value="<?=$value?>"><?=$value?></option>
                                            <?php endforeach; ?>

                                        </select>
                                    </div>
                                    <div class="indication">
                                        <label for="category">Classification</label>
                                        <select name="category" id="category">
                                            <option value="">All</option>
                                            <?php foreach($category as $cat): ?>
                                            <option <?=(isset($data['category']) && $data['category'] == $cat)?(' selected '):('')?>  value="<?=$cat?>"><?=strtoupper($cat)?></option>
                                            <?php endforeach; ?>
                                        </select>
                                    </div>
                                    <div class="checked">
                                        <label for="checkedIn">Checked In</label>
                                        <select name="checkedIn" id="checkedIn">
                                            <option value="">All</option>
                                            <option value="1">Yes</option>
                                            <option value="0">No</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="show">
                                    <button type="submit" class="go-show">Show</button>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="users-section">
                        
                        
                      
                 
                        
                        
                        <?php
                        foreach($guests_list as $guest): 
                            
                            $profile_image = base_url('assets/images/profile.png');
                            if($guest['profile_image'])
                                $profile_image = base_url('assets/images/profiles/' . $guest['profile_image']);
                        ?>
                        <div class="users" style="    display: flex;
    flex-direction: column;
    margin-top: 27px;
    align-content: center;
    justify-content: space-between;
    align-items: center;">
                            <div class="user">
                                <h5><?=$guest['id']?></h5>
                                <h5><?=$guest['title'] . " " . $guest['name'] . " " . $guest['surname']?></h5>
                               
                         <!--       <h5><?=$guest['designation']?></h5>-->
                         <!--<h5><?=$guest['company']?></h5>-->
                         
                               
                                <h5><?=$guest['category']?></h5>
                                    <div class="edit">
                                        <?php if($is_superadmin || $is_admin): ?>
                                        <!--<a href="<?=base_url('session/checkin/qr/download/' . $guest['id'])?>">QR Code</a>-->
                                        <a href="<?=base_url('edit-guest/' . $guest['id'])?>">Edit</a>
                                        <?php endif; ?>
                                    </div>
                           </div>
                        </div>          
                        <?php
                        endforeach;
                        ?>
                    </div>
                </div>
            </div>
    </div>

<script> function closeFilter(){
        
        document.getElementById('showing-card').style.display = 'none';
    }
    </script>
    <script src="<?=base_url("assets/Js/main.js")?>"></script>
    <script>
    $(document).ready(function() {
        $("#search_text").on("keyup", function() {
            var value = $(this).val().toLowerCase();
            $(".users .user").filter(function() {
                $(this).parent().toggle($(this).text()
                .toLowerCase().indexOf(value) > -1)
            });
        });
    });
</script>
</body>
</html>