From cfeb2fc8f34fe6dfd5487b0968c87b8d988e04ed Mon Sep 17 00:00:00 2001 From: Dan Lemon Date: Fri, 20 Feb 2026 19:51:09 +0100 Subject: [PATCH 1/3] chore: improve admin pages with sorting and filtering --- .../Resources/PolydockStoreAppResource.php | 6 +- .../Admin/Resources/PolydockStoreResource.php | 4 +- .../Admin/Resources/UserGroupResource.php | 13 +- app/Filament/Admin/Resources/UserResource.php | 30 ++++- app/Models/PolydockAppInstance.php | 2 + app/Models/PolydockStoreApp.php | 18 +++ composer.json | 15 ++- composer.lock | 114 +++++++++--------- lagoon-docker-compose.yml | 1 - 9 files changed, 124 insertions(+), 79 deletions(-) diff --git a/app/Filament/Admin/Resources/PolydockStoreAppResource.php b/app/Filament/Admin/Resources/PolydockStoreAppResource.php index 7386486..30dba9a 100644 --- a/app/Filament/Admin/Resources/PolydockStoreAppResource.php +++ b/app/Filament/Admin/Resources/PolydockStoreAppResource.php @@ -193,10 +193,12 @@ public static function table(Table $table): Table return $table ->columns([ Tables\Columns\TextColumn::make('name') - ->searchable(), + ->searchable() + ->sortable(), Tables\Columns\TextColumn::make('store.name') ->label('Store') - ->searchable(), + ->searchable() + ->sortable(), Tables\Columns\TextColumn::make('status'), Tables\Columns\IconColumn::make('available_for_trials') ->label('Trials') diff --git a/app/Filament/Admin/Resources/PolydockStoreResource.php b/app/Filament/Admin/Resources/PolydockStoreResource.php index 8e73a19..47a2f4f 100644 --- a/app/Filament/Admin/Resources/PolydockStoreResource.php +++ b/app/Filament/Admin/Resources/PolydockStoreResource.php @@ -129,9 +129,11 @@ public static function form(Form $form): Form public static function table(Table $table): Table { return $table + ->searchable() ->columns([ Tables\Columns\TextColumn::make('name') - ->searchable(), + ->searchable() + ->sortable(), Tables\Columns\TextColumn::make('status'), Tables\Columns\IconColumn::make('listed_in_marketplace') ->label('Listed') diff --git a/app/Filament/Admin/Resources/UserGroupResource.php b/app/Filament/Admin/Resources/UserGroupResource.php index bdba816..06a23e8 100644 --- a/app/Filament/Admin/Resources/UserGroupResource.php +++ b/app/Filament/Admin/Resources/UserGroupResource.php @@ -37,14 +37,17 @@ public static function form(Form $form): Form public static function table(Table $table): Table { return $table + ->searchable() ->columns([ - TextColumn::make('name'), + TextColumn::make('name') + ->searchable() + ->sortable(), TextColumn::make('users_count') ->counts('users') - ->label('Users'), - ]) - ->filters([ - // + ->label('Users') + ->sortable(), + TextColumn::make('created_at')->dateTime() + ->sortable(), ]) ->actions([ Tables\Actions\ViewAction::make(), diff --git a/app/Filament/Admin/Resources/UserResource.php b/app/Filament/Admin/Resources/UserResource.php index 630fe67..85d478c 100644 --- a/app/Filament/Admin/Resources/UserResource.php +++ b/app/Filament/Admin/Resources/UserResource.php @@ -57,17 +57,35 @@ public static function form(Form $form): Form public static function table(Table $table): Table { return $table + ->searchable() ->columns([ - TextColumn::make('first_name'), - TextColumn::make('last_name'), - TextColumn::make('email'), + TextColumn::make('first_name') + ->searchable() + ->sortable(), + TextColumn::make('last_name') + ->searchable() + ->sortable(), + TextColumn::make('email') + ->searchable() + ->sortable(), TextColumn::make('groups_count') ->counts('groups') - ->label('Groups'), - TextColumn::make('created_at')->dateTime(), + ->label('Groups') + ->sortable(), + TextColumn::make('created_at')->dateTime() + ->sortable(), ]) ->filters([ - // + Tables\Filters\Filter::make('created_from') + ->form([ + Forms\Components\DatePicker::make('created_from'), + ]) + ->query(function ($query, array $data) { + return $query->when( + $data['created_from'], + fn ($query) => $query->where('created_at', '>=', $data['created_from']), + ); + }), ]) ->actions([ Tables\Actions\ViewAction::make(), diff --git a/app/Models/PolydockAppInstance.php b/app/Models/PolydockAppInstance.php index 161b4ae..ab01784 100644 --- a/app/Models/PolydockAppInstance.php +++ b/app/Models/PolydockAppInstance.php @@ -273,6 +273,8 @@ protected static function boot() 'lagoon-project-name' => $model->name, 'amazee-ai-backend-region-id' => $storeApp->amazee_ai_backend_region_id_ext, 'available-for-trials' => $storeApp->available_for_trials, + 'lagoon-auto-idle' => $storeApp->lagoon_auto_idle, + 'lagoon-production-environment' => $storeApp->lagoon_production_environment, 'lagoon-generate-app-admin-username' => $model->generateUniqueUsername(), 'lagoon-generate-app-admin-password' => $model->generateUniquePassword(), 'polydock-app-instance-health-webhook-url' => str_replace(':status:', '', route('api.instance.health', [ diff --git a/app/Models/PolydockStoreApp.php b/app/Models/PolydockStoreApp.php index 67e0f8b..2203843 100644 --- a/app/Models/PolydockStoreApp.php +++ b/app/Models/PolydockStoreApp.php @@ -90,6 +90,8 @@ class PolydockStoreApp extends Model 'unallocated_instances_count', 'needs_more_unallocated_instances', 'lagoon_deploy_group_name', + 'lagoon_auto_idle', + 'lagoon_production_environment', ]; /** @@ -218,4 +220,20 @@ public function getLagoonDeployGroupNameAttribute(): ?string { return $this->store->lagoon_deploy_group_name; } + + /** + * Get the Lagoon autoIdle setting from app_config + */ + public function getLagoonAutoIdleAttribute(): ?int + { + return $this->app_config['lagoon_auto_idle'] ?? 0; + } + + /** + * Get the Lagoon production environment from app_config + */ + public function getLagoonProductionEnvironmentAttribute(): ?string + { + return $this->app_config['lagoon_production_environment'] ?? null; + } } diff --git a/composer.json b/composer.json index cfc78f7..b275dd4 100644 --- a/composer.json +++ b/composer.json @@ -1,21 +1,24 @@ { "$schema": "https://getcomposer.org/schema.json", - "name": "laravel/laravel", + "name": "amazeeio/polydock-engine", "type": "project", "description": "The skeleton application for the Laravel framework.", - "keywords": ["laravel", "framework"], + "keywords": [ + "laravel", + "framework" + ], "license": "MIT", "require": { "php": "^8.3", "ext-curl": "*", "amazeeio/lagoon-logs": "^0.0.5", - "amazeeio/polydock-app-amazeeio-privategpt": "^0.0.11", + "amazeeio/polydock-app-amazeeio-privategpt": "^0.0.12", "evanschleret/lara-mjml": "^0.3.0", "filament/filament": "^3.2", - "freedomtech-hosting/ft-lagoon-php": "^0.0.11", + "freedomtech-hosting/ft-lagoon-php": "^0.0.12", "freedomtech-hosting/polydock-amazeeai-backend-client-php": "^0.0.6", - "freedomtech-hosting/polydock-app": "^0.0.30", - "freedomtech-hosting/polydock-app-amazeeio-generic": "^0.0.79", + "freedomtech-hosting/polydock-app": "^0.0.31", + "freedomtech-hosting/polydock-app-amazeeio-generic": "^0.0.80", "laravel/framework": "^11.31", "laravel/horizon": "^5.30", "laravel/sanctum": "^4.0", diff --git a/composer.lock b/composer.lock index 6818511..271e4cf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e310386e38a65e83d5071a758d2bc500", + "content-hash": "5cbbb6108dd82589b638b5949a3a7986", "packages": [ { "name": "amazeeio/lagoon-logs", @@ -55,28 +55,28 @@ }, { "name": "amazeeio/polydock-app-amazeeio-privategpt", - "version": "v0.0.11", + "version": "v0.0.12", "source": { "type": "git", "url": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt.git", - "reference": "f19eb47855515e104bf64d3cb78e538be84af641" + "reference": "66696550d88cf4b61b97046c848f5d7c8f8c5f27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amazeeio/polydock-app-amazeeio-privategpt/zipball/f19eb47855515e104bf64d3cb78e538be84af641", - "reference": "f19eb47855515e104bf64d3cb78e538be84af641", + "url": "https://api.github.com/repos/amazeeio/polydock-app-amazeeio-privategpt/zipball/66696550d88cf4b61b97046c848f5d7c8f8c5f27", + "reference": "66696550d88cf4b61b97046c848f5d7c8f8c5f27", "shasum": "" }, "require": { - "cuyz/valinor": "^1.0", - "freedomtech-hosting/ft-lagoon-php": "^0.0.11", - "freedomtech-hosting/polydock-app": "^0.0.30", - "freedomtech-hosting/polydock-app-amazeeio-generic": "^0.0.79", - "guzzlehttp/guzzle": "^7.0" + "cuyz/valinor": "^2.3.2", + "freedomtech-hosting/ft-lagoon-php": "^0.0.12", + "freedomtech-hosting/polydock-app": "^0.0.31", + "freedomtech-hosting/polydock-app-amazeeio-generic": "^0.0.80", + "guzzlehttp/guzzle": "^7.10.0" }, "require-dev": { - "laravel/pint": "^1.22", - "mockery/mockery": "*", + "laravel/pint": "^1.27.1", + "mockery/mockery": "^1.6.12", "orchestra/testbench": "*", "phpstan/extension-installer": "*", "phpstan/phpstan": "^1.10", @@ -102,9 +102,9 @@ "description": "Polydock App - amazee.io PrivateGPT with Direct API Integration", "support": { "issues": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt/issues", - "source": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt/tree/v0.0.11" + "source": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt/tree/v0.0.12" }, - "time": "2026-02-18T20:41:03+00:00" + "time": "2026-02-20T18:34:53+00:00" }, { "name": "anourvalar/eloquent-serialize", @@ -453,30 +453,28 @@ }, { "name": "cuyz/valinor", - "version": "1.17.0", + "version": "2.3.2", "source": { "type": "git", "url": "https://github.com/CuyZ/Valinor.git", - "reference": "9eb2802797e36f3af1fd6e13ff23e4e3d0058022" + "reference": "3b9f3f54901371d589776502aab3da3a046801a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CuyZ/Valinor/zipball/9eb2802797e36f3af1fd6e13ff23e4e3d0058022", - "reference": "9eb2802797e36f3af1fd6e13ff23e4e3d0058022", + "url": "https://api.github.com/repos/CuyZ/Valinor/zipball/3b9f3f54901371d589776502aab3da3a046801a7", + "reference": "3b9f3f54901371d589776502aab3da3a046801a7", "shasum": "" }, "require": { - "composer-runtime-api": "^2.0", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", - "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" }, "conflict": { "phpstan/phpstan": "<1.0 || >= 3.0", "vimeo/psalm": "<5.0 || >=7.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.4", - "infection/infection": "^0.29", + "friendsofphp/php-cs-fixer": "^3.91", + "infection/infection": "^0.31", "marcocesarato/php-conventional-changelog": "^1.12", "mikey179/vfsstream": "^1.6.10", "phpbench/phpbench": "^1.3", @@ -504,7 +502,7 @@ "homepage": "https://github.com/romm" } ], - "description": "Library that helps to map any input into a strongly-typed value object structure.", + "description": "Dependency free PHP library that helps to map any input into a strongly-typed structure.", "homepage": "https://github.com/CuyZ/Valinor", "keywords": [ "array", @@ -519,7 +517,7 @@ ], "support": { "issues": "https://github.com/CuyZ/Valinor/issues", - "source": "https://github.com/CuyZ/Valinor/tree/1.17.0" + "source": "https://github.com/CuyZ/Valinor/tree/2.3.2" }, "funding": [ { @@ -527,7 +525,7 @@ "type": "github" } ], - "time": "2025-06-20T06:40:38+00:00" + "time": "2026-01-23T15:26:34+00:00" }, { "name": "danharrin/date-format-converter", @@ -1230,7 +1228,7 @@ }, { "name": "filament/actions", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/actions.git", @@ -1283,7 +1281,7 @@ }, { "name": "filament/filament", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/panels.git", @@ -1348,16 +1346,16 @@ }, { "name": "filament/forms", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "45f6e9337d60154f2d0ad3b2c4e47f7e16912971" + "reference": "c64bf142f808d292b0c6c21fdd3c75cbef9e9d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/45f6e9337d60154f2d0ad3b2c4e47f7e16912971", - "reference": "45f6e9337d60154f2d0ad3b2c4e47f7e16912971", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/c64bf142f808d292b0c6c21fdd3c75cbef9e9d30", + "reference": "c64bf142f808d292b0c6c21fdd3c75cbef9e9d30", "shasum": "" }, "require": { @@ -1400,11 +1398,11 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2026-02-07T21:51:43+00:00" + "time": "2026-02-19T23:07:33+00:00" }, { "name": "filament/infolists", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/infolists.git", @@ -1455,7 +1453,7 @@ }, { "name": "filament/notifications", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", @@ -1507,7 +1505,7 @@ }, { "name": "filament/support", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", @@ -1566,7 +1564,7 @@ }, { "name": "filament/tables", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", @@ -1618,7 +1616,7 @@ }, { "name": "filament/widgets", - "version": "v3.3.48", + "version": "v3.3.49", "source": { "type": "git", "url": "https://github.com/filamentphp/widgets.git", @@ -1662,16 +1660,16 @@ }, { "name": "freedomtech-hosting/ft-lagoon-php", - "version": "v0.0.11", + "version": "v0.0.12", "source": { "type": "git", "url": "https://github.com/amazeeio/polydock-lagoon-php-lib.git", - "reference": "f9c12b2be5b204c6ba37a64c86ace8af4745da23" + "reference": "2543ae3aea1f3d5e176e6c918c8e8c6b4cc27cb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amazeeio/polydock-lagoon-php-lib/zipball/f9c12b2be5b204c6ba37a64c86ace8af4745da23", - "reference": "f9c12b2be5b204c6ba37a64c86ace8af4745da23", + "url": "https://api.github.com/repos/amazeeio/polydock-lagoon-php-lib/zipball/2543ae3aea1f3d5e176e6c918c8e8c6b4cc27cb7", + "reference": "2543ae3aea1f3d5e176e6c918c8e8c6b4cc27cb7", "shasum": "" }, "require": { @@ -1698,9 +1696,9 @@ "description": "The Freedom Tech Lagoon PHP library", "support": { "issues": "https://github.com/amazeeio/polydock-lagoon-php-lib/issues", - "source": "https://github.com/amazeeio/polydock-lagoon-php-lib/tree/v0.0.11" + "source": "https://github.com/amazeeio/polydock-lagoon-php-lib/tree/v0.0.12" }, - "time": "2026-02-17T11:31:32+00:00" + "time": "2026-02-20T12:39:54+00:00" }, { "name": "freedomtech-hosting/polydock-amazeeai-backend-client-php", @@ -1745,16 +1743,16 @@ }, { "name": "freedomtech-hosting/polydock-app", - "version": "v0.0.30", + "version": "v0.0.31", "source": { "type": "git", "url": "https://github.com/amazeeio/polydock-app-lib.git", - "reference": "b779e9dac1b8fea63e9f617931991c840674436c" + "reference": "cf234a3d6722cd01f0296e0fc01c34e3553c9340" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amazeeio/polydock-app-lib/zipball/b779e9dac1b8fea63e9f617931991c840674436c", - "reference": "b779e9dac1b8fea63e9f617931991c840674436c", + "url": "https://api.github.com/repos/amazeeio/polydock-app-lib/zipball/cf234a3d6722cd01f0296e0fc01c34e3553c9340", + "reference": "cf234a3d6722cd01f0296e0fc01c34e3553c9340", "shasum": "" }, "require": { @@ -1779,28 +1777,28 @@ "description": "Library for Polydock Apps", "support": { "issues": "https://github.com/amazeeio/polydock-app-lib/issues", - "source": "https://github.com/amazeeio/polydock-app-lib/tree/v0.0.30" + "source": "https://github.com/amazeeio/polydock-app-lib/tree/v0.0.31" }, - "time": "2026-02-13T02:15:27+00:00" + "time": "2026-02-20T18:31:16+00:00" }, { "name": "freedomtech-hosting/polydock-app-amazeeio-generic", - "version": "v0.0.79", + "version": "v0.0.80", "source": { "type": "git", "url": "https://github.com/amazeeio/polydock-app-amazeeio-generic.git", - "reference": "ab18815f8f26d605e9af32dc5e551ce3fb2fc81d" + "reference": "459b0e91e04bf489a36279bf80a94cea361db6ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amazeeio/polydock-app-amazeeio-generic/zipball/ab18815f8f26d605e9af32dc5e551ce3fb2fc81d", - "reference": "ab18815f8f26d605e9af32dc5e551ce3fb2fc81d", + "url": "https://api.github.com/repos/amazeeio/polydock-app-amazeeio-generic/zipball/459b0e91e04bf489a36279bf80a94cea361db6ef", + "reference": "459b0e91e04bf489a36279bf80a94cea361db6ef", "shasum": "" }, "require": { - "freedomtech-hosting/ft-lagoon-php": "^0.0.11", + "freedomtech-hosting/ft-lagoon-php": "^0.0.12", "freedomtech-hosting/polydock-amazeeai-backend-client-php": "^0.0.6", - "freedomtech-hosting/polydock-app": "^0.0.30" + "freedomtech-hosting/polydock-app": "^0.0.31" }, "type": "library", "autoload": { @@ -1821,9 +1819,9 @@ "description": "Polydock App - amazee.io Generic", "support": { "issues": "https://github.com/amazeeio/polydock-app-amazeeio-generic/issues", - "source": "https://github.com/amazeeio/polydock-app-amazeeio-generic/tree/v0.0.79" + "source": "https://github.com/amazeeio/polydock-app-amazeeio-generic/tree/v0.0.80" }, - "time": "2026-02-18T20:37:21+00:00" + "time": "2026-02-20T18:33:49+00:00" }, { "name": "fruitcake/php-cors", diff --git a/lagoon-docker-compose.yml b/lagoon-docker-compose.yml index ceb9101..425ea9e 100644 --- a/lagoon-docker-compose.yml +++ b/lagoon-docker-compose.yml @@ -50,7 +50,6 @@ services: lagoon.name: worker lagoon.persistent.name: nginx lagoon.persistent: /app/storage/ - mariadb: image: uselagoon/mysql-8.0 From bb395e059dfe614ea691868d4d9c8be64ba9f2c2 Mon Sep 17 00:00:00 2001 From: Dan Lemon Date: Fri, 20 Feb 2026 20:13:00 +0100 Subject: [PATCH 2/3] bump deps --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index b275dd4..9f6a482 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "php": "^8.3", "ext-curl": "*", "amazeeio/lagoon-logs": "^0.0.5", - "amazeeio/polydock-app-amazeeio-privategpt": "^0.0.12", + "amazeeio/polydock-app-amazeeio-privategpt": "^0.0.13", "evanschleret/lara-mjml": "^0.3.0", "filament/filament": "^3.2", "freedomtech-hosting/ft-lagoon-php": "^0.0.12", diff --git a/composer.lock b/composer.lock index 271e4cf..619a6b2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5cbbb6108dd82589b638b5949a3a7986", + "content-hash": "2b6342ce3c11cc91087fd3c28bfc7d71", "packages": [ { "name": "amazeeio/lagoon-logs", @@ -55,16 +55,16 @@ }, { "name": "amazeeio/polydock-app-amazeeio-privategpt", - "version": "v0.0.12", + "version": "v0.0.13", "source": { "type": "git", "url": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt.git", - "reference": "66696550d88cf4b61b97046c848f5d7c8f8c5f27" + "reference": "fe64d58fc223e6b7e2754c154c1f253b39296078" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amazeeio/polydock-app-amazeeio-privategpt/zipball/66696550d88cf4b61b97046c848f5d7c8f8c5f27", - "reference": "66696550d88cf4b61b97046c848f5d7c8f8c5f27", + "url": "https://api.github.com/repos/amazeeio/polydock-app-amazeeio-privategpt/zipball/fe64d58fc223e6b7e2754c154c1f253b39296078", + "reference": "fe64d58fc223e6b7e2754c154c1f253b39296078", "shasum": "" }, "require": { @@ -102,9 +102,9 @@ "description": "Polydock App - amazee.io PrivateGPT with Direct API Integration", "support": { "issues": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt/issues", - "source": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt/tree/v0.0.12" + "source": "https://github.com/amazeeio/polydock-app-amazeeio-privategpt/tree/v0.0.13" }, - "time": "2026-02-20T18:34:53+00:00" + "time": "2026-02-20T19:01:43+00:00" }, { "name": "anourvalar/eloquent-serialize", From f1e2d395dbf1862422091a6a476380b633238461 Mon Sep 17 00:00:00 2001 From: Dan Lemon Date: Fri, 20 Feb 2026 20:20:31 +0100 Subject: [PATCH 3/3] chore: additional page improvements --- .../Resources/PolydockAppInstanceResource.php | 18 ++++++-- .../UserRemoteRegistrationResource.php | 45 ++++++++++++++++--- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/app/Filament/Admin/Resources/PolydockAppInstanceResource.php b/app/Filament/Admin/Resources/PolydockAppInstanceResource.php index 40970c5..6934d89 100644 --- a/app/Filament/Admin/Resources/PolydockAppInstanceResource.php +++ b/app/Filament/Admin/Resources/PolydockAppInstanceResource.php @@ -50,10 +50,12 @@ public static function form(Form $form): Form public static function table(Table $table): Table { return $table + ->searchable() ->columns([ TextColumn::make('name') ->description(fn ($record) => $record->storeApp->store->name.' - '.$record->storeApp->name) - ->searchable(), + ->searchable() + ->sortable(), TextColumn::make('userGroup.name') ->label('User Group') ->searchable(), @@ -61,14 +63,16 @@ public static function table(Table $table): Table ->badge() ->color(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getColor()) ->icon(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getIcon()) - ->formatStateUsing(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getLabel()), + ->formatStateUsing(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getLabel()) + ->sortable(), TextColumn::make('is_trial') ->state(fn ($record) => $record->is_trial ? 'Yes' : 'No') ->label('Trial'), TextColumn::make('trial_ends_at') ->label('Trial Ends At') ->description(fn ($record) => $record->trial_completed ? 'Trial completed' : 'Trial active') - ->dateTime(), + ->dateTime() + ->sortable(), TextColumn::make('send_midtrial_email_at') ->label('Midtrial Email') ->description(fn ($record) => $record->midtrial_email_sent ? 'Sent' : 'Pending') @@ -86,6 +90,14 @@ public static function table(Table $table): Table ->state(fn ($record) => $record->is_trial && $record->trial_complete_email_sent ? 'Sent' : ($record->is_trial ? 'Pending' : '')), + TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + TextColumn::make('updated_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), ]) ->filters([ SelectFilter::make('status') diff --git a/app/Filament/Admin/Resources/UserRemoteRegistrationResource.php b/app/Filament/Admin/Resources/UserRemoteRegistrationResource.php index aaaada9..9e91b3d 100644 --- a/app/Filament/Admin/Resources/UserRemoteRegistrationResource.php +++ b/app/Filament/Admin/Resources/UserRemoteRegistrationResource.php @@ -3,7 +3,10 @@ namespace App\Filament\Admin\Resources; use App\Filament\Admin\Resources\UserRemoteRegistrationResource\Pages; +use App\Models\PolydockStore; +use App\Models\PolydockStoreApp; use App\Models\UserRemoteRegistration; +use Filament\Forms; use Filament\Forms\Form; use Filament\Resources\Resource; use Filament\Tables; @@ -36,17 +39,30 @@ public static function form(Form $form): Form public static function table(Table $table): Table { return $table + ->searchable() ->columns([ TextColumn::make('type') ->badge() ->color(fn ($state): string => $state ? $state->getColor() : 'gray') ->icon(fn ($state): string => $state ? $state->getIcon() : '') ->sortable(), - TextColumn::make('email'), - TextColumn::make('user.name'), - TextColumn::make('userGroup.name'), - TextColumn::make('storeApp.store.name'), - TextColumn::make('storeApp.name'), + TextColumn::make('email') + ->searchable() + ->sortable(), + TextColumn::make('user.name') + ->searchable() + ->sortable(), + TextColumn::make('userGroup.name') + ->searchable() + ->sortable(), + TextColumn::make('storeApp.store.name') + ->label('Store') + ->searchable() + ->sortable(), + TextColumn::make('storeApp.name') + ->label('Store App') + ->searchable() + ->sortable(), TextColumn::make('status') ->badge() ->color(fn ($state): string => match ($state->value) { @@ -55,10 +71,25 @@ public static function table(Table $table): Table 'success' => 'success', 'failed' => 'danger', default => 'gray', + }) + ->sortable(), + TextColumn::make('created_at')->dateTime() + ->sortable(), + ]) + ->filters([ + Tables\Filters\SelectFilter::make('store_id') + ->label('Store') + ->options(fn () => PolydockStore::pluck('name', 'id')) + ->query(function ($query, array $data) { + return $query->when($data['value'], fn ($query) => $query->whereHas('storeApp', fn ($q) => $q->where('polydock_store_id', $data['value']))); + }), + Tables\Filters\SelectFilter::make('store_app_id') + ->label('Store App') + ->options(fn () => PolydockStoreApp::pluck('name', 'id')) + ->query(function ($query, array $data) { + return $query->when($data['value'], fn ($query) => $query->where('polydock_store_app_id', $data['value'])); }), - TextColumn::make('created_at')->dateTime(), ]) - ->filters([]) ->actions([ Tables\Actions\ViewAction::make(), ])