Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
ad18d94489 | |||
453917ea1a | |||
1f2b93baf1 |
@ -15,11 +15,11 @@
|
||||
"currentPage": "1",
|
||||
"showActionColumn": true,
|
||||
"showFiltersRow": true,
|
||||
"filter": true,
|
||||
"total": 10,
|
||||
"paginationPrefix": "/page",
|
||||
"params": {"class": "table table-bordered", "border": "1"}
|
||||
},
|
||||
"filters": ["email", "status"],
|
||||
"data": [
|
||||
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","description2":"ffdghdas", "created_at": "17.06.2024", "status": "1"},
|
||||
{"id": 2,"email":"fas2@mail.ru","description":"fafdgdfgsdfdfs","description2":"ffdghdas", "created_at": "18.06.2024", "status": "1"},
|
||||
|
@ -6,6 +6,7 @@ use Exception;
|
||||
use Itguild\Tables\ActionColumn\DeleteActionColumn;
|
||||
use Itguild\Tables\ActionColumn\EditActionColumn;
|
||||
use Itguild\Tables\ActionColumn\ViewActionColumn;
|
||||
use Itguild\Tables\Filter\InputTextFilter;
|
||||
use Itguild\Tables\traits\CreateParams;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
@ -64,7 +65,7 @@ class ListJsonTable extends JasonTable
|
||||
$this->html .= "<th>" . "ID" . "</th>";
|
||||
$columnKeys[] = "id";
|
||||
}
|
||||
$columnKeys = $this->getColumnKeys();
|
||||
$columnKeys = array_merge($columnKeys, $this->getColumnKeys());
|
||||
$columnKeys = array_merge($columnKeys, $this->getCustomColumnKeys());
|
||||
$this->getCustomHeadColumn();
|
||||
if ($this->showActionColumn) {
|
||||
@ -92,6 +93,9 @@ class ListJsonTable extends JasonTable
|
||||
foreach ($row as $key => $cell) {
|
||||
if ($this->issetColumn($key) and $this->is_fillable($key)) {
|
||||
if($this->beforePrintCell) {
|
||||
if ($key === "id" and $cell === 0){
|
||||
$cell = $this->count;
|
||||
}
|
||||
$cell = $this->getCustomCell($key, $cell);
|
||||
}
|
||||
$this->html .= "<td style='" . $this->getStyleFromCustomColumn($key) . "'>" . $cell . "</td>";
|
||||
@ -144,9 +148,9 @@ class ListJsonTable extends JasonTable
|
||||
|
||||
private function getCurrentFilter(string $column)
|
||||
{
|
||||
if (is_array($this->beforePrintCell[$column])) {
|
||||
if (isset($this->beforePrintCell[$column]) and is_array($this->beforePrintCell[$column])) {
|
||||
if (isset($this->beforePrintCell[$column]['filter'])) {
|
||||
if (is_array($this->beforePrintCell[$column]['filter'])) {
|
||||
if (isset($this->beforePrintCell[$column]['filter']) and is_array($this->beforePrintCell[$column]['filter'])) {
|
||||
return $this->beforePrintCell[$column]['filter'];
|
||||
}
|
||||
}
|
||||
@ -267,12 +271,19 @@ class ListJsonTable extends JasonTable
|
||||
foreach ($columnKeys as $key){
|
||||
if ($this->issetFilter($key)){
|
||||
$filter = $this->getCurrentFilter($key);
|
||||
$class = new $filter['class']([
|
||||
$params = [
|
||||
'param' => $filter['param'] ?? '',
|
||||
'name' => $key,
|
||||
'value' => $filter['value'] ?? '',
|
||||
]);
|
||||
$this->html .= $class->fetch();
|
||||
];
|
||||
if ($filter){
|
||||
$class = new $filter['class']($params);
|
||||
$this->html .= $class->fetch();
|
||||
}
|
||||
else {
|
||||
$class = new InputTextFilter($params);
|
||||
$this->html .= $class->fetch();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->html .= "<td></td>";
|
||||
|
Reference in New Issue
Block a user