<?php
/******************************************************************************
 *   ______                                                                   *
 *  /       \                                                                 *
 * /$$$$$$  | ________  __    __   ______    ______                           *
 * $$ |__$$ |/        |/  |  /  | /      \  /      \                          *
 * $$    $$ |$$$$$$$$/ $$ |  $$ |/$$$$$$  |/$$$$$$  |                         *
 * $$$$$$$$ |  /  $$/  $$ |  $$ |$$ |  $$/ $$    $$ |                         *
 * $$ |  $$ | /$$$$/__ $$ \__$$ |$$ |      $$$$$$$$/                          *
 * $$ |  $$ |/$$      |$$    $$/ $$ |      $$       |                         *
 * $$/   $$/ $$$$$$$$/  $$$$$$/  $$/        $$$$$$$/                          *
 *                                                                            *
 * @PROJECT    : 3D Preview Extension [Magetop.com]                           *
 * @AUTHOR     : Azure - Developer                                            *
 * @COPYRIGHT  : © 2019  Magetop.com                                          *
 * @LINK       : https://Magetop.com                                          *
 * @CREATED    :  10/01/2022                                                  *
 ******************************************************************************/

namespace Magetop\Advancepreview\Controller\Product;

use Magento\Framework\App\Action;
class GetTierPrices  extends Action\Action
{
    protected $jsonFactory;
    public function __construct(
        Action\Context $context,
        \Magento\Framework\Controller\Result\JsonFactory $jsonFactory
    )
    {
        parent::__construct($context);
        $this->jsonFactory = $jsonFactory;
    }
    public function execute()
    {
        $response = array(
            'status'=>'error',
            'message'=>'error',
            'html'=>''
        );
        try {
            $response['message'] = 'success';
            $response['status'] = 'success';
            $response['html'] = $this->_view->getLayout()->createBlock('Magetop\Advancepreview\Block\CustomProduct')->setTemplate('Magetop_Advancepreview::product/discount/tier-price.phtml')->toHtml();
        }
        catch (\Exception $exception) {
            $response['message'] = $exception->getMessage();
        }
        return $this->jsonFactory->create()->setData($response);
    }
}
