Refactor table components to use GenericTableSettings and remove deprecated classes

This commit is contained in:
David
2025-04-25 01:19:30 -04:00
parent 7466083798
commit 9f12bc28d0
17 changed files with 177 additions and 203 deletions

View File

@@ -4,8 +4,10 @@ namespace App\Tables\Extensions;
use Closure;
use Mmt\GenericTable\Attributes\MappedRoute;
use Mmt\GenericTable\Interfaces\ICellData;
use Mmt\GenericTable\Interfaces\IColumn;
use Mmt\GenericTable\Interfaces\IColumnRenderer;
use Mmt\GenericTable\Interfaces\IRowData;
use Str;
class IconColumn implements IColumn, IColumnRenderer
@@ -20,17 +22,19 @@ class IconColumn implements IColumn, IColumnRenderer
private Closure $setIconCallback;
public int $columnIndex;
public function __construct()
{
if($this->databaseColumnName == null)
$this->databaseColumnName = Str::snake($this->columnTitle);
}
public function renderCell(\Illuminate\Database\Eloquent\Model $rowModel): string
public function renderCell(ICellData $cell, IRowData $row): string|null
{
$icon = 'bi bi-arrow-up-right-circle-fill';
if(isset($this->setIconCallback))
$icon = $this->setIconCallback->call($this, $rowModel);
$icon = $this->setIconCallback->call($this, $row);
return <<<HTML
<div class = "w-100 d-flex justify-content-start">