12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- /**
- *
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Shipping\Controller\Adminhtml\Order\Shipment;
- use Magento\Backend\App\Action;
- use Magento\Framework\App\ResponseInterface;
- class GetShippingItemsGrid extends \Magento\Backend\App\Action
- {
- /**
- * Authorization level of a basic admin session
- *
- * @see _isAllowed()
- */
- const ADMIN_RESOURCE = 'Magento_Sales::shipment';
- /**
- * @var \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader
- */
- protected $shipmentLoader;
- /**
- * @param Action\Context $context
- * @param \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader
- */
- public function __construct(
- Action\Context $context,
- \Magento\Shipping\Controller\Adminhtml\Order\ShipmentLoader $shipmentLoader
- ) {
- $this->shipmentLoader = $shipmentLoader;
- parent::__construct($context);
- }
- /**
- * Return grid with shipping items for Ajax request
- *
- * @return ResponseInterface
- */
- public function execute()
- {
- $this->shipmentLoader->setOrderId($this->getRequest()->getParam('order_id'));
- $this->shipmentLoader->setShipmentId($this->getRequest()->getParam('shipment_id'));
- $this->shipmentLoader->setShipment($this->getRequest()->getParam('shipment'));
- $this->shipmentLoader->setTracking($this->getRequest()->getParam('tracking'));
- $this->shipmentLoader->load();
- return $this->getResponse()->setBody(
- $this->_view->getLayout()->createBlock(
- \Magento\Shipping\Block\Adminhtml\Order\Packaging\Grid::class
- )->setIndex(
- $this->getRequest()->getParam('index')
- )->toHtml()
- );
- }
- }
|