-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
87 changed files
with
592 additions
and
236 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 |
---|---|---|
|
@@ -41,3 +41,5 @@ | |
/var/package/* | ||
!/var/package/*.xml | ||
|
||
/.idea/* | ||
.DS_Store |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Category\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Category\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Category\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Category\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
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 |
---|---|---|
@@ -1,4 +1,10 @@ | ||
<?php | ||
/** | ||
* AssignCustomers | ||
* | ||
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Customer; | ||
|
||
|
@@ -99,7 +105,6 @@ public function getProductsJson() | |
return '{}'; | ||
} | ||
|
||
|
||
/** | ||
* @return array | ||
*/ | ||
|
@@ -108,7 +113,7 @@ public function getUsageCustomer() | |
$id = $this->getRequest()->getParam('entity_id'); | ||
$customerArray = []; | ||
|
||
if(isset($id)){ | ||
if (isset($id)) { | ||
$collection = $this->collectionFactory->create(); | ||
foreach ($collection as $item) { | ||
$customerArray[$item->getCustomerId()] = $item->getCustomerId(); | ||
|
@@ -117,10 +122,15 @@ public function getUsageCustomer() | |
return $customerArray; | ||
} | ||
|
||
public function showGrid(){ | ||
/** | ||
* @return bool|mixed | ||
*/ | ||
public function showGrid() | ||
{ | ||
$customLicense = $this->request->getParam('custom_license'); | ||
if(isset($customLicense)) | ||
if (isset($customLicense)) { | ||
return $customLicense; | ||
} | ||
return false; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,10 @@ | ||
<?php | ||
/** | ||
* Customer | ||
* | ||
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Customer\Tab; | ||
|
||
|
@@ -20,9 +26,9 @@ class Customer extends \Magento\Backend\Block\Widget\Grid\Extended | |
protected $coreRegistry = null; | ||
|
||
/** | ||
* @var \Magento\Customer\Model\CustomerFactory | ||
* @var \DevStone\UsageCalculator\Model\ResourceModel\Customer\CollectionFactory|\Magento\Customer\Model\ResourceModel\Customer\CollectionFactory | ||
*/ | ||
protected $customerFactory; | ||
protected $customerCollectionFactory; | ||
|
||
/** | ||
* @var mixed | ||
|
@@ -44,12 +50,13 @@ class Customer extends \Magento\Backend\Block\Widget\Grid\Extended | |
*/ | ||
protected $collectionFactory; | ||
|
||
protected $resource; | ||
|
||
/** | ||
* Customer constructor. | ||
* @param \Magento\Backend\Block\Template\Context $context | ||
* @param \Magento\Backend\Helper\Data $backendHelper | ||
* @param \Magento\Customer\Model\CustomerFactory $customerFactory | ||
* @param \Magento\Customer\Model\ResourceModel\Customer\CollectionFactory $customerCollectionFactory | ||
* @param \Magento\Framework\Registry $coreRegistry | ||
* @param \Magento\Framework\App\RequestInterface $request | ||
* @param \DevStone\UsageCalculator\Model\ResourceModel\UsageCustomer\CollectionFactory $collectionFactory | ||
|
@@ -60,18 +67,20 @@ class Customer extends \Magento\Backend\Block\Widget\Grid\Extended | |
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
\Magento\Backend\Helper\Data $backendHelper, | ||
\Magento\Customer\Model\CustomerFactory $customerFactory, | ||
\Magento\Framework\App\ResourceConnection $resource, | ||
\Magento\Framework\Registry $coreRegistry, | ||
\Magento\Framework\App\RequestInterface $request, | ||
\DevStone\UsageCalculator\Model\ResourceModel\UsageCustomer\CollectionFactory $collectionFactory, | ||
\DevStone\UsageCalculator\Model\ResourceModel\Customer\CollectionFactory $customerCollectionFactory, | ||
array $data = [], | ||
Visibility $visibility = null, | ||
Status $status = null | ||
) { | ||
$this->customerFactory = $customerFactory; | ||
$this->customerCollectionFactory = $customerCollectionFactory; | ||
$this->coreRegistry = $coreRegistry; | ||
$this->request = $request; | ||
$this->collectionFactory = $collectionFactory; | ||
$this->resource = $resource; | ||
$this->visibility = $visibility ?: ObjectManager::getInstance()->get(Visibility::class); | ||
$this->status = $status ?: ObjectManager::getInstance()->get(Status::class); | ||
parent::__construct($context, $backendHelper, $data); | ||
|
@@ -86,10 +95,14 @@ protected function _construct() | |
$this->setId('usage_calculator_customers'); | ||
$this->setDefaultSort('id'); | ||
$this->setDefaultFilter(['in_usage' => 1]); | ||
|
||
$this->setUseAjax(true); | ||
} | ||
|
||
/** | ||
* @param Grid\Column $column | ||
* @return $this|Extended | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
protected function _addColumnFilterToCollection($column) | ||
{ | ||
if ($column->getId() == 'in_usage') { | ||
|
@@ -98,26 +111,30 @@ protected function _addColumnFilterToCollection($column) | |
$customerIds = 0; | ||
} | ||
$linkField = 'entity_id'; | ||
$filter = $column->getFilter(); | ||
$filter = $column->getFilter(); | ||
if ($filter !== false && $column->getFilter()->getValue()) { | ||
$this->getCollection()->addFieldToFilter($linkField, ['in' => $customerIds]); | ||
} elseif (!empty($customerIds)) { | ||
$this->getCollection()->addFieldToFilter($linkField, ['nin' => $customerIds]); | ||
} | ||
} elseif ($column->getId() == 'name') { | ||
$this->getCollection()->getSelect()->where("CONCAT(e.firstname, ' ', e.lastname) like '%" . $column->getFilter()->getValue() . "%'"); | ||
} elseif ($column->getId() == 'company') { | ||
$this->getCollection()->getSelect()->where('company like "%' . $column->getFilter()->getValue() . '%"'); | ||
} else { | ||
parent::_addColumnFilterToCollection($column); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* @return Extended | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
*/ | ||
protected function _prepareCollection() | ||
{ | ||
$collection = $this->customerFactory->create()->getCollection()->addAttributeToSelect('*'); | ||
$collection = $this->customerCollectionFactory->create(); | ||
$storeId = (int)$this->getRequest()->getParam('store', 0); | ||
if ($storeId > 0) { | ||
$collection->addStoreFilter($storeId); | ||
|
@@ -156,8 +173,39 @@ protected function _prepareColumns() | |
'column_css_class' => 'col-id' | ||
] | ||
); | ||
$this->addColumn('email', ['header' => __('Email'), 'index' => 'email']); | ||
|
||
// Customer Email Column | ||
$this->addColumn( | ||
'email', | ||
[ | ||
'type' => 'text', | ||
'name' => 'email', | ||
'header' => __('Email'), | ||
'index' => 'email' | ||
] | ||
); | ||
|
||
//Customer Name Column | ||
$this->addColumn( | ||
'name', | ||
[ | ||
'type' => 'text', | ||
'name' => 'name', | ||
'header' => __('Name'), | ||
'index' => 'name' | ||
] | ||
); | ||
|
||
//Customer Company Column | ||
$this->addColumn( | ||
'company', | ||
[ | ||
'type' => 'text', | ||
'name' => 'company', | ||
'header' => __('Company'), | ||
'index' => 'company' | ||
] | ||
); | ||
return parent::_prepareColumns(); | ||
} | ||
|
||
|
@@ -197,4 +245,6 @@ public function getCustomersId() | |
} | ||
return $customerArray; | ||
} | ||
|
||
|
||
} |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Size\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Size\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Size\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Size\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Usage\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
|
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 |
---|---|---|
@@ -1,4 +1,10 @@ | ||
<?php | ||
/** | ||
* CustomLicense | ||
* | ||
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Usage\Edit; | ||
|
||
|
@@ -17,9 +23,8 @@ class CustomLicense implements \Magento\Framework\View\Element\UiComponent\Contr | |
* CustomLicense constructor. | ||
* @param \Magento\Framework\UrlInterface $urlBuilder | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\UrlInterface $urlBuilder | ||
) { | ||
public function __construct(\Magento\Framework\UrlInterface $urlBuilder) | ||
{ | ||
$this->urlBuilder = $urlBuilder; | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Usage\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Usage\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @copyright Copyright © 2018 DevStone. All rights reserved. | ||
* @author [email protected] | ||
*/ | ||
|
||
namespace DevStone\UsageCalculator\Block\Adminhtml\Usage\Edit; | ||
|
||
use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; | ||
|
Oops, something went wrong.