{{-- "Last sync + Pull Now / Push Now buttons + CLI note" panel. Rendered as a sibling of the config-form shell rather than nested inside it because HTML disallows nested form elements and the sync trigger POSTs to a different route than the config save. Every auth-shape partial under resources/views/settings/adapters/ picks up the sync UI by rendering this component alongside the config-form shell. --}} @props(['adapter']) @php $slug = $adapter->name(); $locked = config('app.lock_passwords') === true; $canSync = $adapter->isEnabled() && ! $locked; @endphp
@if ($adapter->lastSyncedAt()) {{ $adapter->lastSyncedAt()->diffForHumans() }}. {{ $adapter->lastSyncResult() }} @else {{ trans('admin/settings/sync_adapters.never_synced') }} @endif
{{-- Inline form so the Pull Now click POSTs to the sync route without submitting the config form (which posts to save). Sibling of the config form since HTML disallows nested form elements. --}}
@csrf
{{-- Push Now button renders for adapters that implement PushableAdapter AND report canPush() true at runtime (Fleet Free returns false because its label writes are Premium-only. CustomHttpAdapter returns false when the admin hasn't set a push endpoint yet). --}} @if ($adapter instanceof \App\SyncAdapters\PushableAdapter && $adapter->canPush())
@csrf
@endif {{-- The submit handler that swaps the icon for a spinner and disables sibling sync-action buttons lives in resources/assets/js/snipeit.js. Fully driven by the .js-sync-action-form / .js-sync-action-button classes above so nothing on this partial needs inline JS. --}}

{{-- Show both commands when this adapter supports push (Kandji, Jamf, Mosyle, WS1, Ninja, Intune). Pull-only adapters get the shorter single-command variant so admins don't see a push-inventory hint they can't act on. --}} @if ($adapter instanceof \App\SyncAdapters\PushableAdapter && $adapter->canPush()) {!! trans('admin/settings/sync_adapters.large_fleet_note', [ 'pull_command' => 'php artisan snipeit:pull-inventory '.e($slug).'', 'push_command' => 'php artisan snipeit:push-inventory '.e($slug).'', ]) !!} @else {!! trans('admin/settings/sync_adapters.large_fleet_note_pull_only', [ 'pull_command' => 'php artisan snipeit:pull-inventory '.e($slug).'', ]) !!} @endif