diff --git a/app/Concerns/HasSortOrder.php b/app/Concerns/HasSortOrder.php new file mode 100644 index 00000000..320e94fd --- /dev/null +++ b/app/Concerns/HasSortOrder.php @@ -0,0 +1,20 @@ +fillable[] = 'sort'; + } + + protected static function bootHasSortOrder(): void + { + static::addGlobalScope(new SortOrder); + } +} diff --git a/app/Filament/Admin/Resources/BenefitResource.php b/app/Filament/Admin/Resources/BenefitResource.php index ee29da9a..ba2f3d47 100644 --- a/app/Filament/Admin/Resources/BenefitResource.php +++ b/app/Filament/Admin/Resources/BenefitResource.php @@ -16,6 +16,7 @@ use Filament\Forms\Components\Toggle; use Filament\Forms\Form; use Filament\Resources\Resource; +use Filament\Tables\Actions\Action as TableAction; use Filament\Tables\Actions\CreateAction; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; @@ -87,6 +88,15 @@ public static function table(Table $table): Table ->url(self::getUrl('create')), ]) ->heading(__('nomenclature.headings.benefit_table')) + ->reorderable('sort') + ->defaultSort('sort') + ->reorderRecordsTriggerAction( + fn (TableAction $action) => $action + ->icon(null) + ->button() + ->outlined() + ->color('primary') + ) ->columns([ TextColumn::make('name') ->label(__('nomenclature.labels.benefit')), diff --git a/app/Filament/Admin/Resources/ResultResource.php b/app/Filament/Admin/Resources/ResultResource.php index a501dce3..56429538 100644 --- a/app/Filament/Admin/Resources/ResultResource.php +++ b/app/Filament/Admin/Resources/ResultResource.php @@ -13,6 +13,7 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Resources\Resource; +use Filament\Tables\Actions\Action as TableAction; use Filament\Tables\Actions\CreateAction; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; @@ -48,6 +49,15 @@ public static function table(Table $table): Table CreateAction::make() ->label(__('nomenclature.actions.add_result')), ]) + ->reorderable('sort') + ->defaultSort('sort') + ->reorderRecordsTriggerAction( + fn (TableAction $action) => $action + ->icon(null) + ->button() + ->outlined() + ->color('primary') + ) ->columns([ TextColumn::make('name') ->label(__('nomenclature.labels.result_name')), diff --git a/app/Filament/Admin/Resources/RoleResource.php b/app/Filament/Admin/Resources/RoleResource.php index 859dcd05..0b8bdaad 100644 --- a/app/Filament/Admin/Resources/RoleResource.php +++ b/app/Filament/Admin/Resources/RoleResource.php @@ -18,6 +18,7 @@ use Filament\Forms\Components\Toggle; use Filament\Forms\Form; use Filament\Resources\Resource; +use Filament\Tables\Actions\Action as TableAction; use Filament\Tables\Actions\CreateAction; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Filters\SelectFilter; @@ -81,6 +82,15 @@ public static function table(Table $table): Table ->label(__('nomenclature.actions.add_role')), ]) + ->reorderable('sort') + ->defaultSort('sort') + ->reorderRecordsTriggerAction( + fn (TableAction $action) => $action + ->icon(null) + ->button() + ->outlined() + ->color('primary') + ) ->columns([ TextColumn::make('name') ->label(__('nomenclature.labels.role_name')), diff --git a/app/Filament/Admin/Resources/ServiceResource.php b/app/Filament/Admin/Resources/ServiceResource.php index 2b1524a6..353f2bf2 100644 --- a/app/Filament/Admin/Resources/ServiceResource.php +++ b/app/Filament/Admin/Resources/ServiceResource.php @@ -21,6 +21,7 @@ use Filament\Forms\Form; use Filament\Forms\Get; use Filament\Resources\Resource; +use Filament\Tables\Actions\Action as TableAction; use Filament\Tables\Actions\CreateAction; use Filament\Tables\Actions\ViewAction; use Filament\Tables\Columns\TextColumn; @@ -141,6 +142,15 @@ public static function table(Table $table): Table { return $table ->modifyQueryUsing(fn (Builder $query) => $query->withCount(['organizationServices'])) + ->reorderable('sort') + ->defaultSort('sort') + ->reorderRecordsTriggerAction( + fn (TableAction $action) => $action + ->icon(null) + ->button() + ->outlined() + ->color('primary') + ) ->columns([ TextColumn::make('name') ->label(__('nomenclature.labels.name')) diff --git a/app/Models/Benefit.php b/app/Models/Benefit.php index 0e36d7c9..714e25d8 100644 --- a/app/Models/Benefit.php +++ b/app/Models/Benefit.php @@ -5,6 +5,7 @@ namespace App\Models; use App\Concerns\HasGeneralStatus; +use App\Concerns\HasSortOrder; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -14,6 +15,7 @@ class Benefit extends Model { use HasFactory; use HasGeneralStatus; + use HasSortOrder; protected $fillable = [ 'name', diff --git a/app/Models/BenefitType.php b/app/Models/BenefitType.php index c916462f..ea24f6bb 100644 --- a/app/Models/BenefitType.php +++ b/app/Models/BenefitType.php @@ -5,7 +5,7 @@ namespace App\Models; use App\Concerns\HasGeneralStatus; -use App\Models\Scopes\SortOrder; +use App\Concerns\HasSortOrder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -14,19 +14,13 @@ class BenefitType extends Model { use HasFactory; use HasGeneralStatus; + use HasSortOrder; protected $fillable = [ 'benefit_id', 'name', - 'sort', ]; - protected static function booted() - { - parent::booted(); - static::addGlobalScope(new SortOrder); - } - public function benefit(): BelongsTo { return $this->belongsTo(Benefit::class); diff --git a/app/Models/Result.php b/app/Models/Result.php index 48596f5a..dd5c2d40 100644 --- a/app/Models/Result.php +++ b/app/Models/Result.php @@ -5,6 +5,7 @@ namespace App\Models; use App\Concerns\HasGeneralStatus; +use App\Concerns\HasSortOrder; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -14,6 +15,7 @@ class Result extends Model { use HasFactory; use HasGeneralStatus; + use HasSortOrder; protected $fillable = [ 'name', diff --git a/app/Models/Role.php b/app/Models/Role.php index 0781891e..55755fcf 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -5,6 +5,7 @@ namespace App\Models; use App\Concerns\HasGeneralStatus; +use App\Concerns\HasSortOrder; use App\Enums\AdminPermission; use App\Enums\CasePermission; use Illuminate\Database\Eloquent\Casts\AsEnumCollection; @@ -16,6 +17,7 @@ class Role extends Model { use HasFactory; use HasGeneralStatus; + use HasSortOrder; protected $fillable = [ 'name', diff --git a/app/Models/Service.php b/app/Models/Service.php index f7763688..469dae8c 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -5,6 +5,7 @@ namespace App\Models; use App\Concerns\HasGeneralStatus; +use App\Concerns\HasSortOrder; use App\Enums\CounselingSheet; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -15,6 +16,7 @@ class Service extends Model { use HasFactory; use HasGeneralStatus; + use HasSortOrder; protected $fillable = [ 'name', diff --git a/app/Models/ServiceIntervention.php b/app/Models/ServiceIntervention.php index cc5e45e1..e217f50c 100644 --- a/app/Models/ServiceIntervention.php +++ b/app/Models/ServiceIntervention.php @@ -5,7 +5,7 @@ namespace App\Models; use App\Concerns\HasGeneralStatus; -use App\Models\Scopes\SortOrder; +use App\Concerns\HasSortOrder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -16,19 +16,13 @@ class ServiceIntervention extends Model { use HasFactory; use HasGeneralStatus; + use HasSortOrder; protected $fillable = [ 'service_id', 'name', - 'sort', ]; - protected static function booted() - { - parent::booted(); - static::addGlobalScope(new SortOrder); - } - public function service(): BelongsTo { return $this->belongsTo(Service::class); diff --git a/database/migrations/2025_01_10_004906_add_sort_column_in_services_table.php b/database/migrations/2025_01_10_004906_add_sort_column_in_services_table.php new file mode 100644 index 00000000..25a977ad --- /dev/null +++ b/database/migrations/2025_01_10_004906_add_sort_column_in_services_table.php @@ -0,0 +1,17 @@ +integer('sort')->default(0); + }); + } +}; diff --git a/database/migrations/2025_01_10_005052_add_sort_column_in_benefits_table.php b/database/migrations/2025_01_10_005052_add_sort_column_in_benefits_table.php new file mode 100644 index 00000000..647e475d --- /dev/null +++ b/database/migrations/2025_01_10_005052_add_sort_column_in_benefits_table.php @@ -0,0 +1,17 @@ +integer('sort')->default(0); + }); + } +}; diff --git a/database/migrations/2025_01_10_005204_add_sort_column_in_results_table.php b/database/migrations/2025_01_10_005204_add_sort_column_in_results_table.php new file mode 100644 index 00000000..0199c89b --- /dev/null +++ b/database/migrations/2025_01_10_005204_add_sort_column_in_results_table.php @@ -0,0 +1,17 @@ +integer('sort')->default(0); + }); + } +}; diff --git a/database/migrations/2025_01_10_005232_add_sort_column_in_roles_table.php b/database/migrations/2025_01_10_005232_add_sort_column_in_roles_table.php new file mode 100644 index 00000000..4b4a6133 --- /dev/null +++ b/database/migrations/2025_01_10_005232_add_sort_column_in_roles_table.php @@ -0,0 +1,17 @@ +integer('sort')->default(0); + }); + } +}; diff --git a/lang/vendor/filament-tables/ro/table.php b/lang/vendor/filament-tables/ro/table.php new file mode 100644 index 00000000..6e6ec4e2 --- /dev/null +++ b/lang/vendor/filament-tables/ro/table.php @@ -0,0 +1,16 @@ + [ + + 'disable_reordering' => [ + 'label' => 'Salvează modificările', + ], + + 'enable_reordering' => [ + 'label' => 'Ordonează lista', + ], + ], +]; diff --git a/resources/views/vendor/filament-tables/index.blade.php b/resources/views/vendor/filament-tables/index.blade.php new file mode 100644 index 00000000..01d02307 --- /dev/null +++ b/resources/views/vendor/filament-tables/index.blade.php @@ -0,0 +1,1298 @@ +@php + use Filament\Support\Enums\Alignment; + use Filament\Support\Enums\VerticalAlignment; + use Filament\Support\Facades\FilamentView; + use Filament\Tables\Columns\Column; + use Filament\Tables\Columns\ColumnGroup; + use Filament\Tables\Enums\ActionsPosition; + use Filament\Tables\Enums\FiltersLayout; + use Filament\Tables\Enums\RecordCheckboxPosition; + use Illuminate\Support\Str; + + $actions = $getActions(); + $flatActionsCount = count($getFlatActions()); + $actionsAlignment = $getActionsAlignment(); + $actionsPosition = $getActionsPosition(); + $actionsColumnLabel = $getActionsColumnLabel(); + $activeFiltersCount = $getActiveFiltersCount(); + $columns = $getVisibleColumns(); + $collapsibleColumnsLayout = $getCollapsibleColumnsLayout(); + $columnsLayout = $getColumnsLayout(); + $content = $getContent(); + $contentGrid = $getContentGrid(); + $contentFooter = $getContentFooter(); + $filterIndicators = $getFilterIndicators(); + $hasColumnGroups = $hasColumnGroups(); + $hasColumnsLayout = $hasColumnsLayout(); + $hasSummary = $hasSummary(); + $header = $getHeader(); + $headerActions = array_filter( + $getHeaderActions(), + fn (\Filament\Tables\Actions\Action | \Filament\Tables\Actions\BulkAction | \Filament\Tables\Actions\ActionGroup $action): bool => $action->isVisible(), + ); + $headerActionsPosition = $getHeaderActionsPosition(); + $heading = $getHeading(); + $group = $getGrouping(); + $bulkActions = array_filter( + $getBulkActions(), + fn (\Filament\Tables\Actions\BulkAction | \Filament\Tables\Actions\ActionGroup $action): bool => $action->isVisible(), + ); + $groups = $getGroups(); + $description = $getDescription(); + $isGroupsOnly = $isGroupsOnly() && $group; + $isReorderable = $isReorderable(); + $isReordering = $isReordering(); + $areGroupingSettingsVisible = (! $isReordering) && count($groups) && (! $areGroupingSettingsHidden()); + $isGroupingDirectionSettingHidden = $isGroupingDirectionSettingHidden(); + $isColumnSearchVisible = $isSearchableByColumn(); + $isGlobalSearchVisible = $isSearchable(); + $isSearchOnBlur = $isSearchOnBlur(); + $isSelectionEnabled = $isSelectionEnabled() && (! $isGroupsOnly); + $selectsCurrentPageOnly = $selectsCurrentPageOnly(); + $recordCheckboxPosition = $getRecordCheckboxPosition(); + $isStriped = $isStriped(); + $isLoaded = $isLoaded(); + $hasFilters = $isFilterable(); + $filtersLayout = $getFiltersLayout(); + $filtersTriggerAction = $getFiltersTriggerAction(); + $hasFiltersDialog = $hasFilters && in_array($filtersLayout, [FiltersLayout::Dropdown, FiltersLayout::Modal]); + $hasFiltersAboveContent = $hasFilters && in_array($filtersLayout, [FiltersLayout::AboveContent, FiltersLayout::AboveContentCollapsible]); + $hasFiltersAboveContentCollapsible = $hasFilters && ($filtersLayout === FiltersLayout::AboveContentCollapsible); + $hasFiltersBelowContent = $hasFilters && ($filtersLayout === FiltersLayout::BelowContent); + $hasColumnToggleDropdown = $hasToggleableColumns(); + $hasHeader = $header || $heading || $description || ($headerActions && (! $isReordering)) || $isReorderable || $areGroupingSettingsVisible || $isGlobalSearchVisible || $hasFilters || count($filterIndicators) || $hasColumnToggleDropdown; + $hasHeaderToolbar = $isReorderable || $areGroupingSettingsVisible || $isGlobalSearchVisible || $hasFiltersDialog || $hasColumnToggleDropdown; + $pluralModelLabel = $getPluralModelLabel(); + $records = $isLoaded ? $getRecords() : null; + $searchDebounce = $getSearchDebounce(); + $allSelectableRecordsCount = ($isSelectionEnabled && $isLoaded) ? $getAllSelectableRecordsCount() : null; + $columnsCount = count($columns); + $reorderRecordsTriggerAction = $getReorderRecordsTriggerAction($isReordering); + $toggleColumnsTriggerAction = $getToggleColumnsTriggerAction(); + $page = $this->getTablePage(); + $defaultSortOptionLabel = $getDefaultSortOptionLabel(); + + if (count($actions) && (! $isReordering)) { + $columnsCount++; + } + + if ($isSelectionEnabled || $isReordering) { + $columnsCount++; + } + + if ($group) { + $groupedSummarySelectedState = $this->getTableSummarySelectedState($this->getAllTableSummaryQuery(), modifyQueryUsing: fn (\Illuminate\Database\Query\Builder $query) => $group->groupQuery($query, model: $getQuery()->getModel())); + } + + $getHiddenClasses = function (Column | ColumnGroup $column): ?string { + if ($breakpoint = $column->getHiddenFrom()) { + return match ($breakpoint) { + 'sm' => 'sm:hidden', + 'md' => 'md:hidden', + 'lg' => 'lg:hidden', + 'xl' => 'xl:hidden', + '2xl' => '2xl:hidden', + }; + } + + if ($breakpoint = $column->getVisibleFrom()) { + return match ($breakpoint) { + 'sm' => 'hidden sm:table-cell', + 'md' => 'hidden md:table-cell', + 'lg' => 'hidden lg:table-cell', + 'xl' => 'hidden xl:table-cell', + '2xl' => 'hidden 2xl:table-cell', + }; + } + + return null; + }; +@endphp + +
$records === null, + ]) +> + +
+ + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::HEADER_BEFORE, scopes: static::class) }} + + @if ($header) + {{ $header }} + @elseif (($heading || $description || $headerActions) && ! $isReordering) + @php + if ($reorderRecordsTriggerAction){ + array_unshift($headerActions, $reorderRecordsTriggerAction); + } + @endphp + + + + @elseif($isReordering && $reorderRecordsTriggerAction) + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_REORDER_TRIGGER_BEFORE, scopes: static::class) }} + + + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_REORDER_TRIGGER_AFTER, scopes: static::class) }} + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::HEADER_AFTER, scopes: static::class) }} + + @if ($hasFiltersAboveContent) +
+ + + @if ($hasFiltersAboveContentCollapsible) + + {{ $filtersTriggerAction->badge($activeFiltersCount) }} + + @endif +
+ @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_BEFORE, scopes: static::class) }} + +
+ {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_START, scopes: static::class) }} + +
+ + @if ((! $isReordering) && count($bulkActions)) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_GROUPING_SELECTOR_BEFORE, scopes: static::class) }} + + @if ($areGroupingSettingsVisible) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_GROUPING_SELECTOR_AFTER, scopes: static::class) }} +
+ + @if ($isGlobalSearchVisible || $hasFiltersDialog || $hasColumnToggleDropdown) +
+ {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_SEARCH_BEFORE, scopes: static::class) }} + + @if ($isGlobalSearchVisible) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_SEARCH_AFTER, scopes: static::class) }} + + @if ($hasFiltersDialog || $hasColumnToggleDropdown) + @if ($hasFiltersDialog) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_TOGGLE_COLUMN_TRIGGER_BEFORE, scopes: static::class) }} + + @if ($hasColumnToggleDropdown) + + @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_TOGGLE_COLUMN_TRIGGER_AFTER, scopes: static::class) }} + @endif +
+ @endif + + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_END) }} +
+ + {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\Tables\View\TablesRenderHook::TOOLBAR_AFTER) }} +
+ + @if ($isReordering) + + @elseif ($isSelectionEnabled && $isLoaded) + + @endif + + @if (count($filterIndicators)) + + @endif + +
! $hasHeader, + ]) + > + @if (($content || $hasColumnsLayout) && ($records !== null) && count($records)) + @if (! $isReordering) + @php + $sortableColumns = array_filter( + $columns, + fn (\Filament\Tables\Columns\Column $column): bool => $column->isSortable(), + ); + @endphp + + @if ($isSelectionEnabled || count($sortableColumns)) +
+ @if ($isSelectionEnabled && (! $isReordering)) + + @endif + + @if (count($sortableColumns)) +
+ + + +
+ @endif +
+ @endif + @endif + + @if ($content) + {{ $content->with(['records' => $records]) }} + @else + $contentGrid, + 'pt-0' => $contentGrid && $this->getTableGrouping(), + 'gap-y-px bg-gray-200 dark:bg-white/5' => ! $contentGrid, + ]) + > + @php + $previousRecord = null; + $previousRecordGroupKey = null; + $previousRecordGroupTitle = null; + @endphp + + @foreach ($records as $record) + @php + $recordAction = $getRecordAction($record); + $recordKey = $getRecordKey($record); + $recordUrl = $getRecordUrl($record); + $openRecordUrlInNewTab = $shouldOpenRecordUrlInNewTab($record); + $recordGroupKey = $group?->getStringKey($record); + $recordGroupTitle = $group?->getTitle($record); + + $collapsibleColumnsLayout?->record($record); + $hasCollapsibleColumnsLayout = (bool) $collapsibleColumnsLayout?->isVisible(); + @endphp + + @if ($recordGroupTitle !== $previousRecordGroupTitle) + @if ($hasSummary && (! $isReordering) && filled($previousRecordGroupTitle)) + + + + @endif + + $contentGrid, + ]) + :x-bind:class="$hasSummary ? null : '{ \'-mb-4 border-b-0\': isGroupCollapsed(' . \Illuminate\Support\Js::from($recordGroupTitle) . ') }'" + > + @if ($isSelectionEnabled) + +
+ +
+
+ @endif +
+ @endif + +
($recordUrl || $recordAction) && (! $contentGrid), + 'hover:bg-gray-50 dark:hover:bg-white/10 dark:hover:ring-white/20' => ($recordUrl || $recordAction) && $contentGrid, + 'rounded-xl shadow-sm ring-1 ring-gray-950/5 dark:bg-white/5 dark:ring-white/10' => $contentGrid, + ...$getRecordClasses($record), + ]) + x-bind:class="{ + 'hidden': + {{ $group?->isCollapsible() ? 'true' : 'false' }} && + isGroupCollapsed( + {{ \Illuminate\Support\Js::from($recordGroupTitle) }}, + ), + {{ ($contentGrid ? '\'bg-gray-50 dark:bg-white/10 dark:ring-white/20\'' : '\'bg-gray-50 dark:bg-white/5 before:absolute before:start-0 before:inset-y-0 before:w-0.5 before:bg-primary-600 dark:before:bg-primary-500\'') . ': isRecordSelected(\'' . $recordKey . '\')' }}, + {{ $contentGrid ? '\'bg-white dark:bg-white/5 dark:ring-white/10\': ! isRecordSelected(\'' . $recordKey . '\')' : '\'\':\'\'' }}, + }" + > + @php + $hasItemBeforeRecordContent = $isReordering || ($isSelectionEnabled && $isRecordSelectable($record)); + $isRecordCollapsible = $hasCollapsibleColumnsLayout && (! $isReordering); + $hasItemAfterRecordContent = $isRecordCollapsible; + $recordHasActions = count($actions) && (! $isReordering); + + $recordContentHorizontalPaddingClasses = \Illuminate\Support\Arr::toCssClasses([ + 'ps-3' => (! $contentGrid) && $hasItemBeforeRecordContent, + 'ps-4 sm:ps-6' => (! $contentGrid) && (! $hasItemBeforeRecordContent), + 'pe-3' => (! $contentGrid) && $hasItemAfterRecordContent, + 'pe-4 sm:pe-6' => (! $contentGrid) && (! $hasItemAfterRecordContent), + 'ps-2' => $contentGrid && $hasItemBeforeRecordContent, + 'ps-4' => $contentGrid && (! $hasItemBeforeRecordContent), + 'pe-2' => $contentGrid && $hasItemAfterRecordContent, + 'pe-4' => $contentGrid && (! $hasItemAfterRecordContent), + ]); + + $recordActionsClasses = \Illuminate\Support\Arr::toCssClasses([ + 'md:ps-3' => (! $contentGrid), + 'order-first' => $actionsPosition === ActionsPosition::BeforeColumns, + 'ps-3' => (! $contentGrid) && $hasItemBeforeRecordContent, + 'ps-4 sm:ps-6' => (! $contentGrid) && (! $hasItemBeforeRecordContent), + 'pe-3' => (! $contentGrid) && $hasItemAfterRecordContent, + 'pe-4 sm:pe-6' => (! $contentGrid) && (! $hasItemAfterRecordContent), + 'ps-2' => $contentGrid && $hasItemBeforeRecordContent, + 'ps-4' => $contentGrid && (! $hasItemBeforeRecordContent), + 'pe-2' => $contentGrid && $hasItemAfterRecordContent, + 'pe-4' => $contentGrid && (! $hasItemAfterRecordContent), + ]); + @endphp + +
(! $contentGrid) && $hasItemBeforeRecordContent, + 'pe-1 sm:pe-3' => (! $contentGrid) && $hasItemAfterRecordContent, + 'ps-1' => $contentGrid && $hasItemBeforeRecordContent, + 'pe-1' => $contentGrid && $hasItemAfterRecordContent, + ]) + > + @if ($isReordering) + + @elseif ($isSelectionEnabled && $isRecordSelectable($record)) + + @endif + + @php + $recordContentClasses = \Illuminate\Support\Arr::toCssClasses([ + $recordContentHorizontalPaddingClasses, + 'block w-full', + ]); + @endphp + +
! $contentGrid, + ]) + > +
+ @if ($recordUrl) + + + + @elseif ($recordAction) + @php + $recordWireClickAction = $getAction($recordAction) + ? "mountTableAction('{$recordAction}', '{$recordKey}')" + : $recordWireClickAction = "{$recordAction}('{$recordKey}')"; + @endphp + + + @else +
+ +
+ @endif + + @if ($hasCollapsibleColumnsLayout && (! $isReordering)) +
+ {{ $collapsibleColumnsLayout->viewData(['recordKey' => $recordKey]) }} +
+ @endif +
+ + @if ($recordHasActions) + + @endif +
+ + @if ($isRecordCollapsible) + + @endif +
+
+ + @php + $previousRecordGroupKey = $recordGroupKey; + $previousRecordGroupTitle = $recordGroupTitle; + $previousRecord = $record; + @endphp + @endforeach + + @if ($hasSummary && (! $isReordering) && filled($previousRecordGroupTitle) && ((! $records instanceof \Illuminate\Contracts\Pagination\Paginator) || (! $records->hasMorePages()))) + + + + @endif +
+ @endif + + @if (($content || $hasColumnsLayout) && $contentFooter) + {{ + $contentFooter->with([ + 'columns' => $columns, + 'records' => $records, + ]) + }} + @endif + + @if ($hasSummary && (! $isReordering)) + + + + @endif + @elseif (($records !== null) && count($records)) + + @if ($hasColumnGroups) + + @if ($isReordering) + + @else + @if (count($actions) && in_array($actionsPosition, [ActionsPosition::BeforeCells, ActionsPosition::BeforeColumns])) + + @endif + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) + + @endif + @endif + + @foreach ($columnsLayout as $columnGroup) + @if ($columnGroup instanceof Column) + @if ($columnGroup->isVisible() && (! $columnGroup->isToggledHidden())) + + @endif + @elseif ($columnGroup instanceof ColumnGroup) + @php + $columnGroupAlignment = $columnGroup->getAlignment(); + $columnGroupColumnsCount = count($columnGroup->getVisibleColumns()); + $isColumnGroupHeaderWrapped = $columnGroup->isHeaderWrapped(); + @endphp + + @if ($columnGroupColumnsCount) + getExtraHeaderAttributeBag()->class([ + 'fi-table-header-group-cell border-gray-200 px-3 py-2 dark:border-white/5 sm:first-of-type:ps-6 sm:last-of-type:pe-6 [&:not(:first-of-type)]:border-s [&:not(:last-of-type)]:border-e', + ]) + }} + > +
! $isColumnGroupHeaderWrapped, + 'whitespace-normal' => $isColumnGroupHeaderWrapped, + match ($columnGroupAlignment) { + Alignment::Start => 'justify-start', + Alignment::Center => 'justify-center', + Alignment::End => 'justify-end', + Alignment::Left => 'justify-start rtl:flex-row-reverse', + Alignment::Right => 'justify-end rtl:flex-row-reverse', + Alignment::Justify, Alignment::Between => 'justify-between', + default => $columnGroupAlignment, + }, + $getHiddenClasses($columnGroup), + ]) + > + + {{ $columnGroup->getLabel() }} + +
+ + @endif + @endif + @endforeach + + @if (! $isReordering) + @if (count($actions) && in_array($actionsPosition, [ActionsPosition::AfterColumns, ActionsPosition::AfterCells])) + + @endif + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells) + + @endif + @endif +
+ @endif + + + @if ($isReordering) + + @else + @if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells) + @if ($actionsColumnLabel) + + {{ $actionsColumnLabel }} + + @else + + @endif + @endif + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) + + + + @endif + + @if (count($actions) && $actionsPosition === ActionsPosition::BeforeColumns) + @if ($actionsColumnLabel) + + {{ $actionsColumnLabel }} + + @else + + @endif + @endif + @endif + + @foreach ($columns as $column) + @php + $columnWidth = $column->getWidth(); + @endphp + + + {{ $column->getLabel() }} + + @endforeach + + @if (! $isReordering) + @if (count($actions) && $actionsPosition === ActionsPosition::AfterColumns) + @if ($actionsColumnLabel) + + {{ $actionsColumnLabel }} + + @else + + @endif + @endif + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells) + + + + @endif + + @if (count($actions) && $actionsPosition === ActionsPosition::AfterCells) + @if ($actionsColumnLabel) + + {{ $actionsColumnLabel }} + + @else + + @endif + @endif + @endif + + + @if ($isColumnSearchVisible) + + @if ($isReordering) + + @else + @if (count($actions) && in_array($actionsPosition, [ActionsPosition::BeforeCells, ActionsPosition::BeforeColumns])) + + @endif + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) + + @endif + @endif + + @foreach ($columns as $column) + getName())->camel()->kebab(), + 'px-3 py-2', + ]) + > + @if ($column->isIndividuallySearchable()) + + @endif + + @endforeach + + @if (! $isReordering) + @if (count($actions) && in_array($actionsPosition, [ActionsPosition::AfterColumns, ActionsPosition::AfterCells])) + + @endif + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells) + + @endif + @endif + + @endif + + @if (($records !== null) && count($records)) + @php + $isRecordRowStriped = false; + $previousRecord = null; + $previousRecordGroupKey = null; + $previousRecordGroupTitle = null; + @endphp + + @foreach ($records as $record) + @php + $recordAction = $getRecordAction($record); + $recordKey = $getRecordKey($record); + $recordUrl = $getRecordUrl($record); + $openRecordUrlInNewTab = $shouldOpenRecordUrlInNewTab($record); + $recordGroupKey = $group?->getStringKey($record); + $recordGroupTitle = $group?->getTitle($record); + @endphp + + @if ($recordGroupTitle !== $previousRecordGroupTitle) + @if ($hasSummary && (! $isReordering) && filled($previousRecordGroupTitle)) + + @endif + + @if (! $isGroupsOnly) + + @php + $groupHeaderColspan = $columnsCount; + + if ($isSelectionEnabled) { + $groupHeaderColspan--; + + if ( + ($recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) && + count($actions) && + ($actionsPosition === ActionsPosition::BeforeCells) + ) { + $groupHeaderColspan--; + } + } + @endphp + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) + @if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells) + + @endif + + + + + @endif + + + + + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells) + + + + @endif + + @endif + + @php + $isRecordRowStriped = false; + @endphp + @endif + + @if (! $isGroupsOnly) + $isReordering, + ...$getRecordClasses($record), + ]) + > + @if ($isReordering) + + + + @endif + + @if (count($actions) && $actionsPosition === ActionsPosition::BeforeCells && (! $isReordering)) + + + + @endif + + @if ($isSelectionEnabled && ($recordCheckboxPosition === RecordCheckboxPosition::BeforeCells) && (! $isReordering)) + + @if ($isRecordSelectable($record)) + + @endif + + @endif + + @if (count($actions) && $actionsPosition === ActionsPosition::BeforeColumns && (! $isReordering)) + + + + @endif + + @foreach ($columns as $column) + @php + $column->record($record); + $column->rowLoop($loop->parent); + @endphp + + + + + @endforeach + + @if (count($actions) && $actionsPosition === ActionsPosition::AfterColumns && (! $isReordering)) + + + + @endif + + @if ($isSelectionEnabled && $recordCheckboxPosition === RecordCheckboxPosition::AfterCells && (! $isReordering)) + + @if ($isRecordSelectable($record)) + + @endif + + @endif + + @if (count($actions) && $actionsPosition === ActionsPosition::AfterCells) + $isReordering, + ]) + > + + + @endif + + @endif + + @php + $isRecordRowStriped = ! $isRecordRowStriped; + $previousRecord = $record; + $previousRecordGroupKey = $recordGroupKey; + $previousRecordGroupTitle = $recordGroupTitle; + @endphp + @endforeach + + @if ($hasSummary && (! $isReordering) && filled($previousRecordGroupTitle) && ((! $records instanceof \Illuminate\Contracts\Pagination\Paginator) || (! $records->hasMorePages()))) + + @endif + + @if ($hasSummary && (! $isReordering)) + + @endif + + @if ($contentFooter) + + {{ + $contentFooter->with([ + 'columns' => $columns, + 'records' => $records, + ]) + }} + + @endif + @endif +
+ @elseif ($records === null) +
+ @elseif ($emptyState = $getEmptyState()) + {{ $emptyState }} + @else + + + + + + @endif +
+ + @if ((($records instanceof \Illuminate\Contracts\Pagination\Paginator) || ($records instanceof \Illuminate\Contracts\Pagination\CursorPaginator)) && + ((! ($records instanceof \Illuminate\Contracts\Pagination\LengthAwarePaginator)) || $records->total())) + + @endif + + @if ($hasFiltersBelowContent) + + @endif +
+ + +