<?php
use yii\helpers\Html;
use yii\helpers\Url;
use backend\models\State;
?>
<section class="section bg-color-dark-scale-1  section-height-1 border-0 m-0 mb-5">
    <div class="container  py-3">
    <div class="heading heading-border heading-middle-border text-center "> 
            <h2 class="font-weight-bold"> Next Destination Across Incredible India </h2>
          </div>
      <div class="row">    
         <div class="owl-carousel owl-theme stage-margin owl-loaded owl-drag owl-carousel-init" data-plugin-options="{'items': 5, 'autoplay': true, 'autoplayTimeout': 4000, 'margin': 10, 'loop': true, 'nav': true, 'dots': false, 'stagePadding': 40}" style="height: auto;margin-bottom: 0px;">
			<div class="owl-stage-outer"><div class="owl-stage" style="transform: translate3d(0px, 0px, 0px); transition: all 0.25s ease 0s; width: 1814px; padding-left: 40px; padding-right: 40px;">
			<?php
            $modelstate = State::find()->where(['status' => 1])->orderBy(['id' => SORT_ASC])->all();
			foreach($modelstate as $modelstateall) {?>
			<div class="owl-item active" style="width: 163.333px; margin-right: 10px;">
			  <div>
				<?php
				if($modelstateall->image != '') {?>
				   <?= Html::a("<img src='".Yii::$app->urlManagerBackend->baseUrl.'/images/state/'.$modelstateall->image."' alt='".$modelstateall->state_name."' class='img-fluid rounded mb-2'>",['/state/view/', 'slug' => $modelstateall->slug])  ?>
				<?php } else { ?>
				  <?= Html::a("<img src='".Yii::$app->urlManagerFrontend->baseUrl.'/images/photo-not-availabe.jpg'."' alt='".$modelstateall->state_name."' class='img-fluid rounded mb-2'>",['/state/view/', 'slug' => $modelstateall->slug])  ?>
				<?php } ?>
					<span>
					   <?php 
						  echo Html::button($modelstateall->state_name, [
								'class' => 'btn btn-rounded full-width btn-gradient mb-2 font-weight-bold',
								'style' => 'width:100%',
								'onclick' => "window.location.href='" . \yii\helpers\Url::to(['/state/view', 'slug' => $modelstateall->slug]) . "'"
							]);

						?>
					</span>
				</div>
			 </div>
			<?php } ?></div></div>
		</div>         
      </div>
      <div class="row">
        <div class="col text-center"><?=Html::a('VIEW ALL STATES IN INDIA', ['/state/index'], ['class' => 'btn btn-primary font-weight-semibold text-3 px-5 btn-py-2'])?></div>
      </div>
    </div>
  </section>