<?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('//cdnjs.cloudflare.com/ajax/libs/autosize.js/3.0.18/autosize.min.js')
    ->appendFile('/js/script-help.js')
;

$this->headLink()
    ->appendStylesheet('/css/styles-help.css');


?>
<section class="b-content__title">
    <div class="wrapp">
        <h1><?= _t("Помощь") ?></h1>
        <div class="row">
            <p class="lead col sm-offset-1 sm-10"><?= _t("Вопросы с которыми чаще всего сталкиваются наши клиенты") ?></p>
        </div>
    </div>
</section>

<section class="b-content__accordeon">
    <div class="wrapp row">
        <div class="b-content__accordeon-category col sm-offset-1 sm-10">
<?php
/** @var \App\Entity\FAQ\Category $category */
foreach ($categories as $category) :
?>
            <div class="b-content__accordeon-category-inner m-content__accordeon-category-inner_<?= $category->getId() ?>">
                <h2 class="b-content__accordeon-category-title" data-open-category><?= _t($category->getName()) ?></h2>
                <div class="wrapp-category">

    <?php /** @var \App\Entity\FAQ\Item $item */
    foreach ($items[$category->getId()] as $itemKey => $item) : ?>

                    <div class="b-content__accordeon-category-item">
                        <p class="b-content__accordeon-category-item-title lead" data-number='<?= $itemKey ?>'><?= _t($item->getName()) ?></p>

                        <article class="b-content__accordeon-category-item-article">
                            <div class="wrapp">
                                <?php
                                /**
                                 * we don't need to translate faq/item content as it parsed from Markdown and translated in FAQ\Items model
                                 */
                                ?>
                                <?= $item->getContent() ?>
                            </div>
                        </article>
                    </div>

    <?php endforeach; ?>

                </div>
            </div>
<?php endforeach; ?>
        </div>
    </div>
</section>

<section class="b-content__contact">
    <div class="wrapp">
        <p>
            <span class="lead"><?= _t("Не нашли нужный ответ?") ?></span>
            <a href="<?= $this->url('contacts', ['lang' => $this->lang]) ?>" title="<?= _t('Контакты') ?>" class="link"><?= _t("Напишите нам") ?></a>
        </p>
    </div>
</section>

