<?php

use yii\helpers\Html;
use yii\helpers\Url;

$lang = Yii::$app->language;
$this->title = 'QFood';
?>

<?= $this->render('_top', $info) ?>

<div class="main-category">
    <?php if($info['categories']) : ?>
        <?php foreach ($info['categories'] as $index => $category) : ?>
        <a href="<?= $category->subCategories ? 'sub-categories?cate_id='.$category->id:'items?cate_id='.$category->id ?>">
            <div class="col-sm-5 col-sm-offset-<?= ($index % 2 == 0 ? '1' : '0') ?> col-xs-10 col-xs-offset-1">
                <div class="category">
                    <img class="img-category img-responsive"
                        <?php if ($category->image_path != null) : ?>
                            src="<?= Url::base()?>/<?= $category->image_path ?>"
                        <?php else : ?>
                            src="<?= Url::base()?>/home-icon/blank-logo.jpg"
                        <?php endif; ?>
                    >
                    <!-- <div class="overlay"></div> -->
                    <?php if($category->subCategories) : ?>
                        <a href="<?= 'sub-categories?cate_id='.$category->id ?>" class="centered title-category"><?= $lang == 'ar' ? $category->arabic_name : $category->english_name ?></a>
                    <?php else : ?>
                        <a href="<?= 'items?cate_id='.$category->id ?>" class="centered title-category"><?= $lang == 'ar' ? $category->arabic_name : $category->english_name ?></a>
                    <?php endif; ?>
                </div>
            </div>
            </a>
        <?php endforeach; ?>
    <?php else : ?>
    <div class="row">
        <div class="col-sm-12 title-bold">
            <div class="centered center-category">
                <?= Yii::t('app', 'There are no categories yet!') ?>
            </div>
        </div>
    </div>
<?php endif;?>
</div>