From a08a23ae2526eed6453819f5ced11aea9d33a7f2 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Tue, 21 Jul 2026 14:51:46 +0700 Subject: [PATCH] feat: enhance task assignment form with date pickers, numeric input, and textarea for improved user input --- .../TaskAssignmentRelationManager.php | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/app/Filament/Resources/Manage/Cooperations/RelationManagers/TaskAssignmentRelationManager.php b/app/Filament/Resources/Manage/Cooperations/RelationManagers/TaskAssignmentRelationManager.php index 987dad1..37aa2d3 100644 --- a/app/Filament/Resources/Manage/Cooperations/RelationManagers/TaskAssignmentRelationManager.php +++ b/app/Filament/Resources/Manage/Cooperations/RelationManagers/TaskAssignmentRelationManager.php @@ -11,6 +11,9 @@ use App\Filament\Support\CheerfulNotification; use Filament\Actions\BulkActionGroup; use Filament\Actions\DeleteBulkAction; +use Filament\Forms\Components\DatePicker; +use Filament\Forms\Components\Textarea; +use Filament\Forms\Components\TextInput; use Filament\Resources\RelationManagers\RelationManager; use Filament\Support\Icons\Heroicon; use Filament\Tables\Columns\TextColumn; @@ -25,6 +28,11 @@ class TaskAssignmentRelationManager extends RelationManager protected static bool $shouldSkipAuthorization = true; + public function isReadOnly(): bool + { + return false; + } + public static function canViewForRecord(Model $ownerRecord, string $pageClass): bool { if (auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value)) { @@ -64,6 +72,35 @@ public function table(Table $table): Table ->headerActions([ CreateAction::make() ->label('Buat Media Order') + ->modalWidth('md') + ->schema([ + DatePicker::make('start_date') + ->label('Tanggal Mulai') + ->native(false) + ->displayFormat('l, d F Y') + ->required(), + + DatePicker::make('end_date') + ->label('Tanggal Selesai') + ->native(false) + ->displayFormat('l, d F Y') + ->required() + ->afterOrEqual('start_date'), + + TextInput::make('report_amount') + ->label('Jumlah Bukti Tayang') + ->numeric() + ->minValue(1) + ->required() + ->autocomplete(false), + + Textarea::make('task_description') + ->label('Deskripsi Tugas') + ->required() + ->rows(4) + ->placeholder('...') + ->autocomplete(false), + ]) ->visible(function (): bool { $user = auth()->user(); @@ -93,6 +130,35 @@ public function table(Table $table): Table ]) ->recordActions([ EditAction::make() + ->modalWidth('md') + ->schema([ + DatePicker::make('start_date') + ->label('Tanggal Mulai') + ->native(false) + ->displayFormat('l, d F Y') + ->required(), + + DatePicker::make('end_date') + ->label('Tanggal Selesai') + ->native(false) + ->displayFormat('l, d F Y') + ->required() + ->afterOrEqual('start_date'), + + TextInput::make('report_amount') + ->label('Jumlah Bukti Tayang') + ->numeric() + ->minValue(1) + ->required() + ->autocomplete(false), + + Textarea::make('task_description') + ->label('Deskripsi Tugas') + ->required() + ->rows(4) + ->placeholder('...') + ->autocomplete(false), + ]) ->successNotification( fn () => CheerfulNotification::success( CheerfulNotification::getByKey('cooperation.assignment_updated'),