verificationService = app(VerificationService::class); } public function mount(): void { $this->company = auth()->user()->company; // Load unified verification request if ($this->company) { $this->verificationRequest = $this->company->verificationRequest() ->with(['reviews.reviewer']) ->latest() ->first(); } } /** * Get unified verification progress */ public function getVerificationProgress(): array { $progress = $this->verificationService->getVerificationProgress( $this->company, $this->verificationRequest ); // Add additional data for view $progress['missingDataButtons'] = $this->verificationService->getMissingDataButtons($this->company); $progress['alert'] = $this->verificationService->getAlertData($this->verificationRequest); $progress['lastSubmittedAt'] = $this->verificationRequest?->updated_at?->format('d M Y, H:i'); return $progress; } /** * Submit unified verification action */ public function submitVerificationAction(): Action { $progress = $this->getVerificationProgress(); return Action::make('submit_verification') ->label(fn (): string => $this->verificationRequest && $this->verificationRequest->status === VerificationStatus::NEED_REVISION ? 'Kirim Ulang' : 'Ajukan Verifikasi') ->icon('heroicon-o-paper-airplane') ->color('primary') ->requiresConfirmation() ->modalHeading('Ajukan Verifikasi Lengkap') ->modalDescription(function () use ($progress): string { if (! $progress['isDataComplete']) { return 'Data belum lengkap. Silakan lengkapi terlebih dahulu: '.implode(', ', $progress['missingData']); } return 'Apakah Anda yakin ingin mengajukan verifikasi untuk Perusahaan, Media, dan Jurnalis? Pastikan semua data sudah benar dan lengkap.'; }) ->modalSubmitActionLabel('Ya, Ajukan') ->visible(fn (): bool => $progress['canSubmit']) ->disabled(fn (): bool => ! $progress['isDataComplete']) ->action(function (): void { $this->submitVerification(); }); } /** * Handle unified verification submission */ protected function submitVerification(): void { $progress = $this->getVerificationProgress(); // Validate data completeness if (! $progress['isDataComplete']) { Notification::make() ->title('Data Belum Lengkap') ->body('Silakan lengkapi data terlebih dahulu: '.implode(', ', $progress['missingData'])) ->danger() ->send(); return; } $this->verificationRequest = $this->verificationService->submitVerification( $this->company, $this->verificationRequest ); Notification::make() ->title('Berhasil!') ->body('Verifikasi lengkap (Perusahaan, Media, dan Jurnalis) berhasil diajukan untuk diverifikasi.') ->success() ->send(); } public function getViewData(): array { return [ 'verificationProgress' => $this->getVerificationProgress(), ]; } }