<?php
/**
 * Show stores.
 *
 * @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\Controller\Adminhtml\Buyerquote;

use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;

class Store extends Action
{

    /**
     * @param Context                                                   $context
     * @param PageFactory                                               $resultPageFactory
     * @param JsonFactory                                               $resultJsonFactory
     */

    public function __construct(
        Context $context,
        PageFactory $resultPageFactory,
        JsonFactory $resultJsonFactory
    ) {
        $this->resultPageFactory = $resultPageFactory;
        $this->resultJsonFactory = $resultJsonFactory;
        parent::__construct($context);
    }

    /**
     * Product option action
     */
    public function execute()
    {
        $resultPage = $this->resultPageFactory->create();
        $result = $this->resultJsonFactory->create();
        $block = $resultPage->getLayout()
                ->createBlock(\Magento\Sales\Block\Adminhtml\Order\Create\Store\Select::class)
                ->setTemplate('Magetop_Quotesystem::storeselect.phtml')
                ->toHtml();
        $result->setData(['output' => $block]);
        return $result;
    }
}
