40 lines
1.5 KiB
PHP
40 lines
1.5 KiB
PHP
<?php
|
|
|
|
use KupShop\AdminBundle\AdminList\BaseList;
|
|
use KupShop\CatalogBundle\Query\Search;
|
|
|
|
class SuppliersList extends BaseList
|
|
{
|
|
protected $tableName = 'suppliers';
|
|
protected ?string $tableAlias = 's';
|
|
protected $showMassEdit = true;
|
|
|
|
protected $tableDef = [
|
|
'id' => 's.id',
|
|
'fields' => [
|
|
'name' => ['translate' => true, 'field' => 's.name'],
|
|
'ico' => ['translate' => true, 'field' => 's.ico', 'spec' => 's.ico', 'fieldType' => BaseList::TYPE_STRING],
|
|
'dic' => ['translate' => true, 'field' => 's.dic', 'spec' => 's.dic', 'visible' => 'N', 'fieldType' => BaseList::TYPE_STRING],
|
|
'phone' => ['translate' => true, 'field' => 's.phone', 'spec' => 's.phone', 'visible' => 'N', 'fieldType' => BaseList::TYPE_STRING],
|
|
'address' => ['translate' => true, 'field' => 's.address', 'spec' => 's.address', 'fieldType' => BaseList::TYPE_STRING],
|
|
'email' => ['translate' => true, 'field' => 's.email', 'spec' => 's.email', 'fieldType' => BaseList::TYPE_STRING],
|
|
],
|
|
];
|
|
|
|
public function getQuery()
|
|
{
|
|
$qb = sqlQueryBuilder()->select('s.id, s.name')->from('suppliers', 's');
|
|
|
|
if ($value = getVal('value')) {
|
|
$qb->andWhere(Search::searchFields($value, [
|
|
['field' => 's.name', 'match' => 'both'],
|
|
['field' => 's.ico', 'match' => 'both'],
|
|
['field' => 's.email', 'match' => 'both'],
|
|
['field' => 's.phone', 'match' => 'both'],
|
|
]));
|
|
}
|
|
|
|
return $qb;
|
|
}
|
|
}
|