@php
$byCat = DB::table('assets')->selectRaw('category, count(*) as cnt')->groupBy('category')->get();
@endphp
@foreach($byCat as $c)
{{ $catLabels[$c->category] ?? $c->category }}
{{ $c->cnt }}
@endforeach
الأصول المتاحة
الاسم
الكود
الفئة
الحالة
@php $avail = DB::table('assets')->where('status','available')->get(); @endphp
@foreach($avail as $a)
{{ $a->name }}
{{ $a->asset_code }}
{{ $catLabels[$a->category] ?? $a->category }}
{{ $condLabels[$a->condition] ?? $a->condition }}
@endforeach
@if($avail->isEmpty())
لا توجد أصول متاحة
@endif
الأصول المخصصة
الاسم
الكود
الفئة
سعر الشراء
@php $assigned = DB::table('assets')->where('status','assigned')->get(); @endphp
@foreach($assigned as $a)
{{ $a->name }}
{{ $a->asset_code }}
{{ $catLabels[$a->category] ?? $a->category }}
{{ number_format($a->purchase_cost) }} ج.م
@endforeach
@if($assigned->isEmpty())
لا توجد أصول مخصصة
@endif
أصول في الصيانة
الاسم
الكود
الفئة
@php $maint = DB::table('assets')->where('status','maintenance')->get(); @endphp
@foreach($maint as $a)
{{ $a->name }}
{{ $a->asset_code }}
{{ $catLabels[$a->category] ?? $a->category }}
@endforeach
@if($maint->isEmpty())
لا توجد أصول في الصيانة
@endif
إجمالي قيمة الأصول
الفئة
العدد
إجمالي القيمة
@php $byVal = DB::table('assets')->selectRaw('category, count(*) as cnt, sum(purchase_cost) as total')->groupBy('category')->get(); @endphp
@foreach($byVal as $v)