@php use Illuminate\Support\Facades\Crypt; @endphp
{{ __('Clients') }}
@if(auth()->user()->hasPermission('contacts.create')) {{ __('Create Contact') }} @endif @if(auth()->user()->hasPermission('clients.create')) {{ __('Add Client') }} @endif
@forelse($clients as $client) @empty @endforelse
{{ __('Company') }} {{ __('Primary Contact') }} {{ __('Status') }} {{ __('KYC Status') }} {{ __('Revenue') }} {{ __('Manager') }} {{ __('Actions') }}
{{ substr($client->company_name, 0, 2) }}
{{ $client->client_id }}
{{ $client->primary_contact_full_name }}
{{ $client->primary_contact_email }}
@if($client->primary_contact_phone)
{{ $client->primary_contact_phone }}
@endif
{{ ucfirst($client->status) }} {{ $client->latest_kyc_status }} €{{ number_format($client->total_revenue, 0) }}
{{ $client->accountManager->name ?? 'Unassigned' }}
@if($client->last_interaction_date)
{{ $client->last_interaction_date->format('M j') }}
@endif
@if(auth()->user()->hasPermission('clients.update')) {{ __('Edit') }} @endif @if(auth()->user()->hasPermission('clients.update')) KYC @endif @if(auth()->user()->hasPermission('clients.delete')) @endif

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

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

{{ $clients->links() }}
@if($showViewModal && $selectedClient)

{{ $selectedClient->company_name }} - {{ __('Client Profile') }}

@if($kycStatusMessage)
@if($kycStatusMessageType === 'success') @else @endif

{{ $kycStatusMessage }}

@endif {{-- Interactions Table (Paginated & Sortable) --}} @php $paginated = $this->paginatedInteractions; @endphp
@foreach($paginated as $loopIndex => $interaction) @endforeach
Title Description Date @if($this->interactionsSortField === 'interaction_date') {{ $this->interactionsSortDirection === 'asc' ? '↑' : '↓' }} @endif Type User @if($this->interactionsSortField === 'user_id') {{ $this->interactionsSortDirection === 'asc' ? '↑' : '↓' }} @endif
{{ Str::limit($interaction->description, 100) }} {{ $interaction->interaction_date ? \Carbon\Carbon::parse($interaction->interaction_date)->format('Y-m-d H:i') : '' }} {{ ucfirst($interaction->type) }} {{ $interaction->user->name ?? 'admin' }}

{{ __('Company Information') }}

{{ __('Client ID') }}
{{ $selectedClient->client_id }}
{{ __('Company Name') }}
{{ $selectedClient->company_name }}
Industry
{{ $selectedClient->industry ?: 'Not specified' }}
{{ __('Company Size') }}
{{ $selectedClient->company_size ?: 'Not specified' }}
Status
{{ ucfirst($selectedClient->status) }}
@if($selectedClient->website) @endif

{{ __('KYC Information') }}

@if(auth()->user()->hasPermission('clients.update')) {{ __('Manage KYC') }} @endif
{{ __('Current KYC Status') }}
{{ $selectedClient->latest_kyc_status }}
@if($selectedClient->kycProcesses->count() > 0) @php $latestKyc = $selectedClient->kycProcesses->sortByDesc('created_at')->first(); @endphp
{{ __('Latest KYC Process') }}
{{ $latestKyc->kyc_number ?? 'N/A' }}
{{ __('KYC Type') }}
{{ ucfirst($latestKyc->type ?? 'N/A') }}
@if($latestKyc->completed_at)
{{ __('Completed Date') }}
{{ $latestKyc->completed_at->format('M j, Y') }}
@endif @if($latestKyc->approved_at)
{{ __('Approved Date') }}
{{ $latestKyc->approved_at->format('M j, Y') }}
@endif @if($latestKyc->rejected_at)
{{ __('Rejected Date') }}
{{ $latestKyc->rejected_at->format('M j, Y') }}
@endif @if($latestKyc->rejection_reason)
{{ __('Rejection Reason') }}
{{ $latestKyc->rejection_reason }}
@endif @else
{{ __('KYC Status') }}
{{ __('No KYC processes have been initiated for this client.') }}
@endif

{{ __('Primary Contact') }}

Name
{{ $selectedClient->primary_contact_full_name }}
{{ __('Title') }}
{{ $selectedClient->primary_contact_title ?: 'Not specified' }}
@if($selectedClient->primary_contact_phone)
{{ __('Phone') }}
{{ $selectedClient->primary_contact_phone }}
@endif

{{ __('Address') }}

{{ __('Business Address') }}
{{ $selectedClient->full_address }}
@if($selectedClient->billing_address)
{{ __('Billing Address') }}
{{ $selectedClient->billing_address_full }}
@endif

{{ __('Recent Interactions') }}

@forelse($this->allInteractions->take(20) as $interaction) @empty @endforelse
Date Subject User Actions
{{ $interaction->interaction_date ? \Carbon\Carbon::parse($interaction->interaction_date)->format('M j, H:i') : '' }} {{ $interaction->subject }} {{ $interaction->user->name ?? 'admin' }}
No interactions yet
@if($this->allInteractions->count() > 20)
Showing latest 20 interactions
@endif

{{ __('Key Metrics') }}

{{ __('Total Revenue') }}
${{ number_format($selectedClient->total_revenue, 0) }}
{{ __('Total Interactions') }}
{{ $selectedClient->interaction_summary['total_interactions'] }}
@if($selectedClient->first_purchase_date)
{{ __('Client Since') }}
{{ $selectedClient->first_purchase_date->format('M j, Y') }}
@endif @if($selectedClient->createdFromLead)
{{ __('Converted From Lead') }}
{{ $selectedClient->converted_at->format('M j, Y') }}
@endif

KYC Status

@if($selectedClient->kycProcesses->count() > 0) @php $latestKyc = $selectedClient->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'; @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
View KYC Form @if($selectedClient->type === 'company') Company @else Individual @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
{{-- Contacts Section --}} {{--

Contacts

Add Contact
@if($selectedClient->contacts->count() > 0)
@foreach($selectedClient->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
--}} @if($selectedClient->accountManager)

Account Manager

{{ substr($selectedClient->accountManager->name, 0, 2) }}

{{ $selectedClient->accountManager->name }}

{{ $selectedClient->accountManager->email }}

@endif

Quick Actions

Create Proposal
@endif @if($showInteractionModal)

{{ $editingInteractionId ? __('Edit Interaction') : __('Add Interaction') }}

@error('interaction_subject') {{ $message }} @enderror
@error('interaction_description') {{ $message }} @enderror
{{ __('Created by:') }} {{ auth()->user()->name }}
{{ __('Date:') }} {{ now()->format('Y-m-d H:i') }}
@endif