{{-- resources/views/superadmin/proactive/command/conflicts.blade.php --}} @extends('layouts.superadmin') @section('title', 'ProActive — التعارضات') @section('page-title', 'تعارضات ProActive') @section('content') @php use Illuminate\Support\Facades\Route; // ✅ safe_route داخل نفس الـView (مرة واحدة) if (!function_exists('safe_route')) { function safe_route(string $name, array $params = [], bool $absolute = true, string $fallback = '#'): string { try { return Route::has($name) ? route($name, $params, $absolute) : $fallback; } catch (\Throwable $e) { return $fallback; } } } $qs = request()->query(); $q = fn($k,$d=null) => request()->get($k,$d); $date = $date ?? $q('date', now()->toDateString()); $conflicts = $conflicts ?? []; $rCommand = safe_route('superadmin.proactive.command', [], true, url('/superadmin/proactive/command')); $rConflicts = safe_route('superadmin.proactive.conflicts', [], true, url()->current()); $rEscalations= safe_route('superadmin.proactive.escalations', [], true, '#'); $chip = fn($cls) => "px-2.5 py-1 rounded-xl border text-[11px] font-extrabold $cls"; $typeBadge = fn($t) => $t==='leader' ? ['label'=>'تعارض قائد','cls'=>'border-rose-400/25 bg-rose-500/10 text-rose-100'] : ['label'=>'تعارض منصة','cls'=>'border-amber-400/25 bg-amber-500/10 text-amber-100']; @endphp
{{-- HERO --}}
ProActive • تحليل التعارضات

تعارضات ProActive — Conflicts

الهدف: كشف تداخل المواعيد قبل ما يصير “فوضى قيادة”. التعارض = قائد واحد على نفس الوقت أو منصة واحدة بتداخل.

التاريخ: {{ $date }} عدد التعارضات: {{ is_array($conflicts) ? count($conflicts) : 0 }}
{{-- FILTER --}}
تصفير
* التداخل محسوب بالوقت/المدة.
{{-- LIST --}} @if(is_array($conflicts) && count($conflicts) > 0)
قائمة التعارضات
مرتبة حسب الاكتشاف داخل اليوم.
@foreach($conflicts as $c) @php $t = (string)($c['type'] ?? 'platform'); $b = $typeBadge($t); $a = $c['a'] ?? []; $b2= $c['b'] ?? []; $aTitle = $a['title'] ?? ('#'.($a['id'] ?? '')); $bTitle = $b2['title'] ?? ('#'.($b2['id'] ?? '')); $aLeader = $a['leader_name'] ?? '-'; $bLeader = $b2['leader_name'] ?? '-'; $aPlat = $a['platform'] ?? '-'; $bPlat = $b2['platform'] ?? '-'; $rangeStart = $c['start'] ?? ''; $rangeEnd = $c['end'] ?? ''; $aType = $a['event_type'] ?? 'regular'; $bType = $b2['event_type'] ?? 'regular'; $aTypeCls = $aType==='plus' ? 'border-fuchsia-400/25 bg-fuchsia-500/10 text-fuchsia-100' : 'border-emerald-400/25 bg-emerald-500/10 text-emerald-100'; $bTypeCls = $bType==='plus' ? 'border-fuchsia-400/25 bg-fuchsia-500/10 text-fuchsia-100' : 'border-emerald-400/25 bg-emerald-500/10 text-emerald-100'; @endphp
{{ $b['label'] }} {{ $rangeStart }} — {{ $rangeEnd }} @if($t==='leader') القائد: {{ $aLeader }} @else المنصة: {{ $aPlat }} @endif
{{-- A --}}
{{ $aTitle }}
{{ $aLeader }} • {{ $aPlat }}
{{ $aType==='plus' ? 'PLUS' : 'REG' }}
الحالة: {{ strtoupper((string)($a['status'] ?? '')) }} • ID: {{ (int)($a['id'] ?? 0) }}
{{-- B --}}
{{ $bTitle }}
{{ $bLeader }} • {{ $bPlat }}
{{ $bType==='plus' ? 'PLUS' : 'REG' }}
الحالة: {{ strtoupper((string)($b2['status'] ?? '')) }} • ID: {{ (int)($b2['id'] ?? 0) }}
{{-- Actions --}}
@endforeach
@else
لا يوجد تعارضات لهذا اليوم ✅
هذا ممتاز — يعني جدول ProActive منضبط وما فيه تداخلات حرجة.
@endif
@endsection