{{-- هيدر الصفحة --}}
🔄

{{ __('sync.title') }}

{{ __('sync.subtitle') }}

⚙️ {{ __('sync.settings_title') }} @if ($configured) @endif
@include('partials.sweet-alert-flash') @if ($isServer) {{-- نسخة السيرفر: بتستقبل من الفروع --}}
☁️ {{ __('sync.role_server') }}
{{ $serverSetting->receive_enabled ? '🟢 ' . __('sync.receiving_on') : '🔴 ' . __('sync.receiving_off') }}
{{ __('sync.last_received_label') }}
{{ $serverSetting->last_received_at?->format('Y-m-d H:i') ?? __('sync.never') }}
{{ __('sync.received_rows_label') }}
{{ number_format((int) $serverSetting->received_rows) }}

{{ __('sync.server_index_hint') }}

{{ url('/') }}

@elseif (!$configured)

⚠️ {{ __('sync.not_configured') }}

⚙️ {{ __('sync.open_settings') }}
{{ __('sync.env_alternative') }}

{{ __('sync.setup_title') }}:

# .env  (جهاز الفرع)
SYNC_CLOUD_URL=
SYNC_TOKEN=your-long-secret-key
SYNC_AUTO=true

# .env  (السيرفر الأونلاين)
SYNC_RECEIVE_TOKEN=your-long-secret-key
@else @if ($error)
{{ $error }}
@endif @if (!($hasBaseline ?? true)) {{-- أول مرة: لازم تتحدّث من السيرفر قبل الشغل أوفلاين --}}
⚠️ {{ __('sync.first_pull_title') }}

{{ __('sync.first_pull_hint') }}

{{ __('sync.first_pull_warning') }}

@endif {{-- حالة المزامنة --}}
{{ __('sync.last_run') }}
{{ __('sync.cloud_server') }}
{{ $cloudUrl }}
{{ $autoSync ? '🟢 ' . __('sync.auto_on') : '⚪ ' . __('sync.auto_off_settings') }}
{{-- رسالة النتيجة --}} {{-- العمليات المنتظرة --}}
📦 {{ __('sync.pending_title') }}
@if ($filesEnabled && $pendingFiles > 0)
📁 {{ __('sync.files_pending_label') }} {{ number_format($pendingFiles) }}
@endif @if (empty($pending) && (!$filesEnabled || $pendingFiles === 0))
{{ __('sync.nothing_pending') }}
@elseif (!empty($pending)) @foreach ($pending as $table => $p) @endforeach
{{ __('sync.table') }} {{ __('sync.new_rows') }} {{ __('sync.updated_rows') }} {{ __('sync.deleted') }}
{{ $table }} {{ number_format($p['new'] ?? 0) }} {{ number_format($p['updated'] ?? 0) }} {{ number_format($p['deleted']) }}
@endif
{{-- نتيجة آخر تشغيل --}} @endif