@extends('layouts.app') @section('content')

Clinic data sync

All times Myanmar (Yangon)
Back to entry counts Refresh status
@if(!$snapshot)
Sync status is currently unavailable. Refresh in a few minutes.
@else @if($stale)
Status collection is delayed. The information below is from the last successful update and may be out of date.
@endif
Receiver {{ $snapshot['receiver_healthy'] ? 'ready' : 'unavailable' }}
Updated {{ \Carbon\Carbon::parse($snapshot['generated_at'])->timezone('Asia/Yangon')->format('d M · H:i:s') }}Every 2 min

Clinic overview · {{ count($overview) }} clinics

@foreach($overviewCounts as $label=>$count){{ $count }}{{ $label }}@endforeach
@foreach($overview as $clinic)

{{ $clinic['label'] }}

History ↗
{{ $clinic['visual']['label'] }}
LAST CONTACT
{{ $clinic['visual']['contact_time'] }} {{ $clinic['last_contact'] ? $clinic['visual']['contact_date'] : 'Not received yet' }}
{{ $clinic['label'] }} · Today's eight sync slots @foreach($snapshot['times'] as $layerIndex=>$layerTime) @php $layerSlot = collect($clinic['today_slots'])->firstWhere('time', $layerTime); $layerTone = 'waiting'; $layerLabel = 'Waiting for this slot'; if (!$clinic['registered'] || !$clinic['enabled']) $layerLabel='Sync is not active'; elseif (!$layerSlot || $stale) $layerLabel='Arrival status unavailable'; elseif ($layerSlot['condition']==='Receiver error') { $layerTone='error'; $layerLabel='Receiver error'; } elseif ($layerSlot['rows']>0) { $layerTone='arrived'; $layerLabel=number_format($layerSlot['rows']).' changes applied'; } elseif ($layerSlot['condition']==='Contact received') { $layerTone='nochanges'; $layerLabel='Contact received; no new data changes'; } elseif ($layerSlot['condition']==='No contact recorded') { $layerTone='missed'; $layerLabel='No contact recorded'; } $layerY=8+$layerIndex*12; @endphp {{ $layerTime }} · {{ $layerLabel }} {{ $layerTime }} @endforeach
@endforeach
Data arrived No new changes Waiting / inactive No contact Error
About status

Green: recent contact. Blue: waiting. Amber: expected contact is overdue and the clinic may be offline. Red: receiver error. Grey: inactive or unavailable. Contact does not confirm the source queue is empty.

Daily attempts: {{ implode(', ', $snapshot['times']) }}. Offline changes wait for a later attempt. Received changes include inserts, updates and deletes.

Choose clinic and date

Select a clinic and date, then click Show to view sync history and received data batches.

@if($errors->any())
{{ $errors->first() }}
@endif
@if($selected)

{{ $selected['label'] }} · Sync history

Applied changes today
{{ number_format($selected['today_rows']) }}
Inserts today
{{ number_format($selected['today_inserts']) }}
Updates today
{{ number_format($selected['today_updates']) }}
Deletes today
{{ number_format($selected['today_deletes']) }}
@if(!$selected['registered'])
This clinic is planned. No source is registered with the receiver yet.
@endif @if(count($slots))

Scheduled arrivals · {{ $date }}

@foreach($slots as $slot)@endforeach
Scheduled timeObserved conditionData batchesApplied changes
{{ $slot['time'] }}{{ $slot['condition'] }}{{ $slot['batches'] }}{{ number_format($slot['rows']) }}

Contact is observed from each scheduled time until the next slot (one hour after 16:20). These observations do not confirm the source worker completed or that its queue is empty. A successful contact can have no data changes.

@else
Scheduled arrival observations are available for the last seven days.
@endif

Received data batches · {{ $date }}

Available data batches are shown for the selected date. Aggregate history for the last {{ $snapshot['retention_days'] }} days is retained on the receiver. Control and heartbeat batches are excluded below. Times before the October 5 timezone correction may reflect the old setting.

@forelse($rows as $row) @empty@endforelse
Received / updatedBatchTypeStatusRowsInsertUpdateDelete
{{ $row['updated'] }}{{ $row['batch'] }}{{ $row['channel']==='reload' ? 'Initial / repair load' : 'Incremental' }}{{ $row['error'] || $row['status']==='ER' ? 'Needs attention' : ($row['status']==='OK' ? 'Applied' : ($row['status']==='IG' ? 'Ignored' : 'Processing')) }}{{ number_format($row['rows_loaded']) }}{{ number_format($row['inserts']) }}{{ number_format($row['updates']) }}{{ number_format($row['deletes']) }}
No data batches recorded for this date in the retained history. Check last contact above; a sync can run without new changes.
{{ $total }} recorded batches for this date
@if($page>1)Previous@endif @if($page*30<$total)Next@endif
@endif @endif
@endsection