@extends('examples.modern-layout-v2') @section('title', __('messages.menu.sync')) @section('sync', 'bg-blue-50 text-blue-700') @section('content') @php // $isApiServer, $isSuperAdmin, $cities, $citySyncDetails are passed from controller. @endphp

{{ __('messages.menu.sync') }}

{{ __('messages.sync.health_subtitle') }}

@if(session('success'))
check_circle

{{ session('success') }}

@endif @if(session('error'))
error_outline

{{ session('error') }}

@endif
@if($isApiServer && $isSuperAdmin)

{{ __('messages.sync.add_city_title') }}

{{ __('messages.sync.add_city_hint') }}

add_location_alt
@csrf
@error('code')

{{ $message }}

@enderror
@error('name')

{{ $message }}

@enderror

{{ __('messages.sync.manage_cities_title') }}

{{ __('messages.sync.manage_cities_hint') }}

location_city
@foreach($cities as $city) @php $cityHasData = ($city->queues_count ?? 0) > 0 || ($city->calls_count ?? 0) > 0 || ($city->messages_count ?? 0) > 0 || ($city->locations_count ?? 0) > 0; @endphp
{{ __('messages.sync.city_code') }}
{{ strtoupper($city->code) }}
@if($city->status) check_circle @else pause_circle @endif @if($city->status) {{ __('messages.sync.active') }} @else {{ __('messages.sync.inactive') }} @endif
@csrf @method('PATCH')

cloud_upload SSH Configuration (for Deployments)

@csrf @method('DELETE')
@endforeach
@endif
{{-- Info banner intentionally hidden per request --}} @if($cities->count() > 0)
@foreach($cities as $city) @php $details = $citySyncDetails[$city->id] ?? []; $lastSync = $details['last_sync'] ?? null; $isHealthy = $lastSync && $lastSync->isAfter(now()->subDay()); $hasData = $city->queues_count > 0 || $city->calls_count > 0 || $city->messages_count > 0 || $city->locations_count > 0; // Determine status color if ($isHealthy && $hasData) { $statusColor = 'green'; $statusText = 'Healthy'; $statusIcon = 'check_circle'; } elseif ($hasData) { $statusColor = 'yellow'; $statusText = 'Stale'; $statusIcon = 'warning'; } else { $statusColor = 'gray'; $statusText = 'No Data'; $statusIcon = 'info'; } @endphp
location_city

{{ $city->name }}

@if(isset($details['app_version'])) v{{ $details['app_version'] }} @endif

Code: {{ strtoupper($city->code) }}

Last Sync

@if($lastSync) {{ $lastSync->diffForHumans() }} @else Never @endif

@if(isset($details['last_success_run']) && $details['last_success_run'])

Last success: {{ \Carbon\Carbon::parse($details['last_success_run']->finished_at)->diffForHumans() }} @if(!empty($details['last_success_run']->duration_ms)) ({{ (int)$details['last_success_run']->duration_ms }}ms) @endif

@endif @if(isset($details['last_failed_run']) && $details['last_failed_run'])

Last failure: {{ \Carbon\Carbon::parse($details['last_failed_run']->finished_at)->diffForHumans() }}

@endif
{{ $statusIcon }} {{ $statusText }}
{{ number_format($city->queues_count) }}
Queues
{{ number_format($city->calls_count) }}
Calls
{{ number_format($city->messages_count) }}
Messages
{{ number_format($city->locations_count) }}
Locations
{{ number_format($details['counters_count']) }}
Counters
{{ number_format($details['services_count']) }}
Services
{{ number_format($details['users_count']) }}
Users
data_usage Data Sync Details
queue Queues
{{ number_format($city->queues_count) }}
@if($details['last_queue']) Updated {{ $details['last_queue']->diffForHumans() }} @else Never @endif
@if(!empty($details['location_breakdown']))
@php $totalQueues = 0; @endphp @foreach($details['location_breakdown'] as $location) @php $totalQueues += $location['queues']; @endphp
{{ $location['name'] }} {{ number_format($location['queues']) }}
@endforeach
Total {{ number_format($totalQueues) }}
@endif
phone Calls
{{ number_format($city->calls_count) }}
@if($details['last_call']) Updated {{ $details['last_call']->diffForHumans() }} @else Never @endif
@if(!empty($details['location_breakdown']))
@php $totalCalls = 0; @endphp @foreach($details['location_breakdown'] as $location) @php $totalCalls += $location['calls']; @endphp
{{ $location['name'] }} {{ number_format($location['calls']) }}
@endforeach
Total {{ number_format($totalCalls) }}
@endif
message Messages
{{ number_format($city->messages_count) }}
@if($details['last_message']) Updated {{ $details['last_message']->diffForHumans() }} @else Never @endif
@if(!empty($details['location_breakdown']))
@php $totalMessages = 0; @endphp @foreach($details['location_breakdown'] as $location) @php $totalMessages += $location['messages']; @endphp
{{ $location['name'] }} {{ number_format($location['messages']) }}
@endforeach
Total {{ number_format($totalMessages) }}
@endif
place Locations
{{ number_format($city->locations_count) }}
@if($details['last_location']) Updated {{ $details['last_location']->diffForHumans() }} @else Never @endif
@if(!empty($details['location_breakdown']))
@foreach($details['location_breakdown'] as $location)
location_on {{ $location['name'] }}
@endforeach
@endif
info Additional Information
desktop_windows Counters
{{ number_format($details['counters_count']) }}
@if($details['last_counter']) Updated {{ $details['last_counter']->diffForHumans() }} @else Never @endif
@if(!empty($details['location_breakdown']))
@php $totalCounters = 0; @endphp @foreach($details['location_breakdown'] as $location) @php $totalCounters += $location['counters']; @endphp
{{ $location['name'] }} {{ number_format($location['counters']) }}
@endforeach
Total {{ number_format($totalCounters) }}
@endif
business_center Services
{{ number_format($details['services_count']) }}
@if($details['last_service']) Updated {{ $details['last_service']->diffForHumans() }} @else Never @endif
@if(!empty($details['location_breakdown']))
@php $totalServices = 0; @endphp @foreach($details['location_breakdown'] as $location) @php $totalServices += $location['services']; @endphp
{{ $location['name'] }} {{ number_format($location['services']) }}
@endforeach
Total {{ number_format($totalServices) }}
@endif
people Users
{{ number_format($details['users_count']) }}
@if($details['last_user']) Updated {{ $details['last_user']->diffForHumans() }} @else Never @endif
@if(!empty($details['location_breakdown']))
@php $totalUsers = 0; @endphp @foreach($details['location_breakdown'] as $location) @php $totalUsers += $location['users']; @endphp
{{ $location['name'] }} {{ number_format($location['users']) }}
@endforeach
Total {{ number_format($totalUsers) }}
@endif
Overall Status
Sync Health {{ $statusText }}
@if($lastSync)
Last synchronized: {{ $lastSync->format('M d, Y H:i:s') }}
@endif
@endforeach
@else
location_city

No cities found. Cities will appear here once they start syncing data.

@endif
@endsection