<?php

/* @var $this yii\web\View
 * @var \common\models\slider\Slide[] $slides;
 * @var \common\models\blog\Article[]   $articles
 */
    
    use artbox\core\helpers\ImageHelper;
    use artbox\core\helpers\Url;
    use frontend\widgets\ParthnersList;
    
    $this->title = 'My Yii Application';
?>

<?php if (!empty($slides)){?>
<section style="margin-bottom: 0" class="">
  <!-- *** HOMEPAGE CAROUSEL ***
_________________________________________________________ -->
  
  <div class="home-carousel">

    <div class="dark-mask"></div>
    
    <div class="container">
      <div class="homepage owl-carousel" >
       
        <?php foreach ($slides as $key => $slide){?>
        
        <div class="item" data-bg="<?=($slide->background !== null) ? $slide->background->getUrl() : ''?>">
          <div class="row">
            <div class="col-sm-5 ">
              <h1><?=$slide->title?></h1>
                <p><?=$slide->description?></p>
                <p style="margin-top:25px;"> </p>
              <p class="text-right">
                <a href="<?= $slide->link ?>" class="btn btn-template-transparent-primary "><?= \Yii::t(
                      'app',
                      'More'
                  ) ?></a></p>
              </div>
            <?php if ($slide->language->image !== null){?>
              <div class="col-sm-7">
              <a href="<?=$slide->link?>"><?=ImageHelper::set($slide->language->image->getPath())
                                                        ->cropResize(650, 380)
                                                        ->quality(84)
                                                        ->renderImage([
                                                           'class' => 'img-responsive'
                                                        ])?></a>
            </div>
            <?php }?>
          </div>
        </div>
        
        <?php }?>
        </div>
      <!-- /.project owl-slider -->
    </div>
  </div>
  
  <!-- *** HOMEPAGE CAROUSEL END *** -->
</section>
<?php }?>
<?php if (!empty($articles)){?>
    <section class="bar background-white no-mb">
        <div class="container">

            <div class="col-md-12">
                <div class="heading text-center">
                    <h2><?=\Yii::t('app', 'News')?></h2>
                </div>


                <!-- *** BLOG HOMEPAGE ***
		  _________________________________________________________ -->

                <div class="row articles-flex">
					<?php foreach ($articles as $article){?>
                        <div class="col-md-3 col-sm-6">
                            <div class="box-image-text blog">
                                <div class="top">
                                    <div class="image">
										<?=ImageHelper::set($article->image->getPath())
											->cropResize(255, 191)
											->quality(84)
											->renderImage(
												[
													'alt' => $article->image->lang ? ( $article->image->lang->title || $article->title ) : $article->title,
												]
											)?>
                                    </div>
                                    <div class="bg"></div>
                                    <div class="text">
                                        <p class="buttons">
                                            <a href="<?=Url::to(['alias' => $article->alias])?>" class="btn btn-template-transparent-primary"><i class="fa fa-link"></i><?=\Yii::t('app', 'Читать далее')?></a>
                                        </p>
                                    </div>
                                </div>
                                <div class="content">
                                    <h4><a href="<?=Url::to(['alias' => $article->alias])?>"><?=$article->title?></a></h4>
                                    <p class="intro"><?=$article->body_preview?></p>
                                    <p class="read-more"><a href="<?=Url::to([ 'alias' => $article->alias])?>" class="btn btn-template-main"><?=\Yii::t('app', 'Читать далее')?></a>
                                    </p>
                                </div>
                            </div>
                            <!-- /.box-image-text -->

                        </div>
					<?php }?>
                </div>
                <!-- /.row -->

                <!-- *** BLOG HOMEPAGE END *** -->

            </div>

        </div>
        <!-- /.container -->
    </section>

<?php }?>
<!-- /.bar -->

<section class="bar background-white no-mb">
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <div class="heading text-center">
          <h2><?=\Yii::t('app','Our parthners');?></h2>
        </div>

	      <?=ParthnersList::widget(); ?>
        <!-- /.owl-carousel -->
      </div>
    
    </div>
  </div>
</section>

