@extends('layouts.frontend')

@section('content')

<div class="container" style="min-height: 450px;margin-top:30px;">
    <div class="row archivio-news">

        <div class="title-section col-sm-12">
            <h1 style="width: 90%"><span>Archivio news - {{$section->name}}</span></h1>                
        </div>
    
        @foreach($news as $n)

            <div class="col-sm-3">
                <div class="news-post image-post">
                    <a href="/{{$n->slug}}"><img src="/files/news/{{$n->image}}" alt="" class="img-responsive"></a>

                            @if(isset($n->section))

                                @if($n->section != $section->name)
                                    <div class="inner-hover" style="margin-top:0px;position:initial;">
                                        <a class="category-post" style="position:absolute;left:0px;top:0px;height:23px;" href="/{{$n->section->slug}}">{{$n->section->name}}</a>
                                    </div>
                                @else

                                    @if(isset($n->region_1))

                                        @if($n->region_1 != $section->name)

                                            <div class="inner-hover" style="margin-top:0px;position:initial;">
                                                <a class="category-post" style="position:absolute;left:0px;top:0px;height:23px;" href="/{{$n->region_1->slug}}">{{$n->region_1->name}}</a>
                                            </div>
                                        
                                        @else

                                            @if(isset($n->region_2))
                                                @if($n->region_2 != $section->name)

                                                    <div class="inner-hover" style="margin-top:0px;position:initial;">
                                                        <a class="category-post" style="position:absolute;left:0px;top:0px;height:23px;" href="/{{$n->region_2->slug}}">{{$n->region_2->name}}</a>
                                                    </div>
                                                
                                                @else

                                                @endif
                                            @endif

                                        @endif
                                    
                                    @else

                                        @if(isset($n->region_2))
                                            @if($n->region_2 != $section->name)

                                                <div class="inner-hover" style="margin-top:0px;position:initial;">
                                                    <a class="category-post" style="position:absolute;left:0px;top:0px;height:23px;" href="/{{$n->region_2->slug}}">{{$n->region_2->name}}</a>
                                                </div>
                                            
                                            @else

                                            @endif
                                        @endif

                                    @endif

                                @endif

                            @else

                                @if(isset($n->region_1))

                                    @if($n->region_1 != $section->name)

                                        <div class="inner-hover" style="margin-top:0px;position:initial;">
                                            <a class="category-post" style="position:absolute;left:0px;top:0px;height:23px;" href="/{{$n->region_1->slug}}">{{$n->region_1->name}}</a>
                                        </div>
                                    
                                    @else

                                        @if(isset($n->region_2))
                                            @if($n->region_2 != $section->name)

                                                <div class="inner-hover" style="margin-top:0px;position:initial;">
                                                    <a class="category-post" style="position:absolute;left:0px;top:0px;height:23px;" href="/{{$n->region_2->slug}}">{{$n->region_2->name}}</a>
                                                </div>
                                            
                                            @else

                                            @endif
                                        @endif

                                    @endif
                                
                                @else

                                    @if(isset($n->region_2))
                                        @if($n->region_2 != $section->name)

                                            <div class="inner-hover" style="margin-top:0px;position:initial;">
                                                <a class="category-post" style="position:absolute;left:0px;top:0px;height:23px;" href="/{{$n->region_2->slug}}">{{$n->region_2->name}}</a>
                                            </div>
                                        
                                        @else

                                        @endif
                                    @endif

                                @endif

                            @endif
                            
                        
                        <div class="post-content">
                            <h2><a href="/{{$n->slug}}">{{$n->getCurrentTitle($section->id)}}</a></h2>
                                <ul class="post-tags">
                                    <li><i class="fa fa-clock-o"></i>{{date("d/m/Y", strtotime($n->date))}}</li>
                                </ul>
                        </div>		
                </div>
            </div>
        
        @endforeach

    </div>
</div>

@stop