-
Notifications
You must be signed in to change notification settings - Fork 30
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 #16 from Smile-SA/feature-787865
Add Retailer Grid massAction
- Loading branch information
Showing
8 changed files
with
315 additions
and
3 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,55 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
* @copyright 2019 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
namespace Smile\Retailer\Controller\Adminhtml\Retailer; | ||
|
||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Backend\App\Action\Context; | ||
use Smile\Retailer\Controller\Adminhtml\AbstractRetailer; | ||
|
||
/** | ||
* Retailer Adminhtml MassAllowDelivery controller. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
*/ | ||
class MassAllowDelivery extends AbstractRetailer implements HttpPostActionInterface | ||
{ | ||
/** | ||
* Execute action | ||
* | ||
* @return \Magento\Backend\Model\View\Result\Redirect | ||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception | ||
*/ | ||
public function execute() | ||
{ | ||
$retailerIds = $this->getRequest()->getParam('selected'); | ||
foreach ($retailerIds as $id) { | ||
$model = $this->retailerRepository->get($id); | ||
$model->setData('allow_store_delivery', true); | ||
$this->retailerRepository->save($model); | ||
} | ||
|
||
$this->messageManager->addSuccessMessage( | ||
__('A total of %1 record(s) have been allowed to store delivery.', count($retailerIds)) | ||
); | ||
|
||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ | ||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); | ||
|
||
return $resultRedirect->setPath('*/*/'); | ||
} | ||
} |
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,54 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
* @copyright 2019 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
namespace Smile\Retailer\Controller\Adminhtml\Retailer; | ||
|
||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Backend\App\Action\Context; | ||
use Smile\Retailer\Controller\Adminhtml\AbstractRetailer; | ||
|
||
/** | ||
* Retailer Adminhtml MassDelete controller. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
*/ | ||
class MassDelete extends AbstractRetailer implements HttpPostActionInterface | ||
{ | ||
/** | ||
* Execute action | ||
* | ||
* @return \Magento\Backend\Model\View\Result\Redirect | ||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception | ||
*/ | ||
public function execute() | ||
{ | ||
$retailerIds = $this->getRequest()->getParam('selected'); | ||
foreach ($retailerIds as $id) { | ||
$model = $this->retailerRepository->get($id); | ||
$this->retailerRepository->delete($model); | ||
} | ||
|
||
$this->messageManager->addSuccessMessage( | ||
__('A total of %1 record(s) have been deleted.', count($retailerIds)) | ||
); | ||
|
||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ | ||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); | ||
|
||
return $resultRedirect->setPath('*/*/'); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
* @copyright 2019 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
namespace Smile\Retailer\Controller\Adminhtml\Retailer; | ||
|
||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Backend\App\Action\Context; | ||
use Smile\Retailer\Controller\Adminhtml\AbstractRetailer; | ||
|
||
/** | ||
* Retailer Adminhtml MassDisable controller. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
*/ | ||
class MassDisable extends AbstractRetailer implements HttpPostActionInterface | ||
{ | ||
/** | ||
* Execute action | ||
* | ||
* @return \Magento\Backend\Model\View\Result\Redirect | ||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception | ||
*/ | ||
public function execute() | ||
{ | ||
$retailerIds = $this->getRequest()->getParam('selected'); | ||
foreach ($retailerIds as $id) { | ||
$model = $this->retailerRepository->get($id); | ||
$model->setData('is_active', false); | ||
$this->retailerRepository->save($model); | ||
} | ||
|
||
$this->messageManager->addSuccessMessage( | ||
__('A total of %1 record(s) have been disabled.', count($retailerIds)) | ||
); | ||
|
||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ | ||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); | ||
|
||
return $resultRedirect->setPath('*/*/'); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
* @copyright 2019 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
namespace Smile\Retailer\Controller\Adminhtml\Retailer; | ||
|
||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Backend\App\Action\Context; | ||
use Smile\Retailer\Controller\Adminhtml\AbstractRetailer; | ||
|
||
/** | ||
* Retailer Adminhtml MassDisallowDelivery controller. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
*/ | ||
class MassDisallowDelivery extends AbstractRetailer implements HttpPostActionInterface | ||
{ | ||
/** | ||
* Execute action | ||
* | ||
* @return \Magento\Backend\Model\View\Result\Redirect | ||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception | ||
*/ | ||
public function execute() | ||
{ | ||
$retailerIds = $this->getRequest()->getParam('selected'); | ||
foreach ($retailerIds as $id) { | ||
$model = $this->retailerRepository->get($id); | ||
$model->setData('allow_store_delivery', false); | ||
$this->retailerRepository->save($model); | ||
} | ||
|
||
$this->messageManager->addSuccessMessage( | ||
__('A total of %1 record(s) have been disallowed to store delivery.', count($retailerIds)) | ||
); | ||
|
||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ | ||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); | ||
|
||
return $resultRedirect->setPath('*/*/'); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
* @copyright 2019 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
namespace Smile\Retailer\Controller\Adminhtml\Retailer; | ||
|
||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Backend\App\Action\Context; | ||
use Smile\Retailer\Controller\Adminhtml\AbstractRetailer; | ||
|
||
/** | ||
* Retailer Adminhtml MassEnable controller. | ||
* | ||
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Fanny DECLERCK <[email protected]> | ||
*/ | ||
class MassEnable extends AbstractRetailer implements HttpPostActionInterface | ||
{ | ||
/** | ||
* Execute action | ||
* | ||
* @return \Magento\Backend\Model\View\Result\Redirect | ||
* @throws \Magento\Framework\Exception\LocalizedException|\Exception | ||
*/ | ||
public function execute() | ||
{ | ||
$retailerIds = $this->getRequest()->getParam('selected'); | ||
foreach ($retailerIds as $id) { | ||
$model = $this->retailerRepository->get($id); | ||
$model->setData('is_active', true); | ||
$this->retailerRepository->save($model); | ||
} | ||
|
||
$this->messageManager->addSuccessMessage( | ||
__('A total of %1 record(s) have been enabled.', count($retailerIds)) | ||
); | ||
|
||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ | ||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); | ||
|
||
return $resultRedirect->setPath('*/*/'); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
use Magento\Framework\Api\SortOrder; | ||
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface; | ||
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; | ||
|
||
use Smile\Retailer\Api\Data\RetailerInterface; | ||
use Smile\Retailer\Api\Data\RetailerSearchResultsInterface; | ||
use Smile\Retailer\Api\RetailerRepositoryInterface; | ||
|
@@ -30,6 +29,7 @@ | |
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Romain Ruaud <[email protected]> | ||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) | ||
*/ | ||
class RetailerRepository implements RetailerRepositoryInterface | ||
{ | ||
|
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 |
---|---|---|
|
@@ -12,7 +12,8 @@ | |
* @category Smile | ||
* @package Smile\Retailer | ||
* @author Romain Ruaud <[email protected]> | ||
* @copyright 2017 Smile | ||
* @author Fanny DECLERCK <[email protected]> | ||
* @copyright 2019 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
--> | ||
|
@@ -21,7 +22,7 @@ | |
<resources> | ||
<resource id="Magento_Backend::admin"> | ||
<resource id="Smile_Seller::sellers"> | ||
<resource id="Smile_Retailer::retailers" title="Manage Retailers"/> | ||
<resource id="Smile_Retailer::retailers" title="Manage Retailers" /> | ||
</resource> | ||
</resource> | ||
</resources> | ||
|
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