@extends('layouts.app') @section('title', 'لوحة التحكم - '.config('app.name')) @section('breadcrumb') الرئيسية @endsection @push('styles') @endpush @section('content')
{{-- بانر الترحيب (نص متدرج + جملة فرعية) --}}

مرحباً بعودتك! {{ Auth::user()->name ?? 'مستخدم' }}

اختر وحدة للوصول إلى ميزاتها وبياناتها

@if(!empty($dashboardSystemWideSummary) && $dashboardSystemWideSummary)
ملخص النظام — جميع المستأجرين
@endif
@if(!empty($tenantPackage['niche_name']) && auth()->user()?->isAdminOrSuperAdmin())

باقة عملك: {{ $tenantPackage['niche_name'] }}

الموديولات والمزايا المفعّلة لحسابك — مخصّصة لنشاط {{ $tenantPackage['niche_key'] ?? 'ERP' }}

@if(!empty($tenantPackage['modules']))
@foreach($tenantPackage['modules'] as $mod) {{ $mod['label'] }} @endforeach
@endif @if(!empty($tenantPackage['premium_features']))
مزايا بريميوم: @foreach($tenantPackage['premium_features'] as $feat) {{ $feat['name_ar'] }} @endforeach
@endif
@if(!empty($tenantPackage['quick_links']))

روابط سريعة

@foreach($tenantPackage['quick_links'] as $link) @if(\Illuminate\Support\Facades\Route::has($link['route'])) {{ $link['label'] }} @endif @endforeach
@endif
@endif
{{-- نتائج البحث (عند وجود استعلام بحث) --}} @if(!empty($searchResults) && isset($searchQuery))
نتائج البحث: «{{ $searchQuery }}»
@if($searchResults['items']->isNotEmpty())
الأصناف / المنتجات
@endif @if($searchResults['units']->isNotEmpty())
وحدات القياس
    @foreach($searchResults['units'] as $unit)
  • {{ $unit->name_ar ?? $unit->name_en ?? $unit->code }}
  • @endforeach
@endif @if($searchResults['warehouses']->isNotEmpty())
المستودعات
@endif
@if($searchResults['items']->isEmpty() && $searchResults['units']->isEmpty() && $searchResults['warehouses']->isEmpty())

لا توجد نتائج مطابقة.

