Skip to content

Commit

Permalink
project clean
Browse files Browse the repository at this point in the history
  • Loading branch information
LeMatosDeFuk committed Sep 30, 2023
1 parent 26a06f6 commit f8abf2e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion resources/views/components/column-filter.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@props([
/** @var \BoredProgrammers\LaraGrid\Livewire\Column $column */
/** @var \BoredProgrammers\LaraGrid\Components\Column $column */
'column',
'sortColumn',
'sortDirection',
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/date-range.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@props([
/** @var \BoredProgrammers\LaraGrid\Livewire\Column $column */
/** @var \BoredProgrammers\LaraGrid\Components\Column $column */
'column',
/** @var \BoredProgrammers\LaraGrid\Livewire\Theme $theme */
'theme',
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/select.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@props([
/** @var \BoredProgrammers\LaraGrid\Livewire\Column $column */
/** @var \BoredProgrammers\LaraGrid\Components\Column $column */
'column',
])

Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/text.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@props([
/** @var \BoredProgrammers\LaraGrid\Livewire\Column $column */
/** @var \BoredProgrammers\LaraGrid\Components\Column $column */
'column',
/** @var \BoredProgrammers\LaraGrid\Livewire\Theme $theme */
'theme'
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/grid.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@php
/**
* @var \BoredProgrammers\LaraGrid\Livewire\Column[] $columns
* @var \BoredProgrammers\LaraGrid\Components\Column[] $columns
* @var \BoredProgrammers\LaraGrid\Livewire\Theme $theme
*/
$theme = new $theme(); // fixme - jde to jinak? Nejak mi to blblo a nechtel se objekt passnout z gridu
Expand Down
8 changes: 4 additions & 4 deletions src/Livewire/Column.php → src/Components/Column.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace BoredProgrammers\LaraGrid\Livewire;
namespace BoredProgrammers\LaraGrid\Components;

use Closure;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use BoredProgrammers\LaraGrid\Enums\FilterType;
use BoredProgrammers\LaraGrid\Filters\BaseFilter;
use BoredProgrammers\LaraGrid\Filters\SelectFilterOption;
use Closure;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use UnitEnum;

class Column
Expand Down
9 changes: 8 additions & 1 deletion src/Livewire/BaseGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace BoredProgrammers\LaraGrid\Livewire;

use BoredProgrammers\LaraGrid\Components\Column;
use Exception;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Builder;
Expand All @@ -27,6 +28,8 @@ abstract class BaseGrid extends Component

public int $perPage = 25;

public string $theme;

protected abstract function getColumns();

protected abstract function getDataSource();
Expand All @@ -51,6 +54,10 @@ public function sort($column): void
*/
public function render(): View
{
if (!$this->theme) {
throw new Exception('Theme is not set!');
}

/**
* @var Column[] $columns
* @var Builder $query
Expand Down Expand Up @@ -104,7 +111,7 @@ public function render(): View
);
}

return view('grid', [
return view('livewire.grid', [
'records' => $query->paginate($this->perPage),
'columns' => $columns,
'theme' => $this->theme,
Expand Down
2 changes: 1 addition & 1 deletion src/Livewire/Theme.php → src/Theme/Theme.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace BoredProgrammers\LaraGrid\Livewire;
namespace BoredProgrammers\LaraGrid\Theme;

class Theme
{
Expand Down
2 changes: 1 addition & 1 deletion src/Livewire/UiKitTheme.php → src/Theme/UiKitTheme.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace BoredProgrammers\LaraGrid\Livewire;
namespace BoredProgrammers\LaraGrid\Theme;

class UiKitTheme extends Theme
{
Expand Down

0 comments on commit f8abf2e

Please sign in to comment.