user()->hasRole(RoleEnum::PERUSAHAAN->value); } public static function getBadge(Model $ownerRecord, string $pageClass): ?string { return $ownerRecord->cooperationMedia()->count(); } public function table(Table $table): Table { return $table ->columns([ TextColumn::make('partnerMedia.name') ->label('Nama') ->searchable(), TextColumn::make('payment.amount') ->label('Jumlah Pembayaran') ->money('IDR', decimalPlaces: 0) ->placeholder('Belum ditentukan'), TextColumn::make('status') ->label('Status') ->badge(), ]) ->filters([]) ->headerActions([]) ->recordActions([ PayAction::make('pay'), ViewAction::make() ->visible(fn (CooperationMedia $record): bool => $record->status === ApprovalStatus::ACCEPTED && $record->payment()->exists()), ]) ->recordAction(null); } public function infolist(Schema $infolist): Schema { return $infolist ->components([ Grid::make(2) ->schema([ TextEntry::make('payment.amount') ->label('Nominal') ->money('IDR'), TextEntry::make('payment.payment_date') ->label('Tanggal Bayar') ->dateTime(), ]), TextEntry::make('payment.description') ->label('Keterangan') ->visible(fn (CooperationMedia $record): bool => $record->description !== null), ImageEntry::make('payment_proof') ->label('Bukti Pembayaran') ->getStateUsing(fn (CooperationMedia $record): ?string => optional($record->getMedia('cooperations')->where('custom_properties.doc_type', 'payment-proof')->sortByDesc('created_at')->first())->getPathRelativeToRoot()) ->disk(config('filesystems.default')), ]) ->columns(1); } }