-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kountret Spyrou
committed
Jun 18, 2021
1 parent
e0dfeb4
commit 15cf482
Showing
109 changed files
with
5,101 additions
and
1,035 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\DocumentType\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class BackButton extends GenericButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Back'), | ||
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()), | ||
'class' => 'back', | ||
'sort_order' => 10 | ||
]; | ||
} | ||
|
||
public function getBackUrl() | ||
{ | ||
return $this->getUrl('*/*/'); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\DocumentType\Edit; | ||
|
||
class GenericButton | ||
{ | ||
/** | ||
* Url Builder | ||
* | ||
* @var \Magento\Framework\UrlInterface | ||
*/ | ||
protected $urlBuilder; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \Magento\Backend\Block\Widget\Context $context | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Widget\Context $context | ||
) { | ||
$this->urlBuilder = $context->getUrlBuilder(); | ||
} | ||
|
||
/** | ||
* Generate url by route and parameters | ||
* | ||
* @param string $route | ||
* @param array $params | ||
* @return string | ||
*/ | ||
public function getUrl($route = '', $params = []) | ||
{ | ||
return $this->urlBuilder->getUrl($route, $params); | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\DocumentType\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class SaveButton extends GenericButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Save'), | ||
'data_attribute' => [ | ||
'mage-init' => ['button' => ['event' => 'save']], | ||
'form-role' => 'save', | ||
], | ||
'sort_order' => 90, | ||
'class' => 'save primary' | ||
]; | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\DocumentType; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
|
||
class GenericButton | ||
{ | ||
/** | ||
* Url Builder | ||
* | ||
* @var \Magento\Framework\UrlInterface | ||
*/ | ||
protected $urlBuilder; | ||
|
||
protected $scopeConfig; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \Magento\Backend\Block\Widget\Context $context | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Widget\Context $context | ||
) { | ||
$this->scopeConfig = $context->getScopeConfig(); | ||
$this->urlBuilder = $context->getUrlBuilder(); | ||
} | ||
|
||
/** | ||
* Generate url by route and parameters | ||
* | ||
* @param string $route | ||
* @param array $params | ||
* @return string | ||
*/ | ||
public function getUrl($route = '', $params = []) | ||
{ | ||
return $this->urlBuilder->getUrl($route, $params); | ||
} | ||
|
||
public function shouldDisplayButton(){ | ||
return (null !== $this->scopeConfig->getValue('megaventory/general/synctimestamp')); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\InventoryAdjustment\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class BackButton extends GenericButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Back'), | ||
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()), | ||
'class' => 'back', | ||
'sort_order' => 10 | ||
]; | ||
} | ||
|
||
public function getBackUrl() | ||
{ | ||
return $this->getUrl('*/index/index') . '#locations'; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
Block/Adminhtml/InventoryAdjustment/Edit/GenericButton.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,49 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\InventoryAdjustment\Edit; | ||
|
||
use Magento\Framework\App\RequestInterface; | ||
|
||
class GenericButton | ||
{ | ||
/** | ||
* Url Builder | ||
* | ||
* @var \Magento\Framework\UrlInterface | ||
*/ | ||
protected $urlBuilder; | ||
|
||
|
||
protected $request; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param \Magento\Backend\Block\Widget\Context $context | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Widget\Context $context, | ||
RequestInterface $requestInterface | ||
) { | ||
$this->urlBuilder = $context->getUrlBuilder(); | ||
$this->request = $requestInterface; | ||
} | ||
|
||
/** | ||
* Generate url by route and parameters | ||
* | ||
* @param string $route | ||
* @param array $params | ||
* @return string | ||
*/ | ||
public function getUrl($route = '', $params = []) | ||
{ | ||
return $this->urlBuilder->getUrl($route, $params); | ||
} | ||
|
||
public function getId() | ||
{ | ||
$id = $this->request->getParam('id',null); | ||
return $id; | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\InventoryAdjustment\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class SaveButton extends GenericButton implements ButtonProviderInterface | ||
{ | ||
public function getButtonData() | ||
{ | ||
return [ | ||
'label' => __('Save'), | ||
'data_attribute' => [ | ||
'mage-init' => ['button' => ['event' => 'save']], | ||
'form-role' => 'save', | ||
], | ||
'sort_order' => 90, | ||
'class' => 'save primary' | ||
]; | ||
} | ||
} |
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,50 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml\InventoryAdjustment\Edit; | ||
|
||
use Magento\Framework\App\RequestInterface; | ||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
||
class SourceRemove extends GenericButton implements ButtonProviderInterface | ||
{ | ||
protected $_inventoryResource; | ||
protected $_inventoryFactory; | ||
|
||
public function __construct( | ||
\Magento\Backend\Block\Widget\Context $context, | ||
RequestInterface $requestInterface, | ||
\Mv\Megaventory\Model\InventoriesFactory $inventoriesFactory, | ||
\Mv\Megaventory\Model\ResourceModel\Inventories $inventoriesResource | ||
) { | ||
parent::__construct($context, $requestInterface); | ||
$this->_inventoryFactory = $inventoriesFactory; | ||
$this->_inventoryResource = $inventoriesResource; | ||
} | ||
|
||
public function getButtonData() | ||
{ | ||
$data = []; | ||
if ($this->getId() && $this->shouldDisplay()) { | ||
$data = [ | ||
'label' => __('Remove Inventory Source Association'), | ||
'class' => 'action-secondary', | ||
'on_click' => 'deleteConfirm(\'' | ||
. __('This will also disable this inventory location until an inventory source is assigned again. Are you sure?') | ||
. '\', \'' . $this->getRemovalUrl() . '\')', | ||
'sort_order' => 20, | ||
]; | ||
} | ||
return $data; | ||
} | ||
|
||
public function getRemovalUrl() | ||
{ | ||
return $this->getUrl('megaventory/inventory/unassigninventorysource', ['id' => $this->getId()]); | ||
} | ||
|
||
private function shouldDisplay(){ | ||
$inventory = $this->_inventoryFactory->create(); | ||
$this->_inventoryResource->load($inventory, $this->getId()); | ||
return ($inventory->getStockSourceCode() !== null); | ||
} | ||
} |
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,7 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml; | ||
|
||
class LogHeader extends \Magento\Backend\Block\Template{ | ||
protected $_template = 'log_header.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,10 @@ | ||
<?php | ||
|
||
namespace Mv\Megaventory\Block\Adminhtml; | ||
|
||
class ProcessUpdates extends \Magento\Backend\Block\Template{ | ||
protected $_template = 'pull_updates.phtml'; | ||
public function getUpdateUrl(){ | ||
return $this->getUrl('megaventory/updates/process'); | ||
} | ||
} |
Oops, something went wrong.