filter beta0.2

This commit is contained in:
Билай Станислав 2024-08-01 12:50:16 +03:00
parent b7fe32b91d
commit 39931b257b
2 changed files with 25 additions and 9 deletions

View File

@ -4,7 +4,8 @@ namespace Itguild\Tables;
class Filter class Filter
{ {
private array $columnsForFilter; // private array $columnsForFilter;
private string $column;
private string $html = ""; private string $html = "";
private string $baseUrl; private string $baseUrl;

View File

@ -90,7 +90,17 @@ class ListJsonTable
// if($this->filter) // if($this->filter)
// { // {
// foreach ($this->data['meta']['columns'] as $col) {
// $this->html .= "<tr><td>";
// foreach ($this->data['meta']['filters'] as $filter) {
// if ($this->issetFilter($filter))
// {
// $filters = new Filter($filter, )
// }
// }
// //
//
// }
// } // }
$this->count = $this->data["meta"]["perPage"] * ($this->data['meta']["currentPage"] - 1); $this->count = $this->data["meta"]["perPage"] * ($this->data['meta']["currentPage"] - 1);
foreach ($this->data['data'] as $row) { foreach ($this->data['data'] as $row) {
@ -110,14 +120,7 @@ class ListJsonTable
} }
$this->getCustomColumns($row["id"] ?? null); $this->getCustomColumns($row["id"] ?? null);
// if (isset($col['id'])) {
// $newColumn = $this->getColumns($col['id']);
//
// $this->html .= "<td>$newColumn</td></tr>";
// }
// else {
// $this->html .= "<td></td></tr>";
// }
if ($this->showActionColumn) { if ($this->showActionColumn) {
if (isset($row["id"])) { if (isset($row["id"])) {
$actions = $this->getActions($row["id"]); $actions = $this->getActions($row["id"]);
@ -189,6 +192,18 @@ class ListJsonTable
return false; return false;
} }
private function issetFilter($filter): bool
{
if (isset($this->data['meta']['filter'])) {
foreach ($this->data['meta']['filter'] as $key => $currentFilter) {
if ($key === $filter) {
return true;
}
}
}
return false;
}
private function is_fillable($column): bool private function is_fillable($column): bool
{ {
if (isset($this->data['meta']['fillable'])) { if (isset($this->data['meta']['fillable'])) {