<?php require PATH . '/theme/view/common/head.php'; ?>
<?php require PATH . '/theme/view/common/header.php'; ?>
<div class="layout-section">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-auto">
                <div class="d-grid mb-3 d-block d-md-none">
                    <form method="post" class="" name="filter">
                        <input type="hidden" name="_TOKEN" value="<?php echo $Token;?>">
                        <input type="hidden" name="_ACTION" value="filter">
                        <select name="category" class="form-select bg-gray-200 category-input border-0">
                            <option value="">
                                <?php echo $this->translate('Categories');?>
                            </option>
                            <?php foreach($Categories as $Category) { ?>
                            <option value="<?php echo $Category['self'];?>" <?php if(isset($Selected['id']) AND $Selected['id'] == $Category['id']) echo 'selected=""';?>>
                                <?php echo $Category['name'];?>
                            </option>
                            <?php } ?>
                        </select>
                    </form>
                </div>
                <div class="w-lg-200 d-none d-lg-block">
                    <ul class="nav flex-column nav-category">
                        <?php foreach($Categories as $Category) { ?>
                        <li class="nav-item">
                            <a class="nav-link" href="<?php echo category($Category['id'],$Category['self']);?>">
                                <span class="nav-icon" style="background-color: <?php echo $Category['color'];?>">
                                    <?php if(isset($Category['icon'])) { ?>
                                    <img src="<?php echo UPLOAD.'/icon/'.$Category['icon'];?>" width="24" height="24" alt="<?php echo $Category['name'];?>">
                                    <?php } ?>
                                </span>
                                <span class="nav-text">
                                    <?php echo $Category['name'];?></span>
                            </a>
                        </li>
                        <?php } ?>
                    </ul>
                </div>
            </div>
            <div class="col-lg">
                <div class="layout-heading mb-4">
                    <h1 class="h2">
                        <?php echo $Config['heading'];?>
                    </h1>
                    <div class="fs-sm text-muted">
                        <?php echo $TotalRecord.' '.$this->translate('games in total');?>
                    </div>
                </div>
                <div class="card-masonry mb-4">
                    <?php
                    $i = 1;
                    foreach ($Listings as $Listing) {
                    ?>
                    <a href="<?php echo play($Listing['id'],$Listing['self']);?>" class="card <?php if($i == 1 || $i == 12 || $i == 24 || $i == 34) echo 'large';?>">
                        <?php echo picture(GAME_FOLDER,($i == 1 || $i == 12 || $i == 24 || $i == 34 ? $Listing['image'] : 'thumb-'.$Listing['image']),'img-fluid',$Listing['title'],GAME_X.','.GAME_Y);?>
                        <div class="card-body">
                            <h3>
                                <?php echo $Listing['title'];?>
                            </h3>
                        </div>
                    </a>
                    <?php $i++; } ?>
                </div>
                <div class="text-center">
                    <?php echo $Pagination;?>
                </div>
                <?php echo ads($Ads,2,'mx-lg-auto py-4 mb-3');?>
            </div>
        </div>
    </div>
</div>
<?php if(isset($Selected['description'])) { ?>
<div class="layout-section layout-text">
    <div class="container-fluid">
        <?php echo htmlspecialchars_decode($Selected['description']);?>
    </div>
</div>
<?php } ?>
<?php require PATH . '/theme/view/common/javascript.php'; ?>
<?php require PATH . '/theme/view/common/footer.php'; ?>