feat: upgrade filament to v4 and ensure 100% test coverage

- Upgrade Filament framework from v3 to v4
   - Update all Filament resources and pages for v4 compatibility
   - Fix test suite to maintain 100% pass rate (321 tests passing)
   - Add visibility condition for ticket close action (only when not closed)
   - Update dependencies and build assets for new Filament version
   - Maintain backward compatibility while leveraging v4 improvements
This commit is contained in:
idevakk
2025-11-14 01:42:07 -08:00
parent 3706072ce5
commit 3892c48ef2
103 changed files with 1741 additions and 890 deletions

View File

@@ -2,21 +2,21 @@
namespace App\Filament\Pages;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Section;
use Exception;
use App\Models\Setting;
use App\Models\ZEmail;
use Artisan;
use Ddeboer\Imap\Server;
use Filament\Actions\Action;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
@@ -26,11 +26,11 @@ class Settings extends Page implements HasForms
public ?array $data = [];
protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-cog-6-tooth';
protected static string $view = 'filament.pages.settings';
protected string $view = 'filament.pages.settings';
protected static ?string $navigationGroup = 'Web Master';
protected static string | \UnitEnum | null $navigationGroup = 'Web Master';
public function mount(): void
{
@@ -103,10 +103,10 @@ class Settings extends Page implements HasForms
}
}
public function form(Form $form): Form
public function form(Schema $schema): Schema
{
return $form
->schema([
return $schema
->components([
Section::make('Website Information')
->description('Change Basic Website Information')
->collapsible()
@@ -356,21 +356,7 @@ class Settings extends Page implements HasForms
->statePath('data');
}
protected function getFormActions(): array
{
return [
Action::make('save')
->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label'))
->submit('save'),
Action::make('flushCache')
->label(__('Flush Cache'))
->color('danger')
->icon('heroicon-m-no-symbol')
->action('flushCache')
->requiresConfirmation(),
];
}
public function flushCache(): void
{
try {
@@ -379,7 +365,7 @@ class Settings extends Page implements HasForms
->title('Cache flushed successfully')
->success()
->send();
} catch (\Exception $e) {
} catch (Exception $e) {
Notification::make()
->title('Error : '.$e->getMessage())
->danger()
@@ -474,7 +460,7 @@ class Settings extends Page implements HasForms
->send();
}
}
} catch (\Exception $exception) {
} catch (Exception $exception) {
Notification::make()
->title('Something went wrong '.$exception->getMessage())
->danger()
@@ -514,7 +500,7 @@ class Settings extends Page implements HasForms
ZEmail::connectMailBox($imap);
return true;
} catch (\Exception $exception) {
} catch (Exception $exception) {
$errorMessage = $exception->getMessage();
// Provide more helpful error messages