-
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 <fadec@smile.fr> | ||
* @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 <fadec@smile.fr> | ||
*/ | ||
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 <fadec@smile.fr> | ||
* @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 <fadec@smile.fr> | ||
*/ | ||
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 <fadec@smile.fr> | ||
* @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 <fadec@smile.fr> | ||
*/ | ||
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 <fadec@smile.fr> | ||
* @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 <fadec@smile.fr> | ||
*/ | ||
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 <fadec@smile.fr> | ||
* @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 <fadec@smile.fr> | ||
*/ | ||
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
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