@endif
@endif @php $dashNav = $tenantNavigation ?? null; $dashModule = static fn (string $module): bool => $dashNav?->isDashboardModuleVisible($module) ?? true; $dashLink = static fn (string $key): bool => $dashNav?->isDashboardQuickLinkVisible($key) ?? true; $dashFullErp = $dashNav?->usesUnfilteredNavigation() ?? true; $dashReports = $dashNav?->isDashboardReportsWidgetVisible() ?? true; $dashAudit = $dashNav?->isLinkVisible('system.audit') ?? \App\Support\ErpRoles::hasFinanceAdminPanelAccess(auth()->user()); @endphp {{-- إحصائيات اليوم (Today's Statistics) - عرض أفقي: flex-row / grid --}} @if($dashModule('manufacturing') && (isset($totalProductionToday) || isset($productionOrdersToday) || isset($journalEntriesToday)))
إنتاج اليوم {{ erp_qty($totalProductionToday ?? 0) }}
هالك اليوم {{ erp_qty($totalScrapToday ?? 0) }}
سجلات التشغيل اليوم {{ $productionRecordsToday ?? 0 }}
أوامر العمل اليوم {{ $productionOrdersToday ?? 0 }}
قيود اليومية اليوم {{ $journalEntriesToday ?? 0 }}
المصروفات اليوم {{ number_format($totalExpensesToday ?? 0, 2) }}
@endif {{-- قيمة المخزون + التدفق النقدي (30 يوم) --}} @if($dashModule('inventory') && isset($inventoryValueTotal))
قيمة المخزون الحالية

{{ number_format($inventoryValueTotal, 2) }}

خامات ({{ $inventoryRmCode ?? '1041' }}): {{ number_format($inventoryRawMaterials ?? 0, 2) }}

منتج تام ({{ $inventoryFgCode ?? '1042' }}): {{ number_format($inventoryFinishedGoods ?? 0, 2) }}

التدفق النقدي — آخر 30 يوم
وارد (تحصيلات) صادر (مشتريات ومصاريف)
@endif @if($dashModule('services') && auth()->user()->isAdminOrSuperAdmin() && isset($serviceOpenCount)) @if($serviceWarrantyExpiringCount > 0) @endif @endif @if($dashModule('services') && auth()->user()->is_technician && ! auth()->user()->isAdminOrSuperAdmin()) @endif {{-- الكروت الثلاثة السريعة - عرض أفقي --}}
جميع الإشعارات
عرض جميع الإشعارات
موافقاتي
إدارة الموافقات المعلقة
لوحة التحكم
عرض التحليلات والرؤى
جميع الوحدات
{{-- شبكة الوحدات بنفس ترتيب السكرين شوت: 4 أعمدة - عرض أفقي --}}
@if($dashModule('purchases')) {{-- 1. المشتريات --}}
@if(auth()->user()->isAdminOrSuperAdmin()) @else @endif
المشتريات
{{ isset($countSuppliers) ? $countSuppliers : '5+' }}

الموردون والفواتير وطلبات الشراء

@if(auth()->user()->isAdminOrSuperAdmin())
@if($dashLink('purchases.suppliers')) الموردون @endif @if($dashLink('purchases.invoices')) فواتير @endif طلبات
@endif
@endif @if($dashModule('inventory')) {{-- 2. المخزون --}}
@if(auth()->user()->isAdminOrSuperAdmin()) @else @endif
المخزون
{{ isset($countItems) ? $countItems : '5+' }}

المنتجات والمستودعات والحركات

@if(auth()->user()->isAdminOrSuperAdmin())
@if($dashLink('inventory.dashboard')) لوحة @endif @if($dashLink('inventory.items')) منتجات @endif @if($dashLink('inventory.warehouses')) مستودعات @endif
@endif
@endif @if($dashModule('finance')) {{-- 3. المحاسبة --}}
@if(auth()->user()->isAdminOrSuperAdmin()) @else @endif
المحاسبة
{{ isset($countAccounts) ? $countAccounts : '13' }}

الحسابات والقيود والتقارير

@endif @if($dashModule('sales')) {{-- 4. المبيعات --}}
@if(auth()->user()->isAdminOrSuperAdmin()) @else @endif
المبيعات
{{ isset($countCustomers) ? $countCustomers : '6+' }}

الفواتير وبطاقة العميل للمستندات المالية

@if(auth()->user()->isAdminOrSuperAdmin()) @endif
@endif {{-- 4b. الخدمات والصيانة --}} @if($dashModule('services') && auth()->user()->isAdminOrSuperAdmin())
الخدمات والصيانة
@if(isset($serviceOpenCount)) {{ $serviceOpenCount }} @endif

طلبات التركيب والصيانة والفنيين

@elseif($dashModule('services') && auth()->user()->is_technician)
مهام الخدمات
@if(isset($technicianMyOpenServiceCount)) {{ $technicianMyOpenServiceCount }} @endif

طلباتك المسندة والمفتوحة

@endif @if($dashModule('manufacturing')) {{-- 5. التصنيع --}}
التصنيع
{{ isset($countProductionShifts) ? $countProductionShifts : '6+' }}

أصناف ← قوائم مواد ← أوامر العمل ← ترحيل

@if($dashLink('manufacturing.items')) أصناف @endif @if($dashLink('manufacturing.bom_lists')) قوائم المواد @endif @if($dashLink('manufacturing.runs')) أوامر العمل @endif
@endif @if($dashModule('hr')) {{-- 6. الموارد البشرية --}}
@if(auth()->user()->isAdminOrSuperAdmin()) @else @endif
الموارد البشرية
{{ isset($countEmployees) ? $countEmployees : '5+' }}

الموظفون والأقسام

@if(auth()->user()->isAdminOrSuperAdmin()) @endif
@endif @if($dashModule('crm')) {{-- 7. إدارة العملاء (CRM — علاقة العميل، وليست عملاء المبيعات التشغيلية) --}}
@if(auth()->user()->isAdminOrSuperAdmin()) @else @endif
إدارة العملاء
5+

CRM: مراحل العميل والمتابعة والمواعيد

@if(auth()->user()->isAdminOrSuperAdmin()) @endif
@endif @if($dashModule('pos')) {{-- 8. نقاط البيع --}}
نقاط البيع
6+

نقاط البيع والمبيعات

@if($dashLink('pos.dashboard')) لوحة @endif @if($dashLink('pos.receipts')) إيصالات @endif
@endif @if($dashReports) {{-- 9. التقارير --}}
@if(auth()->user()->isAdminOrSuperAdmin()) @else @endif
التقارير
6+

المالية والمبيعات والضرائب

@if(auth()->user()->isAdminOrSuperAdmin())
@if($dashLink('sales.reports.statement')) ميزان @endif @if($dashLink('finance.reports.profit_loss')) أرباح @endif @if($dashLink('reports.tax')) ضرائب @endif
@endif
@endif @if($dashAudit) {{-- 10. التدقيق --}}
@if(\App\Support\ErpRoles::hasFinanceAdminPanelAccess(auth()->user())) @else @endif
التدقيق
5+

سجل العمليات والنشاط

@if(\App\Support\ErpRoles::hasFinanceAdminPanelAccess(auth()->user())) @endif
@endif @if($dashFullErp) {{-- 11. مكتبة المستندات --}}
مكتبة المستندات
5+

المستندات والملفات

{{-- 12. التخطيط --}}
التخطيط
5+

التخطيط والجدولة

@endif {{-- 13. الإدارة --}}
الإدارة
6+

إعدادات النظام والصلاحيات

ملف شخصي @if(\App\Support\ErpRoles::hasFinanceAdminPanelAccess(auth()->user())) سجل النشاط @endif

آخر العمليات

@if(isset($managedActivityUsers) && $managedActivityUsers->isNotEmpty())
@if(request()->filled('q')) @endif
@endif
@if(isset($recentActivity) && $recentActivity->isNotEmpty())
@foreach($recentActivity as $row) @endforeach
التاريخ المستخدم نوع العملية الجدول المرجع القيم
{{ $row->created_at?->format('Y-m-d H:i') }} {{ $row->user?->name ?? '—' }} @php $actionLabels = ['create' => 'إنشاء', 'update' => 'تحديث', 'delete' => 'حذف', 'complete' => 'إتمام إنتاج', 'approve_location' => 'اعتماد موقع']; @endphp {{ $actionLabels[$row->action] ?? $row->action }} @php $tableLabels = [ 'sales_orders' => 'أمر بيع', 'production_orders' => 'أمر إنتاج', 'bom' => 'BOM', 'delivery_orders' => 'أمر توريد', 'purchase_invoices' => 'فاتورة مشتريات', 'service_orders' => 'طلب خدمة', 'accounts' => 'حساب محاسبي', 'fleet_customers' => 'عميل ميداني', ]; @endphp {{ $tableLabels[$row->table_name] ?? $row->table_name }} #{{ $row->record_id }}
@else

لا توجد عمليات مسجّلة بعد.

@endif
@endsection @push('scripts') @endpush