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