131 lines
3.3 KiB
PHP
131 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* Copyright © 2016 Magento. All rights reserved.
|
|
* See COPYING.txt for license details.
|
|
*/
|
|
|
|
/**
|
|
* Adminhtml customer grid block
|
|
*
|
|
* @author Magento Core Team <core@magentocommerce.com>
|
|
*/
|
|
namespace Wowow\Devis\Block\Adminhtml\ItemDevis;
|
|
|
|
use Magento\Store\Model\Store;
|
|
use Magento\Framework\App\RequestInterface;
|
|
|
|
|
|
class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
|
|
{
|
|
|
|
/**
|
|
* @var \Magento\Catalog\Model\ProductFactory
|
|
*/
|
|
protected $_itemDevisFactory;
|
|
|
|
/**
|
|
* @param \Magento\Backend\Block\Template\Context $context
|
|
* @param \Magento\Backend\Helper\Data $backendHelper
|
|
* @param \Magento\Store\Model\WebsiteFactory $websiteFactory
|
|
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setsFactory
|
|
* @param \Magento\Catalog\Model\ProductFactory $productFactory
|
|
* @param \Magento\Catalog\Model\Product\Type $type
|
|
* @param \Magento\Catalog\Model\Product\Attribute\Source\Status $status
|
|
* @param \Magento\Catalog\Model\Product\Visibility $visibility
|
|
* @param \Magento\Framework\Module\Manager $moduleManager
|
|
* @param array $data
|
|
*
|
|
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
|
|
*/
|
|
public function __construct(
|
|
\Magento\Backend\Block\Template\Context $context,
|
|
\Magento\Backend\Helper\Data $backendHelper,
|
|
\Wowow\Devis\Model\ItemDevisFactory $itemDevisFactory,
|
|
array $data = []
|
|
) {
|
|
$this->_itemDevisFactory = $itemDevisFactory;
|
|
parent::__construct($context, $backendHelper, $data);
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
protected function _construct()
|
|
{
|
|
parent::_construct();
|
|
$this->setId('itemDevisGrid');
|
|
$this->setDefaultSort('entity_id');
|
|
$this->setDefaultDir('ASC');
|
|
$this->setSaveParametersInSession(true);
|
|
$this->setUseAjax(true);
|
|
$this->setHeaderVisibility(false);
|
|
$this->setFilterVisibility(false);
|
|
}
|
|
|
|
|
|
/**
|
|
* @return $this
|
|
*/
|
|
protected function _prepareCollection()
|
|
{
|
|
|
|
$collection = $this->_itemDevisFactory->create()->getCollection()->addFieldToFilter('devis_id',$this->getRequest()->getParam('id'))->addFieldToSelect(
|
|
'sku'
|
|
)->addFieldToSelect(
|
|
'qty'
|
|
)->addFieldToSelect(
|
|
'prix_unit'
|
|
);
|
|
|
|
$this->setCollection($collection);
|
|
|
|
parent::_prepareCollection();
|
|
|
|
return $this;
|
|
}
|
|
|
|
protected function _prepareLayout()
|
|
{
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return $this
|
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
*/
|
|
protected function _prepareColumns()
|
|
{
|
|
$this->addColumn(
|
|
'sku',
|
|
[
|
|
'header' => __('sku'),
|
|
'index' => 'sku',
|
|
'class' => 'xxx',
|
|
'filter' => false
|
|
]
|
|
);
|
|
|
|
$this->addColumn(
|
|
'qty',
|
|
[
|
|
'header' => __('qty'),
|
|
'index' => 'qty',
|
|
'type' => 'integer',
|
|
'filter' => false
|
|
]
|
|
);
|
|
|
|
$this->addColumn(
|
|
'prix_unit',
|
|
[
|
|
'header' => __('prix_unit'),
|
|
'index' => 'prix_unit',
|
|
'type' => 'text',
|
|
'filter' => false
|
|
]
|
|
);
|
|
|
|
}
|
|
|
|
}
|