<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\Breadcrumbs;

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

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


<div class="main-category">
<?php

    $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Main Menu'), 'url' => 'categories'];
    $this->title = $lang == 'en' ? $info['category']->english_name : $info['category']->arabic_name;
    $this->params['breadcrumbs'][] = $this->title;
?>
<?= Breadcrumbs::widget([
                'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
                'homeLink' => false,
            ]) ?>

<?php foreach ($info['subs'] as $index => $sub) : ?>
    <a href="<?= 'items?cate_id=' . $sub->main_category_id . '&' . 'sub_id=' . $sub->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 ($sub->image_path != null) : ?>
                        src="<?= Url::base()?>/<?= $sub->image_path ?>"
                    <?php else : ?>
                        src="<?= Url::base()?>/home-icon/blank-logo.jpg"
                    <?php endif; ?>
                >
                <!-- <div class="overlay"></div> -->
                <a href="<?= 'items?cate_id=' . $sub->main_category_id . '&' . 'sub_id=' . $sub->id ?>" class="centered title-category"><?= $lang == 'ar' ? $sub->arabic_name : $sub->english_name ?></a>
            </div>
        </div>
    </a>
    <?php endforeach; ?>
</div>