<?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 */
/** @var $itemKey int */
/** @var $item \App\Entity\FAQ\Item */

$item = $this->item;
$itemKey = $this->itemKey ?? 1;
/**
 * if mode NOT partial render -> add scripts
 * layot should reneder headLink and headScript
 */
$addScripts = $this->addScripts;
if ($addScripts) {
    $this->partial('adm::faq/scripts');
}


?>
<div class="b-content__accordeon-category-item">

        <div class="b-content__accordeon-category-item-title lead" data-number='<?= $itemKey ?>'>
            <?= $item->getName() ?>
            <?php if ($this->showButtons) : ?>
            <div class="btn-toolbar" role="toolbar">
                <div class="btn-group" role="group">
                    <button type="button" role="button" class="btn btn-primary" data-action="<?= $this->url('adm.faq.item.edit', [
                        'id' => $item->getId(),
                        'lang' => $this->lang,
                    ]) ?>">Edit</button>
                </div>
                <div class="btn-group" role="group">
                    <button type="button" role="button" class="btn btn-primary <?= $item->getHidden() ? '': 'btn-danger' ?>"
                            data-toggle
                            data-activate="<?= $this->url('adm.faq.item.activate', [
                                'id' => $item->getId(),
                                'lang' => $this->lang,
                            ]) ?>"
                            data-activate-caption="<?= _t('Activate') ?>"
                            data-hide="<?= $this->url('adm.faq.item.hide', [
                                'id' => $item->getId(),
                                'lang' => $this->lang,
                            ]) ?>"
                            data-hide-caption="<?= _t('Hide') ?>"
                            data-value="<?= $item->getHidden() ? 'data-activate' : 'data-hide' ?>"
                    >
                        <?= $item->getHidden() ? _t('Activate') : _t('Hide') ?>
                    </button>
                </div>
            </div>
            <?php endif; ?>
        </div>

    <article class="b-content__accordeon-category-item-article">
        <div class="wrapp">
            <?= $item->getContent() ?>
        </div>
    </article>
</div>
<?php
