@php use Illuminate\Support\Facades\Crypt; @endphp
@if (session()->has('success'))
{{ session('success') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{ __('Create Proposal') }}

{{ $client->company_name }}

{{ __('Proposals') }}

{{ $proposals->count() }} {{ __('total') }} Add
@if($proposals->count() > 0)
@foreach($proposals->take(20) as $proposal) @endforeach
Title Status Amount Date Actions
{{ $proposal->title }} {{ $proposal->status_icon }} {{ ucfirst($proposal->status) }} €{{ number_format($proposal->amount, 0) }} {{ $proposal->proposal_date ? $proposal->proposal_date->format('M j, Y') : '' }}
@if($proposals->count() > 20)
Showing latest 20 proposals
@endif @else

{{ __('No proposals') }}

{{ __('Get started by creating a new proposal.') }}

@endif

{{ __('All Interactions') }}

@php $allInteractions = $this->allInteractions->take(20); @endphp @if($allInteractions->count() > 0)
@foreach($allInteractions as $interaction) @endforeach
Date Subject User Actions
{{ $interaction->interaction_date ? \Carbon\Carbon::parse($interaction->interaction_date)->format('M j, H:i') : '' }} {{ $interaction->subject }} @if($interaction->interactable_type === \App\Models\Proposal::class)
@php $proposal = \App\Models\Proposal::find($interaction->interactable_id); @endphp @if($proposal) {{ $proposal->title }} @else Proposal #{{ $interaction->interactable_id }} @endif
@endif
{{ $interaction->user->name ?? 'Unknown' }}
@if($this->allInteractions->count() > 20)
Showing latest 20 interactions
@endif @else

{{ __('No interactions found') }}

{{ __('All interactions with this client will appear here.') }}

@endif

{{ __('Company Information') }}

@if(!$isEditing) @else
@endif
@error('type')

{{ $message }}

@enderror
@error('company_name')

{{ $message }}

@enderror
@error('status')

{{ $message }}

@enderror
@if($client->reglab_client_id)
@endif

{{ __('Primary Contact') }}

@if(!$isEditing) @else
@endif
@error('primary_contact_first_name')

{{ $message }}

@enderror
@error('primary_contact_last_name')

{{ $message }}

@enderror
@error('primary_contact_email')

{{ $message }}

@enderror

{{ __('Company Contact Information') }}

@if(!$isEditing) @else
@endif

{{ __('Address Information') }}

@if(!$isEditing) @else
@endif
@if(!$use_same_billing_address)
@endif

{{ __('Management Information') }}

@if(!$isEditing) @else
@endif
@if(auth()->user()->hasPermission('clients.update'))
@endif

{{ __('Client Statistics') }}

{{ __('Total Revenue') }}
€{{ number_format($client->total_revenue ?? 0, 2) }}
{{ __('Total | Approved | Rejected') }}
{{ $proposals->count() }} {{ $proposals->where('status', 'approved')->count() }} {{ $rejectedProposals->count() }}
{{ __('Total Rejected Amount') }}
€{{ number_format($this->totalRejectedRevenue, 2) }}
{{ __('Client Since') }}
{{ $client->created_at->format('M j, Y') }}

Contacts

@if(auth()->user()->hasPermission('contacts.create')) Add New @endif
@if($contactSearch) @endif
@if($contactSearch && strlen($contactSearch) >= 2)
@if($this->availableContacts->count() > 0)
@foreach($this->availableContacts as $contact)
{{ $contact->name }}
@if($contact->company)
{{ $contact->company }}
@endif @if($contact->email)
{{ $contact->email }}
@endif
@endforeach
@else
No contacts found matching "{{ $contactSearch }}"
@endif
@elseif($contactSearch && strlen($contactSearch) < 2)
Enter at least 2 characters to search
@endif
@if($client->contacts && $client->contacts->count() > 0)
@foreach($client->contacts as $contact)
{{ substr($contact->name, 0, 2) }}

{{ $contact->name }}

@if($contact->position)

{{ $contact->position }}

@endif @if($contact->company)

{{ $contact->company }}

@endif
@if($contact->email) @endif @if($contact->mobile_phone) @endif @if($contact->linkedin_profile) @endif
Edit
@endforeach
@else

No contacts

Get started by adding a contact to this client.

@if(auth()->user()->hasPermission('contacts.create')) Add Contact @endif
@endif

KYC Status

@if($client->kycProcesses->count() > 0) @php $latestKyc = $client->kycProcesses->sortByDesc('created_at')->first(); $kycStatus = $latestKyc->status; $statusColors = [ 'pending' => 'bg-yellow-100 text-yellow-800', 'sent' => 'bg-blue-100 text-blue-800', 'to_be_filled' => 'bg-orange-100 text-orange-800', 'completed' => 'bg-purple-100 text-purple-800', 'approved' => 'bg-green-100 text-green-800', 'rejected' => 'bg-red-100 text-red-800' ]; $statusColor = $statusColors[$kycStatus] ?? 'bg-gray-100 text-gray-800'; // Safely decrypt access token $decryptedToken = ''; if ($latestKyc->access_token) { try { $decryptedToken = Crypt::decryptString($latestKyc->access_token); } catch (\Exception $e) { // If decryption fails (corrupted token, wrong key, etc.), log and use empty string \Log::warning('Failed to decrypt KYC access token', [ 'kyc_process_id' => $latestKyc->id, 'error' => $e->getMessage() ]); $decryptedToken = ''; } } @endphp
Current Status: {{ ucfirst(str_replace('_', ' ', $kycStatus)) }}
KYC Number: {{ $latestKyc->kyc_number }}
Type: {{ ucfirst($latestKyc->type) }}
@if($latestKyc->sent_at)
Sent Date: {{ $latestKyc->sent_at->format('M j, Y') }}
@endif @if($latestKyc->last_opened_at)
Last Opened: {{ $latestKyc->last_opened_at->format('M j, Y') }}
@endif @if($latestKyc->completed_at)
Completed: {{ $latestKyc->completed_at->format('M j, Y') }}
@endif
@php $isAdmin = auth()->user()->role === 'admin' || auth()->user()->role === 'manager' || auth()->user()->role === 'superadmin'; $hasValidToken = !empty($decryptedToken); $formUrl = null; if ($hasValidToken) { // Use token-based route if we have a valid token $formUrl = route('kyc.form', [ 'token' => $decryptedToken, 'client_type' => $client->type, 'client_id' => $client->id ]); } elseif ($isAdmin && $latestKyc->uuid) { // Use admin route if admin and no token but we have UUID $formUrl = route('kyc.admin.form', ['uuid' => $latestKyc->uuid]); } @endphp @if($formUrl) View KYC Form @if($client->type === 'company') Company @else Individual @endif @else @endif @if(auth()->user()->role === 'admin' || auth()->user()->role === 'manager' || auth()->user()->role === 'superadmin') @if($kycStatus === 'completed')
@endif @if(in_array($kycStatus, ['pending', 'sent', 'to_be_filled', 'rejected'])) @endif @endif
@else

No KYC Process

This client doesn't have any KYC process yet.

@if(auth()->user()->role === 'admin' || auth()->user()->role === 'manager' || auth()->user()->role === 'superadmin')
@endif
@endif