-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Ready for Pickup" button on the Order page in Admin Panel which …
…notifies Customer that Order could be picked up #2034. Added the button itself
- Loading branch information
Showing
4 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
InventoryInStorePickupAdminUi/Block/Adminhtml/Order/View/ReadyForPickup.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\InventoryInStorePickupAdminUi\Block\Adminhtml\Order\View; | ||
|
||
/** | ||
* TODO: is it possible to replace with UI Component? | ||
* | ||
* @package Magento\InventoryInStorePickupAdminUi\Block\Adminhtml\Order\View | ||
*/ | ||
class ReadyForPickup extends \Magento\Backend\Block\Widget\Form\Container | ||
{ | ||
const ADMIN_SALES_EMAIL_RESOURCE = 'Magento_Sales::emails'; | ||
|
||
/** | ||
* Block group | ||
* | ||
* @var string | ||
*/ | ||
protected $_blockGroup = 'Magento_Sales'; | ||
|
||
/** | ||
* Rendering Ready for Pickup button | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->_objectId = 'order_id'; | ||
$this->_controller = 'adminhtml_order'; | ||
$this->_mode = 'view'; | ||
|
||
if ($this->isEmailsSendingAllowed()) {/* TODO: add is order ready check */ | ||
$message = __('Are you sure you want to notify the customer that order is ready for pickup?'); | ||
$this->addButton( | ||
'ready_for_pickup', | ||
[ | ||
'label' => __('Notify Order is Ready for Pickup'), | ||
'class' => 'action-default ready-for-pickup', | ||
'onclick' => sprintf( | ||
"confirmSetLocation('%s', '%s')", | ||
$message, | ||
$this->getUrl('*/*/notifyPickup') | ||
) | ||
] | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
private function isEmailsSendingAllowed():bool | ||
{ | ||
return $this->_authorization->isAllowed(self::ADMIN_SALES_EMAIL_RESOURCE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
InventoryInStorePickupAdminUi/view/adminhtml/layout/sales_order_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<body> | ||
<referenceContainer name="content"> | ||
<block class="Magento\InventoryInStorePickupAdminUi\Block\Adminhtml\Order\View\ReadyForPickup" name="sales_order_ready_for_pickup"/> | ||
</referenceContainer> | ||
</body> | ||
</page> |