-
Notifications
You must be signed in to change notification settings - Fork 15
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 #40 from Paazl/1.2.0
1.2.0
- Loading branch information
Showing
83 changed files
with
2,576 additions
and
582 deletions.
There are no files selected for viewing
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
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
75 changes: 75 additions & 0 deletions
75
Block/Adminhtml/Order/Create/Shipping/Method/Paazl/Widget/Config.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,75 @@ | ||
<?php | ||
/** | ||
* Copyright © 2019 Paazl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Paazl\CheckoutWidget\Block\Adminhtml\Order\Create\Shipping\Method\Paazl\Widget; | ||
|
||
use Magento\Backend\Block\Template; | ||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Framework\Serialize\SerializerInterface; | ||
use Paazl\CheckoutWidget\Model\CompositeConfigProvider; | ||
|
||
/** | ||
* PaazlShipping method block | ||
* | ||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) | ||
*/ | ||
class Config extends Template | ||
{ | ||
/** | ||
* Path to template file in theme. | ||
* | ||
* @var string | ||
*/ | ||
protected $_template = 'Paazl_CheckoutWidget::order/create/shipping/method/paazl/widget/config.phtml'; | ||
|
||
/** | ||
* @var CompositeConfigProvider | ||
*/ | ||
protected $configProvider; | ||
|
||
/** | ||
* @var SerializerInterface | ||
*/ | ||
private $serializer; | ||
|
||
/** | ||
* @param CompositeConfigProvider $configProvider | ||
* @param SerializerInterface $serializer | ||
* @param Context $context | ||
* @param array $data | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function __construct( | ||
CompositeConfigProvider $configProvider, | ||
SerializerInterface $serializer, | ||
Context $context, | ||
array $data = [] | ||
) { | ||
$this->configProvider = $configProvider; | ||
$this->serializer = $serializer; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Retrieves order configuration | ||
* | ||
* @return array | ||
*/ | ||
public function getWidgetConfig() | ||
{ | ||
return $this->configProvider->getConfig(); | ||
} | ||
|
||
/** | ||
* Retrieves serialized order config. | ||
* | ||
* @return bool|string | ||
*/ | ||
public function getSerializedWidgetConfig() | ||
{ | ||
return $this->serializer->serialize($this->getWidgetConfig()); | ||
} | ||
} |
124 changes: 124 additions & 0 deletions
124
Block/Adminhtml/Order/Create/Shipping/Method/Paazl/Widget/Modal.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,124 @@ | ||
<?php | ||
/** | ||
* Copyright © 2019 Paazl. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Paazl\CheckoutWidget\Block\Adminhtml\Order\Create\Shipping\Method\Paazl\Widget; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Backend\Block\Widget; | ||
use Magento\Backend\Model\Session\Quote as SessionQuote; | ||
use Magento\Framework\Serialize\SerializerInterface; | ||
use Magento\Quote\Model\Quote; | ||
use Magento\Store\Model\Store; | ||
|
||
/** | ||
* Adminhtml sales order create abstract block | ||
* | ||
* @SuppressWarnings(PHPMD.NumberOfChildren) | ||
*/ | ||
class Modal extends Widget | ||
{ | ||
/** | ||
* Path to template file in theme. | ||
* | ||
* @var string | ||
*/ | ||
protected $_template = 'Paazl_CheckoutWidget::order/create/shipping/method/paazl/widget/modal.phtml'; | ||
|
||
/** | ||
* @var SerializerInterface | ||
*/ | ||
private $serializer; | ||
|
||
/** | ||
* Session quote | ||
* | ||
* @var SessionQuote | ||
*/ | ||
private $sessionQuote; | ||
|
||
/** | ||
* @param Context $context | ||
* @param SerializerInterface $serializer | ||
* @param SessionQuote $sessionQuote | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
SerializerInterface $serializer, | ||
SessionQuote $sessionQuote, | ||
array $data = [] | ||
) { | ||
$this->sessionQuote = $sessionQuote; | ||
$this->serializer = $serializer; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Retrieve quote session object | ||
* | ||
* @return SessionQuote | ||
*/ | ||
protected function getSession() | ||
{ | ||
return $this->sessionQuote; | ||
} | ||
|
||
/** | ||
* Retrieve quote model object | ||
* | ||
* @return Quote | ||
*/ | ||
public function getQuote() | ||
{ | ||
return $this->getSession()->getQuote(); | ||
} | ||
|
||
/** | ||
* Retrieve customer identifier | ||
* | ||
* @return int | ||
*/ | ||
public function getCustomerId() | ||
{ | ||
return $this->getSession()->getCustomerId(); | ||
} | ||
|
||
/** | ||
* Retrieve store model object | ||
* | ||
* @return Store | ||
*/ | ||
public function getStore() | ||
{ | ||
return $this->getSession()->getStore(); | ||
} | ||
|
||
/** | ||
* Retrieve store identifier | ||
* | ||
* @return int | ||
*/ | ||
public function getStoreId() | ||
{ | ||
return $this->getSession()->getStoreId(); | ||
} | ||
|
||
/** | ||
* Initialize paazl modal widget | ||
* | ||
* @return string | ||
*/ | ||
public function getPaazlWidgetModalJson() | ||
{ | ||
return $this->serializer->serialize( | ||
[ | ||
'paazlWidgetModal' => [ | ||
'modalClass' => 'ui-dialog-active ui-popup paazl-widget-modal' | ||
], | ||
] | ||
); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -113,4 +113,4 @@ public function getSaveUrl() | |
] | ||
); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.