@extends('layouts.app') @section('title', __('dashboard.sidebar_laundry_ops')) @section('page_heading', __('dashboard.sidebar_laundry_ops')) @section('content') @php $currentState = $state ?? request('state', 'active'); $hasFilter = request()->hasAny(['search','sku_search','laundry_id','status']); $statusBadge = ['sent'=>['var(--c-primary-bg)','var(--c-primary)','مُرسل'],'partially_received'=>['#fffbeb','#d97706','مستلم جزئياً'],'received'=>['#f0fdf4','#16a34a','مستلم']]; @endphp {{-- KPIs --}}
@foreach([ ['fa-solid fa-arrows-rotate', '#eff6ff','#2563eb', $laundryOperations->total(), __('dashboard.total_operations')], ['fa-solid fa-clock', 'var(--c-primary-bg)','var(--c-primary)', $laundryOperations->getCollection()->where('status','sent')->count(), 'قيد الإرسال'], ['fa-solid fa-circle-check', '#f0fdf4','#16a34a', $laundryOperations->getCollection()->where('status','received')->count(), 'مستلمة'], ['fa-solid fa-coins', '#fffbeb','#d97706', number_format($laundryOperations->getCollection()->whereIn('status',['received','partially_received'])->sum('laundry_amount'),2), 'إجمالي التكلفة (ج.م)'], ] as [$ic,$bg,$cl,$val,$lbl])
{{ $val }}
{{ $lbl }}
@endforeach
{{ __('dashboard.All Laundry Operations') }} {{ number_format($laundryOperations->total()) }}
@foreach(['active'=>'النشط','trashed'=>'المحذوف','all'=>'الكل'] as $val=>$lbl) {{ $lbl }} @endforeach
@can('create laundry operations') {{ __('dashboard.Add New Laundry Operation') }} @endcan
{{-- Filter --}}
@if($hasFilter)@endif
@if($laundryOperations->isEmpty())
@include('layouts.partials.index-empty-state',['icon'=>'fa-solid fa-arrows-rotate','title'=>__('dashboard.No laundry operations found.'),'message'=>''])
@else
@foreach(['#',__('dashboard.Laundry'),__('dashboard.Products'),__('dashboard.Created At'),__('dashboard.Status'),__('dashboard.Laundry Amount')] as $h) @endforeach @foreach($laundryOperations as $op) @php [$sbg,$scolor,$slabel] = $statusBadge[$op->status] ?? ['var(--border-subtle)','var(--text-muted)',$op->status]; @endphp @endforeach
{{ $h }}{{ __('dashboard.Actions') }}
{{ $op->id }}
{{ $op->laundry->name }}
@if($op->trashed())محذوف@endif
@foreach($op->operationProducts as $pivot) @if($pivot->product)
{{ $pivot->product->sku }} {{ $pivot->product->name }}
@endif @endforeach
{{ $op->created_at->format('Y-m-d H:i') }} {{ $slabel }} @if($op->status !== 'sent')
{{ number_format($op->laundry_amount,2) }}
ج.م
@else @endif
@canany(['view laundry operations','edit laundry operations','delete laundry operations'])
@if($op->trashed())
@csrf
@else @can('view laundry operations'){{ __('dashboard.receive') }}@endcan @can('edit laundry operations'){{ __('dashboard.Edit') }}@endcan @can('delete laundry operations')
@csrf @method('DELETE')
@endcan @endif
@endcanany
{{ $laundryOperations->appends(request()->query())->links() }}
@endif
@endsection