<?php
/**
 * Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 *
 */


/** @var $this \Zend\View\Renderer\PhpRenderer */

$this->headScript()
    //->appendFile('/js/adm/feeds.js')
    
;

$this->headLink()
    ->appendStylesheet('/css/styles-cabinet.css')
    //->appendStylesheet('/css/styles-cabinet-550.css', 'all and (max-width: 550px)')
;

/** @var \App\Entity\IdentityInterface $identity */
$identity = $this->identity();

$lang = $this->lang;
$feeds = $this->feeds;
$stats = $this->stats;

$btn_create_link = $this->url('adm.feed.create', [                    
    'lang' => $lang,
]);                 

$form_link = $this->url('adm.feed.edit',['lang' => $lang, 'id' => 0]);


?>


<section class="b-content__title">
    <div class="wrapp">
        <!-- Вход произведен -->
        <picture>
            <img src="/img/bg-img-logo.svg" alt="No logo">
        </picture>
        <p class="lead"><?= $identity->getEmail() ?></p>
        <p class="b-content__title-settings">
            <a href="<?= $this->url('user.cabinet.profile', ['lang' => $this->lang]) ?>" title="" class="annotation"><?= _t("Настройки профиля") ?></a>
            <a href="<?= $this->url('logout', ['lang' => $this->lang]) ?>" title="" class="annotation"><?= _t("Выход") ?></a>
        </p>
    </div>
</section>

<section class="b-content__work" style="margin-top: 10px;">

    <section class="b-content__work">
        <div class="panel panel-info">
            
            <div class="panel-heading">
                <h1 style="padding: 0 0 10px 0;"><?= _t('Список фидов') ?></h1>
            </div>

            <div class="panel-body all" style="min-height: 500px;">

                <table class="table table-striped offers" id="table2excel" data-action="<?= $form_link ?>" data-content="offers">
                    <thead>
                        <tr>                        
                            <th width="110px"><span class="sort" data-sort="id" data-sortasc="1">#ID</span></th>
                            <th><span class="sort" data-sort="title" data-sortasc="1">Название</span></th>
                            <th><span class="sort" data-sort="url" data-sortasc="1">URL</span></th>
                            <th><span class="sort" data-sort="format" data-sortasc="1">Format</span></th>
                            <th><span class="sort" data-sort="status" data-sortasc="1">Status</span></th>
                            <th><span class="sort" data-sort="defaultcur" data-sortasc="1">DefaultCUR</span></th>
                            <th><span class="sort" data-sort="goodscount" data-sortasc="1">GoodsCount</span></th>
                            <th><span class="sort" data-sort="lastcheck" data-sortasc="1">LastCheck</span></th>
                        </tr>
                    </thead>
                    <tbody>

                    <?php foreach ($feeds as $feed) : ?>
                        <tr <?= (!$feed['active'] ? 'class="disabled"' : '')?>>
                            <td>
                                <span class="feed-id"><?= $feed['id'] ?></span>
                            </td>
                            <td>
                                <span class="feed-clientid"><?= $feed['title'] ?></span>
                            </td>
                            <td>
                                <span class="feed-url"><?= $feed['url'] ?></span>
                            </td>
                            <td>
                                <span class="feed-format"><?= $feed['format'] ?></span>
                            </td>
                            <td>
                                <span class="feed-status"><?= $feed['status'] ?></span>
                            </td>
                            <td>
                                <span class="feed-defaultcur"><?= $feed['defaultcur'] ?></span>
                            </td>
                            <td>
                                <span class="feed-goodscount"><?= $feed['goodscount'] ?></span>
                            </td>
                            <td>
                                <span class="feed-lastcheck"><?= $feed['lastcheck'] ?></span>
                            </td>
                        </tr>
                    <?php endforeach; ?>


                    </tbody>
                </table>

            </div>
            <div class="panel-footer">
            </div>    
        </div>
    </section>

</section>
