user()->hasRole(RoleEnum::PERUSAHAAN->value)) { return $ownerRecord->cooperationMedia() ->whereHas('partnerMedia.company', function ($query) { $query->where('user_id', auth()->id()); }) ->accepted() ->exists(); } return true; } public function table(Table $table): Table { return $table ->columns([ ...RowIndexColumn::make(), TextColumn::make('start_date') ->label('Tanggal Mulai') ->date('l, d F Y'), TextColumn::make('end_date') ->label('Tanggal Selesai') ->date('l, d F Y'), TextColumn::make('task_description') ->label('Deskripsi Tugas') ->limit(50), TextColumn::make('report_amount') ->label('Jumlah Bukti Tayang'), ]) ->headerActions([ CreateAction::make() ->label('Buat Media Order') ->visible(function (): bool { $cooperation = $this->getOwnerRecord(); return $cooperation->proposal()->accepted()->exists() && ! $cooperation->taskAssignment()->exists(); }) ->successNotification( fn () => CheerfulNotification::success( CheerfulNotification::getByKey('cooperation.assignment_success'), CheerfulNotification::getByKey('cooperation.assignment_set_success') ) ), ]) ->recordActions([ EditAction::make() ->successNotification( fn () => CheerfulNotification::success( CheerfulNotification::getByKey('cooperation.assignment_updated'), CheerfulNotification::getByKey('cooperation.assignment_updated_desc') ) ), DeleteAction::make() ->successNotification( fn () => CheerfulNotification::success( CheerfulNotification::getByKey('cooperation.assignment_deleted'), CheerfulNotification::getByKey('cooperation.assignment_deleted_desc') ) ), ]) ->toolbarActions([ BulkActionGroup::make([ DeleteBulkAction::make() ->successNotification( fn () => CheerfulNotification::success( CheerfulNotification::getByKey('cooperation.assignment_deleted_success'), CheerfulNotification::getByKey('cooperation.bulk_assignment_deleted') ) ), ]), ]) ->emptyStateIcon(Heroicon::OutlinedArchiveBoxXMark) ->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.assignment_empty_heading')) ->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.assignment_empty')); } }