@php use Illuminate\Support\Str; $currentStatus = $currentStatus ?? 'all'; $currentType = $currentType ?? 'all'; $currentRange = $currentRange ?? 'all'; $currentSearch = $currentSearch ?? ''; $typeCounts = $typeCounts ?? ['all' => 0]; $total = $total ?? ($typeCounts['all'] ?? 0); $userTz = $userTz ?? config('app.timezone', 'UTC'); $aiAllowed = $aiAllowed ?? false; // Build a filter URL preserving the OTHER active filters (mirrors IG index). $filterUrl = function (array $override) use ($currentStatus, $currentType, $currentRange, $currentSearch) { $q = array_filter([ 'status' => $override['status'] ?? ($currentStatus !== 'all' ? $currentStatus : null), 'type' => $override['type'] ?? ($currentType !== 'all' ? $currentType : null), 'range' => $override['range'] ?? ($currentRange !== 'all' ? $currentRange : null), 'q' => $override['q'] ?? ($currentSearch !== '' ? $currentSearch : null), ], fn ($v) => $v !== null && $v !== '' && $v !== 'all'); return route('user.facebook.posts') . ($q ? '?' . http_build_query($q) : ''); }; $statusPill = fn (string $s) => match ($s) { 'scheduled' => ['cls' => 'bg-accent-amber/15 text-[#7B5A14]', 'label' => __('Scheduled')], 'published' => ['cls' => 'bg-wa-mint text-wa-deep', 'label' => __('Published')], 'failed' => ['cls' => 'bg-accent-coral/10 text-accent-coral', 'label' => __('Failed')], 'draft' => ['cls' => 'bg-paper-100 text-ink-600', 'label' => __('Draft')], default => ['cls' => 'bg-paper-100 text-ink-600', 'label' => Str::title($s)], }; $statusTabs = [ ['key' => 'all', 'label' => __('All'), 'count' => $total], ['key' => 'published', 'label' => __('Published'), 'count' => $counts['published'] ?? 0], ['key' => 'scheduled', 'label' => __('Scheduled'), 'count' => $counts['scheduled'] ?? 0], ['key' => 'failed', 'label' => __('Failed'), 'count' => $counts['failed'] ?? 0], ]; $typeTabs = [ ['key' => 'photo', 'label' => __('Photo'), 'hint' => __('A single photo post.'), 'icon' => ''], ['key' => 'multi_photo', 'label' => __('Album'), 'hint' => __('2–10 photos in one post.'), 'icon' => ''], ['key' => 'link', 'label' => __('Link'), 'hint' => __('Share a link with a preview.'), 'icon' => ''], ['key' => 'video', 'label' => __('Video'), 'hint' => __('A feed video (MP4 / MOV).'), 'icon' => ''], ['key' => 'reel', 'label' => __('Reel'), 'hint' => __('A vertical short video reel.'), 'icon' => ''], ]; @endphp
{{-- ===== Header ===== --}}
{{ __('Workspace') }} · {{ auth()->user()?->currentWorkspace?->name ?: __('Facebook') }}

{{ __('Create a') }} {{ __('post') }}

{{ __('Compose photos, albums, links, videos and reels — publish now or schedule them straight to your connected Pages. Watch it build in the live mobile preview.') }}

{{-- ===== Flash + validation (inline, no scripts) ===== --}} @if (session('status'))
{{ session('status') }}
@endif @if ($errors->any())
    @foreach ($errors->all() as $e)
  • {{ $e }}
  • @endforeach
@endif @if ($pages->isEmpty()) {{-- ===== Empty state — no Page connected ===== --}}
{{ __('No Facebook Page connected yet') }}

{{ __('Connect a Facebook account to publish and schedule Page posts.') }}

{{ __('Connect a Facebook account') }}
@else {{-- ===== Composer (CREATE only — the list lives on “My posts”) + live preview ===== --}}
@csrf {{-- 01 Page --}}
01 {{ __('Page') }} {{ __('required') }}
{{-- 02 Post type --}}
02 {{ __('Post type') }}
@foreach ($typeTabs as $i => $t) @endforeach

{{ $typeTabs[0]['hint'] }}

{{-- 03 Media --}}
03 {{ __('Media') }}
{{-- Photo / Album --}}
{{-- Link --}} {{-- Video / Reel --}}
{{-- 04 Message + AI tools --}}
04 {{ __('Message') }} 0
{{-- AI composer tools (parity with Instagram) --}}
{{ __('AI composer tools') }}
@unless ($aiAllowed)
{{ __('AI tools aren\'t included in your current plan.') }}
@else
@endunless
{{-- 05 When to post --}}
05 {{ __('When to post') }}
{{-- Footer --}}
{{-- ===== Live preview — clean card (mirrors /instagram/posts/create) ===== --}}
{{ __('Live preview') }}
{{ __('Facebook') }}
{{-- The post card --}}
{{-- header --}}
{{ strtoupper(mb_substr($pages->first()->name ?? 'F', 0, 1)) }}
{{ $pages->first()->name ?? __('Your Page') }}
{{ __('Just now') }} ·
{{-- message --}}
{{ __('Your post text will appear here…') }}
{{-- media --}} {{-- reactions summary --}}
{{ __('You and 12 others') }} 3 {{ __('shares') }}
{{-- action buttons --}}
{{ __('Like') }} {{ __('Comment') }} {{ __('Share') }}

{{ __('Live preview — the real post may look slightly different on Facebook.') }}

{{-- ===== Help cards ===== --}}
{{ __('Help - 01') }}
{{ __('What can I post?') }}

{{ __('Photos, albums, links, feed videos and reels publish straight to your connected Page through the Graph API.') }}

{{ __('Help - 02') }}
{{ __('How does scheduling work?') }}

{{ __('Pick a time between 10 minutes and 75 days out and Facebook queues it — it publishes automatically when due. Or publish now.') }}

{{ __('Help - 03') }}
{{ __('A post failed — why?') }}

{{ __('Usually the media URL was not public HTTPS, or the Page was reconnected. Read the error on the row, then retry with Publish now.') }}

@endif