<?php
/**
 * Define Tabs in admin.
 *
 * @category  Magetop Extensions
 * @package   Magetop_Quotesystem
 * @author    Magetop Developer
 * @copyright Copyright (c) Magetop (https://www.magetop.com)
 * @license   https://www.magetop.com/license.html
 */

namespace Magetop\Quotesystem\Block\Adminhtml\Managequotes\Edit;

use Magento\Backend\Block\Template\Context;
use Magento\Framework\Json\EncoderInterface;
use Magento\Backend\Model\Auth\Session;
use Magetop\Quotesystem\Helper\Data as Helper;

class Tabs extends \Magento\Backend\Block\Widget\Tabs
{

    /**
     * @param \Magento\Backend\Block\Template\Context   $context
     * @param \Magento\Framework\Json\EncoderInterface  $jsonEncoder
     * @param \Magento\Backend\Model\Auth\Session       $authSession
     * @param Helper                                    $helper
     * @param array                                     $data
     */
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Framework\Json\EncoderInterface $jsonEncoder,
        \Magento\Backend\Model\Auth\Session $authSession,
        Helper $helper,
        array $data = []
    ) {
        $this->helper = $helper;
        parent::__construct($context, $jsonEncoder, $authSession, $data);
    }

    /**
     * Costruct
     */
    protected function _construct()
    {
        parent::_construct();
        $this->setId('managequotes_tabs');
        $this->setDestElementId('edit_form');
        $this->setTitle(__('Manage Quotes Information'));
    }

    /**
     * Before Html
     */
    protected function _beforeToHtml()
    {
        $this->addTab(
            "form_section",
            [
                "label"     =>  __("Quote Manager"),
                "alt"       =>  __("Quote Manager"),
                "content"   =>  $this->getLayout()
                    ->createBlock(\Magetop\Quotesystem\Block\Adminhtml\EditQuotes ::class)
                    ->setTemplate("Magetop_Quotesystem::form.phtml")->toHtml()
            ]
        );
        $this->addTab(
            'conversation',
            [
                'label' => __('Quote Conversation'),
                'url'   => $this->getUrl(
                    'quotesystem/*/grid',
                    ['_current' => true]
                ),
                'class' => 'ajax',
            ]
        );
        return parent::_beforeToHtml();
    }

    /**
     * Get Helper
     *
     * @return Magetop\QuoteSystem\Helper\Data
     */
    public function getHelper()
    {
        return $this->helper;
    }
}
