mirror of
https://github.com/bdnugget/magento2.git
synced 2026-11-07 17:27:36 +00:00
108 lines
2.5 KiB
PHP
108 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © Magento, Inc. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
namespace Magento\Shipping\Block\Adminhtml\Create;
|
|
|
|
use Magento\Framework\App\ObjectManager;
|
|
use Magento\Tax\Helper\Data as TaxHelper;
|
|
|
|
/**
|
|
* Adminhtml shipment create form
|
|
*
|
|
* @api
|
|
* @since 100.0.2
|
|
*/
|
|
class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder
|
|
{
|
|
/**
|
|
* @param \Magento\Backend\Block\Template\Context $context
|
|
* @param \Magento\Framework\Registry $registry
|
|
* @param \Magento\Sales\Helper\Admin $adminHelper
|
|
* @param array $data
|
|
* @param TaxHelper|null $taxHelper
|
|
*/
|
|
public function __construct(
|
|
\Magento\Backend\Block\Template\Context $context,
|
|
\Magento\Framework\Registry $registry,
|
|
\Magento\Sales\Helper\Admin $adminHelper,
|
|
array $data = [],
|
|
?TaxHelper $taxHelper = null
|
|
) {
|
|
$data['taxHelper'] = $taxHelper ?? ObjectManager::getInstance()->get(TaxHelper::class);
|
|
parent::__construct($context, $registry, $adminHelper, $data);
|
|
}
|
|
|
|
/**
|
|
* Retrieve invoice order
|
|
*
|
|
* @return \Magento\Sales\Model\Order
|
|
*/
|
|
public function getOrder()
|
|
{
|
|
return $this->getShipment()->getOrder();
|
|
}
|
|
|
|
/**
|
|
* Retrieve source
|
|
*
|
|
* @return \Magento\Sales\Model\Order\Shipment
|
|
*/
|
|
public function getSource()
|
|
{
|
|
return $this->getShipment();
|
|
}
|
|
|
|
/**
|
|
* Retrieve shipment model instance
|
|
*
|
|
* @return \Magento\Sales\Model\Order\Shipment
|
|
*/
|
|
public function getShipment()
|
|
{
|
|
return $this->_coreRegistry->registry('current_shipment');
|
|
}
|
|
|
|
/**
|
|
* Prepare layout.
|
|
*
|
|
* @return \Magento\Framework\View\Element\AbstractBlock
|
|
*/
|
|
protected function _prepareLayout()
|
|
{
|
|
$this->addChild('items', \Magento\Shipping\Block\Adminhtml\Create\Items::class);
|
|
return parent::_prepareLayout();
|
|
}
|
|
|
|
/**
|
|
* Return payment html.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getPaymentHtml()
|
|
{
|
|
return $this->getChildHtml('order_payment');
|
|
}
|
|
|
|
/**
|
|
* Return items html.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getItemsHtml()
|
|
{
|
|
return $this->getChildHtml('order_items');
|
|
}
|
|
|
|
/**
|
|
* Generate save url.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getSaveUrl()
|
|
{
|
|
return $this->getUrl('*/*/save', ['order_id' => $this->getShipment()->getOrderId()]);
|
|
}
|
|
}
|