Compare commits

..

No commits in common. "master" and "1.1.0" have entirely different histories.

2 changed files with 6 additions and 12 deletions

View File

@ -5,12 +5,12 @@ namespace Itguild\Tables\Filter;
abstract class Filter
{
public string $html = '';
public string|array $params;
public string|array $param;
public string $name;
public string $value;
public function __construct(array $source)
{
$this->params = $source['params'] ?? '';
$this->param = $source['param'] ?? '';
$this->name = $source['name'];
$this->value = $source['value'] ?? '';
}

View File

@ -9,7 +9,6 @@ use Itguild\Tables\ActionColumn\ViewActionColumn;
use Itguild\Tables\Filter\InputTextFilter;
use Itguild\Tables\traits\CreateParams;
use JetBrains\PhpStorm\NoReturn;
use kernel\helpers\Debug;
class ListJsonTable extends JasonTable
{
@ -19,7 +18,6 @@ class ListJsonTable extends JasonTable
private int $count = 0;
private string $baseUrl;
private string $searchPrefix;
private array $data;
private bool $pagination = true;
@ -37,7 +35,6 @@ class ListJsonTable extends JasonTable
$this->json = $json;
$this->data = json_decode($this->json, true);
$this->baseUrl = $this->data['meta']['baseUrl'] ?? '';
$this->searchPrefix = $this->data['meta']['searchPrefix'] ?? '/search';
$this->pagination = $this->data['meta']['pagination'] ?? true;
$this->showActionColumn = $this->data['meta']['showActionColumn'] ?? true;
$this->showFiltersRow = $this->data['meta']['showFiltersRow'] ?? true;
@ -76,8 +73,8 @@ class ListJsonTable extends JasonTable
}
if ($this->showFiltersRow) {
$this->getFilters($columnKeys);
$this->html .= "</thead>";
}
$this->html .= "</thead>";
}
public function createTbody(): void
@ -273,14 +270,12 @@ class ListJsonTable extends JasonTable
private function getFilters(array $columnKeys): void
{
$this->html .= "<tr><form action='$this->baseUrl$this->searchPrefix'>";
$flag = false;
$this->html .= "<tr><form action='$this->baseUrl/search'>";
foreach ($columnKeys as $key) {
if ($this->issetFilter($key)) {
$flag = true;
$filter = $this->getCurrentFilter($key);
$params = [
'params' => $filter['params'] ?? '',
'param' => $filter['param'] ?? '',
'name' => $key,
'value' => $filter['value'] ?? '',
];
@ -295,8 +290,7 @@ class ListJsonTable extends JasonTable
$this->html .= "<td></td>";
}
}
if ($flag) {
$this->showActionColumn = true;
if ($this->showActionColumn) {
$this->html .= "<td><input class='btn btn-primary' type='submit' style='width: 150px' value='Применить'></td>";
}
$this->html .= "</form></tr>";