diff --git a/app/Filament/Resources/Manage/Cooperations/RelationManagers/CooperationMediaRelationManager.php b/app/Filament/Resources/Manage/Cooperations/RelationManagers/CooperationMediaRelationManager.php
index 8ddf452..909dad6 100644
--- a/app/Filament/Resources/Manage/Cooperations/RelationManagers/CooperationMediaRelationManager.php
+++ b/app/Filament/Resources/Manage/Cooperations/RelationManagers/CooperationMediaRelationManager.php
@@ -2,8 +2,11 @@
namespace App\Filament\Resources\Manage\Cooperations\RelationManagers;
-use Filament\Actions\ViewAction;
+use App\Filament\Resources\Manage\Partners\PartnerResource;
+use App\Models\CooperationMedia;
+use Filament\Actions\Action;
use Filament\Resources\RelationManagers\RelationManager;
+use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
@@ -35,9 +38,15 @@ public function table(Table $table): Table
->filters([])
->headerActions([])
->recordActions([
- ViewAction::make(),
+ Action::make('view')
+ ->label('Lihat')
+ ->icon(Heroicon::Eye)
+ ->url(
+ fn (CooperationMedia $record): string => PartnerResource::getUrl('view', [
+ 'record' => $record->partnerMedia->company->user_id,
+ ])
+ ),
])
- ->toolbarActions([])
->recordAction(null);
}
}
diff --git a/app/Filament/Resources/Manage/Partners/Pages/ViewPartner.php b/app/Filament/Resources/Manage/Partners/Pages/ViewPartner.php
new file mode 100644
index 0000000..1232ece
--- /dev/null
+++ b/app/Filament/Resources/Manage/Partners/Pages/ViewPartner.php
@@ -0,0 +1,11 @@
+components([
- TextInput::make('name')
- ->required()
- ->maxLength(255),
- ]);
+ ->schema([
+ Section::make('Akun')
+ ->schema([
+ Grid::make(3)
+ ->schema([
+ TextEntry::make('name')
+ ->label('Nama'),
+
+ TextEntry::make('email')
+ ->label('Email'),
+
+ TextEntry::make('username')
+ ->label('Nama Pengguna'),
+
+ TextEntry::make('is_active')
+ ->label('Status')
+ ->badge(),
+
+ TextEntry::make('email_verified_at')
+ ->label('Email Verifikasi')
+ ->placeholder('Akun Belum Diverifikasi')
+ ->dateTime('l, d F Y H:i'),
+ ]),
+ ]),
+
+ Section::make('Perusahaan')
+ ->schema([
+ Grid::make(3)
+ ->schema([
+ TextEntry::make('company.name')
+ ->label('Nama'),
+
+ TextEntry::make('company.email')
+ ->label('Email'),
+
+ TextEntry::make('company.address')
+ ->label('Alamat'),
+
+ TextEntry::make('company.director_name')
+ ->label('Nama Direktur'),
+
+ TextEntry::make('company.validated_at')
+ ->label('Tanggal Validasi')
+ ->dateTime('d F Y H:i'),
+
+ TextEntry::make('company.rejection_reason')
+ ->label('Alasan Penolakan')
+ ->visible(fn ($record) => $record->company?->rejection_reason),
+ ]),
+
+ Grid::make(3)
+ ->schema([
+ Section::make('NIK Direktur')
+ ->schema([
+ TextEntry::make('company.director_nik')
+ ->hiddenLabel(),
+
+ TextEntry::make('company.director_nik_docs')
+ ->hiddenLabel()
+ ->html()
+ ->getStateUsing(function ($record) {
+ $media = $record->company
+ ?->getMedia('companies')
+ ->where('custom_properties.doc_type', 'director-nik')
+ ->sortByDesc('created_at')
+ ->first();
+
+ if (! $media) {
+ return 'Tidak ada dokumen';
+ }
+
+ $url = $media->getUrl();
+ $mime = $media->mime_type;
+
+ if (str_contains($mime, 'image')) {
+ return '
';
+ }
+
+ if (str_contains($mime, 'pdf')) {
+ return '';
+ }
+
+ return 'Unduh Dokumen';
+ }),
+ ]),
+
+ Section::make('Akta Pendirian')
+ ->schema([
+ TextEntry::make('company.deed_incorporation')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.deed_incorporation'),
+ ]),
+
+ Section::make('SIUP')
+ ->schema([
+ TextEntry::make('company.trade_license')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.trade_license'),
+ ]),
+
+ Section::make('NPWP')
+ ->schema([
+ TextEntry::make('company.tax_id_number')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.tax_id_number'),
+ ]),
+
+ Section::make('PKP')
+ ->schema([
+ TextEntry::make('company.taxable_enterprise')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.taxable_enterprise'),
+ ]),
+
+ Section::make('SPT Tahunan')
+ ->schema([
+ TextEntry::make('company.annual_tax_return')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.annual_tax_return'),
+ ]),
+
+ Section::make('SK Domisili')
+ ->schema([
+ TextEntry::make('company.domicile_certificate')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.domicile_certificate'),
+ ]),
+
+ Section::make('Profil Perusahaan')
+ ->schema([
+ TextEntry::make('company.profile')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.profile'),
+ ]),
+ ]),
+ ]),
+
+ Section::make('Media')
+ ->schema([
+ Grid::make(4)
+ ->schema([
+ TextEntry::make('company.partnerMedia.name')
+ ->label('Nama'),
+
+ TextEntry::make('company.partnerMedia.link')
+ ->label('Tautan')
+ ->url(fn ($record) => $record->company?->partnerMedia?->link, true),
+
+ TextEntry::make('company.partnerMedia.type')
+ ->label('Jenis')
+ ->badge(),
+
+ TextEntry::make('company.partnerMedia.classification')
+ ->label('Klasifikasi')
+ ->badge(),
+
+ TextEntry::make('company.partnerMedia.address')
+ ->label('Alamat')
+ ->columnSpanFull(),
+ ]),
+
+ Grid::make(2)
+ ->schema([
+ Section::make('Sertifikat Organisasi Kewartawanan')
+ ->schema([
+ TextEntry::make('company.partnerMedia.journalism_organization')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.partnerMedia.journalism_organization', 'company.partnerMedia', 'partnerMedia'),
+ ]),
+
+ Section::make('Sertifikat Dewan Pers')
+ ->schema([
+ TextEntry::make('company.partnerMedia.press_council_certificate')
+ ->hiddenLabel(),
+
+ self::fileEntry('company.partnerMedia.press_council_certificate', 'company.partnerMedia', 'partnerMedia'),
+ ]),
+ ]),
+ ]),
+
+ Section::make('Jurnalis')
+ ->schema([
+ RepeatableEntry::make('company.partnerMedia.journalists')
+ ->hiddenLabel()
+ ->schema([
+ Grid::make(3)
+ ->schema([
+ TextEntry::make('name')
+ ->label('Nama'),
+
+ TextEntry::make('email')
+ ->label('Email'),
+
+ TextEntry::make('phone_number')
+ ->label('No. Telepon'),
+ ]),
+ Grid::make(2)
+ ->schema([
+ Section::make('Kartu Pers')
+ ->schema([
+ TextEntry::make('press_card')
+ ->hiddenLabel(),
+
+ self::fileEntry('press_card', null, 'journalists'),
+ ]),
+
+ Section::make('Sertifikat UKW')
+ ->schema([
+ TextEntry::make('ukw_certificate')
+ ->hiddenLabel(),
+
+ self::fileEntry('ukw_certificate', null, 'journalists'),
+ ]),
+ ]),
+ ]),
+ ]),
+ ])
+ ->columns(1);
}
public static function table(Table $table): Table
@@ -59,7 +281,7 @@ public static function table(Table $table): Table
->label('Perusahaan')
->searchable()
->sortable()
- ->description(fn (User $record) => $record->company?->director_name),
+ ->description(fn (User $record) => 'Direktur: '.$record->company?->director_name),
TextColumn::make('company.partnerMedia.name')
->label('Media')
@@ -85,14 +307,7 @@ public static function table(Table $table): Table
->native(false),
])
->recordActions([
- EditAction::make()
- ->modalWidth(Width::Large),
-
- DeleteAction::make(),
-
- ForceDeleteAction::make(),
-
- RestoreAction::make(),
+ ViewAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
@@ -118,6 +333,33 @@ public static function getPages(): array
{
return [
'index' => ManagePartners::route('/'),
+ 'view' => ViewPartner::route('/{record}'),
];
}
+
+ private static function fileEntry(
+ string $name,
+ ?string $mediaOwner = 'company',
+ string $collection = 'companies'
+ ): PdfViewerEntry {
+ return PdfViewerEntry::make($name)
+ ->hiddenLabel()
+ ->getStateUsing(function ($record) use ($name, $mediaOwner, $collection) {
+ $owner = data_get($record, $mediaOwner);
+
+ if (! $owner) {
+ return null;
+ }
+
+ $docType = str($name)
+ ->afterLast('.')
+ ->slug('-');
+
+ return $owner->getMedia($collection)
+ ->where('custom_properties.doc_type', $docType)
+ ->sortByDesc('created_at')
+ ->first()
+ ?->getUrl();
+ });
+ }
}
diff --git a/composer.json b/composer.json
index 4a77214..1a04483 100644
--- a/composer.json
+++ b/composer.json
@@ -11,6 +11,7 @@
"bezhansalleh/filament-shield": "^4.0",
"filament/filament": "^4.0",
"filament/spatie-laravel-media-library-plugin": "^4.0",
+ "joaopaulolndev/filament-pdf-viewer": "^2.0",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1",
"spatie/laravel-sluggable": "^3.7",
diff --git a/composer.lock b/composer.lock
index 49a0e2a..e359db4 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": "cb99bc6f72a67719573fb6369e534728",
+ "content-hash": "c2c5addb8f0b597b5135fc66bf225efd",
"packages": [
{
"name": "anourvalar/eloquent-serialize",
@@ -2305,6 +2305,79 @@
],
"time": "2025-08-22T14:27:06+00:00"
},
+ {
+ "name": "joaopaulolndev/filament-pdf-viewer",
+ "version": "v2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/joaopaulolndev/filament-pdf-viewer.git",
+ "reference": "381c2fbbced49788a57c97a3df56782a91bb23dc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/joaopaulolndev/filament-pdf-viewer/zipball/381c2fbbced49788a57c97a3df56782a91bb23dc",
+ "reference": "381c2fbbced49788a57c97a3df56782a91bb23dc",
+ "shasum": ""
+ },
+ "require": {
+ "filament/filament": "^4.0",
+ "php": "^8.2",
+ "spatie/laravel-package-tools": "^1.15.0"
+ },
+ "require-dev": {
+ "laravel/pint": "^1.0",
+ "nunomaduro/collision": "^7.9|^8.6",
+ "orchestra/testbench": "^8.0|^9.0|^10.0",
+ "pestphp/pest": "^2.1|^3.4.7",
+ "pestphp/pest-plugin-arch": "^2.0|^3.0",
+ "pestphp/pest-plugin-laravel": "^2.0|^3.1.0"
+ },
+ "type": "library",
+ "extra": {
+ "laravel": {
+ "aliases": {
+ "FilamentPdfViewer": "Joaopaulolndev\\FilamentPdfViewer\\Facades\\FilamentPdfViewer"
+ },
+ "providers": [
+ "Joaopaulolndev\\FilamentPdfViewer\\FilamentPdfViewerServiceProvider"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Joaopaulolndev\\FilamentPdfViewer\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "João Paulo Leite Nascimento",
+ "email": "joaopauloln7@gmail.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "Filament package to show pdf document viewer",
+ "homepage": "https://github.com/joaopaulolndev/filament-pdf-viewer",
+ "keywords": [
+ "filament-pdf-viewer",
+ "joaopaulolndev",
+ "laravel"
+ ],
+ "support": {
+ "issues": "https://github.com/joaopaulolndev/filament-pdf-viewer/issues",
+ "source": "https://github.com/joaopaulolndev/filament-pdf-viewer"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/joaopaulolndev",
+ "type": "github"
+ }
+ ],
+ "time": "2025-08-09T21:11:21+00:00"
+ },
{
"name": "kirschbaum-development/eloquent-power-joins",
"version": "4.2.10",