@extends('layouts.admin.app', ['page' => $menuAdmin['cron_monitor']['active'] ?? '', 'sub_page' => '']) @section('title', __('labels.cron_monitor')) @section('header_data') @php $page_title = __('labels.cron_monitor'); $page_pretitle = __('labels.system'); @endphp @endsection @php $breadcrumbs = [ ['title' => __('labels.home'), 'url' => route('admin.dashboard')], ['title' => __('labels.cron_monitor'), 'url' => null], ]; @endphp @section('admin-content')
{{-- Health banner --}}

{{ __('labels.cron_monitor') }}

{{-- Scheduler & Queue Worker health indicators --}} @php $phpBinary = shell_exec('which php') ? trim(shell_exec('which php')) : '/usr/local/bin/php'; $schedulerCmd = '* * * * * ' . $phpBinary . ' ' . base_path('artisan') . ' schedule:run >> ' . storage_path('logs/schedule.txt') . ' 2>&1'; $queueCmd = '* * * * * ' . $phpBinary . ' ' . base_path('artisan') . ' queue:work --stop-when-empty >> ' . storage_path('logs/cron-log.txt') . ' 2>&1'; @endphp
{{ __('labels.task_scheduler') }} (schedule:run)
@if($isSchedulerHealthy) {{ __('labels.cron_running') }} @else {{ __('labels.cron_not_detected') }} @endif
{{ __('labels.queue_worker') }} (queue:work)
@if($isQueueWorkerHealthy) {{ __('labels.cron_running') }} @else {{ __('labels.cron_not_detected') }} @endif
@if($runPermission)
@endif
{{-- Command cards --}}
@foreach($commands as $cmd) @if(in_array($cmd['type'], ['scheduled', 'manual']))

{{ $cmd['name'] }}

{{ $cmd['command'] }}
@php $statusColor = match ($cmd['last_status']) { 'success' => 'bg-success-lt', 'running' => 'bg-azure-lt', 'failed' => 'bg-danger-lt', default => 'bg-secondary-lt', }; $statusLabel = match ($cmd['last_status']) { 'success' => __('labels.cron_status_success'), 'running' => __('labels.cron_status_running'), 'failed' => __('labels.cron_status_failed'), default => __('labels.cron_status_never_run'), }; @endphp {{ $statusLabel }}

{{ __($cmd['description']) }}

{{ __($cmd['frequency']) }}
@if($cmd['last_run'])
{{ __('labels.last_run') }}: {{ $cmd['last_run']->started_at->diffForHumans() }} @if($cmd['last_run']->duration_ms !== null) ({{ $cmd['last_run']->duration_ms }}ms) @endif
@else
{{ __('labels.never_executed') }}
@endif {{-- Recent run history dots --}} @if($cmd['recent_runs']->count() > 0)
@foreach($cmd['recent_runs'] as $run) @php $statusVal = $run->status instanceof \App\Enums\CommandRunStatusEnum ? $run->status->value : (string) $run->status; $dotColor = match ($statusVal) { 'success' => '#2fb344', 'failed' => '#d63939', 'running' => '#4299e1', default => '#667382', }; @endphp @endforeach
@endif
@if($runPermission) @endif
@endif @endforeach
{{-- History modal --}} @endsection @push('scripts') @endpush