user()->can('View:Verification'); } public function mount(): void { $user = Auth::user(); $this->company = $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 { return app(VerificationProgressService::class)->getProgress( $this->company, $this->verificationRequest, ); } /** * Submit unified verification action */ public function submitVerificationAction(): Action { return SubmitVerificationAction::make(); } public function handleVerificationSubmit(array $data = []): void { $user = Auth::user(); $progress = app(VerificationProgressService::class)->getProgress( $this->company, $this->verificationRequest, ); if (! $progress['isDataComplete']) { CheerfulNotification::danger( CheerfulNotification::getByKey('verification.incomplete.title'), CheerfulNotification::getByKey( 'verification.incomplete.body', ['missing' => implode(', ', $progress['missingData'])] ) )->send(); return; } $isRevision = $this->verificationRequest && $this->verificationRequest->status === VerificationStatus::NEED_REVISION; $this->verificationRequest = app(VerificationSubmissionService::class)->submit( $this->company, $this->verificationRequest, $user, ); CheerfulNotification::success( CheerfulNotification::getByKey('verification.success.title'), CheerfulNotification::getByKey('verification.success.body') )->send(); app(VerificationAdminNotifier::class)->notifySuperAdmins($user, $isRevision); } /** * Check if all required data is complete for verification */ protected function isDataComplete(): bool { return app(VerificationProgressService::class)->isDataComplete($this->company); } /** * Get missing data items for verification */ protected function getMissingData(): array { return app(VerificationProgressService::class)->getMissingData($this->company); } /** * Check if user can submit verification */ protected function canSubmit(): bool { return app(VerificationProgressService::class)->canSubmit($this->company, $this->verificationRequest); } /** * Determine the current step based on status */ protected function resolveStep(): int { return app(VerificationProgressService::class)->resolveStep($this->company, $this->verificationRequest); } /** * Get the latest review notes */ protected function getLatestReviewNotes(): ?string { return app(VerificationProgressService::class)->getLatestReviewNotes($this->verificationRequest); } /** * Get all reviews history */ protected function getReviewHistory(): Collection { return app(VerificationProgressService::class)->getReviewHistory($this->verificationRequest); } /** * Submit unified verification */ protected function submitVerification(): VerificationRequest { return app(VerificationSubmissionService::class)->submit( $this->company, $this->verificationRequest, Auth::user(), ); } /** * Get alert data for verification status */ protected function getAlertData(): ?array { return app(VerificationProgressService::class)->getAlertData($this->verificationRequest); } /** * Get missing data buttons configuration */ protected function getMissingDataButtons(): array { return app(VerificationProgressService::class)->getMissingDataButtons($this->company); } /** * Get steps array for stepper */ protected function getSteps(bool $isComplete): array { return app(VerificationProgressService::class)->getSteps( $this->company, $this->verificationRequest, $isComplete ); } public function getViewData(): array { return [ 'verificationProgress' => $this->getVerificationProgress(), ]; } }