@extends('layouts.home')

@section('page-title', trans('app.welcome'))

@section('content')
  <section class="blog-two">
    <div class="container">
      <div class="block-title text-center">
          <div class="block-title__decor"></div><!-- /.block-title__decor -->
          <!-- <p>From the Blog</p> -->
          <h3>Noticias</h3>
      </div><!-- /.block-title -->
      <div class="thm-tiny__slider" id="blog-two__carousel" data-tiny-options='{
      "container": "#blog-two__carousel",
      "items": 1,
      "slideBy": "page",
      "gutter": 0,
      "mouseDrag": true,
      "autoplay": true,
      "nav": false,
      "controlsPosition": "bottom",
      "controlsText": ["<i class=\"fa fa-angle-left\"></i>", "<i class=\"fa fa-angle-right\"></i>"],
      "autoplayButtonOutput": false,
      "responsive": {
          "640": {
            "items": 2,
            "gutter": 30
          },
          "992": {
            "gutter": 30,
            "items": 3
          },
          "1200": {
            "disable": true
          }
        }
  }'>

    @if ($contentAll)
    @foreach ($contentAll as $content)
      <div>
          <div class="blog-card">
              <div class="blog-card__image">
                  <div class="blog-card__date">{{ date('d M', strtotime($content->publish_up)) }}</div><!-- /.blog-card__date -->
                  <img src="{{asset('assets/img/optimized/image-'.$content->images)}}" alt="{{$content->title}}">
                  <a href="{{url($content->category.'/blog/'.$content->slug)}}"></a>
              </div>
              <div class="blog-card__content">
                  <div class="blog-card__meta">
                    <a href="#"><i class="far fa-user-circle"></i>
                      @if ($content->created_by_alias) {{$content->created_by_alias}} @else {{$content->author}} @endif  
                    </a>
                  </div>
                  <h3>
                    <a href="{{url($content->category.'/blog/'.$content->slug)}}">
                      <!-- {{$content->title}} -->
                      {{ str_limit($content->title, $limit = 50, $end = '...') }}
                    </a>
                  </h3>
              </div>
          </div>
      </div>
    @endforeach
    @endif

          </div>
      </div>
  </section>

@stop
@section('last')
    <div class="row">
        <div class="col-xs-12 col-md-6 contentLast"><h2></h2>
            <div class="row">
              <div class="col s12 m6">
                <div class="card">
                  @if($news)
                  <div class="card-image">
                    @if($news->images=='')                      
                      <img src="https://dummyimage.com/600x250/000/c8f7ea&text=Sin-Imagen" />
                    @else
                      <img  class="materialboxed" data-caption="{{$news->title}}" src="{{asset('assets/img/optimized/image-'.$news->images)}}">
                    @endif  
                    <span class="card-title titlePrimary">
                      {{$news->title}}
                      {{ str_limit($news->title, $limit = 50, $end = '...') }}
                    </span>
                    <a class="btn-floating halfway-fab waves-effect waves-light orangeTI pulse z-depth-4" onclick="location.href='{{url('noticias/blog/'.$news->slug)}}'"><i class="fa fa-eye"></i></a>
                  </div>
                  <div class="card-content">
                    <blockquote>
                        <div class="text-right timeDescription">
                            @php
                               echo "<span class='new badge'>".\Carbon\Carbon::now()->subMinutes( \Carbon\Carbon::now()->diffInMinutes( \Carbon\Carbon::parse($news->publish_up)))->diffForHumans()."</span> <i class='fa fa-calendar' aria-hidden='true'></i> ".date('d M Y',strtotime($news->publish_up));
                            @endphp
                        </div>
                        <p class="text-justify descriptionText">{{{ substr(strip_tags($news->description),0,300) }}}...
                        <span class="new badge badgeButtom">  <a class="titleHref" href="{{url('noticias/blog/'.$news->slug)}}">Leer más...</a></span>
                        </p>
                        <p class="text-right">
                            <i class="fa fa-user"></i> <small>Escrito por:</small> @if ($news->created_by_alias) {{$news->created_by_alias}} @else {{$news->author}} @endif
                        </p>
                    </blockquote>
                  </div>
                  @endif
                </div>
              </div>
            </div>
        </div>
        <div class="col-xs-12 col-md-6 contentLast"><h2>Cultura</h2>
            <div class="row">
              <div class="col s12 m6">
                <div class="card">
                  @if($activities)
                  <div class="card-image">
                    @if($activities->images=='')                      
                      <img src="https://dummyimage.com/600x250/000/c8f7ea&text=Sin-Imagen" />
                    @else
                      <img  class="materialboxed" data-caption="{{$activities->title}}" src="{{asset('assets/img/optimized/image-'.$activities->images)}}">
                    @endif 
                    <span class="card-title titlePrimary">{{$activities->title}}</span>
                    <a class="btn-floating halfway-fab waves-effect waves-light orangeTI pulse z-depth-4" onclick="location.href='{{url('actividades/blog/'.$activities->slug)}}'"><i class="fa fa-eye"></i> </a>
                  </div>
                  <div class="card-content">
                    <blockquote>
                        <div class="text-right timeDescription">
                            @php
                               echo "<span class='new badge'>".\Carbon\Carbon::now()->subMinutes( \Carbon\Carbon::now()->diffInMinutes( \Carbon\Carbon::parse($activities->publish_up)))->diffForHumans()."</span> <i class='fa fa-calendar' aria-hidden='true'></i> ".date('d M Y',strtotime($activities->publish_up));
                            @endphp
                        </div>
                        <p class="text-justify descriptionText">{{{ substr(strip_tags($activities->description),0,300) }}}...
                        <span class="new badge badgeButtom">  <a class="titleHref" href="{{url('actividades/blog/'.$activities->slug)}}">Leer más...</a></span>
                        </p>
                        <p class="text-right">
                            <i class="fa fa-user"></i> <small>Escrito por:</small> @if ($activities->created_by_alias) {{$activities->created_by_alias}} @else {{$activities->author}} @endif
                        </p>
                    </blockquote>
                  </div>
                  @endif
                </div>
              </div>
            </div>
        </div>
    </div>
@endsection


@section('scripts')
    <script type="text/javascript">

        $(document).ready(function(){
            console.log('parallaxLoad');
          $('.parallax').parallax();
        });
        $(document).ready(function(){
          $('.slider').slider();
        });


    </script>
@stop
