37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\LingxingErp\Controller\Adminhtml\Order;
|
|
|
|
use Esun\LingxingErp\Model\Sync\DetailProvider;
|
|
use Magento\Backend\App\Action;
|
|
use Magento\Framework\Controller\Result\Redirect;
|
|
use Magento\Framework\View\Result\Page;
|
|
use Magento\Framework\View\Result\PageFactory;
|
|
|
|
class View extends Action
|
|
{
|
|
public const ADMIN_RESOURCE = 'Esun_LingxingErp::orders';
|
|
|
|
public function __construct(
|
|
Action\Context $context,
|
|
private readonly PageFactory $pageFactory,
|
|
private readonly DetailProvider $detailProvider
|
|
) {
|
|
parent::__construct($context);
|
|
}
|
|
|
|
public function execute(): Page|Redirect
|
|
{
|
|
$record = $this->detailProvider->getRecord('order', (int)$this->getRequest()->getParam('id'));
|
|
if ($record === null) {
|
|
$this->messageManager->addErrorMessage(__('The order synchronization record no longer exists.'));
|
|
return $this->resultRedirectFactory->create()->setPath('*/*/index');
|
|
}
|
|
$page = $this->pageFactory->create();
|
|
$page->setActiveMenu('Esun_LingxingErp::orders');
|
|
$page->getConfig()->getTitle()->prepend(__('Order Synchronization #%1', $record['increment_id']));
|
|
return $page;
|
|
}
|
|
}
|