mirror of
https://github.com/bdnugget/module-integration.git
synced 2026-11-07 08:17:27 +00:00
52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
namespace ActiveCampaign\Order\Ui\Component\Listing\Column;
|
|
|
|
use Magento\Framework\Api\SearchCriteriaBuilder;
|
|
use Magento\Framework\View\Element\UiComponent\ContextInterface;
|
|
use Magento\Framework\View\Element\UiComponentFactory;
|
|
use Magento\Sales\Api\OrderRepositoryInterface;
|
|
use Magento\Ui\Component\Listing\Columns\Column;
|
|
|
|
class OrderStatus extends Column
|
|
{
|
|
protected $_orderRepository;
|
|
protected $_searchCriteria;
|
|
|
|
public function __construct(
|
|
ContextInterface $context,
|
|
UiComponentFactory $uiComponentFactory,
|
|
OrderRepositoryInterface $orderRepository,
|
|
SearchCriteriaBuilder $criteria,
|
|
array $components = [],
|
|
array $data = []
|
|
) {
|
|
$this->_orderRepository = $orderRepository;
|
|
$this->_searchCriteria = $criteria;
|
|
parent::__construct($context, $uiComponentFactory, $components, $data);
|
|
}
|
|
|
|
/**
|
|
* @param array $dataSource
|
|
* @return array
|
|
*/
|
|
public function prepareDataSource(array $dataSource)
|
|
{
|
|
if (isset($dataSource['data']['items'])) {
|
|
foreach ($dataSource['data']['items'] as & $item) {
|
|
$order = $this->_orderRepository->get($item["entity_id"]);
|
|
$status = $order->getData("ac_order_sync_status");
|
|
|
|
if ($status) {
|
|
$message = 'Synced';
|
|
} else {
|
|
$message = 'Not Synced';
|
|
}
|
|
|
|
$item[$this->getData('name')] = $message;
|
|
}
|
|
}
|
|
|
|
return $dataSource;
|
|
}
|
|
}
|