@php $connected = ! $accounts->isEmpty(); $needsReconnect = $connected ? $accounts->first(fn ($a) => in_array($a->status, ['expiring', 'expired'], true)) : null; $pillMap = [ 'scheduled' => ['bg-[#13478A]/10', 'text-[#13478A]', 'border-[#13478A]/30', 'bg-[#13478A]'], 'processing' => ['bg-accent-amber/10', 'text-[#7B5A14]', 'border-accent-amber/30', 'bg-accent-amber'], 'published' => ['bg-wa-green/10', 'text-wa-deep', 'border-wa-green/30', 'bg-wa-green'], 'failed' => ['bg-accent-coral/10', 'text-[#A1431F]', 'border-accent-coral/30', 'bg-accent-coral'], ]; $cPub = $posts->where('status', 'published')->count(); $cSch = $posts->whereIn('status', ['scheduled', 'processing'])->count(); $cFail = $posts->where('status', 'failed')->count(); $tabs = [ ['key' => 'all', 'label' => __('All'), 'count' => $posts->count()], ['key' => 'published', 'label' => __('Published'), 'count' => $cPub], ['key' => 'scheduled', 'label' => __('Scheduled'), 'count' => $cSch], ['key' => 'failed', 'label' => __('Failed'), 'count' => $cFail], ]; @endphp
{{-- Flash --}} @if (session('status'))
{{ session('status') }}
@endif @if (session('error'))
{{ session('error') }}
@endif {{-- ===== Header ===== --}}
{{ __('LinkedIn / Publishing') }}

{{ __('Publish to') }} {{ __('LinkedIn') }}.

{{ __('Compose, schedule and track posts to your LinkedIn profile and Company Pages — right from your social calendar. Publishing only; LinkedIn has no messaging API.') }}

@if ($connected)
{{ $accounts->count() }} {{ __('connected') }} @if (\App\Services\PlanLimitGuard::hasFeature(auth()->user()?->currentWorkspace, 'linkedin_replies')) {{ __('Reply automation') }} @endif @if (\App\Models\SystemSetting::get('linkedin_org_enabled', false))
@csrf
@endif {{ __('Add account') }} {{ __('New post') }}
@endif
@php $ws = auth()->user()?->currentWorkspace; $ownLi = $ws?->ownLinkedInApp(); $liClientId = $ws?->linkedin_client_id; $liSecretSet = ! empty($ws?->linkedin_client_secret); $liRedirect = url('/linkedin/callback'); $liManual = (bool) \App\Models\SystemSetting::get('linkedin_allow_manual_app', false); @endphp {{-- ===== Use your own app keys — shown when the admin allows it (or keys already set) ===== --}} @if ($liManual || $ownLi)
{{ __('Connect with your own LinkedIn app keys') }} {{ $ownLi ? __('Using your app') : __('Using platform app') }}

{{ __('Connect through your OWN LinkedIn app instead of the platform default — you control the app, branding and limits. Leave both blank to use the platform app. These take priority over the admin app.') }}

@csrf
{{ __('In your LinkedIn app → Auth tab, add this redirect URL:') }}
{{ $liRedirect }}
{{ __('Add the products "Sign In with LinkedIn (OpenID Connect)" + "Share on LinkedIn" — both self-serve. Save, then click Connect.') }}
@endif @if (! $connected) {{-- ===== Empty state ===== --}}
{!! \App\Support\SvgIcon::inner('brands', 'linkedin') !!}

{{ __('Connect LinkedIn') }}

{{ __('Publish and schedule posts to your LinkedIn profile from here. Sign in with LinkedIn to connect — no approval needed.') }}

{!! \App\Support\SvgIcon::inner('brands', 'linkedin') !!}{{ __('Connect with LinkedIn') }}
{{ __('Posts publish through the official LinkedIn API. There is no LinkedIn messaging API, so this channel is for publishing only — not direct messages.') }}
@else @if ($needsReconnect)
{{ __('A connected LinkedIn account needs to be reconnected to keep posting.') }} {{ __('Reconnect') }}
@endif {{-- ===== Status tabs (underline, like templates) ===== --}}
@foreach ($tabs as $tab) @endforeach
{{-- ===== Showing + legend ===== --}}
{{ __('Showing') }} {{ $posts->count() }} {{ __('posts') }} {{ __('Published') }} {{ __('Scheduled') }} {{ __('Failed') }}
@if ($posts->isEmpty())

{{ __('No posts yet.') }}

{{ __('Create your first post') }}
@else
@foreach ($posts as $p) @php $st = strtolower($p->status); $tabStatus = in_array($st, ['scheduled', 'processing'], true) ? 'scheduled' : $st; $pill = $pillMap[$st] ?? $pillMap['scheduled']; $thumb = $p->image_url ?: null; $acc = $p->account; $accName = $acc?->label() ?: 'LinkedIn'; $accAvatar = $acc?->profile_pic_url; $avStyle = $accAvatar ? "background-image:url('".e($accAvatar)."');background-size:cover;background-position:center" : 'background:#0A66C2'; @endphp
{{ ucfirst($st) }} {{ $p->media_type }}
@if (! $accAvatar){!! \App\Support\SvgIcon::inner('brands', 'linkedin') !!}@endif
{{ $accName }}
{{ $p->visibility === 'CONNECTIONS' ? __('Connections') : __('Anyone') }}
{{ $p->text ?: '('.$p->media_type.')' }}
@if ($thumb)
@elseif ($p->media_type === 'article' && $p->link_url)
{{ $p->link_url }}
{{ __('Shared link') }}
@endif
@if ($p->last_error)
{{ \Illuminate\Support\Str::limit($p->last_error, 90) }}
@endif
@if ($p->published_at) {{ $p->published_at->format('M j, H:i') }} @elseif ($p->scheduled_at) {{ __('Sched') }} · {{ $p->scheduled_at->format('M j, H:i') }} @else {{ $p->created_at?->format('M j, H:i') }} @endif @if ($p->status !== 'published')
@csrf @method('DELETE')
@endif
@endforeach
@endif @endif
@push('scripts') @endpush