View.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Controller\Adminhtml\Pickup;
  6. use Magento\Backend\App\Action;
  7. use Magento\Backend\App\Action\Context;
  8. use Magento\Framework\Controller\ResultFactory;
  9. use Temando\Shipping\Model\Pickup\PickupLoader;
  10. /**
  11. * Temando View Pickup Page
  12. *
  13. * @package Temando\Shipping\Controller
  14. * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
  15. * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  16. * @link https://www.temando.com/
  17. */
  18. class View extends Action
  19. {
  20. const ADMIN_RESOURCE = 'Temando_Shipping::pickups';
  21. /**
  22. * @var PickupLoader
  23. */
  24. private $pickupLoader;
  25. /**
  26. * View constructor.
  27. * @param Context $context
  28. * @param PickupLoader $pickupLoader
  29. */
  30. public function __construct(Context $context, PickupLoader $pickupLoader)
  31. {
  32. $this->pickupLoader = $pickupLoader;
  33. parent::__construct($context);
  34. }
  35. /**
  36. * @return \Magento\Framework\Controller\ResultInterface
  37. */
  38. public function execute()
  39. {
  40. $orderId = $this->getRequest()->getParam('sales_order_id', 0);
  41. $pickupId = $this->getRequest()->getParam('pickup_id', '');
  42. $pickups = $this->pickupLoader->load($orderId, $pickupId);
  43. $this->pickupLoader->register($pickups, $orderId, $pickupId);
  44. /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
  45. $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
  46. $resultPage->setActiveMenu('Temando_Shipping::pickups');
  47. $resultPage->getConfig()->getTitle()->prepend(__('Pickups'));
  48. $resultPage->addBreadcrumb(__('Pickups'), __('Pickups'), $this->getUrl('temando/pickup'));
  49. return $resultPage;
  50. }
  51. }