-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from ihorvansach/confirmation-popup-window-ui-v2
Confirmation pop-up window for "Login as Customer" (New Request)
- Loading branch information
Showing
18 changed files
with
349 additions
and
193 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
app/code/Magento/LoginAsCustomerUi/Block/Adminhtml/ConfirmationPopup.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,82 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\LoginAsCustomerUi\Block\Adminhtml; | ||
|
||
use Magento\Framework\Serialize\Serializer\Json; | ||
use Magento\Store\Ui\Component\Listing\Column\Store\Options as StoreOptions; | ||
use Magento\Backend\Block\Template; | ||
use Magento\LoginAsCustomerApi\Api\ConfigInterface; | ||
|
||
/** | ||
* Admin blog post | ||
*/ | ||
class ConfirmationPopup extends Template | ||
{ | ||
/** | ||
* Store Options | ||
* | ||
* @var StoreOptions | ||
*/ | ||
private $storeOptions; | ||
|
||
/** | ||
* Config | ||
* | ||
* @var ConfigInterface | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* Json Serializer | ||
* | ||
* @var Json | ||
*/ | ||
private $json; | ||
|
||
/** | ||
* ConfirmationPopup constructor. | ||
* @param Template\Context $context | ||
* @param StoreOptions $storeOptions | ||
* @param ConfigInterface $config | ||
* @param Json $json | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Template\Context $context, | ||
StoreOptions $storeOptions, | ||
ConfigInterface $config, | ||
Json $json, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->storeOptions = $storeOptions; | ||
$this->config = $config; | ||
$this->json = $json; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getJsLayout() | ||
{ | ||
$layout = $this->json->unserialize(parent::getJsLayout()); | ||
$showStoreViewOptions = $this->config->isStoreManualChoiceEnabled(); | ||
|
||
$layout['components']['lac-confirmation-popup']['title'] = $showStoreViewOptions | ||
? __('Login as Customer: Select Store View') | ||
: __('You are about to Login as Customer'); | ||
$layout['components']['lac-confirmation-popup']['content'] = __('Actions taken while in "Login as Customer" will affect actual customer data.'); | ||
|
||
$layout['components']['lac-confirmation-popup']['showStoreViewOptions'] = $showStoreViewOptions; | ||
$layout['components']['lac-confirmation-popup']['storeViewOptions'] = $showStoreViewOptions | ||
? $this->storeOptions->toOptionArray() | ||
: []; | ||
|
||
return $this->json->serialize($layout); | ||
} | ||
} |
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
43 changes: 0 additions & 43 deletions
43
app/code/Magento/LoginAsCustomerUi/Controller/Adminhtml/Login/Manual.php
This file was deleted.
Oops, something went wrong.
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
37 changes: 0 additions & 37 deletions
37
app/code/Magento/LoginAsCustomerUi/Ui/Store/DataProvider/Form/StoreDataProvider.php
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
app/code/Magento/LoginAsCustomerUi/view/adminhtml/layout/adminhtml_order_shipment_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,10 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> | ||
<update handle="loginascustomer_confirmation_popup" /> | ||
</layout> |
10 changes: 10 additions & 0 deletions
10
app/code/Magento/LoginAsCustomerUi/view/adminhtml/layout/customer_index_edit.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,10 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> | ||
<update handle="loginascustomer_confirmation_popup" /> | ||
</layout> |
22 changes: 22 additions & 0 deletions
22
...de/Magento/LoginAsCustomerUi/view/adminhtml/layout/loginascustomer_confirmation_popup.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,22 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> | ||
<referenceContainer name="content"> | ||
<block class="Magento\LoginAsCustomerUi\Block\Adminhtml\ConfirmationPopup" name="lac.confirmation.popup" template="Magento_LoginAsCustomerUi::confirmation-popup.phtml"> | ||
<arguments> | ||
<argument name="jsLayout" xsi:type="array"> | ||
<item name="components" xsi:type="array"> | ||
<item name="lac-confirmation-popup" xsi:type="array"> | ||
<item name="component" xsi:type="string">Magento_LoginAsCustomerUi/js/confirmation-popup</item> | ||
</item> | ||
</item> | ||
</argument> | ||
</arguments> | ||
</block> | ||
</referenceContainer> | ||
</layout> |
15 changes: 0 additions & 15 deletions
15
app/code/Magento/LoginAsCustomerUi/view/adminhtml/layout/loginascustomer_login_manual.xml
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
app/code/Magento/LoginAsCustomerUi/view/adminhtml/layout/sales_order_creditmemo_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,10 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> | ||
<update handle="loginascustomer_confirmation_popup" /> | ||
</layout> |
10 changes: 10 additions & 0 deletions
10
app/code/Magento/LoginAsCustomerUi/view/adminhtml/layout/sales_order_invoice_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,10 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> | ||
<update handle="loginascustomer_confirmation_popup" /> | ||
</layout> |
10 changes: 10 additions & 0 deletions
10
app/code/Magento/LoginAsCustomerUi/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,10 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd"> | ||
<update handle="loginascustomer_confirmation_popup" /> | ||
</layout> |
15 changes: 15 additions & 0 deletions
15
app/code/Magento/LoginAsCustomerUi/view/adminhtml/templates/confirmation-popup.phtml
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,15 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
/** @var \Magento\LoginAsCustomerUi\Block\Adminhtml\ConfirmationPopup $block */ | ||
?> | ||
|
||
<script type="text/x-magento-init"> | ||
{ | ||
"*": { | ||
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?> | ||
} | ||
} | ||
</script> |
Oops, something went wrong.