first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?php
use KupShop\AdminBundle\AdminList\BaseList;
class PricelevelsList extends BaseList
{
protected $tableName = 'price_levels';
protected ?string $tableAlias = 'pl';
protected $tableDef = [
'id' => 'pl.id',
'fields' => [
'Cenová hladina' => ['field' => 'pl.name'],
'Sleva' => ['field' => 'pl.discount', 'render' => 'renderDiscount'],
'Popis' => ['field' => 'pl.descr'],
],
];
public function renderDiscount($values, $column)
{
global $dbcfg;
$value = $this->getListRowValue($values, $column['field']);
if (isset($values['unit'])) {
switch ($values['unit']) {
case 'perc':
return "{$value}%";
case 'price':
return "{$value} ".$dbcfg->currency;
}
}
return "{$value}";
}
public function getFilterQuery(): \Query\QueryBuilder
{
$qb = parent::getFilterQuery();
if ($name = getVal('name')) {
$qb->andWhere(\KupShop\CatalogBundle\Query\Search::searchFields(
$name,
[
['field' => 'name', 'match' => 'both'],
['field' => 'descr', 'match' => 'both'],
]
));
}
return $qb;
}
}