title = "Galereýa"
url = "/gallery"
layout = "default"
meta_title = "TDH"
meta_description = "Iň soňky we möhüm habarlar: Surat hasabaty. Türkmenistanyň soňky täzeliklerini okaň."
is_hidden = 0

[viewBag]
localeTitle[ru] = "Галерея"
localeTitle[en] = "Gallery"
localeUrl[ru] = "/gallery"
localeUrl[en] = "/gallery"
localeMeta_description[ru] = "Свежие и актуальные Новости: Фоторепортаж. Следите за последними новостями Туркменистана."
localeMeta_description[en] = "Top and current news: Photo report. Follow the latest from Turkmenistan."
==
<?php
function onStart(){

    $gallery = Admin\Photos\Models\Photo::orderBy("date",'desc')->paginate(10);
    $this['gallery'] = $gallery;

    $this['lastNews'] = \Indikator\News\Models\Posts::where("locale", App::getLocale())->where("status", 1)
        ->where("category_id", "!=", $this->theme->colleagues_news)
        ->whereNotIn('category_id', [20,21,22])
        ->orderBy('published_at', 'desc')
        ->limit(6)->get();

}
?>
==
<section class="section" id="intro">
    <div class="auto_container">
        <div class="which_page">
            <a href="{{ 'index'|page}}">
                <div class="page_name">
                    {{'Главная'|_}}
                </div>
            </a>
            <div class="slash">\</div>
            <div class="page_name">
                {{'Фоторепортаж'|_}}
            </div>
        </div>
        <div class="section_wrapper">
            <div class="center">
                <div class="title">
                    {{'Фоторепортаж'|_}}
                </div>
                <div class="gallery_outer">

                    {% for key, item in gallery %}

                    <div class="gallery_item">
                        <div class="gallery_img fancybox" href="{{item.getImages().first.path}}" data-fancybox="{{key}}"
                                    data-width="1500" data-height="1000">
                            <img src="{{item.image[0].thumb(auto, 270)}}" alt="">

                        </div>

                        <div style="display: none;">
                            {% for image in item.getImages().slice(1,item.getImages().size) %}
                            <a href="{{image.path}}" data-fancybox="{{key}}" data-width="1500"
                                data-height="1000" data-thumb="{{image.path}}"></a>
                            {% endfor %}
                        </div>

                        <div class="gallery_info">
                            <div class="photo_title">
                                {{ item.title }}
                            </div>
                            <div class="photo_date">
                                {{ item.date| date("d.m.Y") }}
                            </div>
                        </div>
                    </div>
                    {% endfor %}
                </div>

                {% if gallery.total > 10 %}
                    <div class="section_end">
                        <div class="page_num">
                            <a href="{{gallery.previousPageUrl}}">
                                <div class="direct_btn">
                                        <img src="{{ 'assets/images/left.svg'|theme }}" alt="">
                                </div>
                            </a>
                            <form action="" method="GET">
                                <input type="text" name="page" value="{{gallery.currentPage}}" class="input_page">
                            </form>
                            <a href="{{gallery.nextPageUrl}}">
                                <div class="direct_btn">
                                        <img src="{{ 'assets/images/right.svg'|theme }}" alt="">
                                </div>
                            </a>
                        </div>
                        <div class="page_list">
                            {{(gallery.total/gallery.perPage)|round(0,"ceil")}} {{'страниц'|_}}
                        </div>
                    </div>
                {% endif %}
            </div>
            <div class="right_side break">
                <div class="title">
                    {{'Последние новости'|_}}
                </div>

                {% for item in lastNews %}
                    <div class="news_info">
                        <div class="left_date">
                            {{ item.published_at| date("d.m") }}
                        </div>
                        <div class="left_info">
                            <div class="left_title">
                                <a href="{{ 'post'|page ({id: item.id, slug: item.slug})}}">
                                    {{item.category.name}}</a>
                            </div>
                            <div class="news_text">
                                {{item.title}}
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
        </div>

    </div>
</section>
